Search in sources :

Example 1 with ObservationComponent

use of ch.elexis.core.findings.ObservationComponent in project elexis-server by elexis.

the class ObservationTest method setupClass.

@BeforeClass
public static void setupClass() throws IOException, SQLException, ElexisException {
    AllTests.getTestDatabaseInitializer().initializeLabResult();
    AllTests.getTestDatabaseInitializer().initializeBehandlung();
    AllTests.getTestDatabaseInitializer().initializeMandant();
    client = FhirUtil.getGenericClient("http://localhost:8380/fhir");
    assertNotNull(client);
    IObservation persAnam = AllTests.getFindingsService().create(IObservation.class);
    persAnam.setCategory(ObservationCategory.SOCIALHISTORY);
    persAnam.setCoding(Collections.singletonList(new TransientCoding(ObservationCode.ANAM_PERSONAL)));
    persAnam.setText("Pers Anamnese 1");
    persAnam.setPatientId(AllTests.getTestDatabaseInitializer().getPatient().getId());
    IObservation risk = AllTests.getFindingsService().create(IObservation.class);
    risk.setCategory(ObservationCategory.SOCIALHISTORY);
    risk.setCoding(Collections.singletonList(new TransientCoding(ObservationCode.ANAM_RISK)));
    risk.setText("Risiken 1");
    risk.setPatientId(AllTests.getTestDatabaseInitializer().getPatient().getId());
    IEncounter encounter = AllTests.getFindingsService().create(IEncounter.class);
    encounter.setConsultationId(TestDatabaseInitializer.getBehandlung().getId());
    encounter.setPatientId(AllTests.getTestDatabaseInitializer().getPatient().getId());
    IObservation iObservation = AllTests.getFindingsService().create(IObservation.class);
    iObservation.setCategory(ObservationCategory.SOAP_SUBJECTIVE);
    iObservation.setText("Encounter test 1");
    iObservation.setPatientId(AllTests.getTestDatabaseInitializer().getPatient().getId());
    iObservation.setEncounter(encounter);
    IObservation vitalSign = AllTests.getFindingsService().create(IObservation.class);
    vitalSign.setObservationType(ObservationType.COMP);
    vitalSign.setCategory(ObservationCategory.VITALSIGNS);
    vitalSign.setCoding(Collections.singletonList(new TransientCoding(CodingSystem.ELEXIS_LOCAL_CODESYSTEM.getSystem(), "test", "display test")));
    ObservationComponent componentA = new ObservationComponent("componentA");
    componentA.setNumericValue(new BigDecimal("122"));
    componentA.setNumericValueUnit("mmHg");
    vitalSign.addComponent(componentA);
    ObservationComponent componentB = new ObservationComponent("componentB");
    componentB.setNumericValue(new BigDecimal("78"));
    componentB.setNumericValueUnit("mmHg");
    vitalSign.addComponent(componentB);
    vitalSign.setPatientId(AllTests.getTestDatabaseInitializer().getPatient().getId());
    vitalSign.setEncounter(encounter);
    new UpdateFindingTextCommand(vitalSign).execute();
    AllTests.getFindingsService().saveFinding(persAnam);
    AllTests.getFindingsService().saveFinding(risk);
    AllTests.getFindingsService().saveFinding(encounter);
    AllTests.getFindingsService().saveFinding(iObservation);
    AllTests.getFindingsService().saveFinding(vitalSign);
    findingsCreated.add(persAnam);
    findingsCreated.add(risk);
    findingsCreated.add(encounter);
    findingsCreated.add(iObservation);
    findingsCreated.add(vitalSign);
}
Also used : IEncounter(ch.elexis.core.findings.IEncounter) TransientCoding(ch.elexis.core.findings.util.model.TransientCoding) UpdateFindingTextCommand(ch.elexis.core.findings.util.commands.UpdateFindingTextCommand) BigDecimal(java.math.BigDecimal) IObservation(ch.elexis.core.findings.IObservation) ObservationComponent(ch.elexis.core.findings.ObservationComponent) BeforeClass(org.junit.BeforeClass)

Aggregations

IEncounter (ch.elexis.core.findings.IEncounter)1 IObservation (ch.elexis.core.findings.IObservation)1 ObservationComponent (ch.elexis.core.findings.ObservationComponent)1 UpdateFindingTextCommand (ch.elexis.core.findings.util.commands.UpdateFindingTextCommand)1 TransientCoding (ch.elexis.core.findings.util.model.TransientCoding)1 BigDecimal (java.math.BigDecimal)1 BeforeClass (org.junit.BeforeClass)1