Click here to Skip to main content
15,923,051 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to get ip address & hostname? Pin
hahyojin20-Feb-01 20:38
hahyojin20-Feb-01 20:38 
GeneralRe: How to get ip address & hostname? Pin
Halid Niyaz25-Jan-02 2:41
Halid Niyaz25-Jan-02 2:41 
GeneralObject Orientated Nightmare Pin
Brendan Tregear20-Feb-01 14:03
Brendan Tregear20-Feb-01 14:03 
GeneralRe: Object Orientated Nightmare Pin
20-Feb-01 15:39
suss20-Feb-01 15:39 
GeneralRe: Object Orientated Nightmare Pin
l a u r e n20-Feb-01 23:13
l a u r e n20-Feb-01 23:13 
GeneralRe: Object Orientated Nightmare Pin
Erik Funkenbusch21-Feb-01 12:59
Erik Funkenbusch21-Feb-01 12:59 
GeneralRe: Object Orientated Nightmare Pin
Mr Morden21-Feb-01 19:32
Mr Morden21-Feb-01 19:32 
GeneralRe: Object Orientated Nightmare Pin
Mr Morden21-Feb-01 19:38
Mr Morden21-Feb-01 19:38 
Hi Brendan,

This answer assumes you are designing an application that allows the entry and display/reporting of patient records. If this isnt correct, let us know what the application is and I'll have another stab.

Anyway, here goes.

I agree with Lauren, I think you would be better off using a database to store the records in this case. A database allows you to not worry about the details of how the records are stored. Any relational database will do here. Access if the system is small, SQL Server or Oracle if the system is a biggie. You can use Active Data Objects to then access the database. Its much easier this way. You can use SQL (or some other means) to join the tables into a recordset that has only the fields that you need.

I also suggest that the Doc/View architecture may not be appropriate here also. Doc/View is great for things like word processor documents, pictures, html, whatever. It falls down a bit though when it comes to handling databases. If you end up using a database, then it may be easier to develop a dialog based app than a SDI (or MDI) application.

I tend to think that whether you use STL or MFC (MFC has a map class too), using the approach that you outlined will produce the messiness that you are trying to avoid. If you are constrained to a object approach rather than a database approach I suggest the following (its just of the top of my head so I havent thought it through that well.)

Instead of embedding each list in a previous class have them separate to each other. This is good OOD too since it reduces the coupling of objects.

CMainObject
{
private:
CMap<patientindex, patientindex,="" patientrec,="" patientrec=""> m_PatientList;
CMap<visitindex, visitindex,="" visitrec,="" visitrec=""> m_VisitList;
...
};

Define your PatientRec class with all of it the appropriate details.

Define your PatientIndex class with the patient identifier.

Do the same for the Visit classes. The VisitIndex class should have the same key as the PatientIndex, this way you can look up all patients in the VisitRec class.

You can do this for all of the list classes. Some of your index classes could have two keys as part of the index. For example the ImageIndex should have a patient and a visit component. These I think both need to be filled in to find the record, but I'm not completely sure of that.

If the CMap class doesnt allow partial matching of keys, you could create your own map class that does.


So then you could have a method that finds a visit.

VisitRec CMainObject::FindVisit(patientID)
{
VisitIndex index;
VisitRec record;
index.patientID = patientID;

m_VisitList.Lookup(index, record);

return record;
}

Anyway, this was a bit rushed. I hope it helps.

regards

John
GeneralCListBox Pin
Vickie20-Feb-01 7:52
Vickie20-Feb-01 7:52 
GeneralRe: CListBox Pin
20-Feb-01 8:12
suss20-Feb-01 8:12 
Generalextracting numbers from CString Pin
20-Feb-01 7:20
suss20-Feb-01 7:20 
GeneralRe: extracting numbers from CString Pin
l a u r e n20-Feb-01 23:08
l a u r e n20-Feb-01 23:08 
QuestionImplementing waitable timers with timeouts ? Pin
20-Feb-01 0:28
suss20-Feb-01 0:28 
AnswerRe: Implementing waitable timers with timeouts ? Pin
l a u r e n20-Feb-01 1:24
l a u r e n20-Feb-01 1:24 
AnswerRe: Implementing waitable timers with timeouts ? Pin
Erik Funkenbusch21-Feb-01 13:02
Erik Funkenbusch21-Feb-01 13:02 
GeneralProperty pages get PSN_KILLACTIVE when edit control changed Pin
Dave Midgley19-Feb-01 22:59
Dave Midgley19-Feb-01 22:59 
GeneralADO Recordset not showing changes just made... Pin
Paul Wolfensberger19-Feb-01 15:34
Paul Wolfensberger19-Feb-01 15:34 
GeneralRe: ADO Recordset not showing changes just made... Pin
l a u r e n19-Feb-01 20:27
l a u r e n19-Feb-01 20:27 
GeneralRe: ADO Recordset not showing changes just made... Pin
Paul Wolfensberger20-Feb-01 2:48
Paul Wolfensberger20-Feb-01 2:48 
GeneralRe: ADO Recordset not showing changes just made... Pin
John M. Drescher20-Feb-01 18:19
John M. Drescher20-Feb-01 18:19 
QuestionHow to enable the second monitor by using APIs? Pin
Wang Huaizhi19-Feb-01 14:08
Wang Huaizhi19-Feb-01 14:08 
QuestionHow to get process name from Process Id/Handle? Pin
19-Feb-01 11:14
suss19-Feb-01 11:14 
AnswerRe: How to get process name from Process Id/Handle? Pin
Todd Wilson19-Feb-01 12:56
Todd Wilson19-Feb-01 12:56 
GeneralGetting closer.. Pin
19-Feb-01 10:36
suss19-Feb-01 10:36 
GeneralRe: Getting closer.. Pin
l a u r e n19-Feb-01 10:55
l a u r e n19-Feb-01 10:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.