Search in sources :

Example 1 with ResultCodeEnum

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();
    }
}
Also used : Personnummer(se.inera.intyg.schemas.contract.Personnummer) InvalidPersonNummerException(se.inera.intyg.schemas.contract.InvalidPersonNummerException) ResultCodeEnum(se.riv.clinicalprocess.healthcond.certificate.types.v2.ResultCodeEnum) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes) ApiOperation(io.swagger.annotations.ApiOperation) PUT(javax.ws.rs.PUT)

Aggregations

ApiOperation (io.swagger.annotations.ApiOperation)1 Consumes (javax.ws.rs.Consumes)1 PUT (javax.ws.rs.PUT)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 InvalidPersonNummerException (se.inera.intyg.schemas.contract.InvalidPersonNummerException)1 Personnummer (se.inera.intyg.schemas.contract.Personnummer)1 ResultCodeEnum (se.riv.clinicalprocess.healthcond.certificate.types.v2.ResultCodeEnum)1