Search in sources :

Example 1 with VersionedResource

use of ch.rgw.tools.VersionedResource in project elexis-server by elexis.

the class MigratorService method updateEncounter.

private void updateEncounter(IEncounter findingsEncounter, ch.elexis.core.model.IEncounter encounter) {
    findingsEncounter.setConsultationId(encounter.getId());
    findingsEncounter.setMandatorId(encounter.getMandator().getId());
    LocalDate encounterDate = encounter.getDate();
    if (encounterDate != null) {
        findingsEncounter.setStartTime(encounterDate.atStartOfDay());
        findingsEncounter.setEndTime(encounterDate.atTime(23, 59, 59));
    }
    ICoverage coverage = encounter.getCoverage();
    if (coverage != null) {
        IPatient patient = coverage.getPatient();
        if (patient != null) {
            findingsEncounter.setPatientId(patient.getId());
        }
    }
    VersionedResource vr = encounter.getVersionedEntry();
    if (vr != null) {
        Samdas samdas = new Samdas(vr.getHead());
        findingsEncounter.setText(samdas.getRecordText());
    }
    List<ICoding> coding = findingsEncounter.getType();
    if (!ModelUtil.isSystemInList(CodingSystem.ELEXIS_ENCOUNTER_TYPE.getSystem(), coding)) {
        coding.add(new TransientCoding(CodingSystem.ELEXIS_ENCOUNTER_TYPE.getSystem(), "text", "Nicht strukturierte Konsultation"));
        findingsEncounter.setType(coding);
    }
    findingsService.saveFinding(findingsEncounter);
}
Also used : ICoding(ch.elexis.core.findings.ICoding) ICoverage(ch.elexis.core.model.ICoverage) TransientCoding(ch.elexis.core.findings.util.model.TransientCoding) Samdas(ch.elexis.core.text.model.Samdas) LocalDate(java.time.LocalDate) VersionedResource(ch.rgw.tools.VersionedResource) IPatient(ch.elexis.core.model.IPatient)

Aggregations

ICoding (ch.elexis.core.findings.ICoding)1 TransientCoding (ch.elexis.core.findings.util.model.TransientCoding)1 ICoverage (ch.elexis.core.model.ICoverage)1 IPatient (ch.elexis.core.model.IPatient)1 Samdas (ch.elexis.core.text.model.Samdas)1 VersionedResource (ch.rgw.tools.VersionedResource)1 LocalDate (java.time.LocalDate)1