use of se.riv.clinicalprocess.healthcond.certificate.types.v2.ResultCodeEnum in project webcert by sklintyg.
the class SrsApiController method setConsent.
@PUT
@Path("/consent/{personnummer}/{hsaId}")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Set consent for patient and careunit", httpMethod = "PUT", produces = MediaType.APPLICATION_JSON)
public Response setConsent(@ApiParam(value = "Personnummer") @PathParam("personnummer") String personnummer, @ApiParam(value = "HsaId för vårdenhet") @PathParam("hsaId") String hsaId, boolean consent) {
authoritiesValidator.given(getWebCertUserService().getUser()).features(AuthoritiesConstants.FEATURE_SRS).orThrow();
try {
Personnummer p = createPnr(personnummer);
ResultCodeEnum result = srsService.setConsent(hsaId, p, consent);
monitoringLog.logSetSrsConsent(p, consent);
return Response.ok(result).build();
} catch (InvalidPersonNummerException e) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
}
Aggregations