Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.iemr.common.identity.repo.rmnch;

import java.math.BigInteger;
import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
Expand All @@ -36,5 +37,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 List<RMNCHBornBirthDetails> getByRegID(@Param("benRegID") BigInteger 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 List<RMNCHCBACdetails> getByRegID(@Param("benRegID") BigInteger 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 @@ -118,7 +118,7 @@
private String fhirUrl;
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
@Override
public String syncDataToAmrit(String requestOBJ, String authorization) throws Exception {

Check failure on line 121 in src/main/java/com/iemr/common/identity/service/rmnch/RmnchDataSyncServiceImpl.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 144 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Identity-API&issues=AZ74HzmJdYTK1nMe01tu&open=AZ74HzmJdYTK1nMe01tu&pullRequest=170


Map<String, Object> resultMap = new HashMap<String, Object>();
Expand Down Expand Up @@ -223,9 +223,12 @@
for (RMNCHBornBirthDetails obj : bornBirthList) {
benRegID = rMNCHMBenRegIdMapRepo.getRegID(obj.getBenficieryid());
obj.setBenRegId(benRegID);
RMNCHBornBirthDetails temp = rMNCHBornBirthDetailsRepo.getByRegID(benRegID);
if (temp != null)
obj.setBornBirthDeatilsId(temp.getBornBirthDeatilsId());
if(!rMNCHBornBirthDetailsRepo.getByRegID(benRegID).isEmpty()){
RMNCHBornBirthDetails temp = rMNCHBornBirthDetailsRepo.getByRegID(benRegID).get(0);
if (temp != null)
obj.setBornBirthDeatilsId(temp.getBornBirthDeatilsId());
}

}
bornBirthList = (ArrayList<RMNCHBornBirthDetails>) rMNCHBornBirthDetailsRepo
.saveAll(bornBirthList);
Expand All @@ -246,9 +249,12 @@
obj.setConfirmed_tb("Not checked");
obj.setConfirmed_ncd_diseases("Not checked");
obj.setDiagnosis_status("pending");
RMNCHCBACdetails temp = rMNCHCBACDetailsRepo.getByRegID(benRegID);
if (temp != null)
obj.setCBACDetailsid(temp.getCBACDetailsid());
if(!rMNCHCBACDetailsRepo.getByRegID(benRegID).isEmpty()){
RMNCHCBACdetails temp = rMNCHCBACDetailsRepo.getByRegID(benRegID).get(0);
if (temp != null)
obj.setCBACDetailsid(temp.getCBACDetailsid());
}

}

cbacList = (ArrayList<RMNCHCBACdetails>) rMNCHCBACDetailsRepo.saveAll(cbacList);
Expand Down Expand Up @@ -667,10 +673,13 @@
benDetailsRMNCHOBJ = rMNCHBeneficiaryDetailsRmnchRepo
.getByRegID(m.getBenRegId()).get(0);
}
if(!rMNCHBornBirthDetailsRepo.getByRegID(m.getBenRegId()).isEmpty()){
benBotnBirthRMNCHROBJ = rMNCHBornBirthDetailsRepo.getByRegID(m.getBenRegId()).get(0);
}
if(!rMNCHCBACDetailsRepo.getByRegID(m.getBenRegId()).isEmpty()){
benCABCRMNCHROBJ = rMNCHCBACDetailsRepo.getByRegID(m.getBenRegId()).get(0);

benBotnBirthRMNCHROBJ = rMNCHBornBirthDetailsRepo.getByRegID(m.getBenRegId());

benCABCRMNCHROBJ = rMNCHCBACDetailsRepo.getByRegID(m.getBenRegId());
}
// 20-09-2021,start
NcdTbHrpData res = getHRP_NCD_TB_SuspectedStatus(m.getBenRegId().longValue(), authorisation,
benDetailsOBJ);
Expand Down
Loading