Search in sources :

Example 16 with Vardgivare

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

the class PageControllerTest method createMockVardgivare.

private Vardgivare createMockVardgivare() {
    Vardgivare vg = new Vardgivare("vg-1", "Vårdgivare 1");
    Vardenhet ve = new Vardenhet("ve-1", "Vårdenhet 1");
    vg.setVardenheter(Collections.singletonList(ve));
    return vg;
}
Also used : Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare) Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet)

Example 17 with Vardgivare

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

the class UtkastApiControllerTest method buildVardgivare.

private SelectableVardenhet buildVardgivare() {
    Vardgivare vardgivare = new Vardgivare();
    vardgivare.setId("456");
    vardgivare.setNamn("vardgivarnamn");
    return vardgivare;
}
Also used : Vardgivare(se.inera.intyg.infra.integration.hsa.model.Vardgivare)

Example 18 with Vardgivare

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

the class IntygIntegrationControllerTest method createUser.

private WebCertUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
    WebCertUser user = new WebCertUser();
    HashMap<String, Privilege> pMap = new HashMap<>();
    pMap.put(p.getName(), p);
    user.setAuthorities(pMap);
    user.setOrigin(origin);
    user.setFeatures(features);
    HashMap<String, Role> rMap = new HashMap<>();
    Role role = new Role();
    role.setName(roleName);
    rMap.put(roleName, role);
    user.setRoles(rMap);
    Vardgivare vg = new Vardgivare();
    vg.setId("vg1");
    Vardenhet ve = new Vardenhet();
    ve.setVardgivareHsaId("vg1");
    ve.setId(ENHETSID);
    vg.setVardenheter(Arrays.asList(ve));
    user.setVardgivare(Arrays.asList(vg));
    return user;
}
Also used : Role(se.inera.intyg.infra.security.common.model.Role) HashMap(java.util.HashMap) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Privilege(se.inera.intyg.infra.security.common.model.Privilege) 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)

Example 19 with Vardgivare

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

the class StatModuleApiControllerTest method setupDataAndExpectations.

@Before
public void setupDataAndExpectations() {
    fragaSvarStatsMap = new HashMap<>();
    fragaSvarStatsMap.put("VE1", 2L);
    fragaSvarStatsMap.put("VE1M1", 3L);
    fragaSvarStatsMap.put("VE1M2", 3L);
    fragaSvarStatsMap.put("VE2", 2L);
    fragaSvarStatsMap.put("VE3", 1L);
    arendeStatsMap = new HashMap<>();
    arendeStatsMap.put("VE1", 2L);
    arendeStatsMap.put("VE1M1", 3L);
    arendeStatsMap.put("VE1M2", 3L);
    arendeStatsMap.put("VE2", 2L);
    arendeStatsMap.put("VE3", 1L);
    intygStatsMap = new HashMap<>();
    intygStatsMap.put("VE1M1", 1L);
    intygStatsMap.put("VE1M2", 2L);
    intygStatsMap.put("VE2", 2L);
    mockUser = new WebCertUser();
    Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
    mockUser.setRoles(AuthoritiesResolverUtil.toMap(role));
    mockUser.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
    ve1 = new Vardenhet("VE1", "Vardenhet1");
    ve1.getMottagningar().add(new Mottagning("VE1M1", "Mottagning1"));
    ve1.getMottagningar().add(new Mottagning("VE1M2", "Mottagning2"));
    ve2 = new Vardenhet("VE2", "Vardenhet2");
    ve2.getMottagningar().add(new Mottagning("VE2M1", "Mottagning3"));
    ve3 = new Vardenhet("VE3", "Vardenhet3");
    ve4 = new Vardenhet("VE4", "Vardenhet4");
    Vardgivare vg = new Vardgivare("VG1", "Vardgivaren");
    vg.setVardenheter(Arrays.asList(ve1, ve2, ve3, ve4));
    mockUser.setVardgivare(Collections.singletonList(vg));
    mockUser.setValdVardgivare(vg);
    when(authoritiesHelper.getIntygstyperForPrivilege(any(UserDetails.class), anyString())).thenReturn(Stream.of("fk7263").collect(Collectors.toSet()));
    when(webCertUserService.getUser()).thenReturn(mockUser);
}
Also used : Role(se.inera.intyg.infra.security.common.model.Role) UserDetails(se.inera.intyg.infra.security.common.model.UserDetails) 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) Mottagning(se.inera.intyg.infra.integration.hsa.model.Mottagning) Before(org.junit.Before)

Example 20 with Vardgivare

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

the class WebCertUserServiceTest method createWebCertUser.

private WebCertUser createWebCertUser(boolean fromJS) {
    WebCertUser user = buildUserPrincipal();
    user.setNamn("A Name");
    user.setHsaId("HSA-id");
    user.setForskrivarkod("Forskrivarkod");
    user.setAuthenticationScheme("AuthScheme");
    user.setSpecialiseringar(Arrays.asList("Kirurgi", "Ortopedi"));
    user.setBefattningar(Arrays.asList("Specialistläkare"));
    List<Vardgivare> vardgivare = new ArrayList<>();
    Vardgivare vg1 = new Vardgivare(VARDGIVARE_1, "Vardgivare 1");
    Vardenhet vg1ve1 = new Vardenhet(VARDENHET_1, "Vardenhet 1");
    vg1.getVardenheter().add(vg1ve1);
    vg1.getVardenheter().add(new Vardenhet(VARDENHET_2, "Vardenhet 2"));
    Vardgivare vg2 = new Vardgivare(VARDGIVARE_2, "Vardgivare 2");
    vg2.getVardenheter().add(new Vardenhet(VARDENHET_3, "Vardenhet 3"));
    vg2.getVardenheter().add(new Vardenhet(VARDENHET_4, "Vardenhet 4"));
    vardgivare.add(vg1);
    vardgivare.add(vg2);
    user.setVardgivare(vardgivare);
    user.setValdVardenhet(vg1ve1);
    user.setValdVardgivare(vg1);
    user.setMiuNamnPerEnhetsId(buildMiuMap());
    if (fromJS) {
        user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
    } else {
        user.setOrigin(UserOriginType.NORMAL.name());
    }
    return user;
}
Also used : 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