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 @@ -56,7 +56,7 @@ public ArrayList<BeneficiaryFlowStatus> getNurseWorklistNew(
+ " t.VisitCategory = :visitCategory, t.nurseFlag = :nurseFlag, t.doctorFlag = :docFlag, "
+ " t.labIteration = :labIteration, t.lab_technician_flag = 0, t.radiologist_flag = :radiologistFlag, "
+ " t.oncologist_flag = :oncologistFlag, t.benVisitDate = now(), "
+ " t.visitCode = :benVisitCode, t.processed = 'U', t.vanID =:vanID "
+ " t.visitCode = :benVisitCode, t.processed = 'U', t.vanID =:vanID, t.vanSerialNo=:benFlowID "
+ " WHERE t.benFlowID = :benFlowID AND t.beneficiaryRegID = :benRegID " + " AND nurseFlag = 1 ")
public int updateBenFlowStatusAfterNurseActivity(@Param("benFlowID") Long benFlowID,
@Param("benRegID") Long benRegID, @Param("benVisitID") Long benVisitID,
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/iemr/mmu/repo/nurse/BenVisitDetailRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,9 @@ public int updateFileID(@Param("fileIDs") String fileIDs, @Param("regID") Long r
@Query("SELECT MAX(bvd.createdDate) from BeneficiaryVisitDetail bvd WHERE bvd.beneficiaryRegID = :benRegID AND bvd.visitReason = :visitreason AND bvd.visitCategory = :visitcategory ")
public String getMaxCreatedDate(@Param("benRegID") Long benRegID, @Param("visitreason") String visitreason,@Param("visitcategory") String visitcategory);

@Transactional
@Modifying
@Query(" UPDATE BeneficiaryVisitDetail set vanSerialNo = :benVisitID WHERE benVisitID = :benVisitID")
int updateVanSerialNo(@Param("benVisitID") Long benVisitID);

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ public ArrayList<Object[]> getBenChiefComplaints(@Param("benRegID") Long benRegI
@Query(" Delete from BenChiefComplaint WHERE beneficiaryRegID = :benRegID AND visitCode = :visitCode")
public int deleteExistingBenChiefComplaints(@Param("benRegID") Long benRegID, @Param("visitCode") Long visitCode);

@Transactional
@Modifying
@Query(" UPDATE BenChiefComplaint set vanSerialNo = :benChiefComplaintID WHERE benChiefComplaintID = :benChiefComplaintID")
int updateVanSerialNo(@Param("benChiefComplaintID") Long benChiefComplaintID);
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public Long saveBenAncCareDetails(ANCCareDetails ancCareDetailsOBJ) throws Parse
}
ANCCareDetails ancCareDetailsRS = ancCareRepo.save(ancCareDetailsOBJ);
if (ancCareDetailsRS != null) {
ancCareDetailsRS.setVanSerialNo((ancCareDetailsRS.getID()));
ancCareSuccessFlag = ancCareDetailsRS.getID();
}
return ancCareSuccessFlag;
Expand All @@ -163,6 +164,7 @@ public Long saveAncImmunizationDetails(WrapperAncImmunization wrapperAncImmuniza
List<ANCWomenVaccineDetail> ancWomenVaccineDetailRSList = (List<ANCWomenVaccineDetail>) ancWomenVaccineRepo
.saveAll(ancWomenVaccineDetailList);
if (!ancWomenVaccineDetailRSList.isEmpty()) {
ancWomenVaccineDetailRSList.get(0).setVanSerialNo(ancWomenVaccineDetailRSList.get(0).getID());
successFlag = ancWomenVaccineDetailRSList.get(0).getID();
}
return successFlag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public int createBenFlowRecord(String requestOBJ, Long beneficiaryRegID, Long be

if (beneficiaryRegID != null && beneficiaryID != null && beneficiaryRegID > 0 && beneficiaryID > 0) {
objRS = beneficiaryFlowStatusRepo.save(obj);
obj.setVanSerialNo((objRS.getBenFlowID()));
if (objRS != null)
returnOBJ = 1;
else
Expand All @@ -91,6 +92,7 @@ public int createBenFlowRecord(String requestOBJ, Long beneficiaryRegID, Long be
returnOBJ = 3;
} else {
objRS = beneficiaryFlowStatusRepo.save(obj);
obj.setVanSerialNo((objRS.getBenFlowID()));
if (objRS != null)
returnOBJ = 1;
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public Long saveCancerDiagnosisData(CancerDiagnosis cancerDiagnosis) {

CancerDiagnosis response = cancerDiagnosisRepo.save(cancerDiagnosis);
if (response != null)
return response.getID();
{
response.setVanSerialNo(response.getID());
return response.getID();
}
else
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ public Integer saveDocFindings(WrapperAncFindings wrapperAncFindings) {
ArrayList<BenChiefComplaint> benChiefComplaintListRS = (ArrayList<BenChiefComplaint>) benChiefComplaintRepo
.saveAll(tmpBenCHiefComplaintsTMP);
if (tmpBenCHiefComplaintsTMP.size() == benChiefComplaintListRS.size()) {
for (BenChiefComplaint complaint : benChiefComplaintListRS) {
if (complaint.getBenChiefComplaintID() != null) {
benChiefComplaintRepo.updateVanSerialNo(complaint.getBenChiefComplaintID());
}
}
chiefComFlag = 1;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public Long saveBeneficiaryVisitDetails(BeneficiaryVisitDetail beneficiaryVisitD
beneficiaryVisitDetail.setReportFilePath(sb.toString());

response = benVisitDetailRepo.save(beneficiaryVisitDetail);
benVisitDetailRepo.updateVanSerialNo(response.getBenVisitID());

if (response != null) {
// Long visitCode = updateVisitCode(response, 10);
Expand Down Expand Up @@ -435,7 +436,14 @@ public int saveBenChiefComplaints(List<BenChiefComplaint> benChiefComplaintList)
List<BenChiefComplaint> benChiefComplaintResultList = (List<BenChiefComplaint>) benChiefComplaintRepo
.saveAll(benChiefComplaintListNew);
if (benChiefComplaintListNew.size() == benChiefComplaintResultList.size())
{
for (BenChiefComplaint complaint : benChiefComplaintResultList) {
if (complaint.getBenChiefComplaintID() != null) {
benChiefComplaintRepo.updateVanSerialNo(complaint.getBenChiefComplaintID());
}
}
r = 1;
}
} else {
r = 1;
}
Expand Down Expand Up @@ -2076,7 +2084,13 @@ public int updateBenChiefComplaints(List<BenChiefComplaint> benChiefComplaintLis
List<BenChiefComplaint> benChiefComplaintResultList = (List<BenChiefComplaint>) benChiefComplaintRepo
.saveAll(benChiefComplaintList);


if (!benChiefComplaintResultList.isEmpty()) {
for (BenChiefComplaint complaint : benChiefComplaintResultList) {
if (complaint.getBenChiefComplaintID() != null) {
benChiefComplaintRepo.updateVanSerialNo(complaint.getBenChiefComplaintID());
}
}
r = benChiefComplaintResultList.size();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
package com.iemr.mmu.service.dataSyncActivity;

import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -326,6 +327,13 @@ public int callCentralAPIToGenerateBenIDAndimportToLocal(String requestOBJ, Stri
String ServerAuthorization, String token) throws Exception {
int i = 0, i1 = 0;
try{
JSONObject originalRequest = new JSONObject(requestOBJ);
BigInteger vanID = null;
if (originalRequest.has("vanID")) {
vanID = originalRequest.getBigInteger("vanID");
}
logger.info("Extracted vanID from original request: " + vanID);

// Rest template
RestTemplate restTemplate = new RestTemplate();
HttpEntity<Object> request = RestTemplateUtil.createRequestEntity(requestOBJ, ServerAuthorization,"datasync");
Expand All @@ -340,10 +348,17 @@ public int callCentralAPIToGenerateBenIDAndimportToLocal(String requestOBJ, Stri
JSONObject obj = new JSONObject(response.getBody());
if (obj != null && obj.has("data") && obj.has("statusCode") && obj.getInt("statusCode") == 200) {
// Consume the response from API and call local identity api to save data
JSONObject localImportPayload = new JSONObject();
localImportPayload.put("vanID", vanID);
localImportPayload.put("benIDList", obj.get("data"));


logger.info("Authorization: " + Authorization);
logger.info("ServerAuthorization: " + ServerAuthorization);
HttpEntity<Object> request1 = RestTemplateUtil.createRequestEntity(obj.get("data").toString(), Authorization, token);
logger.info("Payload to local import: " + localImportPayload.toString());


HttpEntity<Object> request1 = RestTemplateUtil.createRequestEntity( localImportPayload.toString(), Authorization, token);
i = 1;
logger.info("Request to benImporturllocal: " + request1);
ResponseEntity<String> response1 = restTemplate.exchange(benImportUrlLocal, HttpMethod.POST, request1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private String startDataSync(int vanID, String user, String Authorization, Strin
// get data from DB to sync to server
List<Map<String, Object>> syncData = getDataToSync(obj.getSchemaName(), obj.getTableName(),
obj.getVanColumnName());
logger.debug("Fetched syncData for schema {} and table {}: {}", obj.getSchemaName(), obj.getTableName(),
logger.info("Fetched syncData for schema {} and table {}: {}", obj.getSchemaName(), obj.getTableName(),
objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(syncData));

if (syncData != null && syncData.size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class GetDataFromVanAndSyncToDBImpl implements GetDataFromVanAndSyncToDB
"t_sys_musculoskeletalsystem", "t_sys_genitourinarysystem"));

TABLE_GROUPS.put(4,
Arrays.asList("t_ancdiagnosis", "t_ncddiagnosis", "t_pncdiagnosis", "t_benchefcomplaint",
Arrays.asList("t_ancdiagnosis", "t_ncddiagnosis", "t_pncdiagnosis", "t_benchiefcomplaint",
"t_benclinicalobservation", "t_prescription", "t_prescribeddrug", "t_lab_testorder",
"t_benreferdetails"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
Expand Down Expand Up @@ -84,6 +86,8 @@ public class QuickConsultationServiceImpl implements QuickConsultationService {
@Autowired
private TeleConsultationServiceImpl teleConsultationServiceImpl;

private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());

@Autowired
public void setGeneralOPDDoctorServiceImpl(GeneralOPDDoctorServiceImpl generalOPDDoctorServiceImpl) {
this.generalOPDDoctorServiceImpl = generalOPDDoctorServiceImpl;
Expand Down Expand Up @@ -170,10 +174,18 @@ public Long saveBeneficiaryChiefComplaint(JsonObject caseSheet) {
if (benChiefComplaints != null && benChiefComplaints.size() > 0) {
List<BenChiefComplaint> chiefComplaints = (List<BenChiefComplaint>) benChiefComplaintRepo
.saveAll(benChiefComplaints);

if (benChiefComplaints.size() == chiefComplaints.size()) {
returnOBJ = new Long(1);
}
if (benChiefComplaints.size() == chiefComplaints.size()) {
// Update vanSerialNo for each saved record
for (BenChiefComplaint complaint : chiefComplaints) {
if (complaint.getBenChiefComplaintID() != null) {
benChiefComplaintRepo.updateVanSerialNo(complaint.getBenChiefComplaintID());
}
}
returnOBJ = new Long(1);
}
// if (benChiefComplaints.size() == chiefComplaints.size()) {
// returnOBJ = new Long(1);
// }
} else {
returnOBJ = new Long(1);
}
Expand Down