1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.hl7v2;
17
18 import ca.uhn.hl7v2.ErrorCode;
19 import ca.uhn.hl7v2.Version;
20 import lombok.AllArgsConstructor;
21 import lombok.Getter;
22 import org.openehealth.ipf.commons.ihe.core.IntegrationProfile;
23 import org.openehealth.ipf.commons.ihe.core.InteractionId;
24 import org.openehealth.ipf.commons.ihe.hl7v2.audit.FeedAuditDataset;
25 import org.openehealth.ipf.commons.ihe.hl7v2.audit.QueryAuditDataset;
26 import org.openehealth.ipf.commons.ihe.hl7v2.audit.iti10.Iti10AuditStrategy;
27 import org.openehealth.ipf.commons.ihe.hl7v2.audit.iti8.Iti8AuditStrategy;
28 import org.openehealth.ipf.commons.ihe.hl7v2.audit.iti9.Iti9AuditStrategy;
29 import org.openehealth.ipf.commons.ihe.hl7v2.definitions.CustomModelClassUtils;
30 import org.openehealth.ipf.commons.ihe.hl7v2.definitions.HapiContextFactory;
31 import org.openehealth.ipf.gazelle.validation.profile.pixpdq.PixPdqTransactions;
32
33 import java.util.ArrayList;
34 import java.util.Arrays;
35 import java.util.Collections;
36 import java.util.List;
37
38
39
40
41
42
43 public class PIX implements IntegrationProfile {
44
45 @AllArgsConstructor
46 public enum FeedInteractions implements Hl7v2InteractionId<FeedAuditDataset> {
47 ITI_8_PIX( ITI_8_CONFIGURATION, ITI_8_NAK_FACTORY),
48 ITI_8_XDS( ITI_8_CONFIGURATION, ITI_8_NAK_FACTORY);
49
50 @Getter private Hl7v2TransactionConfiguration<FeedAuditDataset> hl7v2TransactionConfiguration;
51 @Getter private NakFactory<FeedAuditDataset> nakFactory;
52 }
53
54 @AllArgsConstructor
55 public enum QueryInteractions implements Hl7v2InteractionId {
56 ITI_9 ( ITI_9_CONFIGURATION, ITI_9_NAK_FACTORY),
57 ITI_10 (ITI_10_CONFIGURATION, ITI_10_NAK_FACTORY);
58
59 @Getter private Hl7v2TransactionConfiguration<QueryAuditDataset> hl7v2TransactionConfiguration;
60 @Getter private NakFactory<QueryAuditDataset> nakFactory;
61 }
62
63 @Override
64 public List<InteractionId> getInteractionIds() {
65 List<InteractionId> interactions = new ArrayList<>();
66 interactions.addAll(Arrays.asList(FeedInteractions.values()));
67 interactions.addAll(Arrays.asList(QueryInteractions.values()));
68 return Collections.unmodifiableList(interactions);
69 }
70
71
72
73 private static final Hl7v2TransactionConfiguration<FeedAuditDataset> ITI_8_CONFIGURATION =
74 new Hl7v2TransactionConfiguration<>(
75 "pix-iti8",
76 "Patient Identity Feed",
77 false,
78 new Iti8AuditStrategy(false),
79 new Iti8AuditStrategy(true),
80 Version.V231,
81 "PIX adapter",
82 "IPF",
83 ErrorCode.APPLICATION_INTERNAL_ERROR,
84 ErrorCode.APPLICATION_INTERNAL_ERROR,
85 "ADT", "A01 A04 A05 A08 A40",
86 "ACK", "*",
87 true,
88 false,
89 HapiContextFactory.createHapiContext(
90 CustomModelClassUtils.createFactory("pix", "2.3.1"),
91 PixPdqTransactions.ITI8));
92
93 private static final NakFactory<FeedAuditDataset> ITI_8_NAK_FACTORY = new NakFactory<>(ITI_8_CONFIGURATION);
94
95 private static final Hl7v2TransactionConfiguration<QueryAuditDataset> ITI_9_CONFIGURATION =
96 new Hl7v2TransactionConfiguration<>(
97 "pix-iti9",
98 "PIX Query",
99 true,
100 new Iti9AuditStrategy(false),
101 new Iti9AuditStrategy(true),
102 Version.V25,
103 "PIX adapter",
104 "IPF",
105 ErrorCode.APPLICATION_INTERNAL_ERROR,
106 ErrorCode.APPLICATION_INTERNAL_ERROR,
107 "QBP", "Q23",
108 "RSP", "K23",
109 true,
110 false,
111 HapiContextFactory.createHapiContext(
112 CustomModelClassUtils.createFactory("pix", "2.5"),
113 PixPdqTransactions.ITI9));
114
115 private static final NakFactory<QueryAuditDataset> ITI_9_NAK_FACTORY = new QpdAwareNakFactory(ITI_9_CONFIGURATION, "RSP", "K23");
116
117 private static final Hl7v2TransactionConfiguration<QueryAuditDataset> ITI_10_CONFIGURATION =
118 new Hl7v2TransactionConfiguration<>(
119 "pix-iti10",
120 "PIX Update Notification",
121 false,
122 new Iti10AuditStrategy(false),
123 new Iti10AuditStrategy(true),
124 Version.V25,
125 "PIX adapter",
126 "IPF",
127 ErrorCode.APPLICATION_INTERNAL_ERROR,
128 ErrorCode.APPLICATION_INTERNAL_ERROR,
129 "ADT", "A31",
130 "ACK", "*",
131 true,
132 false,
133 HapiContextFactory.createHapiContext(PixPdqTransactions.ITI10));
134
135 private static final NakFactory<QueryAuditDataset> ITI_10_NAK_FACTORY = new NakFactory<>(ITI_10_CONFIGURATION);
136 }