use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareType in project webcert by sklintyg.
the class SendMessageToCareResponderImpl method sendMessageToCare.
@Override
public SendMessageToCareResponseType sendMessageToCare(String logicalAddress, SendMessageToCareType request) {
LOG.debug("Received new message to care");
SendMessageToCareResponseType response = new SendMessageToCareResponseType();
ResultType result = new ResultType();
try {
arendeService.processIncomingMessage(ArendeConverter.convert(request));
result.setResultCode(ResultCodeType.OK);
} catch (WebCertServiceException e) {
result.setResultCode(ResultCodeType.ERROR);
switch(e.getErrorCode()) {
case INVALID_STATE:
case DATA_NOT_FOUND:
case EXTERNAL_SYSTEM_PROBLEM:
result.setErrorId(ErrorIdType.VALIDATION_ERROR);
result.setResultText(e.getMessage());
LOG.warn("{}: {}", e.getErrorCode().name(), e.getMessage());
break;
default:
result.setErrorId(ErrorIdType.APPLICATION_ERROR);
result.setResultText(e.getMessage());
LOG.error("Could not process incoming message to care. Cause is: {}", e.getMessage());
break;
}
}
response.setResult(result);
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareType in project webcert by sklintyg.
the class SendMessageToCareResponderImplTest method createNewRequest.
private SendMessageToCareType createNewRequest() {
SendMessageToCareType res = new SendMessageToCareType();
res.setAmne(new Amneskod());
res.getAmne().setCode(ArendeAmne.KONTKT.toString());
res.setIntygsId(createIntygsId(DEFAULT_INTYG_ID));
res.setMeddelandeId(DEFAULT_MEDDELANDE_ID);
res.setPatientPersonId(createPersonId(DEFAULT_PATIENT_ID));
res.setSkickatAv(createSkickadAv());
return res;
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareType in project webcert by sklintyg.
the class ArendeConverterTest method testConvertArende.
@Test
public void testConvertArende() {
final ArendeAmne amneskod = ArendeAmne.AVSTMN;
final String intygId = "intygId";
final String kontaktInfo = "kontaktInfo";
final String skickatAv = PARTKOD_FKASSA;
final String frageId = "frageId";
final Integer instans = 1;
final String kompletteringsText = "kompletteringsText";
final String meddelande = "meddelande";
final String meddelandeId = "meddelandeId";
final String paminnelseMeddelandeId = "paminnelseMeddelandeId";
final String personId = "personId";
final String referensId = "referensId";
final String rubrik = "rubrik";
final LocalDate sistaDatum = LocalDate.now();
final LocalDateTime skickatTidpunkt = LocalDateTime.now();
final String svarPa = "svarPa";
final String svarReferensId = "svarReferensId";
SendMessageToCareType input = createSendMessageToCare(amneskod.name(), intygId, kontaktInfo, skickatAv, frageId, instans, kompletteringsText, meddelande, meddelandeId, paminnelseMeddelandeId, personId, referensId, rubrik, sistaDatum, skickatTidpunkt, svarPa, svarReferensId);
Arende res = ArendeConverter.convert(input);
assertEquals(amneskod, res.getAmne());
assertEquals(intygId, res.getIntygsId());
assertEquals(kontaktInfo, res.getKontaktInfo().get(0));
assertEquals(FRAGESTALLARKOD_FORSAKRINGSKASSA, res.getSkickatAv());
assertEquals(frageId, res.getKomplettering().get(0).getFrageId());
assertEquals(instans, res.getKomplettering().get(0).getInstans());
assertEquals(kompletteringsText, res.getKomplettering().get(0).getText());
assertEquals(meddelande, res.getMeddelande());
assertEquals(meddelandeId, res.getMeddelandeId());
assertEquals(paminnelseMeddelandeId, res.getPaminnelseMeddelandeId());
assertEquals(personId, res.getPatientPersonId());
assertEquals(referensId, res.getReferensId());
assertEquals(rubrik, res.getRubrik());
assertEquals(sistaDatum, res.getSistaDatumForSvar());
assertEquals(skickatTidpunkt, res.getSkickatTidpunkt());
assertEquals(svarPa, res.getSvarPaId());
assertEquals(svarReferensId, res.getSvarPaReferens());
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToCare.v2.SendMessageToCareType in project webcert by sklintyg.
the class ArendeConverterTest method createSendMessageToCare.
private SendMessageToCareType createSendMessageToCare(String amneskod, String intygId, String kontaktInfo, String skickatAv, String frageId, Integer instans, String kompletteringsText, String meddelande, String meddelandeId, String paminnelseMeddelandeId, String personId, String referensId, String rubrik, LocalDate sistaDatum, LocalDateTime skickatTidpunkt, String svarPa, String svarReferensId) {
SendMessageToCareType res = new SendMessageToCareType();
Amneskod amne = new Amneskod();
amne.setCode(amneskod);
res.setAmne(amne);
SkickatAv sa = new SkickatAv();
sa.getKontaktInfo().add(kontaktInfo);
Part part = new Part();
part.setCode(skickatAv);
sa.setPart(part);
res.setSkickatAv(sa);
Komplettering komplettering = new Komplettering();
komplettering.setFrageId(frageId);
komplettering.setInstans(instans);
komplettering.setText(kompletteringsText);
res.getKomplettering().add(komplettering);
PersonId pid = new PersonId();
pid.setExtension(personId);
res.setPatientPersonId(pid);
MeddelandeReferens mr = new MeddelandeReferens();
mr.setMeddelandeId(svarPa);
mr.setReferensId(svarReferensId);
res.setSvarPa(mr);
IntygId ii = new IntygId();
ii.setExtension(intygId);
res.setIntygsId(ii);
res.setMeddelande(meddelande);
res.setMeddelandeId(meddelandeId);
res.setPaminnelseMeddelandeId(paminnelseMeddelandeId);
res.setReferensId(referensId);
res.setRubrik(rubrik);
res.setSistaDatumForSvar(sistaDatum);
res.setSkickatTidpunkt(skickatTidpunkt);
return res;
}
Aggregations