@Test public void testGetPrevious() { setupUser("", "luse"); Utkast utkast1 = buildUtkast(PATIENT_PERSONNUMMER); utkast1.setStatus(UtkastStatus.SIGNED); Utkast utkast2 = buildUtkast(PATIENT_PERSONNUMMER); utkast2.setStatus(UtkastStatus.SIGNED); Utkast utkast3 = buildUtkast(PATIENT_PERSONNUMMER); utkast3.setIntygsTyp("Fel typ"); utkast3.setStatus(UtkastStatus.DRAFT_INCOMPLETE); Utkast utkast4 = buildUtkast(PATIENT_PERSONNUMMER); utkast4.setIntygsTyp("Fel typ 2"); utkast4.setStatus(UtkastStatus.SIGNED); utkast4.setAterkalladDatum(LocalDateTime.of(2017, 1, 1, 1, 1)); Response response = utkastController.getPreviousCertificateWarnings(PATIENT_PERSONNUMMER.getPersonnummer(), null); assertNotNull(response); Map<String, Map<String, PreviousIntyg>> responseBody = (Map<String, Map<String, PreviousIntyg>>) response.readEntity(HashMap.class); assertEquals(1, responseBody.size()); assertTrue(responseBody.get("intyg").get("luse").isSameVardgivare()); }
@GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer, @PathParam("currentDraftId") String currentDraftId) { Map<String, Map<String, PreviousIntyg>> res = utkastService .checkIfPersonHasExistingIntyg(Personnummer.createPersonnummer(personnummer).get(), getWebCertUserService().getUser(), currentDraftId); return Response.ok(res).build(); }
UtkastApiController extends AbstractApiController { @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer, @PathParam("currentDraftId") String currentDraftId) { Map<String, Map<String, PreviousIntyg>> res = utkastService .checkIfPersonHasExistingIntyg(Personnummer.createPersonnummer(personnummer).get(), getWebCertUserService().getUser(), currentDraftId); return Response.ok(res).build(); } }
UtkastApiController extends AbstractApiController { @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer, @PathParam("currentDraftId") String currentDraftId) { Map<String, Map<String, PreviousIntyg>> res = utkastService .checkIfPersonHasExistingIntyg(Personnummer.createPersonnummer(personnummer).get(), getWebCertUserService().getUser(), currentDraftId); return Response.ok(res).build(); }  }
UtkastApiController extends AbstractApiController { @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer, @PathParam("currentDraftId") String currentDraftId) { Map<String, Map<String, PreviousIntyg>> res = utkastService .checkIfPersonHasExistingIntyg(Personnummer.createPersonnummer(personnummer).get(), getWebCertUserService().getUser(), currentDraftId); return Response.ok(res).build(); }  @POST @Path("/{intygsTyp}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response createUtkast(@PathParam("intygsTyp") String intygsTyp, CreateUtkastRequest request); @GET @Path("/questions/{intygsTyp}/{version}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getQuestions(@PathParam("intygsTyp") String intygsTyp, @PathParam("version") String version); @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters); @GET @Path("/lakare") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getLakareWithDraftsByEnheter(); @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer,
                                                   @PathParam("currentDraftId") String currentDraftId); }
UtkastApiController extends AbstractApiController { @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer, @PathParam("currentDraftId") String currentDraftId) { Map<String, Map<String, PreviousIntyg>> res = utkastService .checkIfPersonHasExistingIntyg(Personnummer.createPersonnummer(personnummer).get(), getWebCertUserService().getUser(), currentDraftId); return Response.ok(res).build(); }  @POST @Path("/{intygsTyp}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response createUtkast(@PathParam("intygsTyp") String intygsTyp, CreateUtkastRequest request); @GET @Path("/questions/{intygsTyp}/{version}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getQuestions(@PathParam("intygsTyp") String intygsTyp, @PathParam("version") String version); @GET @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response filterDraftsForUnit(@QueryParam("") QueryIntygParameter filterParameters); @GET @Path("/lakare") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getLakareWithDraftsByEnheter(); @GET @Path("/previousIntyg/{personnummer}/{currentDraftId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getPreviousCertificateWarnings(@PathParam("personnummer") String personnummer,
                                                   @PathParam("currentDraftId") String currentDraftId);  }