Search in sources :

Example 1 with HoSPersonal

use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.

the class IntygConverterUtilTest method testBuildHosPersonalFromWebCertUserWithVardenhet.

@Test
public void testBuildHosPersonalFromWebCertUserWithVardenhet() {
    final String forskrivarkod = "forskrivarkod";
    final String hsaId = "hsaid";
    final String namn = "namn";
    final String arbetsplatskod = "arbetsplatskod";
    final String epost = "epost";
    final String enhetsId = "enhetsId";
    final String enhetsnamn = "enhetsnamn";
    final String postadress = "postadress";
    final String postnummer = "postnummer";
    final String postort = "postort";
    final String telefonnummer = "telefonnummer";
    final String vardgivarId = "vardgivarId";
    final String vardgivarnamn = "vardgivarnamn";
    se.inera.intyg.common.support.model.common.internal.Vardgivare vardgivare = new se.inera.intyg.common.support.model.common.internal.Vardgivare();
    vardgivare.setVardgivarid(vardgivarId);
    vardgivare.setVardgivarnamn(vardgivarnamn);
    se.inera.intyg.common.support.model.common.internal.Vardenhet vardenhet = new se.inera.intyg.common.support.model.common.internal.Vardenhet();
    vardenhet.setArbetsplatsKod(arbetsplatskod);
    vardenhet.setEpost(epost);
    vardenhet.setEnhetsid(enhetsId);
    vardenhet.setEnhetsnamn(enhetsnamn);
    vardenhet.setPostadress(postadress);
    vardenhet.setPostnummer(postnummer);
    vardenhet.setPostort(postort);
    vardenhet.setTelefonnummer(telefonnummer);
    vardenhet.setVardgivare(vardgivare);
    WebCertUser user = new WebCertUser();
    user.setForskrivarkod(forskrivarkod);
    user.setHsaId(hsaId);
    user.setNamn(namn);
    HoSPersonal result = IntygConverterUtil.buildHosPersonalFromWebCertUser(user, vardenhet);
    assertEquals(forskrivarkod, result.getForskrivarKod());
    assertEquals(hsaId, result.getPersonId());
    assertEquals(namn, result.getFullstandigtNamn());
    assertEquals(arbetsplatskod, result.getVardenhet().getArbetsplatsKod());
    assertEquals(epost, result.getVardenhet().getEpost());
    assertEquals(enhetsId, result.getVardenhet().getEnhetsid());
    assertEquals(enhetsnamn, result.getVardenhet().getEnhetsnamn());
    assertEquals(postadress, result.getVardenhet().getPostadress());
    assertEquals(postnummer, result.getVardenhet().getPostnummer());
    assertEquals(postort, result.getVardenhet().getPostort());
    assertEquals(telefonnummer, result.getVardenhet().getTelefonnummer());
    assertEquals(vardgivarId, result.getVardenhet().getVardgivare().getVardgivarid());
    assertEquals(vardgivarnamn, result.getVardenhet().getVardgivare().getVardgivarnamn());
}
Also used : Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Example 2 with HoSPersonal

use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.

the class SendCertificateToRecipientTypeConverterTest method buildHosPersonal.

private HoSPersonal buildHosPersonal(String enhetsId, String enhetsnamn, String skapadAvFullstandigtNamn, String skapadAvPersonId, String arbetsplatsKod, String postadress, String postNummer, String postOrt, String epost, String telefonNummer, String vardgivarid, String vardgivarNamn, String forskrivarKod) {
    HoSPersonal hosPersonal = new HoSPersonal();
    Vardenhet vardenhet = new Vardenhet();
    vardenhet.setEnhetsid(enhetsId);
    vardenhet.setEnhetsnamn(enhetsnamn);
    vardenhet.setArbetsplatsKod(arbetsplatsKod);
    vardenhet.setPostadress(postadress);
    vardenhet.setPostnummer(postNummer);
    vardenhet.setPostort(postOrt);
    vardenhet.setEpost(epost);
    vardenhet.setTelefonnummer(telefonNummer);
    Vardgivare vardgivare = new Vardgivare();
    vardgivare.setVardgivarid(vardgivarid);
    vardgivare.setVardgivarnamn(vardgivarNamn);
    vardenhet.setVardgivare(vardgivare);
    hosPersonal.setVardenhet(vardenhet);
    hosPersonal.setFullstandigtNamn(skapadAvFullstandigtNamn);
    hosPersonal.setPersonId(skapadAvPersonId);
    hosPersonal.setForskrivarKod(forskrivarKod);
    return hosPersonal;
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) Vardgivare(se.inera.intyg.common.support.model.common.internal.Vardgivare)

Example 3 with HoSPersonal

use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.

the class IntygModuleApiController method createRenewalCopyRequest.

private CreateRenewalCopyRequest createRenewalCopyRequest(String orgIntygsId, String intygsTyp, CopyIntygRequest request) {
    HoSPersonal hosPerson = createHoSPersonFromUser();
    Patient patient = createPatientFromCopyIntygRequest(request);
    CreateRenewalCopyRequest req = new CreateRenewalCopyRequest(orgIntygsId, intygsTyp, patient, hosPerson);
    // Add new personnummer to request
    addPersonnummerToRequest(req, userService.getUser().getParameters());
    // Set djupintegrerad flag on request to true if origin is DJUPINTEGRATION
    setDeepIntegrationFlagOnRequest(req);
    return req;
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Patient(se.inera.intyg.common.support.model.common.internal.Patient)

Example 4 with HoSPersonal

use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.

the class IntygModuleApiController method createReplacementCopyRequest.

private CreateReplacementCopyRequest createReplacementCopyRequest(String orgIntygsId, String intygsTyp, CopyIntygRequest request) {
    HoSPersonal hosPerson = createHoSPersonFromUser();
    Patient patient = createPatientFromCopyIntygRequest(request);
    final WebCertUser user = userService.getUser();
    IntegrationParameters parameters = user.getParameters();
    boolean coherentJournaling = parameters != null && parameters.isSjf();
    CreateReplacementCopyRequest req = new CreateReplacementCopyRequest(orgIntygsId, intygsTyp, patient, hosPerson, coherentJournaling);
    // Add new personnummer to request
    addPersonnummerToRequest(req, parameters);
    // Set djupintegrerad flag on request to true if origin is DJUPINTEGRATION
    setDeepIntegrationFlagOnRequest(req);
    return req;
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) IntegrationParameters(se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters) Patient(se.inera.intyg.common.support.model.common.internal.Patient) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 5 with HoSPersonal

use of se.inera.intyg.common.support.model.common.internal.HoSPersonal in project webcert by sklintyg.

the class IntygConverterUtil method buildHosPersonalFromWebCertUser.

public static HoSPersonal buildHosPersonalFromWebCertUser(WebCertUser user, Vardenhet vardenhet) {
    HoSPersonal hosPersonal = new HoSPersonal();
    hosPersonal.setPersonId(user.getHsaId());
    hosPersonal.setFullstandigtNamn(user.getNamn());
    hosPersonal.setForskrivarKod(user.getForskrivarkod());
    hosPersonal.getBefattningar().addAll(user.getBefattningar());
    hosPersonal.getSpecialiteter().addAll(user.getSpecialiseringar());
    if (vardenhet != null) {
        hosPersonal.setVardenhet(vardenhet);
    } else {
        hosPersonal.setVardenhet(buildVardenhet(user));
    }
    return hosPersonal;
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal)

Aggregations

HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)38 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)15 Test (org.junit.Test)13 Patient (se.inera.intyg.common.support.model.common.internal.Patient)11 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)10 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)10 Before (org.junit.Before)8 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)7 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)5 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)5 ValidateDraftResponse (se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse)5 Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)5 Personnummer (se.inera.intyg.schemas.contract.Personnummer)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)4 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)4 CreateNewDraftRequest (se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)4 UpdatePatientOnDraftRequest (se.inera.intyg.webcert.web.service.utkast.dto.UpdatePatientOnDraftRequest)4 AbstractVardenhet (se.inera.intyg.infra.integration.hsa.model.AbstractVardenhet)3 SaveDraftResponse (se.inera.intyg.webcert.web.service.utkast.dto.SaveDraftResponse)3