This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have need to verify whether I have correctly identify the relationship among those classes. For example Suppose I have below entities,
Doctor 1---------m Diagnosis m----------m Prescriptions m ----------1 Patience
1 ------------------------------------------------------------------------- m
So its basically diagnonsis is a refernece table where a admin doctor entered all the dignosis details. For example,
Diag_ID, Category, Name, Desc
1 Skin Red Skin Red spots in skin
So my business flow is Doctor going to create a prescription for a patient. So he will be giving a patient id (patient registration also happen but i didn't display those entity). Then from Doctor.createPrescription(patientId) he will refer to the Diagnosis table and create prescription with relevant details. Suppose the prescription class constructor takes new Prescription(diagnonsisId,doctorId,patientID).
Is it a correct way to identify the relationship among them. Is it correct to link doctor and diagnosis class when creating the prescription. Doctor can also create a new diagnosis type if its not exsits.
So one doctor can diagnose a patient with more than one symptoms. For example one with skin and another one with Chest. so in that case 1 doctor can have many diagnosis. But all those should be done by one doctor. So for each diagnonsis doctor can issue seperate prescriptions or a one prescription can issue for all diagnoses. So its a many to many relationship. Finally those prescriptions should be belong to a one patient. Can not share between patients. I guess my model is right know?
What if multiple doctors can diagnose a patient. How to extend this to support that requirement?
Any suggestions and if this model wrong from start. please suggest a new model
I would think the diagram would have Diagnosis at the center and the other three classes related to it, but not directly to each other.
It's true that a single Doctor is related to any given prescription, so it would seem that those two classes should be directly related. However, the Prescription exists only because the Doctor made a Diagnosis. Also, one Diagnosis might require multiple Prescriptions, however any one Prescription is for exactly Diagnosis.
There may be a relationship between Patient and Doctor (e.g. Patient goes-to Doctor maybe). However as far as the business of making a Diagnosis and writing a Prescription goes, that relation can be momentarily ignored.