Create Sale

Register Sales (Visits)

Patient in Sale

When you create a Sale object, behind the scenes you also create, modify or link it to an existing Patient.

You can link the Sale to an existing Patient in which case you omit any other data for the patient. It is done by patient ID (primary key in the database) as following:

<sale>
    <patient>
        <id>123456</id>
    </patient>
    <otherTags>...</otherTags>
</sale>

Create or modify (if needed) existing Patient

The most common way to deal with Patients is to invoke Sale creation with all the data for the Patient and leave iLab to care about creation or modification.

Example Patient object in the Sale:

<sale>
  <patient>
    <patientIdTypeId>4</patientIdTypeId>
    <patientId>1403978412131</patientId>
    <givenName>Яне</givenName>
    <middleName/>
    <familyName>Глигоров</familyName>
    <isMale>true</isMale>
    <species>1</species>
    <dateOfBirth>1978-03-14</dateOfBirth>
    <isDobAprox>false</isDobAprox>
  </patient>
  <otherTags>...</otherTags>
</sale>

In the example above, iLab will lookup for a Patient with PID Type 4 (ЕМБГ) and PID 1403978412131. If such a Patient exists, iLab will compare non-calculated fields (in this case only names) and if there are some differences, it will update the existing Patient. If no differences are found, iLab will just link the Sale with the existing Patient. If no such Patient is found, it will be created. Calculated fields (date of birth and gender in the given case) will be ignored.

Id of the Patient object has a higher priority, so if it exists, the other fields will be ignored.

Referring Doctor in Sale

Referring Doctor is the one, who sends the Patient to the laboratory. Some Sale Schemas requires pointing the doctor, whereas other - not. Usually, there is a special doctor (with a family name 'Unknown') which is used when Sale Schema requires a doctor, but it is unknown.

Just like the Patient, when you create Sale and desired Sale Schema requires Dcotor, you create, modify or link a Doctor object.

Doctor's specialty ...

Examples

There are many settings of the system instance that set default values of different fields. So you can omit them to simplify your invocations and leave the fields to their defaults.

The simplest example

Here is the simplest example which exploits many default values and registers a Sale. The Patient is anonymous, Sale Schema is by default, and if Doctor is required - it is also the one by default.

<sale>
    <patient>
        <givenName>John</givenName>
    </patient>
    <items>
        <item>
            <loincId>22664-7</loincId>
        </item>
    </items>
</sale>

Example with a Doctor

Here is an example with an anonymous Patient and full data for referring Doctor.

<sale>
    <patient>
        <givenName>Maria</givenName>
        <familyName>Stein</familyName>
    </patient>
  	<doctor>
      	<uin>123556</uin>
        <familyName>House</familyName>
      	<speciality>
        	<name>Internal medicine</name>
      </speciality>
  	</doctor>
  	<schemaId>3</schemaId>
    <items>
        <item>
            <loincId>22664-7</loincId>
        </item>
    </items>
</sale>

TODO

Last updated

Was this helpful?