Skip to content

Commit

Permalink
AMM-514 : 1097- Moving back to previous page take more time and image
Browse files Browse the repository at this point in the history
api change
  • Loading branch information
indraniBan authored and indraniBan committed Aug 12, 2024
1 parent 2e28f6c commit f6394a7
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class RMNCHBeneficiaryDetailsRmnch {

@Expose
@Column(name = "BeneficiaryRegID")
private BigInteger BenRegId;
private Long BenRegId;

@Expose
@Column(name = "aadhaNo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class RMNCHBornBirthDetails {

@Expose
@Column(name = "BeneficiaryRegID")
private BigInteger BenRegId;
private Long BenRegId;

@Expose
@Column(name = "beneficiaryId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class RMNCHCBACdetails {

@Expose
@Column(name = "BeneficiaryRegId")
private BigInteger BenRegId;
private Long BenRegId;

@Expose
@Column(name = "cbac_age")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class RMNCHMBeneficiarymapping implements Serializable {
private BigInteger benAccountID;

@Column(name = "BenRegId")
private BigInteger benRegId;
private Long benRegId;

@Expose
@Column(name = "vanID")
Expand Down
17 changes: 3 additions & 14 deletions src/main/java/com/iemr/common/identity/repo/BenMappingRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,7 @@ List<MBeneficiarymapping> findByBeneficiaryDetailsByVillageIDAndLastModifyDate(
Long getBeneficiaryCountsByVillageIDAndLastModifyDate(@Param("villageIDs") List<Integer> villageID,
@Param("lastModDate") Timestamp lastModifiedDate);

/*
* List<MBeneficiarymapping> dynamicFilterSearch(IdentitySearchDTO searchDTO);
*
*//**
* This method is to search finite beneficiary for MCTS before in order to
* generate iemr ID and can be use to finite search generally
*
* @param identityDTO
* @return mBeneficiarymappingList
*//*
* List<MBeneficiarymapping> finiteSearch(IdentityDTO identityDTO);
*
* List<VBenAdvanceSearch> dynamicFilterSearchNew(IdentitySearchDTO searchDTO);
*/

@Query("SELECT t FROM MBeneficiarymapping t WHERE t.vanSerialNo =:vanSerialNo AND t.vanID=:vanID")
MBeneficiarymapping getMapping(@Param("vanSerialNo") BigInteger vanSerialNo,@Param("vanID") Integer vanID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ public RMNCHMBeneficiarydetail getByIdAndVanID(@Param("vanSerialNo") BigInteger

@Query(" SELECT t FROM RMNCHMBeneficiarydetail t WHERE t.id = " +
"(SELECT m.benDetailsId from RMNCHMBeneficiarymapping m where m.benRegId = :beneficiaryRegID)")
public RMNCHMBeneficiarydetail getByBenRegID(@Param("beneficiaryRegID") BigInteger beneficiaryRegID);
public RMNCHMBeneficiarydetail getByBenRegID(@Param("beneficiaryRegID") Long beneficiaryRegID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ public RMNCHBeneficiaryDetailsRmnch getByIdAndVanID(@Param("vanSerialNo") BigInt
@Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHBeneficiaryDetailsRmnch t WHERE t.BenRegId =:benRegID ")
public RMNCHBeneficiaryDetailsRmnch getByRegID(@Param("benRegID") BigInteger bigInteger);
public RMNCHBeneficiaryDetailsRmnch getByRegID(@Param("benRegID") Long benRegId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ public interface RMNCHBornBirthDetailsRepo extends CrudRepository<RMNCHBornBirth
public RMNCHBornBirthDetails getByIdAndVanID(@Param("vanSerialNo") Long vanSerialNo, @Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHBornBirthDetails t WHERE t.BenRegId =:benRegID ")
public RMNCHBornBirthDetails getByRegID(@Param("benRegID") BigInteger benRegID);
public RMNCHBornBirthDetails getByRegID(@Param("benRegID") Long benRegID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public interface RMNCHCBACDetailsRepo extends CrudRepository<RMNCHCBACdetails, L
public RMNCHCBACdetails getByIdAndVanID(@Param("vanSerialNo") Long vanSerialNo, @Param("vanID") int vanID);

@Query(" SELECT t FROM RMNCHCBACdetails t WHERE t.BenRegId =:benRegID")
public RMNCHCBACdetails getByRegID(@Param("benRegID") BigInteger benRegID);
public RMNCHCBACdetails getByRegID(@Param("benRegID") Long benRegID);

@Query(value = "select beneficiary_visit_code,visit_category from db_iemr.i_ben_flow_outreach where beneficiary_reg_id=:benRegID AND beneficiary_visit_code is not null AND visit_category is not null order by created_date desc limit 1", nativeQuery = true)
public List<Object[]> getVisitDetailsbyRegID(@Param("benRegID") Long benRegID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ public int updateProviderServiceMapID(@Param("benRegID") BigInteger benRegID,
@Param("providerServiceMapID") int providerServiceMapID);

@Query(" SELECT t.benRegId FROM RMNCHMBeneficiaryregidmapping t WHERE t.beneficiaryID = :benID ")
public BigInteger getRegID(@Param("benID") BigInteger benID);
public Long getRegID(@Param("benID") BigInteger benID);
}
62 changes: 32 additions & 30 deletions src/main/java/com/iemr/common/identity/service/IdentityService.java
Original file line number Diff line number Diff line change
Expand Up @@ -577,15 +577,14 @@ public List<BeneficiariesDTO> searhBeneficiaryByGovIdentity(String identity)

private MBeneficiarymapping getBeneficiariesDTONew(Object[] benMapArr) {
MBeneficiarymapping benMapOBJ = new MBeneficiarymapping();

benMapOBJ.setBenMapId(getBigIntegerValueFromObject(benMapArr[0]));
benMapOBJ.setCreatedBy(String.valueOf(benMapArr[10]));
benMapOBJ.setCreatedDate((Timestamp) benMapArr[11]);

if (benMapArr != null && benMapArr.length == 12 && benMapArr[8] != null && benMapArr[9] != null) {
Long benRegID = Long.valueOf(benMapArr[5].toString());
benMapOBJ.setBenMapId(getBigIntegerValueFromObject(benMapArr[0]));
benMapOBJ.setCreatedBy(String.valueOf(benMapArr[10]));
benMapOBJ.setCreatedDate((Timestamp) benMapArr[11]);
benMapOBJ = mappingRepo.getMapping(getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]);

RMNCHBeneficiaryDetailsRmnch obj = rMNCHBeneficiaryDetailsRmnchRepo
.getByRegID(BigInteger.valueOf(benRegID));
.getByRegID(((BigInteger) benMapArr[5]).longValue());
if (obj != null) {
if (obj.getHouseoldId() != null)
benMapOBJ.setHouseHoldID(obj.getHouseoldId());
Expand All @@ -594,31 +593,10 @@ private MBeneficiarymapping getBeneficiariesDTONew(Object[] benMapArr) {
if (obj.getRchid() != null)
benMapOBJ.setRchID(obj.getRchid());
}

benMapOBJ.setMBeneficiaryaddress(addressRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[1]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryconsent(consentRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[2]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiarycontact(contactRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[3]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiarydetail(detailRepo
.getWith_vanSerialNo_vanID(getBigIntegerValueFromObject(benMapArr[4]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryregidmapping(regIdRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[5]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryImage(imageRepo.getWithVanSerialNoVanID(
BigInteger.valueOf(Long.valueOf(benMapArr[6].toString())), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryAccount(accountRepo
.getWithVanSerialNoVanID(getBigIntegerValueFromObject(benMapArr[7]), (Integer) benMapArr[8]));

benMapOBJ.setMBeneficiaryfamilymappings(familyMapRepo.findByBenMapIdAndVanIDOrderByBenFamilyMapIdAsc(
getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]));
benMapOBJ.setMBeneficiaryidentities(identityRepo
.findByBenMapIdAndVanID(getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]));


}
return benMapOBJ;
}

private MBeneficiarymapping getBeneficiariesDTONewPartial(Object[] benMapArr) {
MBeneficiarymapping benMapOBJ = new MBeneficiarymapping();

Expand Down Expand Up @@ -972,6 +950,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
*/

logger.debug("Image to upsert = " + OutputMapper.gson().toJson(beneficiaryImage));
beneficiaryImage.setProcessed("N");
imageRepo.save(beneficiaryImage);
}

Expand Down Expand Up @@ -1187,7 +1166,9 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) {
// Update van serial no for data sync
accountRepo.updateVanSerialNo(bankOBJ.getBenAccountID());

MBeneficiaryImage benImageOBJ = mapper.identityDTOToMBeneficiaryImage(identity);
// MBeneficiaryImage benImageOBJ = mapper.identityDTOToMBeneficiaryImage(identity);
MBeneficiaryImage benImageOBJ = identityDTOToMBeneficiaryImage(identity);

if (benImageOBJ.getCreatedDate() == null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
String dateToStoreInDataBase = sdf.format(new Date());
Expand Down Expand Up @@ -1227,6 +1208,9 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) {
Timestamp ts = Timestamp.valueOf(dateToStoreInDataBase);
benMapping.setCreatedDate(ts);
}

if (identity.getBenFamilyDTOs().get(0).getVanID() != null)
benMapping.setVanID(identity.getBenFamilyDTOs().get(0).getVanID());

benMapping = mappingRepo.save(benMapping);
// Update van serial no for data sync
Expand All @@ -1246,6 +1230,8 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) {

if (bfMapping.getVanID() == null && identity.getVanID() != null)
bfMapping.setVanID(identity.getVanID());
if (bfMapping.getVanID() == null && identity.getBenFamilyDTOs().get(0).getVanID() != null)
bfMapping.setVanID(identity.getBenFamilyDTOs().get(0).getVanID());

if (bfMapping.getParkingPlaceID() == null && identity.getParkingPlaceId() != null)
bfMapping.setParkingPlaceID(identity.getParkingPlaceId());
Expand Down Expand Up @@ -1369,6 +1355,22 @@ private MBeneficiarydetail convertIdentityDTOToMBeneficiarydetail(IdentityDTO dt
beneficiarydetail.setLiteracyStatus(dto.getLiteracyStatus());
return beneficiarydetail;
}

private MBeneficiaryImage identityDTOToMBeneficiaryImage(IdentityDTO identity) {
MBeneficiaryImage beneficiaryImage = new MBeneficiaryImage();

beneficiaryImage.setBenImage(identity.getBenImage());
beneficiaryImage.setCreatedBy(identity.getAgentName());
beneficiaryImage.setCreatedDate(identity.getCreatedDate());
if (identity.getVanID() != null)
beneficiaryImage.setVanID(identity.getVanID());
if (identity.getBenFamilyDTOs() != null)
beneficiaryImage.setVanID(identity.getBenFamilyDTOs().get(0).getVanID());

beneficiaryImage.setParkingPlaceID(identity.getParkingPlaceId());

return beneficiaryImage;
}

private MBeneficiarycontact identityDTOToMBeneficiarycontact(IdentityDTO dto) {
MBeneficiarycontact beneficiaryContact = new MBeneficiarycontact();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public String syncDataToAmrit(String requestOBJ) throws Exception {
// other tables data saving
// ben details RMNCH extra fields details

BigInteger benRegID = null;
Long benRegID = null;

if (jsnOBJ != null && jsnOBJ.has("beneficiaryDetails")) {
RMNCHBeneficiaryDetailsRmnch[] objArr = InputMapper.gson()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void getBeneficiariesTest() throws NoResultException, QueryTimeoutException, Exc
rmnchBenDetails.setRchid("7");
rmnchBenDetails.toString();

when(rMNCHBeneficiaryDetailsRmnchRepo.getByRegID(new BigInteger( elements[5].toString())))
when(rMNCHBeneficiaryDetailsRmnchRepo.getByRegID(new Long( elements[5].toString())))
.thenReturn(rmnchBenDetails);
MBeneficiaryaddress beneficiaryaddress1 = new MBeneficiaryaddress();
beneficiaryaddress1.setCreatedBy(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ void testSyncDataToAmrit() throws Exception {
when(rMNCHHouseHoldDetailsRepo.getByHouseHoldID(Long.valueOf(987))).thenReturn(rMNCHHouseHoldDetails);
when(rMNCHCBACDetailsRepo.saveAll(anyList())).thenReturn(rMNCHCBACdetailslist);
when(rMNCHCBACDetailsRepo.getByRegID(any())).thenReturn(rMNCHCBACdetails);
when(rMNCHMBenRegIdMapRepo.getRegID(any())).thenReturn(BigInteger.valueOf(987));
when(rMNCHMBenRegIdMapRepo.getRegID(any())).thenReturn(Long.valueOf(987));
when(rMNCHBornBirthDetailsRepo.saveAll(anyList())).thenReturn(rMNCHBornBirthDetailslist);
when(rMNCHBornBirthDetailsRepo.getByRegID(any())).thenReturn(rMNCHBornBirthDetails);
when(rMNCHMBenRegIdMapRepo.getRegID(any())).thenReturn(BigInteger.valueOf(987));
when(rMNCHMBenRegIdMapRepo.getRegID(any())).thenReturn(Long.valueOf(987));
when(rMNCHBeneficiaryDetailsRmnchRepo.getByRegID(any())).thenReturn(rMNCHBeneficiaryDetailsRmnch);
when(rMNCHMBenRegIdMapRepo.getRegID(any())).thenReturn(BigInteger.valueOf(987));
when(rMNCHMBenRegIdMapRepo.getRegID(any())).thenReturn(Long.valueOf(987));
RMNCHMBeneficiarydetail rmnchBenDetails = new RMNCHMBeneficiarydetail();
when(rMNCHBenDetailsRepo.getByBenRegID(any())).thenReturn(rmnchBenDetails);

Expand Down Expand Up @@ -238,7 +238,7 @@ void testgetBenDataForGeneralOPDCase() throws Exception {
m.setBenImageId(BigInteger.valueOf(9));
m.setBenAddressId(BigInteger.valueOf(9));
m.setBenConsentId(BigInteger.valueOf(9));
m.setBenRegId(BigInteger.valueOf(9));
m.setBenRegId(Long.valueOf(9));
m.toString();
RMNCHMBeneficiarydetail benDetailsOBJ = new RMNCHMBeneficiarydetail();

Expand Down Expand Up @@ -334,7 +334,7 @@ void testgetBenDataForGeneralOPDQCCase() throws Exception {
m.setBenImageId(BigInteger.valueOf(9));
m.setBenAddressId(BigInteger.valueOf(9));
m.setBenConsentId(BigInteger.valueOf(9));
m.setBenRegId(BigInteger.valueOf(9));
m.setBenRegId(Long.valueOf(9));
m.toString();
RMNCHMBeneficiarydetail benDetailsOBJ = new RMNCHMBeneficiarydetail();
benDetailsOBJ.toString();
Expand Down Expand Up @@ -419,7 +419,7 @@ void testgetBenDataForPNCCase() throws Exception {
m.setBenImageId(BigInteger.valueOf(9));
m.setBenAddressId(BigInteger.valueOf(9));
m.setBenConsentId(BigInteger.valueOf(9));
m.setBenRegId(BigInteger.valueOf(9));
m.setBenRegId(Long.valueOf(9));
m.hashCode();
m.equals(m);
m.toString();
Expand Down Expand Up @@ -548,7 +548,7 @@ void testgetBenDataForANCCase() throws Exception {
m.setBenImageId(BigInteger.valueOf(9));
m.setBenAddressId(BigInteger.valueOf(9));
m.setBenConsentId(BigInteger.valueOf(9));
m.setBenRegId(BigInteger.valueOf(9));
m.setBenRegId(Long.valueOf(9));
m.toString();
RMNCHMBeneficiarydetail benDetailsOBJ = new RMNCHMBeneficiarydetail();
benDetailsOBJ.toString();
Expand Down Expand Up @@ -629,7 +629,7 @@ void testgetBenDataForNCDcare() throws Exception {
m.setBenImageId(BigInteger.valueOf(9));
m.setBenAddressId(BigInteger.valueOf(9));
m.setBenConsentId(BigInteger.valueOf(9));
m.setBenRegId(BigInteger.valueOf(9));
m.setBenRegId(Long.valueOf(9));
m.toString();
RMNCHMBeneficiarydetail benDetailsOBJ = new RMNCHMBeneficiarydetail();

Expand Down Expand Up @@ -729,7 +729,7 @@ void testgetBenDataForNCDscreening() throws Exception {
m.setBenImageId(BigInteger.valueOf(9));
m.setBenAddressId(BigInteger.valueOf(9));
m.setBenConsentId(BigInteger.valueOf(9));
m.setBenRegId(BigInteger.valueOf(9));
m.setBenRegId(Long.valueOf(9));
m.toString();
RMNCHMBeneficiarydetail benDetailsOBJ = new RMNCHMBeneficiarydetail();

Expand Down Expand Up @@ -825,7 +825,7 @@ void testgetBenDataForCOVID19Screening() throws Exception {
m.setBenImageId(BigInteger.valueOf(9));
m.setBenAddressId(BigInteger.valueOf(9));
m.setBenConsentId(BigInteger.valueOf(9));
m.setBenRegId(BigInteger.valueOf(9));
m.setBenRegId(Long.valueOf(9));
m.toString();
RMNCHMBeneficiarydetail benDetailsOBJ = new RMNCHMBeneficiarydetail();

Expand Down

0 comments on commit f6394a7

Please sign in to comment.