Assignment 3: Hospital Information System

Informal Requirements Description

Patient Alice is already checked into the hospital and has been assigned to Doctor Bob. Bob checks her blood pressure at 2:20pm and heart rate at 2:35pm. He records each observation using a small handheld device which has a form for the data. The device sends the observation data via radio link to the clinic's central computer.

Going to consult with Doctor Carol, Bob shows her the patient's history thus far. To do this, he pushes a button on his handheld device which causes it to request patient history data from the clinic's central computer and display it. After the consultation, Bob scrawls a prescription on a paper form and gives it to Alice.

Additional Information

The observation data sent from the handheld device to the main computer consists of ASCII text, with one observation per line:

observation <doctorid> <patientid> <type> <values...>

Examples:

observation 87 390111 heart-rate 130
observation 87 390111 blood-pressure 180 110

The history request and response is also ASCII text:

history <patientid>

where <patientid> is the ID of the relevant Patient record. The response is also ASCII text, one observation per line, sorted by time:

<time> | <doctor name> | <Description>

Examples:

1/12/01 2:20pm | Bob | Blood Pressure 120/80
1/12/01 2:35pm | Bob | Heart Rate at 110

Assignment

Using Assignment 2 as a starting point, design and implement a Java program that will support the description given above. Update your class diagram to include any new classes and methods needed, and update your system diagram to include the new handheld external system.

Write code for the methods called for in the design. (You can write test code to create the relevant Doctor and Patient objects and put them in the correct state, with the Patient checked in to the hospital and assigned to the Doctor.)

Assume that the handheld system's ASCII data eventually ends up being passed to your program's System.in input stream, and anything you send back to System.out gets passed back to the handheld. Use the data specification given above for the data passed back and forth.

As part of your design and implementation, assume that the basic protocol (the "observation" and "history" part) won't change very often, but that we will be adding new kinds of observations as the system is adopted by new departments in the hospital over the next several months. Minimize the amount of code that needs to be changed when this happens.

Document the methods appropriately (for example, getDoctor() is probably self-explanatory, but methods like PatientHistory.display() needs careful documentation of the output requirements.) If there are useful preconditions or postconditions for your methods, document them in the comments.

As part of your code, implement a test routine that sets up the initial objects and then lets you interactively implement the scenario above. Turn in the updated diagrams, code, and test run(s).