Search in sources :

Example 6 with UtkastStatus

use of se.inera.intyg.webcert.common.model.UtkastStatus in project webcert by sklintyg.

the class IntygServiceImpl method buildIntygItemListFromDrafts.

private List<ListIntygEntry> buildIntygItemListFromDrafts(List<String> enhetId, Personnummer personnummer) {
    List<UtkastStatus> statuses = new ArrayList<>();
    statuses.add(UtkastStatus.SIGNED);
    SekretessStatus sekretessmarkering = patientDetailsResolver.getSekretessStatus(personnummer);
    Set<String> base = authoritiesHelper.getIntygstyperForPrivilege(webCertUserService.getUser(), AuthoritiesConstants.PRIVILEGE_VISA_INTYG);
    // Remove intygstyper that cannot be issued for a sekretessmarkerad patient
    Set<String> intygsTyper = (sekretessmarkering == SekretessStatus.TRUE || sekretessmarkering == SekretessStatus.UNDEFINED) ? filterAllowedForSekretessMarkering(base) : base;
    List<Utkast> drafts = utkastRepository.findDraftsByPatientAndEnhetAndStatus(DaoUtil.formatPnrForPersistence(personnummer), enhetId, statuses, intygsTyper);
    return IntygDraftsConverter.convertUtkastsToListIntygEntries(drafts);
}
Also used : UtkastStatus(se.inera.intyg.webcert.common.model.UtkastStatus) SekretessStatus(se.inera.intyg.webcert.common.model.SekretessStatus) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) ArrayList(java.util.ArrayList)

Aggregations

UtkastStatus (se.inera.intyg.webcert.common.model.UtkastStatus)6 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)6 ModuleApi (se.inera.intyg.common.support.modules.support.api.ModuleApi)3 ModuleException (se.inera.intyg.common.support.modules.support.api.exception.ModuleException)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Transactional (org.springframework.transaction.annotation.Transactional)2 Relation (se.inera.intyg.common.support.model.common.internal.Relation)2 Utlatande (se.inera.intyg.common.support.model.common.internal.Utlatande)2 LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)2 CopyUtkastBuilderResponse (se.inera.intyg.webcert.web.service.utkast.dto.CopyUtkastBuilderResponse)2 OptimisticLockException (javax.persistence.OptimisticLockException)1 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 XPath (javax.xml.xpath.XPath)1 Test (org.junit.Test)1 GrundData (se.inera.intyg.common.support.model.common.internal.GrundData)1 Patient (se.inera.intyg.common.support.model.common.internal.Patient)1 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)1