Skip to content

Commit

Permalink
AMM-871 Abdm Facility fetch services changes (#46)
Browse files Browse the repository at this point in the history
* Abdm Facility fetch services changes

* facility save after carecontext and patientcarecontextx update

* FacilityId save in mongo db and Variable declaration correction

* revert mistake changes HTTPRequestInterceptor.java

* Updating logger for src/main/java/com/wipro/fhir/service/common/CommonServiceImpl.java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update common_ci.properties

---------

Co-authored-by: KA40094929 <[email protected]>
Co-authored-by: KA40094929 <KA40094929@APL-5CD1394ZJT>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Nov 27, 2024
1 parent 031a3d7 commit a53760b
Show file tree
Hide file tree
Showing 46 changed files with 528 additions and 865 deletions.
16 changes: 12 additions & 4 deletions src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ eAushadhiDummy=yes
##NDHM ABHA API
clientID=@env.NDHM_ABHA_CLIENT_ID@
clientSecret=@env.NDHM_ABHA_CLIENT_SECRET_KEY@
ndhmuserAuthenticate=@env.ABDM_BASE_URL@/gateway/v1/sessions

##Default ABDM Facility ID
abdmFacilityId= @env.ABDM_FACILITY_ID@

ndhmuserAuthenticate=@env.ABDM_BASE_URL@/gateway/v0.5/sessions
ndhmGenerateOTP=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registration/mobile/generateOtp
ndhmVerifyOTP=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registration/mobile/verifyOtp
ndhmCreateHealthID=@env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registration/mobile/createHealthId
Expand All @@ -53,9 +57,9 @@ abdmcreateHealthIdWithPreVerified= @env.ABDM_HEALTH_ID_BASE_URL@/api/v1/registra


##CareContext Creation API
generateOTPForCareContext=@env.ABDM_BASE_URL@/gateway/v1/users/auth/init
addCareContext = @env.ABDM_BASE_URL@/gateway/v1/links/link/add-contexts
validateOTPForCareContext=@env.ABDM_BASE_URL@/gateway/v1/users/auth/confirm
generateOTPForCareContext=@env.ABDM_BASE_URL@/gateway/v0.5/users/auth/init
addCareContext = @env.ABDM_BASE_URL@/gateway/v0.5/links/link/add-contexts
validateOTPForCareContext=@env.ABDM_BASE_URL@/gateway/v0.5/users/auth/confirm

##ABHA Card API
## Auth init - aadhar / mobile
Expand All @@ -77,6 +81,10 @@ [email protected]_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/
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= @env.ABDM_HEALTH_ID_BASE_URL@/devservice/v1/bridges/getServices


abhaMode=sbx

#logging.pattern.level=DEBUG
Expand Down
16 changes: 12 additions & 4 deletions src/main/environment/common_dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ eAushadhiDummy=yes
##NDHM ABHA API
clientID=<Enter client ID>
clientSecret=<Enter client secret key>
ndhmuserAuthenticate=https://dev.abdm.gov.in/gateway/v1/sessions

##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
Expand All @@ -53,9 +57,9 @@ abdmcreateHealthIdWithPreVerified= https://healthidsbx.abdm.gov.in/api/v1/regist


##CareContext Creation API
generateOTPForCareContext=https://dev.abdm.gov.in/gateway/v1/users/auth/init
addCareContext = https://dev.abdm.gov.in/gateway/v1/links/link/add-contexts
validateOTPForCareContext=https://dev.abdm.gov.in/gateway/v1/users/auth/confirm
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
Expand All @@ -77,6 +81,10 @@ [email protected]_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/
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


abhaMode=sbx

#logging.pattern.level=DEBUG
Expand Down
16 changes: 12 additions & 4 deletions src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ eAushadhiDummy=yes
##NDHM ABHA API
clientID=<Enter client ID>
clientSecret=<Enter client secret key>
ndhmuserAuthenticate=https://dev.abdm.gov.in/gateway/v1/sessions

##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
Expand All @@ -53,9 +57,9 @@ abdmcreateHealthIdWithPreVerified= https://healthidsbx.abdm.gov.in/api/v1/regist


##CareContext Creation API
generateOTPForCareContext=https://dev.abdm.gov.in/gateway/v1/users/auth/init
addCareContext = https://dev.abdm.gov.in/gateway/v1/links/link/add-contexts
validateOTPForCareContext=https://dev.abdm.gov.in/gateway/v1/users/auth/confirm
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
Expand All @@ -77,6 +81,10 @@ [email protected]_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/
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


abhaMode=sbx

#logging.pattern.level=DEBUG
Expand Down
16 changes: 12 additions & 4 deletions src/main/environment/common_test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ eAushadhiDummy=yes
##NDHM ABHA API
clientID=<Enter client ID>
clientSecret=<Enter client secret key>
ndhmuserAuthenticate=https://dev.abdm.gov.in/gateway/v1/sessions

##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
Expand All @@ -53,9 +57,9 @@ abdmcreateHealthIdWithPreVerified= https://healthidsbx.abdm.gov.in/api/v1/regist


##CareContext Creation API
generateOTPForCareContext=https://dev.abdm.gov.in/gateway/v1/users/auth/init
addCareContext = https://dev.abdm.gov.in/gateway/v1/links/link/add-contexts
validateOTPForCareContext=https://dev.abdm.gov.in/gateway/v1/users/auth/confirm
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
Expand All @@ -77,6 +81,10 @@ [email protected]_HEALTH_ID_BASE_URL@/api/v1/registration/aadhaar/
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


abhaMode=sbx

#logging.pattern.level=DEBUG
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class CareContextController {
@Operation(summary = "Generate OTP for care context linking")
@PostMapping(value = { "/generateOTPForCareContext" })
public String generateOTP(
@Param(value = "{\"healthID\":\"String\",\"authenticationMode\":\"String\",\"healthIdNumber\":\"String\"}") @RequestBody String request,
@Param(value = "{\"healthID\":\"String\",\"authenticationMode\":\"String\",\"healthIdNumber\":\"String\", \"abdmFacilityId\":\"String\", \"abdmFacilityName\":\"String\" }") @RequestBody String request,
@RequestHeader(value = "Authorization") String Authorization) {

OutputResponse response = new OutputResponse();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package com.wipro.fhir.controller.facility;

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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.wipro.fhir.data.request_handler.ResourceRequestHandler;
import com.wipro.fhir.service.facility.FacilityService;
import com.wipro.fhir.utils.exception.FHIRException;
import com.wipro.fhir.utils.response.OutputResponse;

import io.swagger.v3.oas.annotations.Operation;


@CrossOrigin
@RestController
@RequestMapping(value = "/facility", headers = "Authorization")
public class FacilityController {


@Autowired
private FacilityService facilityService;

Logger logger = LoggerFactory.getLogger(this.getClass().getName());

@CrossOrigin
@Operation(summary = "Get ABDM Registered Facilities")
@GetMapping(value = { "/getAbdmRegisteredFacilities" })
public String getAbdmRegisteredFacilities(@RequestHeader(value = "Authorization") String Authorization) {

OutputResponse response = new OutputResponse();

try {

String resp = facilityService.fetchRegisteredFacilities();

response.setResponse(resp);

} catch (FHIRException e) {

response.setError(5000, e.getMessage());
logger.error(e.getMessage());
}
logger.info("Get ABDM Registered facilities API response" + response.toString());
return response.toString();
}


@CrossOrigin
@Operation(summary = "Get ABDM Registered Facilities")
@PostMapping(value = { "/saveAbdmFacilityId" })
public String saveAbdmFacilityForVisit(@RequestHeader(value = "Authorization") String Authorization, @RequestBody() String reqObj) {

OutputResponse response = new OutputResponse();

try {

String resp = facilityService.saveAbdmFacilityId(reqObj);

response.setResponse(resp);
} catch (FHIRException e) {

response.setError(5000, e.getMessage());
logger.error(e.getMessage());
}
logger.info("ABDM save Facility ID response" + response.toString());
return response.toString();
}

}
Loading

0 comments on commit a53760b

Please sign in to comment.