Search in sources :

Example 1 with Vardenhet

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

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

the class BaseCreateDraftCertificateTest method createVardenhet.

private Vardenhet createVardenhet(Vardgivare vardgivare) {
    Vardenhet vardenhet = new Vardenhet();
    vardenhet.setId(UNIT_HSAID);
    vardenhet.setNamn("Vardenheten");
    vardenhet.setVardgivareHsaId(vardgivare.getId());
    vardenhet.setArbetsplatskod("12345");
    vardenhet.setPostadress("Gatan 1");
    vardenhet.setPostnummer("54321");
    vardenhet.setPostort("Vardmåla");
    vardenhet.setTelefonnummer("123-456789");
    return vardenhet;
}
Also used : Vardenhet(se.inera.intyg.infra.integration.hsa.model.Vardenhet)

Example 3 with Vardenhet

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

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

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

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