Search in sources :

Example 6 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationTypeConverterTest method testConvert.

@Test
public void testConvert() throws Exception {
    final String intygsId = "intygsid";
    final LocalDateTime handelsetid = LocalDateTime.now().minusDays(1);
    final HandelsekodEnum handelsetyp = HandelsekodEnum.ANDRAT;
    final int skickadeFragorTotalt = 8;
    final int skickadeFragorHanterade = 7;
    final int skickadeFragorBesvarade = 6;
    final int skickadeFragorEjBesvarade = 5;
    final int mottagnaFragorTotalt = 4;
    final int mottagnaFragorHanterade = 3;
    final int mottagnaFragorBesvarade = 2;
    final int mottagnaFragorEjBesvarade = 1;
    final Intyg intyg = buildIntyg();
    ArendeCount skickadeFragor = new ArendeCount(skickadeFragorTotalt, skickadeFragorEjBesvarade, skickadeFragorBesvarade, skickadeFragorHanterade);
    ArendeCount mottagnaFragor = new ArendeCount(mottagnaFragorTotalt, mottagnaFragorEjBesvarade, mottagnaFragorBesvarade, mottagnaFragorHanterade);
    NotificationMessage msg = new NotificationMessage(intygsId, "luse", handelsetid, handelsetyp, "address", "", null, skickadeFragor, mottagnaFragor, SchemaVersion.VERSION_3, "ref");
    CertificateStatusUpdateForCareType res = NotificationTypeConverter.convert(msg, intyg);
    assertEquals(intyg, res.getIntyg());
    assertEquals(HandelsekodEnum.ANDRAT.value(), res.getHandelse().getHandelsekod().getCode());
    assertEquals(HandelsekodEnum.ANDRAT.description(), res.getHandelse().getHandelsekod().getDisplayName());
    assertEquals(handelsetid, res.getHandelse().getTidpunkt());
    assertNotNull(res.getHandelse().getHandelsekod().getCodeSystem());
    // handelsekod -> codeSystemName is not valid in schema but incorrectly generated in java class
    // therefore we should not populate this field
    assertNull(res.getHandelse().getHandelsekod().getCodeSystemName());
    assertSkickadeFrågor(skickadeFragorTotalt, skickadeFragorHanterade, skickadeFragorBesvarade, skickadeFragorEjBesvarade, res);
    assertMottagnaFragor(mottagnaFragorTotalt, mottagnaFragorHanterade, mottagnaFragorBesvarade, mottagnaFragorEjBesvarade, res);
    // Make sure we have a valid Intyg according to service contract
    assertEquals(NotificationTypeConverter.TEMPORARY_ARBETSPLATSKOD, res.getIntyg().getSkapadAv().getEnhet().getArbetsplatskod().getExtension());
    assertNull(res.getIntyg().getSkapadAv().getEnhet().getEpost());
}
Also used : LocalDateTime(java.time.LocalDateTime) NotificationMessage(se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage) Intyg(se.riv.clinicalprocess.healthcond.certificate.v3.Intyg) ArendeCount(se.inera.intyg.common.support.modules.support.api.notification.ArendeCount) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType) HandelsekodEnum(se.inera.intyg.common.support.common.enumerations.HandelsekodEnum) Test(org.junit.Test)

Example 7 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationTypeConverter method convert.

public static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg) {
    CertificateStatusUpdateForCareType destination = new CertificateStatusUpdateForCareType();
    complementIntyg(intyg);
    destination.setIntyg(intyg);
    decorateWithHandelse(destination, notificationMessage);
    decorateWithArenden(destination, notificationMessage);
    destination.setRef(notificationMessage.getReference());
    return destination;
}
Also used : CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType)

Example 8 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationStubRestApi method notifieringarV3Stats.

@GET
@Path("/notifieringar/v3/stats")
@Produces(MediaType.APPLICATION_JSON)
public Response notifieringarV3Stats() {
    Collection<se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType> notifs = notificationStoreV3.getNotifications();
    Map<String, List<NotificationStubEntry>> stringListMap = new StatTransformerUtil().toStat(notifs);
    StringBuilder buf = new StringBuilder();
    for (Map.Entry<String, List<NotificationStubEntry>> entry : stringListMap.entrySet()) {
        buf.append("---- ").append(entry.getKey()).append(" ----\n");
        entry.getValue().stream().sorted(Comparator.comparing(NotificationStubEntry::getHandelseTid)).forEach(ie -> buf.append(ie.getHandelseTid().format(DateTimeFormatter.ofPattern("HH:mm:ss"))).append("\t").append(ie.getHandelseKod()).append("\n"));
        buf.append("-----------------------------------------------\n\n");
    }
    return Response.ok(buf.toString()).build();
}
Also used : CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType) StatTransformerUtil(se.inera.intyg.webcert.notificationstub.v3.stat.StatTransformerUtil) NotificationStubEntry(se.inera.intyg.webcert.notificationstub.v3.stat.NotificationStubEntry) List(java.util.List) Map(java.util.Map) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 9 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class IntegrationTest method buildNotificationV1.

private CertificateStatusUpdateForCareType buildNotificationV1() {
    Handelse handelse = new Handelse();
    handelse.setHandelsetidpunkt(LocalDateTime.now().minusMinutes(1));
    UtlatandeType utl = new UtlatandeType();
    utl.setHandelse(handelse);
    utl.setUtlatandeId(new UtlatandeId());
    utl.getUtlatandeId().setExtension(UUID.randomUUID().toString());
    CertificateStatusUpdateForCareType type = new CertificateStatusUpdateForCareType();
    type.setUtlatande(utl);
    return type;
}
Also used : UtlatandeId(se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId) UtlatandeType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.UtlatandeType) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType) Handelse(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.Handelse)

Example 10 with CertificateStatusUpdateForCareType

use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType in project webcert by sklintyg.

the class NotificationStoreTest method populateNotificationsMap.

private void populateNotificationsMap(int nbr, NotificationStoreImpl notificationStore, LocalDateTime baseTime) {
    Iterator<String> intygsIdIter = Iterables.cycle(INTYG_IDS).iterator();
    for (int i = 0; i < nbr; i++) {
        String intygsId = intygsIdIter.next();
        Handelse handelse = new Handelse();
        handelse.setHandelsetidpunkt(baseTime.minusMinutes(nbr - i));
        UtlatandeType utl = new UtlatandeType();
        utl.setHandelse(handelse);
        utl.setUtlatandeId(new UtlatandeId());
        utl.getUtlatandeId().setExtension(intygsId);
        CertificateStatusUpdateForCareType type = new CertificateStatusUpdateForCareType();
        type.setUtlatande(utl);
        notificationStore.put(type);
    }
}
Also used : UtlatandeId(se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId) UtlatandeType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.UtlatandeType) CertificateStatusUpdateForCareType(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType) Handelse(se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.Handelse)

Aggregations

CertificateStatusUpdateForCareType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType)6 NotificationMessage (se.inera.intyg.common.support.modules.support.api.notification.NotificationMessage)5 CertificateStatusUpdateForCareType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType)5 UtlatandeType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.UtlatandeType)4 UtlatandeId (se.riv.clinicalprocess.healthcond.certificate.types.v1.UtlatandeId)4 Intyg (se.riv.clinicalprocess.healthcond.certificate.v3.Intyg)4 LocalDateTime (java.time.LocalDateTime)3 Test (org.junit.Test)3 HandelsekodEnum (se.inera.intyg.common.support.common.enumerations.HandelsekodEnum)3 ArendeCount (se.inera.intyg.common.support.modules.support.api.notification.ArendeCount)3 Handelse (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.Handelse)2 CertificateStatusUpdateForCareResponseType (se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareResponseType)2 ResultType (se.riv.clinicalprocess.healthcond.certificate.v3.ResultType)2 LocalDate (java.time.LocalDate)1 List (java.util.List)1 Map (java.util.Map)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 QName (javax.xml.namespace.QName)1