From cc77f01fc39f43d7a4b1152c15b424a8172402d3 Mon Sep 17 00:00:00 2001 From: ravishanigarapu <133210792+ravishanigarapu@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:29:27 +0530 Subject: [PATCH] AMM-1076 and AMM-1078 (#146) * missed file * FieldName Patching * Null Conditions added * Update beneficiary * update * Update * community changes * AMM-1076 * Changed RequestInterceptor * AMM-1178 * Null check * Null check --- .../NHMDetailCallReportScheduler.java | 8 ++- .../dto/identity/CommonIdentityDTO.java | 1 + .../model/beneficiary/BeneficiaryModel.java | 6 ++ .../repository/report/CallReportRepo.java | 2 +- .../IEMRSearchUserServiceImpl.java | 9 ++- .../RegisterBenificiaryServiceImpl.java | 56 ++++++++++++++++--- .../utils/http/HTTPRequestInterceptor.java | 3 + 7 files changed, 75 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/iemr/common/controller/nhmdashboard/NHMDetailCallReportScheduler.java b/src/main/java/com/iemr/common/controller/nhmdashboard/NHMDetailCallReportScheduler.java index 8da22a3d..5fd3e281 100644 --- a/src/main/java/com/iemr/common/controller/nhmdashboard/NHMDetailCallReportScheduler.java +++ b/src/main/java/com/iemr/common/controller/nhmdashboard/NHMDetailCallReportScheduler.java @@ -62,6 +62,9 @@ public void detailedCallReport() { for (DetailedCallReport detailedCallReport : findByCallStartTimeBetween) { String phoneNo = detailedCallReport.getPHONE(); String sessionID = detailedCallReport.getSession_ID(); + if(null != phoneNo && phoneNo.length()>10) { + phoneNo = phoneNo.replaceFirst("^0+", ""); + } BeneficiaryCall existRecord = callReportRepo.getBenCallDetailsBySessionIDAndPhone(sessionID,phoneNo); if (existRecord != null) { logger.info("Record already present in t_bencall table with sessionID : " + sessionID @@ -150,7 +153,10 @@ private Integer getCallTypeId(Boolean isOutbound, Integer calledServiceId, Detai private BeneficiaryCall getCallDetail(DetailedCallReport detailedCallReport) { BeneficiaryCall beneficiaryCall = new BeneficiaryCall(); beneficiaryCall.setCallID(detailedCallReport.getSession_ID()); - beneficiaryCall.setPhoneNo(detailedCallReport.getPHONE()); + String phoneNo = detailedCallReport.getPHONE(); + if(null != phoneNo && phoneNo.length()>10) + phoneNo = phoneNo.replaceFirst("^0+", ""); + beneficiaryCall.setPhoneNo(phoneNo); beneficiaryCall.setCalledServiceID(null); beneficiaryCall.setRemarks("missed records - Failure"); beneficiaryCall.setIs1097(true); diff --git a/src/main/java/com/iemr/common/dto/identity/CommonIdentityDTO.java b/src/main/java/com/iemr/common/dto/identity/CommonIdentityDTO.java index e2664920..431a267a 100644 --- a/src/main/java/com/iemr/common/dto/identity/CommonIdentityDTO.java +++ b/src/main/java/com/iemr/common/dto/identity/CommonIdentityDTO.java @@ -151,6 +151,7 @@ public class CommonIdentityDTO { @Expose private Boolean beneficiaryConsent; private String otherFields; + private String religionName; // private Object otherFields; diff --git a/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java b/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java index 45064f55..aee6b8f7 100644 --- a/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java +++ b/src/main/java/com/iemr/common/model/beneficiary/BeneficiaryModel.java @@ -213,12 +213,16 @@ public class BeneficiaryModel implements Comparable { @Expose private String occupationName; @Expose + private String occupation; + @Expose private String incomeStatus; @Expose private BigInteger religionId; @Expose private String religion; @Expose + private String education; + @Expose private Integer providerServiceMapID; @Expose @@ -285,6 +289,8 @@ public class BeneficiaryModel implements Comparable { @Expose private Boolean passToNurse = false; private String otherFields; + @Expose + private String religionName; // private Object otherFields; diff --git a/src/main/java/com/iemr/common/repository/report/CallReportRepo.java b/src/main/java/com/iemr/common/repository/report/CallReportRepo.java index 6b8094a9..075f0b01 100644 --- a/src/main/java/com/iemr/common/repository/report/CallReportRepo.java +++ b/src/main/java/com/iemr/common/repository/report/CallReportRepo.java @@ -42,7 +42,7 @@ public interface CallReportRepo extends CrudRepository + "and report.createdDate >= :startDate and report.createdDate <= :endDate ") public List getAllBenCallIDetails(@Param("startDate") Timestamp startDate, @Param("endDate") Timestamp endDate);//start date and end date as param for x days. - @Query("SELECT call FROM BeneficiaryCall call WHERE call.callID = :sessionID and call.phoneNo = :phoneNo") + @Query("SELECT call FROM BeneficiaryCall call WHERE call.callID = :sessionID and call.phoneNo like %:phoneNo%") public BeneficiaryCall getBenCallDetailsBySessionIDAndPhone(@Param("sessionID") String sessionID,@Param("phoneNo") String phoneNo); @Transactional diff --git a/src/main/java/com/iemr/common/service/beneficiary/IEMRSearchUserServiceImpl.java b/src/main/java/com/iemr/common/service/beneficiary/IEMRSearchUserServiceImpl.java index 8432d7e7..0be729a4 100644 --- a/src/main/java/com/iemr/common/service/beneficiary/IEMRSearchUserServiceImpl.java +++ b/src/main/java/com/iemr/common/service/beneficiary/IEMRSearchUserServiceImpl.java @@ -372,8 +372,15 @@ public List getBeneficiaryListFromMapper(List { BeneficiaryModel beneficiary = benCompleteMapper.benDetailForOutboundDTOToIBeneficiary(beneficiaryModel); - if(null != beneficiaryModel.getBeneficiaryDetails() && null != beneficiaryModel.getBeneficiaryDetails().getCommunity()) + if(null != beneficiaryModel && null != beneficiaryModel.getBeneficiaryDetails()) { beneficiary.setCommunityName(beneficiaryModel.getBeneficiaryDetails().getCommunity()); + beneficiary.setReligion(beneficiaryModel.getBeneficiaryDetails().getReligion()); + beneficiary.setReligionName(beneficiaryModel.getBeneficiaryDetails().getReligion()); + beneficiary.setOccupationName(beneficiaryModel.getBeneficiaryDetails().getOccupation()); + beneficiary.setOccupation(beneficiaryModel.getBeneficiaryDetails().getOccupation()); + beneficiary.setEducation(beneficiaryModel.getBeneficiaryDetails().getEducation()); + beneficiary.setIncomeStatus(beneficiaryModel.getBeneficiaryDetails().getIncomeStatus()); + } if (beneficiary.getAge() == null) { beneficiary.setAge(beneficiary.getActualAge()); } diff --git a/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java b/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java index 2c675f51..1d829d17 100644 --- a/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java +++ b/src/main/java/com/iemr/common/service/beneficiary/RegisterBenificiaryServiceImpl.java @@ -114,10 +114,8 @@ public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String aut Integer updatedRows = 0; IdentityEditDTO identityEditDTO = identityBenEditMapper.BenToIdentityEditMapper(benificiaryDetails); - if(null != benificiaryDetails.getI_bendemographics()) { - identityEditDTO.setCommunity(benificiaryDetails.getI_bendemographics().getCommunityName()); - identityEditDTO.setCommunityName(benificiaryDetails.getI_bendemographics().getCommunityName()); - } + setDemographicDetails(identityEditDTO,benificiaryDetails); + if (benificiaryDetails.getBeneficiaryIdentities() != null && benificiaryDetails.getBeneficiaryIdentities().size() > 0) { identityEditDTO.setIdentities(Identity.createIdentity(benificiaryDetails.getBeneficiaryIdentities(), @@ -132,6 +130,29 @@ public Integer updateBenificiary(BeneficiaryModel benificiaryDetails, String aut return updatedRows; } + private void setDemographicDetails(IdentityEditDTO identityEditDTO, BeneficiaryModel benificiaryDetails) { + if(null != benificiaryDetails.getI_bendemographics()) { + identityEditDTO.setCommunity(benificiaryDetails.getI_bendemographics().getCommunityName()); + identityEditDTO.setCommunityName(benificiaryDetails.getI_bendemographics().getCommunityName()); + if(null != benificiaryDetails.getReligion()) + identityEditDTO.setReligion(benificiaryDetails.getReligion()); + else if(null != benificiaryDetails.getI_bendemographics().getReligion()) + identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligion()); + else + identityEditDTO.setReligion(benificiaryDetails.getI_bendemographics().getReligionName()); + if(null != benificiaryDetails.getOccupation()) + identityEditDTO.setOccupationName(benificiaryDetails.getOccupation()); + else + identityEditDTO.setOccupationName(benificiaryDetails.getI_bendemographics().getOccupation()); + identityEditDTO.setEducation(benificiaryDetails.getI_bendemographics().getEducationName()); + if(null != benificiaryDetails.getIncomeStatus()) + identityEditDTO.setIncomeStatus(benificiaryDetails.getIncomeStatus()); + else + identityEditDTO.setIncomeStatus(benificiaryDetails.getI_bendemographics().getIncomeStatus()); + } + + } + private int updateDemographics(BeneficiaryDemographicsModel i_BenDemographics) { int updatedRows = 0; System.out.println(i_BenDemographics); @@ -145,9 +166,7 @@ public String save(BeneficiaryModel beneficiaryModel, HttpServletRequest servlet // logger.info("benificiaryDetails: " + beneficiaryModel); CommonIdentityDTO identityDTO = identityMapper.beneficiaryModelCommonIdentityDTO(beneficiaryModel); - if(null != beneficiaryModel.getI_bendemographics()) { - identityDTO.setCommunity(beneficiaryModel.getI_bendemographics().getCommunityName()); - } + setSaveDemographicDetails(identityDTO,beneficiaryModel); // identityDTO.setOtherFields(beneficiaryModel.getOtherFields()); identityDTO.setFaceEmbedding(beneficiaryModel.getFaceEmbedding()); identityDTO.setEmergencyRegistration(beneficiaryModel.isEmergencyRegistration()); @@ -178,6 +197,29 @@ public String save(BeneficiaryModel beneficiaryModel, HttpServletRequest servlet return OutputMapper.gson().toJson(beneficiary); } + private void setSaveDemographicDetails(CommonIdentityDTO identityDTO, BeneficiaryModel beneficiaryModel) { + if(null != beneficiaryModel.getI_bendemographics()) { + identityDTO.setCommunity(beneficiaryModel.getI_bendemographics().getCommunityName()); + if(null != beneficiaryModel.getReligion()) + identityDTO.setReligion(beneficiaryModel.getReligion()); + else if(null != beneficiaryModel.getI_bendemographics().getReligion()) + identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligion()); + else + identityDTO.setReligion(beneficiaryModel.getI_bendemographics().getReligionName()); + if(null != beneficiaryModel.getOccupation()) + identityDTO.setOccupationName(beneficiaryModel.getOccupation()); + else + identityDTO.setOccupationName(beneficiaryModel.getI_bendemographics().getOccupation()); + if(null != beneficiaryModel.getI_bendemographics().getEducationName()) + identityDTO.setEducation(beneficiaryModel.getI_bendemographics().getEducationName()); + if(null != beneficiaryModel.getIncomeStatus()) + identityDTO.setIncomeStatus(beneficiaryModel.getIncomeStatus()); + else + identityDTO.setIncomeStatus(beneficiaryModel.getI_bendemographics().getIncomeStatus()); + } + + } + @Override public Integer updateCommunityorEducation(BeneficiaryModel benificiaryDetails, String auth) throws IEMRException { IdentityEditDTO identityEditDTO = new IdentityEditDTO(); diff --git a/src/main/java/com/iemr/common/utils/http/HTTPRequestInterceptor.java b/src/main/java/com/iemr/common/utils/http/HTTPRequestInterceptor.java index 6cab79cb..7038cdb7 100644 --- a/src/main/java/com/iemr/common/utils/http/HTTPRequestInterceptor.java +++ b/src/main/java/com/iemr/common/utils/http/HTTPRequestInterceptor.java @@ -87,6 +87,9 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons case "doAgentLogout": case "userLogout": case "swagger-ui.html": + case "index.html": + case "swagger-initializer.js": + case "swagger-config": case "ui": case "swagger-resources": case "api-docs":