use of se.riv.clinicalprocess.healthcond.certificate.v3.Arenden in project webcert by sklintyg.
the class CertificateStatusUpdateForCareResponderStub method certificateStatusUpdateForCare.
@Override
public CertificateStatusUpdateForCareResponseType certificateStatusUpdateForCare(String logicalAddress, CertificateStatusUpdateForCareType request) {
Intyg intyg = request.getIntyg();
String handelseKod = request.getHandelse().getHandelsekod().getCode();
String intygsId = intyg.getIntygsId().getExtension();
StringBuilder sb = new StringBuilder();
if (intyg.getSigneringstidpunkt() != null) {
sb.append(" Signeringstidpunkt: " + intyg.getSigneringstidpunkt());
sb.append("\n");
}
if (intyg.getPatient() != null) {
sb.append(" Patient: " + intyg.getPatient().getPersonId().getExtension());
sb.append("\n");
}
Arenden skickadeFragor = request.getSkickadeFragor();
sb.append(" Skickade fragor totalt: " + skickadeFragor.getTotalt());
sb.append(" Skickade fragor hanterade: " + skickadeFragor.getHanterade());
sb.append(" Skickade fragor besvarade: " + skickadeFragor.getBesvarade());
sb.append(" Skickade fragor ej besvarade: " + skickadeFragor.getEjBesvarade());
sb.append("\n");
Arenden mottagnaFragor = request.getMottagnaFragor();
sb.append(" Mottagna fragor totalt: " + mottagnaFragor.getTotalt());
sb.append(" Mottagna fragor hanterade: " + mottagnaFragor.getHanterade());
sb.append(" Mottagna fragor besvarade: " + mottagnaFragor.getBesvarade());
sb.append(" Mottagna fragor ej besvarade: " + mottagnaFragor.getEjBesvarade());
sb.append("\n");
LOG.info("\n*********************************************************************************\n" + " Request to address '{}' recieved for intyg: {} handelse: {}.\n" + "{}" + "*********************************************************************************", logicalAddress, intygsId, handelseKod, sb.toString());
notificationStoreV3.put(request);
CertificateStatusUpdateForCareResponseType response = new CertificateStatusUpdateForCareResponseType();
response.setResult(ResultTypeUtil.okResult());
LOG.debug("Request set to 'OK'");
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.v3.Arenden in project webcert by sklintyg.
the class NotificationTypeConverter method toArenden.
public static Arenden toArenden(ArendeCount source) {
Arenden target = new Arenden();
target.setTotalt(source.getTotalt());
target.setBesvarade(source.getBesvarade());
target.setEjBesvarade(source.getEjBesvarade());
target.setHanterade(source.getHanterade());
return target;
}
use of se.riv.clinicalprocess.healthcond.certificate.v3.Arenden in project webcert by sklintyg.
the class IntygServiceImpl method listCertificatesForCareWithQA.
@Override
public List<IntygWithNotificationsResponse> listCertificatesForCareWithQA(IntygWithNotificationsRequest request) {
List<Utkast> utkastList;
if (request.shouldUseEnhetId()) {
utkastList = utkastRepository.findDraftsByPatientAndEnhetAndStatus(DaoUtil.formatPnrForPersistence(request.getPersonnummer()), request.getEnhetId(), Arrays.asList(UtkastStatus.values()), moduleRegistry.listAllModules().stream().map(IntygModule::getId).collect(Collectors.toSet()));
} else {
utkastList = utkastRepository.findDraftsByPatientAndVardgivareAndStatus(DaoUtil.formatPnrForPersistence(request.getPersonnummer()), request.getVardgivarId(), Arrays.asList(UtkastStatus.values()), moduleRegistry.listAllModules().stream().map(IntygModule::getId).collect(Collectors.toSet()));
}
List<IntygWithNotificationsResponse> res = new ArrayList<>();
for (Utkast utkast : utkastList) {
List<Handelse> notifications = notificationService.getNotifications(utkast.getIntygsId());
String ref = referensService.getReferensForIntygsId(utkast.getIntygsId());
notifications = notifications.stream().filter(handelse -> {
if (request.getStartDate() != null && handelse.getTimestamp().isBefore(request.getStartDate())) {
return false;
}
if (request.getEndDate() != null && handelse.getTimestamp().isAfter(request.getEndDate())) {
return false;
}
return true;
}).collect(Collectors.toList());
// this time span
if ((request.getStartDate() != null || request.getEndDate() != null) && notifications.isEmpty()) {
continue;
}
try {
ModuleApi api = moduleRegistry.getModuleApi(utkast.getIntygsTyp());
Intyg intyg = api.getIntygFromUtlatande(api.getUtlatandeFromJson(utkast.getModel()));
Pair<ArendeCount, ArendeCount> arenden = fragorOchSvarCreator.createArenden(utkast.getIntygsId(), utkast.getIntygsTyp());
res.add(new IntygWithNotificationsResponse(intyg, notifications, arenden.getLeft(), arenden.getRight(), ref));
} catch (ModuleNotFoundException | ModuleException | IOException e) {
LOG.error("Could not convert intyg {} to external format", utkast.getIntygsId());
}
}
return res;
}
Aggregations