use of ch.elexis.core.findings.IEncounter in project elexis-server by elexis.
the class EncounterResourceProvider method searchReqIdentifier.
/**
* Search for an Encounter with a matching Elexis consultation id.
*
* @param identifier
* @return
*/
@Search
public List<Encounter> searchReqIdentifier(@RequiredParam(name = Encounter.SP_IDENTIFIER) TokenParam identifier) {
if (identifier != null && !identifier.isEmpty() && identifier.getValue() != null && !identifier.getValue().isEmpty()) {
migratorService.migrateConsultationsFindings(identifier.getValue(), IEncounter.class);
List<IEncounter> findings = findingsService.getConsultationsFindings(identifier.getValue(), IEncounter.class);
if (findings != null && !findings.isEmpty()) {
List<Encounter> ret = new ArrayList<Encounter>();
for (IFinding iFinding : findings) {
Optional<Encounter> fhirEncounter = getTransformer().getFhirObject((IEncounter) iFinding);
fhirEncounter.ifPresent(fe -> ret.add(fe));
}
return ret;
}
}
return null;
}
use of ch.elexis.core.findings.IEncounter 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);
}
use of ch.elexis.core.findings.IEncounter in project elexis-server by elexis.
the class ServiceRequestResourceProvider method findProcedureRequest.
@Search()
public List<ServiceRequest> findProcedureRequest(@RequiredParam(name = ServiceRequest.SP_PATIENT) IdType thePatientId, @OptionalParam(name = ServiceRequest.SP_ENCOUNTER) IdType theEncounterId) {
if (thePatientId != null && !thePatientId.isEmpty()) {
Optional<IPatient> patient = modelService.load(thePatientId.getIdPart(), IPatient.class);
if (patient.isPresent()) {
if (patient.get().isPatient()) {
List<IProcedureRequest> findings = findingsService.getPatientsFindings(thePatientId.getIdPart(), IProcedureRequest.class);
if (theEncounterId != null) {
Optional<IEncounter> encounter = findingsService.findById(theEncounterId.getIdPart(), IEncounter.class);
if (encounter.isPresent()) {
IEncounter iEncounter = encounter.get();
String consid = iEncounter.getConsultationId();
if (consid != null && !consid.isEmpty()) {
findings = findingsService.getConsultationsFindings(consid, IProcedureRequest.class);
}
}
}
if (findings != null && !findings.isEmpty()) {
List<ServiceRequest> ret = new ArrayList<ServiceRequest>();
for (IProcedureRequest iFinding : findings) {
Optional<ServiceRequest> fhirProcedureRequest = getTransformer().getFhirObject(iFinding);
fhirProcedureRequest.ifPresent(pr -> ret.add(pr));
}
return ret;
}
}
}
}
return Collections.emptyList();
}
use of ch.elexis.core.findings.IEncounter in project elexis-server by elexis.
the class MigratorService method migrateEncounter.
private void migrateEncounter(ch.elexis.core.model.IEncounter encounter) {
IPatient patient = encounter.getCoverage().getPatient();
IQuery<IEncounter> query = FindingsModelServiceHolder.get().getQuery(IEncounter.class);
query.and("patientid", COMPARATOR.EQUALS, patient.getId());
query.and("consultationid", COMPARATOR.EQUALS, encounter.getId());
List<IEncounter> encounters = query.execute();
if (encounters.isEmpty()) {
createEncounter(encounter);
}
}
use of ch.elexis.core.findings.IEncounter in project elexis-server by elexis.
the class MigratorService method createEncounter.
private void createEncounter(ch.elexis.core.model.IEncounter encounter) {
IEncounter findingsEncounter = FindingsServiceHolder.getiFindingsService().create(IEncounter.class);
updateEncounter(findingsEncounter, encounter);
}
Aggregations