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.Getter;
21 import org.openehealth.ipf.commons.ihe.core.IntegrationProfile;
22 import org.openehealth.ipf.commons.ihe.core.InteractionId;
23 import org.openehealth.ipf.commons.ihe.core.atna.AuditStrategy;
24 import org.openehealth.ipf.commons.ihe.hl7v2.audit.FeedAuditDataset;
25 import org.openehealth.ipf.commons.ihe.hl7v2.audit.iti30.Iti30AuditStrategy;
26 import org.openehealth.ipf.commons.ihe.hl7v2.audit.iti31.Iti31AuditStrategy;
27 import org.openehealth.ipf.commons.ihe.hl7v2.definitions.HapiContextFactory;
28 import org.openehealth.ipf.gazelle.validation.profile.pam.PamTransactions;
29
30 import java.util.Arrays;
31 import java.util.List;
32
33
34
35
36
37 public class PAM implements IntegrationProfile {
38
39 public enum Interactions implements Hl7v2InteractionId<FeedAuditDataset> {
40 ITI_30 {
41 @Override
42 public void init(List<? extends HL7v2TransactionOption> options) {
43 init("pam-iti30",
44 "Patient Identity Management",
45 false,
46 new Iti30AuditStrategy(false),
47 new Iti30AuditStrategy(true),
48 PamTransactions.ITI30,
49 options);
50 }
51 },
52 ITI_31 {
53 @Override
54 public void init(List<? extends HL7v2TransactionOption> options) {
55 init("pam-iti31",
56 "Patient Encounter Management",
57 false,
58 new Iti31AuditStrategy(false),
59 new Iti31AuditStrategy(true),
60 PamTransactions.ITI31,
61 options);
62 }
63 };
64
65 @Getter private Hl7v2TransactionConfiguration<FeedAuditDataset> hl7v2TransactionConfiguration;
66 @Getter private NakFactory<FeedAuditDataset> nakFactory;
67
68 protected void init(
69 String name,
70 String description,
71 boolean isQuery,
72 AuditStrategy<FeedAuditDataset> clientAuditStrategy,
73 AuditStrategy<FeedAuditDataset> serverAuditStrategy,
74 PamTransactions pamTransactions,
75 List<? extends HL7v2TransactionOption> options)
76 {
77 this.hl7v2TransactionConfiguration = new Hl7v2TransactionConfiguration<>(
78 name,
79 description,
80 isQuery,
81 clientAuditStrategy,
82 serverAuditStrategy,
83 new Version[]{Version.V25},
84 "PIM adapter",
85 "IPF",
86 ErrorCode.APPLICATION_INTERNAL_ERROR,
87 ErrorCode.APPLICATION_INTERNAL_ERROR,
88 new String[]{"ADT"},
89 new String[]{HL7v2TransactionOption.concatAllToString(options)},
90 new String[]{"ACK"},
91 new String[]{"*"},
92 new boolean[]{true},
93 new boolean[]{false},
94 HapiContextFactory.createHapiContext(pamTransactions));
95
96 this.nakFactory = new NakFactory<>(this.hl7v2TransactionConfiguration);
97 }
98 }
99
100 @Override
101 public List<InteractionId> getInteractionIds() {
102 return Arrays.asList(Interactions.values());
103 }
104 }