Search in sources :

Example 1 with ICoverage

use of ch.elexis.core.model.ICoverage 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)

Example 2 with ICoverage

use of ch.elexis.core.model.ICoverage in project elexis-server by elexis.

the class CoverageResourceProvider method findCoverageByBeneficiary.

@Search()
public List<Coverage> findCoverageByBeneficiary(@RequiredParam(name = Coverage.SP_BENEFICIARY) IdType theBeneficiaryId) {
    if (theBeneficiaryId != null) {
        Optional<IPatient> patient = coreModelService.load(theBeneficiaryId.getIdPart(), IPatient.class);
        if (patient.isPresent()) {
            List<ICoverage> faelle = patient.get().getCoverages();
            if (faelle != null) {
                List<Coverage> ret = new ArrayList<Coverage>();
                for (ICoverage fall : faelle) {
                    Optional<Coverage> fhirCoverage = getTransformer().getFhirObject(fall);
                    fhirCoverage.ifPresent(fp -> ret.add(fp));
                }
                return ret;
            }
        }
    }
    return Collections.emptyList();
}
Also used : ICoverage(ch.elexis.core.model.ICoverage) ArrayList(java.util.ArrayList) ICoverage(ch.elexis.core.model.ICoverage) Coverage(org.hl7.fhir.r4.model.Coverage) IPatient(ch.elexis.core.model.IPatient) Search(ca.uhn.fhir.rest.annotation.Search)

Example 3 with ICoverage

use of ch.elexis.core.model.ICoverage in project elexis-server by elexis.

the class AbstractServiceTest method cleanup.

public void cleanup() {
    for (IEncounter cons : testBehandlungen) {
        // List<Verrechnet> verrechnet = VerrechnetService.getAllVerrechnetForBehandlung(cons);
        // for (Verrechnet verrechnet2 : verrechnet) {
        // System.out.print("Deleting verrechnet " + verrechnet2.getLabel() + " on behandlung "
        // + cons.getLabel());
        // VerrechnetService.remove(verrechnet2);
        // System.out.println(" [OK]");
        // }
        System.out.print("Deleting behandlung " + cons.getLabel());
        modelService.remove(cons);
        System.out.println(" [OK]");
    }
    for (ICoverage fall : testFaelle) {
        System.out.print("Removing fall " + fall.getLabel());
        modelService.remove(fall);
        System.out.println(" [OK]");
    }
    for (IContact contact : testPatients) {
        System.out.print("Removing patient " + contact.getLabel());
        modelService.remove(contact);
        System.out.println(" [OK]");
    }
    for (IContact contact : testContacts) {
        System.out.print("Removing contact " + contact.getLabel());
        modelService.remove(contact);
        System.out.println(" [OK]");
    }
}
Also used : IEncounter(ch.elexis.core.model.IEncounter) IContact(ch.elexis.core.model.IContact) ICoverage(ch.elexis.core.model.ICoverage)

Example 4 with ICoverage

use of ch.elexis.core.model.ICoverage in project elexis-server by elexis.

the class AbstractServiceTest method createTestMandantPatientFallBehandlung.

public void createTestMandantPatientFallBehandlung() {
    TimeTool timeTool = new TimeTool();
    IPerson mandator = new IContactBuilder.PersonBuilder(modelService, "mandator1 " + timeTool.toString(), "Anton" + timeTool.toString(), timeTool.toLocalDate(), Gender.MALE).mandator().buildAndSave();
    mandator.setMandator(true);
    testContacts.add(mandator);
    IPatient patient = new IContactBuilder.PatientBuilder(modelService, "Armer", "Anton" + timeTool.toString(), timeTool.toLocalDate(), Gender.MALE).buildAndSave();
    testPatients.add(patient);
    ICoverage testFall = new ICoverageBuilder(modelService, patient, "Fallbezeichnung", "Fallgrund", "KVG").buildAndSave();
    testFaelle.add(testFall);
    IEncounter behandlung = new IEncounterBuilder(modelService, testFall, (IMandator) mandator).buildAndSave();
    testBehandlungen.add(behandlung);
}
Also used : IPerson(ch.elexis.core.model.IPerson) IEncounter(ch.elexis.core.model.IEncounter) IContactBuilder(ch.elexis.core.model.builder.IContactBuilder) ICoverage(ch.elexis.core.model.ICoverage) IMandator(ch.elexis.core.model.IMandator) ICoverageBuilder(ch.elexis.core.model.builder.ICoverageBuilder) TimeTool(ch.rgw.tools.TimeTool) IEncounterBuilder(ch.elexis.core.model.builder.IEncounterBuilder) IPatient(ch.elexis.core.model.IPatient)

Aggregations

ICoverage (ch.elexis.core.model.ICoverage)4 IPatient (ch.elexis.core.model.IPatient)3 IEncounter (ch.elexis.core.model.IEncounter)2 Search (ca.uhn.fhir.rest.annotation.Search)1 ICoding (ch.elexis.core.findings.ICoding)1 TransientCoding (ch.elexis.core.findings.util.model.TransientCoding)1 IContact (ch.elexis.core.model.IContact)1 IMandator (ch.elexis.core.model.IMandator)1 IPerson (ch.elexis.core.model.IPerson)1 IContactBuilder (ch.elexis.core.model.builder.IContactBuilder)1 ICoverageBuilder (ch.elexis.core.model.builder.ICoverageBuilder)1 IEncounterBuilder (ch.elexis.core.model.builder.IEncounterBuilder)1 Samdas (ch.elexis.core.text.model.Samdas)1 TimeTool (ch.rgw.tools.TimeTool)1 VersionedResource (ch.rgw.tools.VersionedResource)1 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1 Coverage (org.hl7.fhir.r4.model.Coverage)1