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;
}
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;
}
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);
}
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();
}
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;
}
Aggregations