Search in sources :

Example 1 with Vardgivare

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

the class ArendeServiceTest 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(UserOriginType.NORMAL.name());
    user.setHsaId("testuser");
    user.setNamn("test userman");
    Feature feature = new Feature();
    feature.setName(AuthoritiesConstants.FEATURE_HANTERA_FRAGOR);
    feature.setGlobal(true);
    feature.setIntygstyper(ImmutableList.of(INTYG_TYP));
    user.setFeatures(ImmutableMap.of(AuthoritiesConstants.FEATURE_HANTERA_FRAGOR, feature));
    Vardenhet vardenhet = new Vardenhet(ENHET_ID, "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) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Example 2 with Vardgivare

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

the class BaseCreateDraftCertificateTest method createVardgivare.

private Vardgivare createVardgivare() {
    Vardgivare vardgivare = new Vardgivare();
    vardgivare.setId(CAREGIVER_HSAID);
    vardgivare.setNamn("Vardgivaren");
    vardgivare.setVardenheter(Arrays.asList(createVardenhet(vardgivare)));
    return vardgivare;
}
Also used : Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare)

Example 3 with Vardgivare

use of se.inera.intyg.infra.integration.hsa.model.Vardgivare 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 4 with Vardgivare

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

the class SendMessageToRecipientTypeBuilderTest method buildWebCertUser.

private WebCertUser buildWebCertUser(boolean complete) {
    WebCertUser user = new WebCertUser();
    user.setHsaId(PERSONAL_HSA_ID);
    user.setNamn(USER_NAMN);
    user.setForskrivarkod(USER_FORSKRIVARKOD);
    Vardenhet valdVardenhet = new Vardenhet();
    valdVardenhet.setArbetsplatskod(ARBETSPLATSKOD);
    valdVardenhet.setId(VARDENHET_ENHET_ID);
    Vardgivare valdVardgivare = new Vardgivare();
    valdVardgivare.setId(VARDGIVARE_ID);
    if (complete) {
        valdVardenhet.setNamn(VARDENHET_NAMN);
        valdVardenhet.setPostadress(VARDENHET_POSTADRESS);
        valdVardenhet.setPostnummer(VARDENHET_POSTNUMMER);
        valdVardenhet.setPostort(VARDENHET_POSTORT);
        valdVardenhet.setTelefonnummer(VARDENHET_TELEFONNUMMER);
        valdVardenhet.setEpost(VARDENHET_EPOST);
        valdVardgivare.setNamn(VARDGIVARE_NAMN);
    }
    user.setValdVardenhet(valdVardenhet);
    user.setValdVardgivare(valdVardgivare);
    return user;
}
Also used : 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)

Example 5 with Vardgivare

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

the class FragaSvarResource method getWebCertUser.

// Create a fake WebCertUser which is authorized for the given care giver and unit
private WebCertUser getWebCertUser(String vardgivarId, String enhetsId) {
    WebCertUser user = new WebCertUser();
    Role role = authoritiesResolver.getRole(AuthoritiesConstants.ROLE_LAKARE);
    user.setRoles(AuthoritiesResolverUtil.toMap(role));
    user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
    user.setHsaId("questionResource");
    user.setNamn("questionResource");
    user.setForskrivarkod("questionResource");
    List<Vardgivare> vardgivarList = new ArrayList<>();
    Vardgivare vardgivare = new Vardgivare(vardgivarId, "questionResource");
    List<Vardenhet> vardenheter = new ArrayList<>();
    Vardenhet enhet = new Vardenhet(enhetsId, "questionResource");
    vardenheter.add(enhet);
    vardgivare.setVardenheter(vardenheter);
    vardgivarList.add(vardgivare);
    user.setVardgivare(vardgivarList);
    user.setValdVardgivare(vardgivare);
    user.setValdVardenhet(enhet);
    return user;
}
Also used : Role(se.inera.intyg.infra.security.common.model.Role) ArrayList(java.util.ArrayList) Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet) WebCertUser(se.inera.intyg.webcert.web.service.user.dto.WebCertUser)

Aggregations

Vardgivare (se.inera.intyg.infra.integration.hsa.model.Vardgivare)26 Vardenhet (se.inera.intyg.infra.integration.hsa.model.Vardenhet)17 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)12 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 Patient (se.inera.intyg.common.support.model.common.internal.Patient)5 Role (se.inera.intyg.infra.security.common.model.Role)5 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)4 Personnummer (se.inera.intyg.schemas.contract.Personnummer)4 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)4 Before (org.junit.Before)3 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)2 Mottagning (se.inera.intyg.infra.integration.hsa.model.Mottagning)2 VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)2 HashMap (java.util.HashMap)1 PostConstruct (javax.annotation.PostConstruct)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)1 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)1