Skip to content

Commit

Permalink
Merge pull request #9 from PSMRI/develop
Browse files Browse the repository at this point in the history
AMM-1076 and AMM-1078 (PSMRI#146)
  • Loading branch information
srishtigrp78 authored Jan 8, 2025
2 parents 019d315 + cc77f01 commit 507f830
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public class CommonIdentityDTO {
@Expose
private Boolean beneficiaryConsent;
private String otherFields;
private String religionName;

// private Object otherFields;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,16 @@ public class BeneficiaryModel implements Comparable<BeneficiaryModel> {
@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
Expand Down Expand Up @@ -285,6 +289,8 @@ public class BeneficiaryModel implements Comparable<BeneficiaryModel> {
@Expose
private Boolean passToNurse = false;
private String otherFields;
@Expose
private String religionName;

// private Object otherFields;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface CallReportRepo extends CrudRepository<BeneficiaryCall, Integer>
+ "and report.createdDate >= :startDate and report.createdDate <= :endDate ")
public List<BeneficiaryCall> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,15 @@ public List<BeneficiaryModel> getBeneficiaryListFromMapper(List<BeneficiariesDTO
benDetailForOutboundDTOList.forEach(beneficiaryModel -> {

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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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);
Expand All @@ -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());
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit 507f830

Please sign in to comment.