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
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: mvn -B package --file pom.xml

- name: Upload WAR file as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: TM-API
path: target/tmapi-v1.0.war
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@
import java.util.Map;

import org.json.JSONObject;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.http.HttpEntity;
Expand All @@ -40,6 +43,9 @@
import org.springframework.web.client.RestTemplate;

import com.google.gson.Gson;
import com.iemr.tm.utils.CookieUtil;

import jakarta.servlet.http.HttpServletRequest;

@Service
public class CSCarestreamServiceImpl implements CSCarestreamService {
Expand All @@ -49,16 +55,23 @@ public class CSCarestreamServiceImpl implements CSCarestreamService {
@Value("${carestreamOrderCreateURL}")
private String carestreamOrderCreateURL;

@Autowired
private CookieUtil cookieUtil;

@Override
public int createMamographyRequest(ArrayList<Object[]> benDataForCareStream, long benRegID, long benVisitID,
String Authorization) {
int responseData = 0;
RestTemplate restTemplate = new RestTemplate();
HttpServletRequest requestHeader = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
String jwtTokenFromCookie = cookieUtil.getJwtTokenFromCookie(requestHeader);
try {
// HttpHeaders headers = new HttpHeaders();
MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
headers.add("Content-Type", "application/json");
headers.add("AUTHORIZATION", Authorization);
headers.add("Cookie", "Jwttoken=" + jwtTokenFromCookie);
String requestOBJ = getOrderCreationRequestOBJ(benDataForCareStream, benRegID, benVisitID);

HttpEntity<Object> request = new HttpEntity<Object>(requestOBJ, headers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.google.gson.Gson;
import com.google.gson.JsonElement;
Expand Down Expand Up @@ -80,10 +82,13 @@
import com.iemr.tm.service.benFlowStatus.CommonBenStatusFlowServiceImpl;
import com.iemr.tm.service.snomedct.SnomedServiceImpl;
import com.iemr.tm.service.tele_consultation.SMSGatewayServiceImpl;
import com.iemr.tm.utils.CookieUtil;
import com.iemr.tm.utils.exception.IEMRException;
import com.iemr.tm.utils.mapper.InputMapper;
import com.iemr.tm.utils.mapper.OutputMapper;

import jakarta.servlet.http.HttpServletRequest;

@Service
@PropertySource("classpath:application.properties")
public class CommonDoctorServiceImpl {
Expand Down Expand Up @@ -120,6 +125,8 @@ public class CommonDoctorServiceImpl {
private SMSGatewayServiceImpl sMSGatewayServiceImpl;
@Autowired
private FoetalMonitorRepo foetalMonitorRepo;
@Autowired
private CookieUtil cookieUtil;

@Autowired
public void setSnomedServiceImpl(SnomedServiceImpl snomedServiceImpl) {
Expand Down Expand Up @@ -519,7 +526,6 @@ public String getPrescribedDrugs(Long beneficiaryRegID, Long visitCode) {
return new Gson().toJson(prescribedDrugs);
}


public String getReferralDetails(Long beneficiaryRegID, Long visitCode) {
ArrayList<Object[]> resList = benReferDetailsRepo.getBenReferDetails(beneficiaryRegID, visitCode);

Expand Down Expand Up @@ -711,7 +717,8 @@ public int updateBenFlowtableAfterDocDataSave(CommonUtilityClass commonUtilityCl

if (commonUtilityClass != null && commonUtilityClass.getVisitCategoryID() != null
&& commonUtilityClass.getVisitCategoryID() == 4) {
ArrayList<FoetalMonitor> foetalMonitorData = foetalMonitorRepo.getFoetalMonitorDetailsByFlowId(tmpBenFlowID);
ArrayList<FoetalMonitor> foetalMonitorData = foetalMonitorRepo
.getFoetalMonitorDetailsByFlowId(tmpBenFlowID);
if (foetalMonitorData.size() > 0) {
labTechnicianFlag = 3;
for (FoetalMonitor data : foetalMonitorData) {
Expand Down Expand Up @@ -769,7 +776,6 @@ public int updateBenFlowtableAfterDocDataSave(CommonUtilityClass commonUtilityCl

int i = 0;


if (commonUtilityClass != null && commonUtilityClass.getIsSpecialist() != null
&& commonUtilityClass.getIsSpecialist() == true) {
// updating lab technician flag as well after feto sense
Expand Down Expand Up @@ -857,7 +863,8 @@ public int updateBenFlowtableAfterDocDataUpdate(CommonUtilityClass commonUtility
// Foetal monitor related update in visitcode and lab flag
if (commonUtilityClass != null && commonUtilityClass.getVisitCategoryID() != null
&& commonUtilityClass.getVisitCategoryID() == 4) {
ArrayList<FoetalMonitor> foetalMonitorData = foetalMonitorRepo.getFoetalMonitorDetailsByFlowId(tmpBenFlowID);
ArrayList<FoetalMonitor> foetalMonitorData = foetalMonitorRepo
.getFoetalMonitorDetailsByFlowId(tmpBenFlowID);
if (foetalMonitorData.size() > 0) {
labTechnicianFlag = 3;
for (FoetalMonitor data : foetalMonitorData) {
Expand Down Expand Up @@ -940,7 +947,7 @@ public int updateBenFlowtableAfterDocDataUpdate(CommonUtilityClass commonUtility

}

//TM Prescription SMS
// TM Prescription SMS
if (commonUtilityClass.getIsSpecialist() == true) {
if (tcSpecialistFlag == 9) {
if (commonUtilityClass.getPrescriptionID() != null)
Expand Down Expand Up @@ -982,9 +989,13 @@ public int callTmForSpecialistSlotBook(TcSpecialistSlotBookingRequestOBJ tcSpeci
String requestOBJ = OutputMapper.gson().toJson(tcSpecialistSlotBookingRequestOBJ);

RestTemplate restTemplate = new RestTemplate();
HttpServletRequest requestHeader = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
String jwtTokenFromCookie = cookieUtil.getJwtTokenFromCookie(requestHeader);
MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
headers.add("Content-Type", "application/json");
headers.add("AUTHORIZATION", Authorization);
headers.add("Cookie", "Jwttoken=" + jwtTokenFromCookie);
HttpEntity<Object> request = new HttpEntity<Object>(requestOBJ, headers);
ResponseEntity<String> response = restTemplate.exchange(tcSpecialistSlotBook, HttpMethod.POST, request,
String.class);
Expand Down Expand Up @@ -1042,8 +1053,8 @@ public void createTMPrescriptionSms(CommonUtilityClass commonUtilityClass) throw

public String getFoetalMonitorData(Long beneFiciaryRegID, Long visitCode) {

ArrayList<FoetalMonitor> foetalMonitorData = foetalMonitorRepo.getFoetalMonitorDetailsForCaseRecord(beneFiciaryRegID,
visitCode);
ArrayList<FoetalMonitor> foetalMonitorData = foetalMonitorRepo
.getFoetalMonitorDetailsForCaseRecord(beneFiciaryRegID, visitCode);

return new Gson().toJson(foetalMonitorData);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.gson.Gson;
Expand All @@ -62,9 +64,12 @@
import com.iemr.tm.service.pnc.PNCServiceImpl;
import com.iemr.tm.service.quickConsultation.QuickConsultationServiceImpl;
import com.iemr.tm.service.tele_consultation.TeleConsultationServiceImpl;
import com.iemr.tm.utils.CookieUtil;
import com.iemr.tm.utils.exception.IEMRException;
import com.iemr.tm.utils.mapper.InputMapper;

import jakarta.servlet.http.HttpServletRequest;

@Service
@PropertySource("classpath:application.properties")
public class CommonServiceImpl implements CommonService {
Expand Down Expand Up @@ -94,6 +99,8 @@ public class CommonServiceImpl implements CommonService {

@Autowired
private BenVisitDetailRepo benVisitDetailRepo;
@Autowired
private CookieUtil cookieUtil;

@Autowired
public void setCsServiceImpl(CSServiceImpl csServiceImpl) {
Expand Down Expand Up @@ -139,13 +146,14 @@ public void setAncServiceImpl(ANCServiceImpl ancServiceImpl) {
public void setBeneficiaryFlowStatusRepo(BeneficiaryFlowStatusRepo beneficiaryFlowStatusRepo) {
this.beneficiaryFlowStatusRepo = beneficiaryFlowStatusRepo;
}

@Autowired
public void setNcdScreeningServiceImpl(NCDScreeningServiceImpl ncdScreeningServiceImpl) {
this.ncdScreeningServiceImpl = ncdScreeningServiceImpl;
}

public String getCaseSheetPrintDataForBeneficiary(BeneficiaryFlowStatus benFlowOBJ, String Authorization) throws JsonProcessingException, ParseException {
public String getCaseSheetPrintDataForBeneficiary(BeneficiaryFlowStatus benFlowOBJ, String Authorization)
throws JsonProcessingException, ParseException {
String visitCategory = benFlowOBJ.getVisitCategory();
String caseSheetData = null;

Expand Down Expand Up @@ -182,7 +190,7 @@ public String getCaseSheetPrintDataForBeneficiary(BeneficiaryFlowStatus benFlowO
case "NCD screening": {
caseSheetData = getNCDScreening_PrintData(benFlowOBJ);
}
break;
break;
default: {
caseSheetData = "Invalid VisitCategory";
}
Expand Down Expand Up @@ -228,7 +236,8 @@ private String getCancerScreening_PrintData(BeneficiaryFlowStatus benFlowOBJ) {
return caseSheetData.toString();
}

private String getGenOPD_PrintData(BeneficiaryFlowStatus benFlowOBJ) throws JsonProcessingException, ParseException {
private String getGenOPD_PrintData(BeneficiaryFlowStatus benFlowOBJ)
throws JsonProcessingException, ParseException {
Map<String, Object> caseSheetData = new HashMap<>();

caseSheetData.put("nurseData", generalOPDServiceImpl.getBenGeneralOPDNurseData(benFlowOBJ.getBeneficiaryRegID(),
Expand All @@ -245,7 +254,8 @@ private String getGenOPD_PrintData(BeneficiaryFlowStatus benFlowOBJ) throws Json
return caseSheetData.toString();
}

private String getNCDcare_PrintData(BeneficiaryFlowStatus benFlowOBJ) throws JsonProcessingException, ParseException {
private String getNCDcare_PrintData(BeneficiaryFlowStatus benFlowOBJ)
throws JsonProcessingException, ParseException {
Map<String, Object> caseSheetData = new HashMap<>();

caseSheetData.put("nurseData", ncdCareServiceImpl.getBenNCDCareNurseData(benFlowOBJ.getBeneficiaryRegID(),
Expand Down Expand Up @@ -296,7 +306,8 @@ private String getQC_PrintData(BeneficiaryFlowStatus benFlowOBJ) throws JsonProc
return caseSheetData.toString();
}

private String getCovid19_PrintData(BeneficiaryFlowStatus benFlowOBJ) throws JsonProcessingException, ParseException {
private String getCovid19_PrintData(BeneficiaryFlowStatus benFlowOBJ)
throws JsonProcessingException, ParseException {
Map<String, Object> caseSheetData = new HashMap<>();

caseSheetData.put("nurseData", covid19ServiceImpl.getBenCovidNurseData(benFlowOBJ.getBeneficiaryRegID(),
Expand All @@ -312,15 +323,16 @@ private String getCovid19_PrintData(BeneficiaryFlowStatus benFlowOBJ) throws Jso

return caseSheetData.toString();
}

private String getNCDScreening_PrintData(BeneficiaryFlowStatus benFlowOBJ) throws JsonProcessingException, ParseException {

private String getNCDScreening_PrintData(BeneficiaryFlowStatus benFlowOBJ)
throws JsonProcessingException, ParseException {
Map<String, Object> caseSheetData = new HashMap<>();

caseSheetData.put("nurseData", ncdScreeningServiceImpl.getBenNCDScreeningNurseData(benFlowOBJ.getBeneficiaryRegID(),
benFlowOBJ.getBenVisitCode()));
caseSheetData.put("nurseData", ncdScreeningServiceImpl
.getBenNCDScreeningNurseData(benFlowOBJ.getBeneficiaryRegID(), benFlowOBJ.getBenVisitCode()));

caseSheetData.put("doctorData", ncdScreeningServiceImpl
.getBenCaseRecordFromDoctorNCDScreening(benFlowOBJ.getBeneficiaryRegID(), benFlowOBJ.getBenVisitCode()));
caseSheetData.put("doctorData", ncdScreeningServiceImpl.getBenCaseRecordFromDoctorNCDScreening(
benFlowOBJ.getBeneficiaryRegID(), benFlowOBJ.getBenVisitCode()));

caseSheetData.put("BeneficiaryData",
getBenDetails(benFlowOBJ.getBenFlowID(), benFlowOBJ.getBeneficiaryRegID()));
Expand Down Expand Up @@ -387,17 +399,16 @@ public String getFamilyHistoryData(Long beneficiaryRegID) {
return commonNurseServiceImpl.fetchBenPersonalFamilyHistory(beneficiaryRegID);
}
/// ------- End of Fetch beneficiary all Family history data ------

public String getProviderSpecificData(String request) throws IEMRException {
return commonNurseServiceImpl.fetchProviderSpecificdata(request);
}

// ------- Fetch beneficiary all Physical history data ---------------
public String getBenPhysicalHistory(Long beneficiaryRegID) {
return commonNurseServiceImpl.fetchBenPhysicalHistory(beneficiaryRegID);
public String getBenPhysicalHistory(Long beneficiaryRegID) {
return commonNurseServiceImpl.fetchBenPhysicalHistory(beneficiaryRegID);
}
/// ------- End of Fetch beneficiary all Physical history data ------



// ------- Fetch beneficiary all Menstrual history data -----------
public String getMenstrualHistoryData(Long beneficiaryRegID) {
Expand Down Expand Up @@ -499,8 +510,8 @@ public TeleconsultationRequestOBJ createTcRequest(JsonObject requestOBJ, CommonU
tRequestModel.setBeneficiaryRegID(commonUtilityClass.getBeneficiaryRegID());
tRequestModel.setProviderServiceMapID(commonUtilityClass.getProviderServiceMapID());
tRequestModel.setVisitCode(commonUtilityClass.getVisitCode());
if(commonUtilityClass.getBenVisitID() != null)
tRequestModel.setBenVisitID(commonUtilityClass.getBenVisitID());
if (commonUtilityClass.getBenVisitID() != null)
tRequestModel.setBenVisitID(commonUtilityClass.getBenVisitID());

tRequestModel.setUserID(tcRequestOBJ.getUserID());
tRequestModel.setSpecializationID(tcRequestOBJ.getSpecializationID());
Expand Down Expand Up @@ -540,6 +551,9 @@ public TeleconsultationRequestOBJ createTcRequest(JsonObject requestOBJ, CommonU

public String getOpenKMDocURL(String requestOBJ, String Authorization) throws JSONException {
RestTemplate restTemplate = new RestTemplate();
HttpServletRequest requestHeader = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
String jwtTokenFromCookie = cookieUtil.getJwtTokenFromCookie(requestHeader);
String fileUUID = null;
JSONObject obj = new JSONObject(requestOBJ);
if (obj.has("fileID")) {
Expand All @@ -552,6 +566,7 @@ public String getOpenKMDocURL(String requestOBJ, String Authorization) throws JS
MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
headers.add("Content-Type", "application/json");
headers.add("AUTHORIZATION", Authorization);
headers.add("Cookie", "Jwttoken=" + jwtTokenFromCookie);
HttpEntity<Object> request = new HttpEntity<Object>(requestBody, headers);
ResponseEntity<String> response = restTemplate.exchange(openkmDocUrl, HttpMethod.POST, request,
String.class);
Expand All @@ -562,25 +577,23 @@ public String getOpenKMDocURL(String requestOBJ, String Authorization) throws JS
return null;

}

@Override
public String getBenSymptomaticQuestionnaireDetailsData(Long beneficiaryRegID) throws Exception {
return commonNurseServiceImpl.getBenSymptomaticData(beneficiaryRegID);

}

@Override
public String getBenPreviousDiabetesData(Long beneficiaryRegID) throws Exception {
return commonNurseServiceImpl.getBenPreviousDiabetesData(beneficiaryRegID);

}

@Override
public String getBenPreviousReferralData(Long beneficiaryRegID) throws Exception {
return commonNurseServiceImpl.getBenPreviousReferralData(beneficiaryRegID);

}



}
Loading