Skip to content
2 changes: 1 addition & 1 deletion .factorypath
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<factorypath>
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.36/lombok-1.18.36.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/projectlombok/lombok/1.18.30/lombok-1.18.30.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/mapstruct/mapstruct-processor/1.2.0.Final/mapstruct-processor-1.2.0.Final.jar" enabled="true" runInBatchMode="false"/>
</factorypath>
4 changes: 4 additions & 0 deletions src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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_ABHA_V3_URL@/v3/token/generate-token
linkCareContext = @env.ABDM_ABHA_V3_URL@/hip/v3/link/carecontext

x-CM-ID=@env.X_CM_ID@
abhaMode=@env.ABHA_MODE@

Expand Down
107 changes: 107 additions & 0 deletions src/main/environment/common_dev.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
benSearchByBenIDURL=<Enter your socket address here>/commonapi-v1.0/beneficiary/searchUserByID
userAuthURL=<Enter your socket address here>/commonapi-v1.0/user/userAuthenticate

# E-aushadhi
eaushadhiStoreStockDetailsUrl=https://uatbiharsso.dcservices.in/eAushadhi_BIHAR/rest/storeStockDetailsService/
eaushadhiStoreStockAckUrl=https://uatbiharsso.dcservices.in/eAushadhi_BIHAR/rest/AcknowledgeStoreStockService/

fhirUserName=<Enter FHIR username here>
fhirPassword=<Enter FHIR password here>

# DB Connections (MySQL)
spring.datasource.url=<Enter AMRIT DB_IEMR URL here>
spring.datasource.username=<Enter your AMRIT DB_IEMR username>
spring.datasource.password=<Enter your AMRIT DB_IEMR password>

Check failure

Code scanning / SonarCloud

Database passwords should not be disclosed High

Make sure this database password gets changed and removed from the code. See more on SonarQube Cloud
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

# DB Connection (Mongo DB)
spring.data.mongodb.host=<Enter Mongo DB host ip address>
spring.data.mongodb.port=27017
spring.data.mongodb.authentication-database=<Enter MongoDB authentication database name>
spring.data.mongodb.database=<Enter MongoDB database name>
spring.data.mongodb.username=<Enter MongoDB username>
spring.data.mongodb.password=<Enter MongoDB password>

atomsFeedStartPage=1
parentUrl=https://demo.mybahmni.org

atomFeedURLPatientDemographic=/openmrs/ws/atomfeed/patient/
atomFeedURLPatientEncounter=/openmrs/ws/atomfeed/encounter/

feedAuthUserName=<Enter feed authentication username>
feedAuthPassword=<Enter feed authentication password>

eAushadhiDummy=yes

##NDHM ABHA API
clientID=<Enter client ID>
clientSecret=<Enter client secret key>

##Default ABDM Facility ID
abdmFacilityId= <Enter ABDM Facility ID>

ndhmuserAuthenticate=https://dev.abdm.gov.in/gateway/v0.5/sessions
ndhmGenerateOTP=https://healthidsbx.abdm.gov.in/api/v1/registration/mobile/generateOtp
ndhmVerifyOTP=https://healthidsbx.abdm.gov.in/api/v1/registration/mobile/verifyOtp
ndhmCreateHealthID=https://healthidsbx.abdm.gov.in/api/v1/registration/mobile/createHealthId

## ABHA with aadhaar
ndhmGenerateOTPWithAadhaar=https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/generateOtp
ndhmCreateHealthIDWithAadhaar=https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/createHealthIdWithAadhaarOtp

## ABHA Creation New APIs
abdmVerifyOTP= https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/verifyOTP
abdmCheckAndGenerateMobileOTP= https://healthidsbx.abdm.gov.in/api/v2/registration/aadhaar/checkAndGenerateMobileOTP
abdmVerifyMobileOTP= https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/verifyMobileOTP
abdmcreateHealthIdWithPreVerified= https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/createHealthIdWithPreVerified


##CareContext Creation API
generateOTPForCareContext=https://dev.abdm.gov.in/gateway/v0.5/users/auth/init
addCareContext = https://dev.abdm.gov.in/gateway/v0.5/links/link/add-contexts
validateOTPForCareContext=https://dev.abdm.gov.in/gateway/v0.5/users/auth/confirm

##ABHA Card API
## Auth init - aadhar / mobile
generateOTP_ForCard=https://healthidsbx.abdm.gov.in/api/v1/auth/init
## confirm with mobile OTP
verifyOTP_ForCard=https://healthidsbx.abdm.gov.in/api/v1/auth/confirmWithMobileOTP
## confirm with Aadhaar
verifyOTP_ForCard_Aadhaar=https://healthidsbx.abdm.gov.in/api/v1/auth/confirmWithAadhaarOtp
## print ABHA card - PNG
generateHealthCard=https://healthidsbx.abdm.gov.in/api/v1/health/facility/getPngCard
generateHealthIDCard=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/account/getPngCard

## Generate Notify SMS once episode completed
generateABDM_NotifySMS=https://dev.abdm.gov.in/gateway/v1/patients/sms/notify2

##verifyBio
abdmVerifyBio=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/verifyBio
abdmGenerateMobileOTP=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/generateMobileOTP
abdmConfirmAadhaarBio=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/auth/confirmWithAadhaarBio
abdmAccountProfile=@env.ABDM_Account_ID_BASE_URL@/api/v1/account/profile

##ABDM Facility services
getAbdmFacilityServicies= https://dev.abdm.gov.in/devservice/v1/bridges/getServices

##ABDM V3 APIs
getAuthCertPublicKey = https://healthidsbx.abdm.gov.in/api/v1/auth/cert
requestOtpForEnrollment = https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/request/otp
abhaEnrollByAadhaar = https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/enrol/byAadhaar
printAbhaCard = https://abhasbx.abdm.gov.in/abha/api/v3/profile/account/abha-card
abhaLoginRequestOtp = https://abhasbx.abdm.gov.in/abha/api/v3/profile/login/request/otp
verifyAbhaLogin = https://abhasbx.abdm.gov.in/abha/api/v3/profile/login/verify
requestAuthByAbdm = https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/auth/byAbdm

## 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

abhaMode=sbx

#logging.pattern.level=DEBUG
logging.level.root=INFO
logging.level.org.springframework.web=INFO
logging.level.org.hibernate=INFO
logging.level.com.iemr=DEBUG
logging.level.org.springframework=INFO
4 changes: 4 additions & 0 deletions src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
107 changes: 107 additions & 0 deletions src/main/environment/common_test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
benSearchByBenIDURL=<Enter your socket address here>/commonapi-v1.0/beneficiary/searchUserByID
userAuthURL=<Enter your socket address here>/commonapi-v1.0/user/userAuthenticate

# E-aushadhi
eaushadhiStoreStockDetailsUrl=https://uatbiharsso.dcservices.in/eAushadhi_BIHAR/rest/storeStockDetailsService/
eaushadhiStoreStockAckUrl=https://uatbiharsso.dcservices.in/eAushadhi_BIHAR/rest/AcknowledgeStoreStockService/

fhirUserName=<Enter FHIR username here>
fhirPassword=<Enter FHIR password here>

# DB Connections (MySQL)
spring.datasource.url=<Enter AMRIT DB_IEMR URL here>
spring.datasource.username=<Enter your AMRIT DB_IEMR username>
spring.datasource.password=<Enter your AMRIT DB_IEMR password>

Check failure

Code scanning / SonarCloud

Database passwords should not be disclosed High

Make sure this database password gets changed and removed from the code. See more on SonarQube Cloud
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

# DB Connection (Mongo DB)
spring.data.mongodb.host=<Enter Mongo DB host ip address>
spring.data.mongodb.port=27017
spring.data.mongodb.authentication-database=<Enter MongoDB authentication database name>
spring.data.mongodb.database=<Enter MongoDB database name>
spring.data.mongodb.username=<Enter MongoDB username>
spring.data.mongodb.password=<Enter MongoDB password>

atomsFeedStartPage=1
parentUrl=https://demo.mybahmni.org

atomFeedURLPatientDemographic=/openmrs/ws/atomfeed/patient/
atomFeedURLPatientEncounter=/openmrs/ws/atomfeed/encounter/

feedAuthUserName=<Enter feed authentication username>
feedAuthPassword=<Enter feed authentication password>

eAushadhiDummy=yes

##NDHM ABHA API
clientID=<Enter client ID>
clientSecret=<Enter client secret key>

##Default ABDM Facility ID
abdmFacilityId= <Enter ABDM Facility ID>

ndhmuserAuthenticate=https://dev.abdm.gov.in/gateway/v0.5/sessions
ndhmGenerateOTP=https://healthidsbx.abdm.gov.in/api/v1/registration/mobile/generateOtp
ndhmVerifyOTP=https://healthidsbx.abdm.gov.in/api/v1/registration/mobile/verifyOtp
ndhmCreateHealthID=https://healthidsbx.abdm.gov.in/api/v1/registration/mobile/createHealthId

## ABHA with aadhaar
ndhmGenerateOTPWithAadhaar=https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/generateOtp
ndhmCreateHealthIDWithAadhaar=https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/createHealthIdWithAadhaarOtp

## ABHA Creation New APIs
abdmVerifyOTP= https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/verifyOTP
abdmCheckAndGenerateMobileOTP= https://healthidsbx.abdm.gov.in/api/v2/registration/aadhaar/checkAndGenerateMobileOTP
abdmVerifyMobileOTP= https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/verifyMobileOTP
abdmcreateHealthIdWithPreVerified= https://healthidsbx.abdm.gov.in/api/v1/registration/aadhaar/createHealthIdWithPreVerified


##CareContext Creation API
generateOTPForCareContext=https://dev.abdm.gov.in/gateway/v0.5/users/auth/init
addCareContext = https://dev.abdm.gov.in/gateway/v0.5/links/link/add-contexts
validateOTPForCareContext=https://dev.abdm.gov.in/gateway/v0.5/users/auth/confirm

##ABHA Card API
## Auth init - aadhar / mobile
generateOTP_ForCard=https://healthidsbx.abdm.gov.in/api/v1/auth/init
## confirm with mobile OTP
verifyOTP_ForCard=https://healthidsbx.abdm.gov.in/api/v1/auth/confirmWithMobileOTP
## confirm with Aadhaar
verifyOTP_ForCard_Aadhaar=https://healthidsbx.abdm.gov.in/api/v1/auth/confirmWithAadhaarOtp
## print ABHA card - PNG
generateHealthCard=https://healthidsbx.abdm.gov.in/api/v1/health/facility/getPngCard
generateHealthIDCard=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/account/getPngCard

## Generate Notify SMS once episode completed
generateABDM_NotifySMS=https://dev.abdm.gov.in/gateway/v1/patients/sms/notify2

##verifyBio
abdmVerifyBio=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/verifyBio
abdmGenerateMobileOTP=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/generateMobileOTP
abdmConfirmAadhaarBio=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/auth/confirmWithAadhaarBio
abdmAccountProfile=@env.ABDM_Account_ID_BASE_URL@/api/v1/account/profile

##ABDM Facility services
getAbdmFacilityServicies= https://dev.abdm.gov.in/devservice/v1/bridges/getServices

##ABDM V3 APIs
getAuthCertPublicKey = https://healthidsbx.abdm.gov.in/api/v1/auth/cert
requestOtpForEnrollment = https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/request/otp
abhaEnrollByAadhaar = https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/enrol/byAadhaar
printAbhaCard = https://abhasbx.abdm.gov.in/abha/api/v3/profile/account/abha-card
abhaLoginRequestOtp = https://abhasbx.abdm.gov.in/abha/api/v3/profile/login/request/otp
verifyAbhaLogin = https://abhasbx.abdm.gov.in/abha/api/v3/profile/login/verify
requestAuthByAbdm = https://abhasbx.abdm.gov.in/abha/api/v3/enrollment/auth/byAbdm

## 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

abhaMode=sbx

#logging.pattern.level=DEBUG
logging.level.root=INFO
logging.level.org.springframework.web=INFO
logging.level.org.hibernate=INFO
logging.level.com.iemr=DEBUG
logging.level.org.springframework=INFO
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.wipro.fhir.data.mongo.care_context;

import java.time.LocalDateTime;

import org.joda.time.DateTime;
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 DateTime createdDate;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.wipro.fhir.data.v3.careContext;

import lombok.Data;

@Data
public class AddCareContextRequest {

private long beneficiaryID;
private String abhaAddress;
private String abhaNumber;
private String linkToken;
private String requestId;
private String visitCategory;
private String visitCode;
private String abdmFacilityId;
private String abdmFacilityName;
private String hiType;
private String display;

}
Loading
Loading