use of se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId in project webcert by sklintyg.
the class ListCertificatesForCareResponderStub method listCertificatesForCare.
@Override
@StubLatencyAware
@StubModeAware
public ListCertificatesForCareResponseType listCertificatesForCare(String logicalAddress, ListCertificatesForCareType parameters) {
ListCertificatesForCareResponseType response = new ListCertificatesForCareResponseType();
response.setIntygsLista(new ListaType());
response.getIntygsLista().getIntyg();
List<CertificateHolder> intygForEnhetAndPersonnummer = intygStore.getIntygForEnhetAndPersonnummer(parameters.getEnhetsId().stream().map(HsaId::getExtension).collect(Collectors.toList()), parameters.getPersonId().getExtension());
for (CertificateHolder cert : intygForEnhetAndPersonnummer) {
Intyg intyg = getIntyg(cert);
intyg.getStatus().addAll(CertificateStateHolderConverter.toIntygsStatusType(cert.getCertificateStates()));
response.getIntygsLista().getIntyg().add(intyg);
}
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImplTest method buildIntyg.
private Utlatande buildIntyg(String intygsKod, String patientEfternamn, String patientFornamn, String patientPersonId, String hosPersonalFullstandigtNamn, String hosPersonalHsaId, String enhetsnamn, String enhetHsaId, boolean createUnit) {
Utlatande intyg = new Utlatande();
TypAvUtlatande typAvIntyg = new TypAvUtlatande();
typAvIntyg.setCode(intygsKod);
intyg.setTypAvUtlatande(typAvIntyg);
Patient patient = new Patient();
patient.setEfternamn(patientEfternamn);
if (patientFornamn != null) {
patient.getFornamn().add(patientFornamn);
}
if (patientPersonId != null) {
patient.setPersonId(new PersonId());
patient.getPersonId().setExtension(patientPersonId);
}
intyg.setPatient(patient);
HosPersonal hosPersonal = new HosPersonal();
hosPersonal.setFullstandigtNamn(hosPersonalFullstandigtNamn);
if (hosPersonalHsaId != null) {
hosPersonal.setPersonalId(new HsaId());
hosPersonal.getPersonalId().setExtension(hosPersonalHsaId);
}
if (createUnit) {
Enhet enhet = new Enhet();
enhet.setEnhetsnamn(enhetsnamn);
if (enhetHsaId != null) {
enhet.setEnhetsId(new HsaId());
enhet.getEnhetsId().setExtension(enhetHsaId);
}
hosPersonal.setEnhet(enhet);
}
intyg.setSkapadAv(hosPersonal);
return intyg;
}
use of se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId in project webcert by sklintyg.
the class CreateDraftCertificateResponderImplTest method createCertificateType.
private CreateDraftCertificateType createCertificateType() {
// Type
TypAvIntyg utlTyp = new TypAvIntyg();
utlTyp.setCode("fk7263");
// HoSPerson
HsaId userHsaId = new HsaId();
userHsaId.setExtension(USER_HSAID);
userHsaId.setRoot("USERHSAID");
HsaId unitHsaId = new HsaId();
unitHsaId.setExtension(UNIT_HSAID);
unitHsaId.setRoot("UNITHSAID");
Enhet hosEnhet = new Enhet();
hosEnhet.setEnhetsId(unitHsaId);
HosPersonal hosPerson = new HosPersonal();
hosPerson.setFullstandigtNamn("Abel Baker");
hosPerson.setPersonalId(userHsaId);
hosPerson.setEnhet(hosEnhet);
// Patient
PersonId personId = new PersonId();
personId.setRoot("PERSNR");
personId.setExtension("19121212-1212");
Patient patType = new Patient();
patType.setPersonId(personId);
patType.setFornamn("Adam");
patType.setMellannamn("Cesarsson");
patType.setEfternamn("Eriksson");
Intyg utlatande = new Intyg();
utlatande.setTypAvIntyg(utlTyp);
utlatande.setSkapadAv(hosPerson);
utlatande.setPatient(patType);
utlatande.setRef("Test-ref");
CreateDraftCertificateType certificateType = new CreateDraftCertificateType();
certificateType.setIntyg(utlatande);
return certificateType;
}
use of se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId in project webcert by sklintyg.
the class CreateDraftCertificateValidatorImplTest method buildIntyg.
private Intyg buildIntyg(String intygsKod, String patientEfternamn, String patientFornamn, String hosPersonalFullstandigtNamn, String enhetsId, String enhetsnamn, boolean createUnit, String personId) {
Intyg intyg = new Intyg();
TypAvIntyg typAvIntyg = new TypAvIntyg();
typAvIntyg.setCode(intygsKod);
intyg.setTypAvIntyg(typAvIntyg);
Patient patient = new Patient();
patient.setEfternamn(patientEfternamn);
patient.setFornamn(patientFornamn);
if (personId != null) {
patient.setPersonId(new PersonId());
patient.getPersonId().setExtension(personId);
}
intyg.setPatient(patient);
HosPersonal hosPersonal = new HosPersonal();
hosPersonal.setFullstandigtNamn(hosPersonalFullstandigtNamn);
HsaId personalHsaId = new HsaId();
personalHsaId.setExtension("personal-1");
hosPersonal.setPersonalId(personalHsaId);
if (createUnit) {
Enhet enhet = new Enhet();
enhet.setEnhetsId(new HsaId());
enhet.getEnhetsId().setExtension(enhetsId);
enhet.setEnhetsnamn(enhetsnamn);
hosPersonal.setEnhet(enhet);
}
intyg.setSkapadAv(hosPersonal);
return intyg;
}
use of se.riv.clinicalprocess.healthcond.certificate.types.v3.HsaId in project webcert by sklintyg.
the class ListCertificatesForCareWithQAResponderImplTest method missingPersonnummerShouldThrow.
@Test(expected = IllegalArgumentException.class)
public void missingPersonnummerShouldThrow() {
ListCertificatesForCareWithQAType request = new ListCertificatesForCareWithQAType();
HsaId hsaId = new HsaId();
hsaId.setExtension("enhetId");
request.getEnhetsId().add(hsaId);
HsaId vardgivarId = new HsaId();
hsaId.setExtension("vardgivarId");
request.setVardgivarId(vardgivarId);
responder.listCertificatesForCareWithQA("logicalAdress", request);
}
Aggregations