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);
}
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();
}
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]");
}
}
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);
}
Aggregations