Skip to content
Merged
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 @@ -1110,6 +1110,7 @@ public List<ChronicDiseaseVisitDTO> saveChronicDiseaseVisit(
private void checkIncentive(ChronicDiseaseVisitEntity chronicDiseaseVisitEntity,Integer ashaId){
String userName = userRepo.getUserNamedByUserId(ashaId);
IncentiveActivity incentiveActivity = incentivesRepo.findIncentiveMasterByNameAndGroup("NCD_FOLLOWUP_TREATMENT", GroupName.NCD.getDisplayName());
logger.info("incentiveActivity:"+ incentiveActivity.getId());
if(incentiveActivity!=null){
if (chronicDiseaseVisitEntity.getFollowUpNo() != null
&& chronicDiseaseVisitEntity.getCreatedDate() != null
Expand Down Expand Up @@ -1149,15 +1150,16 @@ private void checkIncentive(ChronicDiseaseVisitEntity chronicDiseaseVisitEntity,

}

private void addNCDFolloupIncentiveRecord(IncentiveActivity activity, Integer ashaId,
private void addNCDFolloupIncentiveRecord(IncentiveActivity incentiveActivity, Integer ashaId,
Long benId, Timestamp createdDate, String userName) {
try {
IncentiveActivityRecord record = recordRepo
.findRecordByActivityIdCreatedDateBenId(activity.getId(), createdDate, benId);
.findRecordByActivityIdCreatedDateBenId(incentiveActivity.getId(), createdDate, benId);

Timestamp now = Timestamp.valueOf(LocalDateTime.now());
if(record==null){
record.setActivityId(activity.getId());
record = new IncentiveActivityRecord();
record.setActivityId(incentiveActivity.getId());
record.setCreatedDate(createdDate);
record.setCreatedBy(userName);
record.setStartDate(createdDate);
Expand All @@ -1166,7 +1168,7 @@ private void addNCDFolloupIncentiveRecord(IncentiveActivity activity, Integer as
record.setUpdatedBy(userName);
record.setBenId(benId);
record.setAshaId(ashaId);
record.setAmount(Long.valueOf(activity.getRate()));
record.setAmount(Long.valueOf(incentiveActivity.getRate()));
record .setIsEligible(true);
recordRepo.save(record);
}
Expand All @@ -1178,37 +1180,43 @@ record .setIsEligible(true);
}
@Override
public List<ChronicDiseaseVisitDTO> getCdtfVisits(GetBenRequestHandler getBenRequestHandler) {
List<ChronicDiseaseVisitDTO> dtoList = new ArrayList<>();

List<ChronicDiseaseVisitEntity> entityList = chronicDiseaseVisitRepository.findByUserID(getBenRequestHandler.getAshaId());
try {

List<ChronicDiseaseVisitDTO> dtoList = new ArrayList<>();
List<ChronicDiseaseVisitEntity> entityList = chronicDiseaseVisitRepository.findByUserID(getBenRequestHandler.getAshaId());

for (ChronicDiseaseVisitEntity entity : entityList) {

ChronicDiseaseVisitDTO dto = new ChronicDiseaseVisitDTO();
for (ChronicDiseaseVisitEntity entity : entityList) {

dto.setId(entity.getId());
dto.setBenId(entity.getBenId());
dto.setHhId(entity.getHhId());
dto.setFormId(entity.getFormId());
dto.setVersion(entity.getVersion());
dto.setVisitNo(entity.getVisitNo());
dto.setFollowUpNo(entity.getFollowUpNo());
if(entity.getFollowUpDate()!=null){
dto.setFollowUpDate(entity.getFollowUpDate());
ChronicDiseaseVisitDTO dto = new ChronicDiseaseVisitDTO();

}
dto.setDiagnosisCodes(entity.getDiagnosisCodes());
dto.setFormDataJson(entity.getFormDataJson());
dto.setId(entity.getId());
dto.setBenId(entity.getBenId());
dto.setHhId(entity.getHhId());
dto.setFormId(entity.getFormId());
dto.setVersion(entity.getVersion());
dto.setVisitNo(entity.getVisitNo());
dto.setFollowUpNo(entity.getFollowUpNo());
if(entity.getFollowUpDate()!=null){
dto.setFollowUpDate(entity.getFollowUpDate());

}
dto.setDiagnosisCodes(entity.getDiagnosisCodes());
dto.setFormDataJson(entity.getFormDataJson());

if (entity.getTreatmentStartDate() != null) {
dto.setTreatmentStartDate(
entity.getTreatmentStartDate().toString()
);
}
checkIncentive(entity,entity.getUserID());
dtoList.add(dto);
}
}catch (Exception e){

}

if (entity.getTreatmentStartDate() != null) {
dto.setTreatmentStartDate(
entity.getTreatmentStartDate().toString()
);
}
checkIncentive(entity,entity.getUserID());
dtoList.add(dto);
}
return dtoList;
}

Expand Down