Insert Patient

Every project will save a different set of information for their patients. To know which data is saved in your project, you first have to make a connection to our web services, then you call the operation module.getPatientFields which will tell you what values can be saved. It will also tell you of what type and format the data is, if it is required or not and so on.

  1. Call module.getPatientFields. This will return an list of patient field objects. These objects have information about what format the data for each field should be.
  2. At least for all patient fields that have 'required' set to true a patientFieldData object has to be created. For creating a patientFieldData object, you have to get the patientfieldId from the PatientField object and save this in the patientFieldData together with the value for this field. ID and value are saved as strings, no matter of what data type the answer is.
  3. Add all patientFieldData objects to an array
  4. Call module.createNewPatient and add the patientFieldData array, the departmentId and the moduleSessionId as parameters
    The method inserts the patient in to the module and returns a Patient object. Now some data of the newly created patient have to be added to the central server
  5. Call server.insertPatient with the values that you recieved from the module as patient object

 

Once you know the patientField IDs that you need, you can save them in a database or properties file and you do not need to call module.getPatientFields again. These values will change though if you point your client code to another server e.g. the MEMdoc live server. Therefore these values should be easily changeable.