diff --git a/.factorypath b/.factorypath
index cdf2ab4..71f998d 100644
--- a/.factorypath
+++ b/.factorypath
@@ -1,4 +1,4 @@
-
+
diff --git a/pom.xml b/pom.xml
index e1f2944..2909c01 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
com.wipro.fhir.r4
fhir-api
- 3.6.0
+ 3.6.1
war
FHIR-API
FHIR_NDHM standard integration in AMRIT
@@ -186,39 +186,74 @@
com.fasterxml.jackson.core
jackson-core
- 2.14.2
+ 2.15.2
com.fasterxml.jackson.core
jackson-databind
- 2.14.2
+ 2.15.2
com.fasterxml.jackson.core
jackson-annotations
- 2.14.2
+ 2.15.2
-
+
ca.uhn.hapi.fhir
hapi-fhir-structures-r4
- 6.10.0
+ 8.4.0
-
+
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation
+ 8.4.0
+
+
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-structures-r4
+ 8.4.0
+
+
+
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-caching-caffeine
+ 8.4.0
+
+
+
ca.uhn.hapi
hapi-base
2.6.0
-
+
ca.uhn.hapi.fhir
org.hl7.fhir.utilities
6.5.18
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation-resources-r4
+ 8.4.0
+
+
org.projectlombok
@@ -363,7 +398,8 @@
${target-properties} and
${source-properties}
-
diff --git a/src/main/environment/common_ci.properties b/src/main/environment/common_ci.properties
index d1a7ec3..cda0a73 100644
--- a/src/main/environment/common_ci.properties
+++ b/src/main/environment/common_ci.properties
@@ -98,6 +98,10 @@ webLoginAbhaRequestOtp = @env.ABDM_PHR_URL@/login/abha/request/otp
webLoginAbhaVerify = @env.ABDM_PHR_URL@/login/abha/verify
webLoginPhrCard = @env.ABDM_PHR_URL@/login/profile/abha/phr-card
+## ABDM V3 M2 APIs
+generateTokenForLinkCareContext = @env.ABDM_HIECM_BASE_URL@/api/hiecm/v3/token/generate-token
+linkCareContext = @env.ABDM_HIECM_BASE_URL@/api/hiecm/hip/v3/link/carecontext
+
x-CM-ID=@env.X_CM_ID@
abhaMode=@env.ABHA_MODE@
@@ -120,3 +124,5 @@ springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@
spring.redis.host=@env.REDIS_HOST@
cors.allowed-origins=@env.CORS_ALLOWED_ORIGINS@
+
+hipSystemUrl= @env.HIP_SYSTEM_URL@
diff --git a/src/main/environment/common_docker.properties b/src/main/environment/common_docker.properties
index 82239d6..496239d 100644
--- a/src/main/environment/common_docker.properties
+++ b/src/main/environment/common_docker.properties
@@ -98,6 +98,10 @@ webLoginAbhaRequestOtp = ${ABDM_PHR_URL}/login/abha/request/otp
webLoginAbhaVerify = ${ABDM_PHR_URL}/login/abha/verify
webLoginPhrCard = ${ABDM_PHR_URL}/login/profile/abha/phr-card
+## ABDM V3 M2 APIs
+generateTokenForLinkCareContext = @env.ABDM_HIECM_BASE_URL@/api/hiecm/v3/token/generate-token
+linkCareContext = @env.ABDM_HIECM_BASE_URL@/api/hiecm/hip/v3/link/carecontext
+
x-CM-ID=${X_CM_ID}
abhaMode=${ABHA_MODE}
@@ -117,4 +121,7 @@ springdoc.api-docs.enabled=${SWAGGER_DOC_ENABLED}
springdoc.swagger-ui.enabled=${SWAGGER_DOC_ENABLED}
# Redis IP
-spring.redis.host=${REDIS_HOST}
\ No newline at end of file
+spring.redis.host=${REDIS_HOST}
+
+
+hipSystemUrl= ${HIP_SYSTEM_URL}
diff --git a/src/main/environment/common_example.properties b/src/main/environment/common_example.properties
index b54379b..4e99ca7 100644
--- a/src/main/environment/common_example.properties
+++ b/src/main/environment/common_example.properties
@@ -100,6 +100,10 @@ requestAuthByAbdm = https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/auth/byAb
webLoginAbhaVerify = https://abhasbx.abdm.gov.in/abha/api/v3/phr/web/login/abha/verify
webLoginPhrCard = https://abhasbx.abdm.gov.in/abha/api/v3/phr/web/login/profile/abha/phr-card
+## ABDM V3 M2 APIs
+generateTokenForLinkCareContext = https://dev.abdm.gov.in/api/hiecm/v3/token/generate-token
+linkCareContext = https://dev.abdm.gov.in/api/hiecm/hip/v3/link/carecontext
+
x-CM-ID= sbx
abhaMode=sbx
@@ -113,4 +117,6 @@ jwt.secret=my-32-character-ultra-secure-and-ultra-long-secret
logging.path=logs/
logging.file.name=logs/fhir-api.log
-cors.allowed-origins=http://localhost:*
\ No newline at end of file
+cors.allowed-origins=http://localhost:*
+
+hipSystemUrl=
\ No newline at end of file
diff --git a/src/main/java/com/wipro/fhir/controller/generateresource/ResourceRequestGateway.java b/src/main/java/com/wipro/fhir/controller/generateresource/ResourceRequestGateway.java
index 78ba1a5..c888027 100644
--- a/src/main/java/com/wipro/fhir/controller/generateresource/ResourceRequestGateway.java
+++ b/src/main/java/com/wipro/fhir/controller/generateresource/ResourceRequestGateway.java
@@ -33,9 +33,9 @@
import org.springframework.web.bind.annotation.RestController;
import com.wipro.fhir.data.request_handler.ResourceRequestHandler;
-import com.wipro.fhir.service.resource_gateway.DiagnosticReportRecord;
-import com.wipro.fhir.service.resource_gateway.OPConsultRecordBundle;
-import com.wipro.fhir.service.resource_gateway.PrescriptionRecordBundle;
+import com.wipro.fhir.service.bundle_creation.DiagnosticRecordResourceBundle;
+import com.wipro.fhir.service.bundle_creation.OPConsultResourceBundle;
+import com.wipro.fhir.service.bundle_creation.PrescriptionResourceBundle;
import com.wipro.fhir.utils.exception.FHIRException;
import com.wipro.fhir.utils.response.OutputResponse;
@@ -55,11 +55,11 @@ public class ResourceRequestGateway {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
@Autowired
- private OPConsultRecordBundle opConsultRecordBundle;
+ private OPConsultResourceBundle opConsultRecordBundle;
@Autowired
- private PrescriptionRecordBundle prescriptionRecordBundle;
+ private PrescriptionResourceBundle prescriptionRecordBundle;
@Autowired
- private DiagnosticReportRecord diagnosticReportRecord;
+ private DiagnosticRecordResourceBundle diagnosticReportRecord;
/***
*
@@ -78,7 +78,7 @@ public String getPatientResource(@RequestBody ResourceRequestHandler patientReso
OutputResponse response = new OutputResponse();
try {
- String s = opConsultRecordBundle.getOPConsultRecordBundle(patientResourceRequest, null);
+ String s = opConsultRecordBundle.populateOPConsultRecordResourceBundle(patientResourceRequest, null);
response.setResponse(s);
} catch (FHIRException e) {
@@ -104,7 +104,7 @@ public String getDiagnosticReportRecord(@RequestBody ResourceRequestHandler pati
OutputResponse response = new OutputResponse();
try {
- String s = diagnosticReportRecord.getDiagnosticReportRecordBundle(patientResourceRequest, null);
+ String s = diagnosticReportRecord.populateDiagnosticReportResourceBundle(patientResourceRequest, null);
response.setResponse(s);
} catch (FHIRException e) {
@@ -129,7 +129,7 @@ public String getPrescriptionRecord(@RequestBody ResourceRequestHandler patientR
OutputResponse response = new OutputResponse();
try {
- String s = prescriptionRecordBundle.getPrescriptionRecordBundle(patientResourceRequest, null);
+ String s = prescriptionRecordBundle.populatePrescriptionResourceBundle(patientResourceRequest, null);
response.setResponse(s);
} catch (FHIRException e) {
diff --git a/src/main/java/com/wipro/fhir/controller/test/Test.java b/src/main/java/com/wipro/fhir/controller/test/Test.java
index 719047c..138db28 100644
--- a/src/main/java/com/wipro/fhir/controller/test/Test.java
+++ b/src/main/java/com/wipro/fhir/controller/test/Test.java
@@ -34,9 +34,7 @@
import com.wipro.fhir.data.request_handler.ResourceRequestHandler;
import com.wipro.fhir.service.atoms.feed.bahmni.ClinicalFeedWorker;
-import com.wipro.fhir.service.resource_gateway.OPConsultRecordBundle;
-import com.wipro.fhir.service.resource_gateway.OPConsultRecordBundleImpl;
-import com.wipro.fhir.service.resource_gateway.PrescriptionRecordBundleImpl;
+import com.wipro.fhir.service.bundle_creation.OPConsultResourceBundleImpl;
import com.wipro.fhir.utils.http.HttpUtils;
import com.wipro.fhir.utils.response.OutputResponse;
@@ -50,7 +48,7 @@ public class Test {
private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
@Autowired
- private OPConsultRecordBundleImpl oPConsultRecordBundleImpl;
+ private OPConsultResourceBundleImpl oPConsultRecordBundleImpl;
@Operation(summary = "Test parse ATOM Feeds")
@PostMapping(value = { "/parse/feed/ATOM" })
@@ -59,7 +57,7 @@ public String parseFeeds(@RequestBody ResourceRequestHandler resourceRequestHand
OutputResponse response = new OutputResponse();
String s = null;
try {
- s = oPConsultRecordBundleImpl.getOPConsultRecordBundle(resourceRequestHandler, null);
+ s = oPConsultRecordBundleImpl.populateOPConsultRecordResourceBundle(resourceRequestHandler, null);
response.setResponse(s);
} catch (Exception e) {
logger.error("Unexpected error:" , e);
diff --git a/src/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.java b/src/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.java
index 4d95154..3c08ece 100644
--- a/src/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.java
+++ b/src/main/java/com/wipro/fhir/controller/v3/abha/CreateAbhaV3Controller.java
@@ -3,7 +3,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-
+import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -60,6 +60,8 @@ public String abhaEnrollmentByAadhaar(@RequestBody String request) {
logger.info("NDHM_FHIR generate OTP for ABHA card API response " + response.toString());
return response.toString();
}
+
+ @CrossOrigin
@Operation(summary = "Verify Auth By ABDM for ABHA enrollment")
@PostMapping(value = { "/verifyAuthByAbdm" })
public String verifyMobileForAuth(@RequestBody String request) {
diff --git a/src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java b/src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
new file mode 100644
index 0000000..8e9a827
--- /dev/null
+++ b/src/main/java/com/wipro/fhir/controller/v3/careContext/CareContextLinkingController.java
@@ -0,0 +1,63 @@
+package com.wipro.fhir.controller.v3.careContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.wipro.fhir.service.v3.careContext.CareContextLinkingService;
+import com.wipro.fhir.utils.exception.FHIRException;
+import com.wipro.fhir.utils.response.OutputResponse;
+
+import io.swagger.v3.oas.annotations.Operation;
+
+@RestController
+@RequestMapping(value = "/careContext", headers = "Authorization")
+public class CareContextLinkingController {
+
+ @Autowired
+ private CareContextLinkingService careContextLinkingService;
+
+ private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
+
+ @Operation(summary = "Generate token for care context linking")
+ @PostMapping(value = { "/generateCareContextToken" })
+ public String requestOtpForEnrollment(@RequestBody String request) {
+ logger.info("Generate token for care context API request " + request);
+ OutputResponse response = new OutputResponse();
+ try {
+ if (request != null) {
+ String s = careContextLinkingService.generateTokenForCareContext(request);
+ response.setResponse(s);
+ } else
+ throw new FHIRException("NDHM_FHIR Empty request object");
+ } catch (FHIRException e) {
+ response.setError(5000, e.getMessage());
+ logger.error(e.toString());
+ }
+ logger.info("NDHM_FHIR generate token for care context API response " + response.toString());
+ return response.toString();
+ }
+
+ @Operation(summary = "link care context")
+ @PostMapping(value = { "/linkCareContext" })
+ public String add(@RequestBody String request) {
+ logger.info("link care context API request " + request);
+ OutputResponse response = new OutputResponse();
+ try {
+ if (request != null) {
+ String s = careContextLinkingService.linkCareContext(request);
+ response.setResponse(s);
+ } else
+ throw new FHIRException("NDHM_FHIR Empty request object");
+ } catch (FHIRException e) {
+ response.setError(5000, e.getMessage());
+ logger.error(e.toString());
+ }
+ logger.info("link care context API response " + response.toString());
+ return response.toString();
+ }
+}
diff --git a/src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java b/src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java
new file mode 100644
index 0000000..153d393
--- /dev/null
+++ b/src/main/java/com/wipro/fhir/data/mongo/care_context/GenerateTokenAbdmResponses.java
@@ -0,0 +1,39 @@
+package com.wipro.fhir.data.mongo.care_context;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import org.springframework.data.annotation.Id;
+import org.springframework.data.mongodb.core.mapping.Document;
+import org.springframework.data.mongodb.core.mapping.Field;
+
+import com.google.gson.annotations.Expose;
+
+import lombok.Data;
+
+@Data
+@Document(collection = "GenerateTokenAbdmResponses")
+public class GenerateTokenAbdmResponses {
+
+ @Id
+ @Expose
+ @Field(value = "id")
+ private String id;
+
+ @Expose
+ @Field(value = "abhaAddress")
+ private String abhaAddress;
+
+ @Expose
+ @Field(value = "requestId")
+ private String requestId;
+
+ @Expose
+ @Field(value = "response")
+ private String response;
+
+ @Expose
+ @Field(value = "createdDate")
+ private Date createdDate;
+
+}
diff --git a/src/main/java/com/wipro/fhir/data/resource_model/ImmunizationDataModel.java b/src/main/java/com/wipro/fhir/data/resource_model/ImmunizationDataModel.java
new file mode 100644
index 0000000..e82fcbd
--- /dev/null
+++ b/src/main/java/com/wipro/fhir/data/resource_model/ImmunizationDataModel.java
@@ -0,0 +1,59 @@
+package com.wipro.fhir.data.resource_model;
+
+import java.math.BigInteger;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import lombok.Data;
+
+@Data
+@Component
+public class ImmunizationDataModel {
+
+ private BigInteger id;
+ private BigInteger beneficiaryRegID;
+ private BigInteger visitCode;
+ private Integer providerServiceMapID;
+ private Integer vanID;
+ private String defaultReceivingAge;
+ private String vaccineName;
+ private Timestamp receivedDate;
+ private String receivedFacilityName;
+ private String sctcode;
+ private String sctTerm;
+ private Timestamp createdDate;
+ private String createdBy;
+
+ public ImmunizationDataModel() {
+ }
+
+ public ImmunizationDataModel(Object[] objArr) {
+ this.id = objArr[0] != null ? BigInteger.valueOf(((Number) objArr[0]).longValue()) : null;
+ this.beneficiaryRegID = objArr[1] != null ? BigInteger.valueOf(((Number) objArr[1]).longValue()) : null;
+ this.visitCode = objArr[2] != null ? BigInteger.valueOf(((Number) objArr[2]).longValue()) : null;
+ this.providerServiceMapID = objArr[3] != null ? ((Number) objArr[3]).intValue() : null;
+ this.vanID = objArr[4] != null ? ((Number) objArr[4]).intValue() : null;
+ this.defaultReceivingAge = objArr[5] != null ? (String) objArr[5] : null;
+ this.vaccineName = objArr[6] != null ? (String) objArr[6] : null;
+ this.receivedDate = objArr[7] != null ? (Timestamp) objArr[7] : null;
+ this.receivedFacilityName = objArr[8] != null ? (String) objArr[8] : null;
+ this.sctcode = objArr[9] != null ? (String) objArr[9] : null;
+ this.sctTerm = objArr[10] != null ? (String) objArr[10] : null;
+ this.createdDate = objArr[11] != null ? (Timestamp) objArr[11] : null;
+ this.createdBy = objArr[12] != null ? (String) objArr[12] : null;
+ }
+
+ public List getImmunizationList(List