Search in sources :

Example 1 with VardpersonReferens

use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.

the class ArendeServiceTest method buildUtkast.

private Utkast buildUtkast() {
    final String signeratAv = "signeratAv";
    Utkast utkast = new Utkast();
    utkast.setIntygsId(INTYG_ID);
    utkast.setSkapadAv(new VardpersonReferens());
    utkast.getSkapadAv().setHsaId(signeratAv);
    utkast.setSignatur(mock(Signatur.class));
    utkast.setPatientPersonnummer(PNR);
    when(utkast.getSignatur().getSigneradAv()).thenReturn(signeratAv);
    return utkast;
}
Also used : Signatur(se.inera.intyg.webcert.persistence.utkast.model.Signatur) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Matchers.anyString(org.mockito.Matchers.anyString) VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)

Example 2 with VardpersonReferens

use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.

the class CreateDraftCertificateResponderImplTest method createVardpersonReferens.

private VardpersonReferens createVardpersonReferens(String hsaId, String name) {
    VardpersonReferens vardperson = new VardpersonReferens();
    vardperson.setHsaId(hsaId);
    vardperson.setNamn(name);
    return vardperson;
}
Also used : VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)

Example 3 with VardpersonReferens

use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.

the class CreateDraftCertificateResponderImplTest method testCreateDraftCertificateMultipleMIUs.

@Test
public void testCreateDraftCertificateMultipleMIUs() {
    CreateNewDraftRequest draftRequest = createCreateNewDraftRequest(createVardenhet(createVardgivare()));
    CreateDraftCertificateType certificateType = createCertificateType();
    VardpersonReferens vardperson = createVardpersonReferens(certificateType.getIntyg().getSkapadAv().getPersonalId().getRoot(), certificateType.getIntyg().getSkapadAv().getFullstandigtNamn());
    Utkast utkast = createUtkast(UTKAST_ID, Long.parseLong(UTKAST_VERSION), UTKAST_TYPE, UtkastStatus.DRAFT_INCOMPLETE, UTKAST_JSON, vardperson);
    when(mockValidator.validate(any(Intyg.class))).thenReturn(new ResultValidator());
    when(mockRequestBuilder.buildCreateNewDraftRequest(any(Intyg.class), any(IntygUser.class))).thenReturn(draftRequest);
    when(mockUtkastService.createNewDraft(any(CreateNewDraftRequest.class))).thenReturn(utkast);
    when(takService.verifyTakningForCareUnit(any(String.class), any(String.class), any(SchemaVersion.class), any(IntygUser.class))).thenReturn(new TakResult(true, Lists.emptyList()));
    CreateDraftCertificateResponseType response = responder.createDraftCertificate(LOGICAL_ADDR, certificateType);
    verify(mockUtkastService).createNewDraft(any(CreateNewDraftRequest.class));
    verify(mockIntegreradeEnheterService).putIntegreradEnhet(any(IntegreradEnhetEntry.class), eq(false), eq(true));
    assertNotNull(response);
    assertEquals(response.getResult().getResultCode(), ResultCodeType.OK);
    assertEquals(response.getIntygsId().getExtension(), UTKAST_ID);
}
Also used : CreateDraftCertificateResponseType(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateResponseType) IntegreradEnhetEntry(se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry) CreateNewDraftRequest(se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest) CreateDraftCertificateType(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateType) SchemaVersion(se.inera.intyg.common.support.modules.support.api.notification.SchemaVersion) TypAvIntyg(se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg) Intyg(se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) ResultValidator(se.inera.intyg.webcert.web.integration.validators.ResultValidator) TakResult(se.inera.intyg.webcert.integration.tak.model.TakResult) IntygUser(se.inera.intyg.infra.security.common.model.IntygUser) VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens) BaseCreateDraftCertificateTest(se.inera.intyg.webcert.web.integration.interactions.createdraftcertificate.BaseCreateDraftCertificateTest) Test(org.junit.Test)

Example 4 with VardpersonReferens

use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.

the class IntygResource method createDraft.

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createDraft(CreateNewDraftRequest request) {
    Utkast utkast = new Utkast();
    Patient patient = request.getPatient();
    utkast.setPatientPersonnummer(patient.getPersonId());
    utkast.setPatientFornamn(patient.getFornamn());
    utkast.setPatientMellannamn(patient.getMellannamn());
    utkast.setPatientEfternamn(patient.getEfternamn());
    utkast.setIntygsId(request.getIntygId());
    utkast.setIntygsTyp(request.getIntygType());
    utkast.setStatus(UtkastStatus.DRAFT_INCOMPLETE);
    Vardenhet vardenhet = request.getHosPerson().getVardenhet();
    utkast.setEnhetsId(vardenhet.getEnhetsid());
    utkast.setEnhetsNamn(vardenhet.getEnhetsnamn());
    Vardgivare vardgivare = vardenhet.getVardgivare();
    utkast.setVardgivarId(vardgivare.getVardgivarid());
    utkast.setVardgivarNamn(vardgivare.getVardgivarnamn());
    VardpersonReferens vardPerson = new VardpersonReferens();
    vardPerson.setNamn(request.getHosPerson().getFullstandigtNamn());
    vardPerson.setHsaId(request.getHosPerson().getPersonId());
    utkast.setSenastSparadAv(vardPerson);
    utkast.setSkapadAv(vardPerson);
    utkastRepository.save(utkast);
    return Response.ok().build();
}
Also used : Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Patient(se.inera.intyg.common.support.model.common.internal.Patient) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) Vardgivare(se.inera.intyg.common.support.model.common.internal.Vardgivare) VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 5 with VardpersonReferens

use of se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens in project webcert by sklintyg.

the class UpdateUserUtil method createVardpersonFromHosPerson.

public static VardpersonReferens createVardpersonFromHosPerson(HoSPersonal hosPerson) {
    VardpersonReferens vardPerson = new VardpersonReferens();
    vardPerson.setNamn(hosPerson.getFullstandigtNamn());
    vardPerson.setHsaId(hosPerson.getPersonId());
    return vardPerson;
}
Also used : VardpersonReferens(se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)

Aggregations

VardpersonReferens (se.inera.intyg.webcert.persistence.utkast.model.VardpersonReferens)33 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)21 Before (org.junit.Before)5 Signatur (se.inera.intyg.webcert.persistence.utkast.model.Signatur)5 Test (org.junit.Test)4 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)4 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)4 SchemaVersion (se.inera.intyg.common.support.modules.support.api.notification.SchemaVersion)4 IntygUser (se.inera.intyg.infra.security.common.model.IntygUser)4 TakResult (se.inera.intyg.webcert.integration.tak.model.TakResult)4 BaseCreateDraftCertificateTest (se.inera.intyg.webcert.web.integration.interactions.createdraftcertificate.BaseCreateDraftCertificateTest)4 IntegreradEnhetEntry (se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry)4 ResultValidator (se.inera.intyg.webcert.web.integration.validators.ResultValidator)4 CreateNewDraftRequest (se.inera.intyg.webcert.web.service.utkast.dto.CreateNewDraftRequest)4 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)3 PagaendeSignering (se.inera.intyg.webcert.persistence.utkast.model.PagaendeSignering)3 CreateDraftCertificateResponseType (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateResponseType)3 CreateDraftCertificateType (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.CreateDraftCertificateType)3 Intyg (se.riv.clinicalprocess.healthcond.certificate.createdraftcertificateresponder.v3.Intyg)3 TypAvIntyg (se.riv.clinicalprocess.healthcond.certificate.types.v3.TypAvIntyg)3