Search in sources :

Example 1 with IPerson

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

the class PersonResourceProvider method search.

@Search
public List<Person> search(@OptionalParam(name = Person.SP_NAME) StringParam name, @OptionalParam(name = ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) StringAndListParam theFtFilter) {
    IQuery<IPerson> query = modelService.getQuery(IPerson.class);
    if (name != null) {
        QueryUtil.andContactNameCriterion(query, name);
    }
    if (theFtFilter != null) {
        new IContactSearchFilterQueryAdapter().adapt(query, theFtFilter);
    }
    List<IPerson> persons = query.execute();
    List<Person> _persons = persons.parallelStream().map(org -> getTransformer().getFhirObject(org)).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
    return _persons;
}
Also used : IdParam(ca.uhn.fhir.rest.annotation.IdParam) IFhirTransformerRegistry(ch.elexis.core.findings.util.fhir.IFhirTransformerRegistry) IFhirTransformer(ch.elexis.core.findings.util.fhir.IFhirTransformer) LoggerFactory(org.slf4j.LoggerFactory) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) Update(ca.uhn.fhir.rest.annotation.Update) StringAndListParam(ca.uhn.fhir.rest.param.StringAndListParam) IModelService(ch.elexis.core.services.IModelService) Component(org.osgi.service.component.annotations.Component) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) Search(ca.uhn.fhir.rest.annotation.Search) IContactSearchFilterQueryAdapter(es.fhir.rest.core.resources.util.IContactSearchFilterQueryAdapter) Delete(ca.uhn.fhir.rest.annotation.Delete) Activate(org.osgi.service.component.annotations.Activate) Person(org.hl7.fhir.r4.model.Person) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) Read(ca.uhn.fhir.rest.annotation.Read) Logger(org.slf4j.Logger) Create(ca.uhn.fhir.rest.annotation.Create) IPerson(ch.elexis.core.model.IPerson) Collectors(java.util.stream.Collectors) IdType(org.hl7.fhir.r4.model.IdType) IQuery(ch.elexis.core.services.IQuery) List(java.util.List) ResourceParam(ca.uhn.fhir.rest.annotation.ResourceParam) QueryUtil(es.fhir.rest.core.resources.util.QueryUtil) StringParam(ca.uhn.fhir.rest.param.StringParam) Optional(java.util.Optional) OptionalParam(ca.uhn.fhir.rest.annotation.OptionalParam) Reference(org.osgi.service.component.annotations.Reference) IPerson(ch.elexis.core.model.IPerson) Optional(java.util.Optional) IContactSearchFilterQueryAdapter(es.fhir.rest.core.resources.util.IContactSearchFilterQueryAdapter) Person(org.hl7.fhir.r4.model.Person) IPerson(ch.elexis.core.model.IPerson) Search(ca.uhn.fhir.rest.annotation.Search)

Example 2 with IPerson

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

IPerson (ch.elexis.core.model.IPerson)2 Create (ca.uhn.fhir.rest.annotation.Create)1 Delete (ca.uhn.fhir.rest.annotation.Delete)1 IdParam (ca.uhn.fhir.rest.annotation.IdParam)1 OptionalParam (ca.uhn.fhir.rest.annotation.OptionalParam)1 Read (ca.uhn.fhir.rest.annotation.Read)1 ResourceParam (ca.uhn.fhir.rest.annotation.ResourceParam)1 Search (ca.uhn.fhir.rest.annotation.Search)1 Update (ca.uhn.fhir.rest.annotation.Update)1 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)1 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)1 StringParam (ca.uhn.fhir.rest.param.StringParam)1 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1 IFhirTransformer (ch.elexis.core.findings.util.fhir.IFhirTransformer)1 IFhirTransformerRegistry (ch.elexis.core.findings.util.fhir.IFhirTransformerRegistry)1 ICoverage (ch.elexis.core.model.ICoverage)1 IEncounter (ch.elexis.core.model.IEncounter)1 IMandator (ch.elexis.core.model.IMandator)1 IPatient (ch.elexis.core.model.IPatient)1 IContactBuilder (ch.elexis.core.model.builder.IContactBuilder)1