Skip to content

Commit 955ec3f

Browse files
helenKaryamsettyKA40094929KA40094929Karyamsetty Helen Grace
authored
M2 FHIR bundles creation (#123)
* Abdm Facility fetch services changes * facility save after carecontext and patientcarecontextx update * FacilityId save in mongo db and Variable declaration correction * Mongo carecontext save query logic changes * ABHA Creation M1 V3 API changes * Abha V3 changes * removed unused code * v3- verify auth by abdm API changes * feat: Abdm M2 V3 changes * feat: mongo query change fetch for linktoken * fix: link carecontext authorization error * feat: hiTypes addition * feat: version change for testing * fix: minor change for empty response * Simplify queries in CareContextRepo interface Removed unnecessary 'order by 1 desc' clause from queries. * fix: corrected response format * fix: minor logic change for care context linking * small correction in hiType and error message modification * modified error message * feat: new standard FHIR bundles creation * Fix environment variable for systemUrl * Fix formatting of systemUrl property * fix: taken coderabbitai comments and minor changes --------- Co-authored-by: KA40094929 <KA40094929@10.152.32.202> Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT> Co-authored-by: Karyamsetty Helen Grace <ka40094929@wipro.com>
1 parent 6dadda6 commit 955ec3f

42 files changed

Lines changed: 2783 additions & 1057 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,39 +186,74 @@
186186
<dependency>
187187
<groupId>com.fasterxml.jackson.core</groupId>
188188
<artifactId>jackson-core</artifactId>
189-
<version>2.14.2</version>
189+
<version>2.15.2</version>
190190
</dependency>
191191
<dependency>
192192
<groupId>com.fasterxml.jackson.core</groupId>
193193
<artifactId>jackson-databind</artifactId>
194-
<version>2.14.2</version>
194+
<version>2.15.2</version>
195195
</dependency>
196196
<dependency>
197197
<groupId>com.fasterxml.jackson.core</groupId>
198198
<artifactId>jackson-annotations</artifactId>
199-
<version>2.14.2</version>
199+
<version>2.15.2</version>
200200
</dependency>
201201

202-
<!-- https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-structures-r4 -->
202+
<!--
203+
https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-structures-r4 -->
203204
<dependency>
204205
<groupId>ca.uhn.hapi.fhir</groupId>
205206
<artifactId>hapi-fhir-structures-r4</artifactId>
206-
<version>6.10.0</version>
207+
<version>8.4.0</version>
207208
</dependency>
208-
209+
210+
<!--
211+
https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-validation -->
212+
<dependency>
213+
<groupId>ca.uhn.hapi.fhir</groupId>
214+
<artifactId>hapi-fhir-validation</artifactId>
215+
<version>8.4.0</version>
216+
</dependency>
217+
218+
<!--
219+
https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-structures-r4 -->
220+
<dependency>
221+
<groupId>ca.uhn.hapi.fhir</groupId>
222+
<artifactId>hapi-fhir-structures-r4</artifactId>
223+
<version>8.4.0</version>
224+
</dependency>
225+
226+
227+
<!-- Choose a HAPI version that matches the rest of your modules -->
228+
<dependency>
229+
<groupId>ca.uhn.hapi.fhir</groupId>
230+
<artifactId>hapi-fhir-caching-caffeine</artifactId>
231+
<version>8.4.0</version> <!-- example; align with your HAPI version -->
232+
</dependency>
233+
234+
209235
<dependency>
210236
<groupId>ca.uhn.hapi</groupId>
211237
<artifactId>hapi-base</artifactId>
212238
<version>2.6.0</version>
213239
</dependency>
214240

215-
<!-- https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/org.hl7.fhir.utilities -->
241+
<!--
242+
https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/org.hl7.fhir.utilities -->
216243
<dependency>
217244
<groupId>ca.uhn.hapi.fhir</groupId>
218245
<artifactId>org.hl7.fhir.utilities</artifactId>
219246
<version>6.5.18</version>
220247
</dependency>
221248

249+
<!--
250+
https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-validation-resources-r4 -->
251+
<dependency>
252+
<groupId>ca.uhn.hapi.fhir</groupId>
253+
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
254+
<version>8.4.0</version>
255+
</dependency>
256+
222257
<!-- lombok -->
223258
<dependency>
224259
<groupId>org.projectlombok</groupId>
@@ -363,7 +398,8 @@
363398
${target-properties} and
364399
${source-properties}
365400
</echo>
366-
<concat destfile="${target-properties}" append="yes"
401+
<concat destfile="${target-properties}"
402+
append="yes"
367403
force="yes">
368404
<fileset file="${source-properties}">
369405
</fileset>

src/main/environment/common_ci.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,5 @@ springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
124124
spring.redis.host=@env.REDIS_HOST@
125125

126126
cors.allowed-origins=@env.CORS_ALLOWED_ORIGINS@
127+
128+
systemUrl= @env.HIP_SYSTEM_URL@

src/main/environment/common_dev.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ logging.level.org.springframework.web=INFO
105105
logging.level.org.hibernate=INFO
106106
logging.level.com.iemr=DEBUG
107107
logging.level.org.springframework=INFO
108+
109+
hipSystemUrl= <Enter HIP request URL>

src/main/environment/common_docker.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,6 @@ springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
117117
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}
118118

119119
# Redis IP
120-
spring.redis.host=${REDIS_HOST}
120+
spring.redis.host=${REDIS_HOST}
121+
122+
hipSystemUrl= ${HIP_SYSTEM_URL}

src/main/environment/common_example.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,6 @@ jwt.secret=my-32-character-ultra-secure-and-ultra-long-secret
117117
logging.path=logs/
118118
logging.file.name=logs/fhir-api.log
119119

120-
cors.allowed-origins=http://localhost:*
120+
cors.allowed-origins=http://localhost:*
121+
122+
hipSystemUrl= <Enter HIP request URL>

src/main/environment/common_test.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ logging.level.org.springframework.web=INFO
105105
logging.level.org.hibernate=INFO
106106
logging.level.com.iemr=DEBUG
107107
logging.level.org.springframework=INFO
108+
109+
hipSystemUrl= <Enter HIP request URL>

src/main/java/com/wipro/fhir/controller/generateresource/ResourceRequestGateway.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
import org.springframework.web.bind.annotation.RestController;
3434

3535
import com.wipro.fhir.data.request_handler.ResourceRequestHandler;
36-
import com.wipro.fhir.service.resource_gateway.DiagnosticReportRecord;
37-
import com.wipro.fhir.service.resource_gateway.OPConsultRecordBundle;
38-
import com.wipro.fhir.service.resource_gateway.PrescriptionRecordBundle;
36+
import com.wipro.fhir.service.bundle_creation.DiagnosticRecordResourceBundle;
37+
import com.wipro.fhir.service.bundle_creation.OPConsultResourceBundle;
38+
import com.wipro.fhir.service.bundle_creation.PrescriptionResourceBundle;
3939
import com.wipro.fhir.utils.exception.FHIRException;
4040
import com.wipro.fhir.utils.response.OutputResponse;
4141

@@ -55,11 +55,11 @@ public class ResourceRequestGateway {
5555
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
5656

5757
@Autowired
58-
private OPConsultRecordBundle opConsultRecordBundle;
58+
private OPConsultResourceBundle opConsultRecordBundle;
5959
@Autowired
60-
private PrescriptionRecordBundle prescriptionRecordBundle;
60+
private PrescriptionResourceBundle prescriptionRecordBundle;
6161
@Autowired
62-
private DiagnosticReportRecord diagnosticReportRecord;
62+
private DiagnosticRecordResourceBundle diagnosticReportRecord;
6363

6464
/***
6565
*
@@ -78,7 +78,7 @@ public String getPatientResource(@RequestBody ResourceRequestHandler patientReso
7878

7979
OutputResponse response = new OutputResponse();
8080
try {
81-
String s = opConsultRecordBundle.getOPConsultRecordBundle(patientResourceRequest, null);
81+
String s = opConsultRecordBundle.PopulateOPConsultRecordResourceBundle(patientResourceRequest, null);
8282

8383
response.setResponse(s);
8484
} catch (FHIRException e) {
@@ -104,7 +104,7 @@ public String getDiagnosticReportRecord(@RequestBody ResourceRequestHandler pati
104104

105105
OutputResponse response = new OutputResponse();
106106
try {
107-
String s = diagnosticReportRecord.getDiagnosticReportRecordBundle(patientResourceRequest, null);
107+
String s = diagnosticReportRecord.PopulateDiagnosticReportResourceBundle(patientResourceRequest, null);
108108

109109
response.setResponse(s);
110110
} catch (FHIRException e) {
@@ -129,7 +129,7 @@ public String getPrescriptionRecord(@RequestBody ResourceRequestHandler patientR
129129

130130
OutputResponse response = new OutputResponse();
131131
try {
132-
String s = prescriptionRecordBundle.getPrescriptionRecordBundle(patientResourceRequest, null);
132+
String s = prescriptionRecordBundle.PopulatePrescriptionResourceBundle(patientResourceRequest, null);
133133

134134
response.setResponse(s);
135135
} catch (FHIRException e) {

src/main/java/com/wipro/fhir/controller/test/Test.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434

3535
import com.wipro.fhir.data.request_handler.ResourceRequestHandler;
3636
import com.wipro.fhir.service.atoms.feed.bahmni.ClinicalFeedWorker;
37-
import com.wipro.fhir.service.resource_gateway.OPConsultRecordBundle;
38-
import com.wipro.fhir.service.resource_gateway.OPConsultRecordBundleImpl;
39-
import com.wipro.fhir.service.resource_gateway.PrescriptionRecordBundleImpl;
37+
import com.wipro.fhir.service.bundle_creation.OPConsultResourceBundleImpl;
4038
import com.wipro.fhir.utils.http.HttpUtils;
4139
import com.wipro.fhir.utils.response.OutputResponse;
4240

@@ -50,7 +48,7 @@ public class Test {
5048
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
5149

5250
@Autowired
53-
private OPConsultRecordBundleImpl oPConsultRecordBundleImpl;
51+
private OPConsultResourceBundleImpl oPConsultRecordBundleImpl;
5452

5553
@Operation(summary = "Test parse ATOM Feeds")
5654
@PostMapping(value = { "/parse/feed/ATOM" })
@@ -59,7 +57,7 @@ public String parseFeeds(@RequestBody ResourceRequestHandler resourceRequestHand
5957
OutputResponse response = new OutputResponse();
6058
String s = null;
6159
try {
62-
s = oPConsultRecordBundleImpl.getOPConsultRecordBundle(resourceRequestHandler, null);
60+
s = oPConsultRecordBundleImpl.PopulateOPConsultRecordResourceBundle(resourceRequestHandler, null);
6361
response.setResponse(s);
6462
} catch (Exception e) {
6563
logger.error("Unexpected error:" , e);
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.wipro.fhir.data.resource_model;
2+
3+
import java.math.BigInteger;
4+
import java.sql.Timestamp;
5+
import java.util.ArrayList;
6+
import java.util.List;
7+
8+
import org.springframework.stereotype.Component;
9+
10+
import lombok.Data;
11+
12+
@Data
13+
@Component
14+
public class ImmunizationDataModel {
15+
16+
private BigInteger id;
17+
private BigInteger beneficiaryRegID;
18+
private BigInteger visitCode;
19+
private Integer providerServiceMapID;
20+
private Integer vanID;
21+
private String defaultReceivingAge;
22+
private String vaccineName;
23+
private Timestamp receivedDate;
24+
private String receivedFacilityName;
25+
private String sctcode;
26+
private String sctTerm;
27+
private Timestamp createdDate;
28+
private String createdBy;
29+
30+
public ImmunizationDataModel() {
31+
}
32+
33+
public ImmunizationDataModel(Object[] objArr) {
34+
this.id = objArr[0] != null ? BigInteger.valueOf(((Number) objArr[0]).longValue()) : null;
35+
this.beneficiaryRegID = objArr[1] != null ? BigInteger.valueOf(((Number) objArr[1]).longValue()) : null;
36+
this.visitCode = objArr[2] != null ? BigInteger.valueOf(((Number) objArr[2]).longValue()) : null;
37+
this.providerServiceMapID = objArr[3] != null ? ((Number) objArr[3]).intValue() : null;
38+
this.vanID = objArr[4] != null ? ((Number) objArr[4]).intValue() : null;
39+
this.defaultReceivingAge = objArr[5] != null ? (String) objArr[5] : null;
40+
this.vaccineName = objArr[6] != null ? (String) objArr[6] : null;
41+
this.receivedDate = objArr[7] != null ? (Timestamp) objArr[7] : null;
42+
this.receivedFacilityName = objArr[8] != null ? (String) objArr[8] : null;
43+
this.sctcode = objArr[9] != null ? (String) objArr[9] : null;
44+
this.sctTerm = objArr[10] != null ? (String) objArr[10] : null;
45+
this.createdDate = objArr[11] != null ? (Timestamp) objArr[11] : null;
46+
this.createdBy = objArr[12] != null ? (String) objArr[12] : null;
47+
}
48+
49+
public List<ImmunizationDataModel> getImmunizationList(List<Object[]> resultSetList) {
50+
List<ImmunizationDataModel> out = new ArrayList<>();
51+
if (resultSetList != null && !resultSetList.isEmpty()) {
52+
for (Object[] objArr : resultSetList) {
53+
out.add(new ImmunizationDataModel(objArr));
54+
}
55+
}
56+
return out;
57+
}
58+
59+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.wipro.fhir.data.resource_model;
2+
3+
import java.io.Serializable;
4+
import java.math.BigInteger;
5+
import java.sql.Timestamp;
6+
import java.util.ArrayList;
7+
import java.util.List;
8+
9+
import org.springframework.stereotype.Component;
10+
11+
import lombok.Data;
12+
13+
14+
@Data
15+
@Component
16+
public class MedicalHistoryDataModel implements Serializable {
17+
18+
private static final long serialVersionUID = 1L;
19+
20+
21+
private BigInteger id;
22+
private BigInteger beneficiaryRegID;
23+
private BigInteger visitCode;
24+
private String currentMedication;
25+
private Integer currentMedYear;
26+
private String yearOfIllness;
27+
private String finalIllnessType;
28+
private String yearOfSurgery;
29+
private String finalSurgeryType;
30+
private Timestamp createdDate;
31+
private String createdBy;
32+
public MedicalHistoryDataModel() {
33+
}
34+
35+
public MedicalHistoryDataModel(Object[] objArr) {
36+
this.id = objArr[0] != null ? BigInteger.valueOf(((Number) objArr[0]).longValue()) : null;
37+
this.beneficiaryRegID = objArr[1] != null ? BigInteger.valueOf(((Number) objArr[1]).longValue()) : null;
38+
this.visitCode = objArr[2] != null ? BigInteger.valueOf(((Number) objArr[2]).longValue()) : null;
39+
this.currentMedication = objArr[3] != null ? (String) objArr[3] : null;
40+
this.currentMedYear = objArr[4] != null ? (Integer) objArr[4] : null;
41+
this.yearOfIllness = objArr[5] != null ? (String) objArr[5] : null;
42+
this.finalIllnessType = objArr[6] != null ? (String) objArr[6] : null;
43+
this.yearOfSurgery = objArr[7] != null ? (String) objArr[7] : null;
44+
this.finalSurgeryType = objArr[8] != null ? (String) objArr[8] : null;
45+
this.createdDate = objArr[9] != null ? (Timestamp) objArr[9] : null;
46+
this.createdBy = objArr[10] != null ? (String) objArr[10] : null;
47+
}
48+
49+
public List<MedicalHistoryDataModel> getMedicalList(List<Object[]> resultSetList) {
50+
MedicalHistoryDataModel medHistoryObj;
51+
List<MedicalHistoryDataModel> medHistoryList = new ArrayList<MedicalHistoryDataModel>();
52+
if (resultSetList != null && resultSetList.size() > 0) {
53+
for (Object[] objArr : resultSetList) {
54+
medHistoryObj = new MedicalHistoryDataModel(objArr);
55+
medHistoryList.add(medHistoryObj);
56+
}
57+
}
58+
return medHistoryList;
59+
}
60+
61+
}

0 commit comments

Comments
 (0)