Search in sources :

Example 21 with Vardenhet

use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.

the class FragaSvarServiceImplTest method buildUserOfRole.

private WebCertUser buildUserOfRole(Role role) {
    WebCertUser user = new WebCertUser();
    user.setRoles(AuthoritiesResolverUtil.toMap(role));
    user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
    user.setOrigin("NORMAL");
    user.setHsaId("testuser");
    user.setNamn("test userman");
    Feature feature = new Feature();
    feature.setName(AuthoritiesConstants.FEATURE_HANTERA_FRAGOR);
    feature.setGlobal(true);
    feature.setIntygstyper(ImmutableList.of("fk7263"));
    user.setFeatures(ImmutableMap.of(AuthoritiesConstants.FEATURE_HANTERA_FRAGOR, feature));
    Vardenhet vardenhet = new Vardenhet("enhet", "Enhet");
    Vardgivare vardgivare = new Vardgivare("vardgivare", "Vardgivaren");
    vardgivare.getVardenheter().add(vardenhet);
    user.setVardgivare(Collections.singletonList(vardgivare));
    user.setValdVardenhet(vardenhet);
    return user;
}
Also used : Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Feature(se.inera.intyg.infra.security.common.model.Feature) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 22 with Vardenhet

use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.

the class CreateNewDraftRequestBuilderTest method createHsaVardenhet.

private Vardenhet createHsaVardenhet() {
    Vardenhet hsaVardenhet = new Vardenhet();
    hsaVardenhet.setId(UNIT_HSAID);
    hsaVardenhet.setNamn("Vardenheten");
    hsaVardenhet.setArbetsplatskod("0000001");
    hsaVardenhet.setPostadress("Postaddr");
    hsaVardenhet.setPostnummer("12345");
    hsaVardenhet.setPostort("Staden");
    hsaVardenhet.setTelefonnummer("0123-456789");
    return hsaVardenhet;
}
Also used : Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet)

Example 23 with Vardenhet

use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.

the class IntygConverterUtilTest method testBuildHosPersonalFromWebCertUserWithSpecialiseringarAndBefattningar.

@Test
public void testBuildHosPersonalFromWebCertUserWithSpecialiseringarAndBefattningar() {
    final String hsaId = "hsaid";
    final String namn = "namn";
    final String befattning1 = "befattning1";
    final String befattning2 = "befattning2";
    final String specialisering1 = "specialisering1";
    final String specialisering2 = "specialisering2";
    se.inera.intyg.common.support.model.common.internal.Vardenhet vardenhet = new se.inera.intyg.common.support.model.common.internal.Vardenhet();
    WebCertUser user = new WebCertUser();
    user.setHsaId(hsaId);
    user.setNamn(namn);
    user.setBefattningar(Arrays.asList(befattning1, befattning2));
    user.setSpecialiseringar(Arrays.asList(specialisering1, specialisering2));
    HoSPersonal result = IntygConverterUtil.buildHosPersonalFromWebCertUser(user, vardenhet);
    assertEquals(hsaId, result.getPersonId());
    assertEquals(namn, result.getFullstandigtNamn());
    assertEquals(2, result.getBefattningar().size());
    assertEquals(befattning1, result.getBefattningar().get(0));
    assertEquals(befattning2, result.getBefattningar().get(1));
    assertEquals(2, result.getSpecialiteter().size());
    assertEquals(specialisering1, result.getSpecialiteter().get(0));
    assertEquals(specialisering2, result.getSpecialiteter().get(1));
}
Also used : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Example 24 with Vardenhet

use of se.inera.intyg.infra.integration.hsa.model.Vardenhet in project webcert by sklintyg.

the class IntygConverterUtilTest method testBuildHosPersonalFromWebCertUser.

@Test
public void testBuildHosPersonalFromWebCertUser() {
    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";
    Vardenhet valdVardenhet = new Vardenhet();
    valdVardenhet.setArbetsplatskod(arbetsplatskod);
    valdVardenhet.setEpost(epost);
    valdVardenhet.setId(enhetsId);
    valdVardenhet.setNamn(enhetsnamn);
    valdVardenhet.setPostadress(postadress);
    valdVardenhet.setPostnummer(postnummer);
    valdVardenhet.setPostort(postort);
    valdVardenhet.setTelefonnummer(telefonnummer);
    Vardgivare valdVardgivare = new Vardgivare();
    valdVardgivare.setId(vardgivarId);
    valdVardgivare.setNamn(vardgivarnamn);
    WebCertUser user = new WebCertUser();
    user.setForskrivarkod(forskrivarkod);
    user.setHsaId(hsaId);
    user.setNamn(namn);
    user.setValdVardenhet(valdVardenhet);
    user.setValdVardgivare(valdVardgivare);
    HoSPersonal result = IntygConverterUtil.buildHosPersonalFromWebCertUser(user, null);
    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 : HoSPersonal(se.inera.intyg.common.support.model.common.internal.HoSPersonal) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser) Test(org.junit.Test)

Aggregations

Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)24 Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)17 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)13 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)5 Role (se.inera.intyg.infra.security.common.model.Role)5 ArrayList (java.util.ArrayList)4 Before (org.junit.Before)4 Test (org.junit.Test)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)2 HashMap (java.util.HashMap)1 MimeMessage (javax.mail.internet.MimeMessage)1 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)1 Patient (se.inera.intyg.common.support.model.common.internal.Patient)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1 ValidateDraftResponse (se.inera.intyg.common.support.modules.support.api.dto.ValidateDraftResponse)1 Mottagning (se.inera.intyg.infra.integration.hsa.model.Mottagning)1 SelectableVardenhet (se.inera.intyg.infra.integration.hsa.model.SelectableVardenhet)1 Feature (se.inera.intyg.infra.security.common.model.Feature)1 Privilege (se.inera.intyg.infra.security.common.model.Privilege)1