diff --git a/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java b/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java index 33fbc9c..a68aacf 100644 --- a/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java +++ b/src/main/java/com/iemr/common/identity/controller/rmnch/RMNCHMobileAppController.java @@ -87,7 +87,17 @@ public String syncDataToAmrit(@ApiParam(value = "{\r\n" + " \"beneficiaryDetail + " \"nishchayPregnancyStatusPosition\": \"Integer\",\r\n" + " \"nishchayDeliveryStatus\": \"String\",\r\n" + " \"nishchayDeliveryStatusPosition\": \"Integer\",\r\n" + " \"relatedBeneficiaryIds\": [\r\n" - + " \"Long\"\r\n" + " ]\r\n" + " }\r\n" + " ],\r\n" + " \"bornBirthDeatils\": [\r\n" + + " \"Long\"\r\n" + " ],\r\n" + + " \"beneficiaryRegID\":\"Long\",\"firstName\":\"String\",\"lastName\":\"String\",\"\n" + + " \"dob\":\"Timestamp\",\"fatherName\":\"String\",\"spouseName\":\"String\",\"\n" + + " \"govtIdentityNo\":\"String\",\"govtIdentityTypeID\":\"Integer\",\"emergencyRegistration\":\"Boolean\",\"\n" + + " \"maritalstatusId\":\"Short\",\"maritalstatus\":\"String\",\"gender\":\"String\",\"genderId\":\"Integer\",\"i_bendemographics\":{\"educationID\":\"Long\",\"\n" + + " \"beneficiaryRegID\":\"Long\",\"occupationID\":\"Integer\",\"healthCareWorkerID\":\"Short\",\"incomeStatusID\":\"Integer\",\"\n" + + " \"communityID\":\"Integer\",\"preferredLangID\":\"Integer\",\"districtID\":\"Integer\",\"stateID\":\"Integer\",\"\n" + + " \"pinCode\":\"String\",\"blockID\":\"Integer\",\"districtBranchID\":\"Integer\",\"createdBy\":\"String\",\"addressLine1\":\"String\"},\"\n" + + " \"benPhoneMaps\":{\"parentBenRegID\":\"Long\",\"phoneNo\":\"String\",\"phoneTypeID\":\"Integer\",\"benRelationshipID\":\"Integer\",\"\n" + + " \"deleted\":\"Boolean\",\"createdBy\":\"String\"},\"\n" + + " }\r\n" + " ],\r\n" + " \"bornBirthDeatils\": [\r\n" + " {\r\n" + " \"BenRegId\": \"Long\",\r\n" + " \"Countyid\": \"Integer\",\r\n" + " \"Processed\": \"String\",\r\n" + " \"ProviderServiceMapID\": \"Integer\",\r\n" + " \"VanID\": \"Integer\",\r\n" + " \"bcdBatchNo\": \"String\",\r\n" diff --git a/src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHBenDetailsRepo.java b/src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHBenDetailsRepo.java index 028e781..b2bcb29 100644 --- a/src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHBenDetailsRepo.java +++ b/src/main/java/com/iemr/common/identity/repo/rmnch/RMNCHBenDetailsRepo.java @@ -35,4 +35,8 @@ public interface RMNCHBenDetailsRepo extends CrudRepository benDetailsExtraList = Arrays.asList(objArr); + List benDetailsList = new ArrayList<>(); if (benDetailsExtraList != null && benDetailsExtraList.size() > 0) { // benRegID = rMNCHMBenRegIdMapRepo.getRegID(benDetailsExtraList.get(0).getBenficieryid()); @@ -166,14 +167,30 @@ public String syncDataToAmrit(String requestOBJ) throws Exception { } obj.setRelatedBeneficiaryIdsDB(sb.toString()); } - + RMNCHMBeneficiarydetail rmnchmBeneficiarydetail = + rMNCHBenDetailsRepo.getByBenRegID(BigInteger.valueOf(obj.getBenRegId())); + if (rmnchmBeneficiarydetail != null) { + rmnchmBeneficiarydetail.setFirstName(obj.getFirstName()); + rmnchmBeneficiarydetail.setLastName(obj.getLastName()); + rmnchmBeneficiarydetail.setFatherName(obj.getFatherName()); + rmnchmBeneficiarydetail.setMotherName(obj.getMotherName()); + rmnchmBeneficiarydetail.setDob(obj.getDob()); + rmnchmBeneficiarydetail.setSpousename(obj.getSpousename()); + rmnchmBeneficiarydetail.setGender(obj.getGender()); + rmnchmBeneficiarydetail.setGenderId(obj.getGenderId()); + rmnchmBeneficiarydetail.setMaritalstatus(obj.getMaritalstatus()); + rmnchmBeneficiarydetail.setMaritalstatusId(obj.getMaritalstatusId()); + benDetailsList.add(rmnchmBeneficiarydetail); + } } benDetailsExtraList = (ArrayList) rMNCHBeneficiaryDetailsRmnchRepo .save(benDetailsExtraList); benDetailsExtraList.forEach((n) -> beneficiaryDetailsIds.add(n.getId())); + // update beneficiary data in i_beneficiarydetails table + rMNCHBenDetailsRepo.save(benDetailsList); // } else // throw new Exception("invalid/empty beneficiary request data.");