Skip to content

Commit

Permalink
Merge branch 'feature/version/upgrade' of https://github.com/PSMRI/MM…
Browse files Browse the repository at this point in the history
…U-API into feature/version/upgrade
  • Loading branch information
NKOKKILIGADDA87 committed Aug 11, 2024
2 parents 8092dfd + 9247fdc commit c904c6b
Show file tree
Hide file tree
Showing 16 changed files with 329 additions and 101 deletions.
19 changes: 1 addition & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,6 @@
<build>
<finalName>mmuapi-v3.0.0</finalName>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>9.0.8</version>
<configuration>
<format>HTML</format>
<nvdApiServerId>nvd</nvdApiServerId>
<nvdApiKey>79597933-f3cc-4601-949b-12513434ade3</nvdApiKey>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -421,4 +404,4 @@
</dependency>
</dependencies>
</dependencyManagement>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ public String saveBenANCNurseData(@RequestBody String requestObj) {
OutputResponse response = new OutputResponse();
try {
JsonObject jsnOBJ = parseJsonRequest(requestObj);

if (jsnOBJ != null) {
Long ancRes = ancService.saveANCNurseData(jsnOBJ);
if (null != ancRes && ancRes > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

import io.swagger.v3.oas.annotations.Operation;


/***
* @purpose Class used for data sync from van-to-server & server-to-van
*/
Expand All @@ -59,6 +58,7 @@ public class StartSyncActivity {
private DownloadDataFromServerTransactionalImpl downloadDataFromServerTransactionalImpl;
private static final String GROUP_ID = "groupID";
private static final String PROVIDER_SERVICE_MAP_ID = "providerServiceMapID";

@CrossOrigin()
@Operation(summary = "Start data sync from van to Server")
@PostMapping(value = { "/van-to-server" })
Expand All @@ -68,14 +68,13 @@ public String dataSyncToServer(@RequestBody String requestOBJ,
OutputResponse response = new OutputResponse();
try {
JSONObject obj = new JSONObject(requestOBJ);
if (obj.has(GROUP_ID) && obj.get(GROUP_ID) != null && obj.has("user")
&& obj.get("user") != null && obj.has("vanID") && obj.get("vanID") != null) {
String s = uploadDataToServerImpl.getDataToSyncToServer(obj.getInt("vanID"), obj.getInt(GROUP_ID),
obj.getString("user"), serverAuthorization);
if (s != null)
if (obj.has("user") && obj.get("user") != null && obj.has("vanID") && obj.get("vanID") != null) {
String s = uploadDataToServerImpl.getDataToSyncToServer(obj.getInt("vanID"), obj.getString("user"),
serverAuthorization);
// if (s != null)
response.setResponse(s);
else
response.setError(5000, "Error in data sync");
// else
// response.setError(5000, "Error in data sync");
} else {
response.setError(5000, "Invalid request, Either of groupID or user is invalid or null");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.iemr.mmu.controller.nurse.vitals;

import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import com.iemr.mmu.service.nurse.vitals.AnthropometryVitalsService;
import com.iemr.mmu.utils.response.OutputResponse;

import io.swagger.v3.oas.annotations.Operation;

@RestController
@CrossOrigin
@RequestMapping(value = "/anthropometryVitals", headers = "Authorization", consumes = "application/json", produces = "application/json")
public class AnthropometryVitalsController {

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

@Autowired
private AnthropometryVitalsService anthropometryVitalsService;

//Auto-patching height in anthropometry details
@CrossOrigin()
@Operation(summary = "Get beneficiary height details")
@PostMapping(value = { "/getBenHeightDetailsFrmNurse" })
public String getBenHeightDetailsFrmNurse(
@Param(value = "{\"benRegID\":\"Long\"}") @RequestBody String comingRequest) {
OutputResponse response = new OutputResponse();

logger.info("Request object for beneficiary height data fetching :" + comingRequest);
try {
JSONObject obj = new JSONObject(comingRequest);
if (obj.has("benRegID")) {
Long benRegID = obj.getLong("benRegID");

String res = anthropometryVitalsService.getBeneficiaryHeightDetails(benRegID);
response.setResponse(res);
} else {
logger.info("Invalid request");
response.setError(5000, "Invalid request");
}
logger.info("Beneficiary height data fetching Response:" + response);
} catch (Exception e) {
response.setError(5000, "Error while getting beneficiary height data");
logger.error("Error while getting beneficiary height data :" + e);
}
return response.toString();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Data;

import com.google.gson.annotations.Expose;

@Entity
@Data
@Table(name = "m_synctablegroup")
public class DataSyncGroups {
@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.google.gson.annotations.Expose;

@Entity
@Table(name = "db_iemr.m_synctabledetail")
@Table(name = "m_synctabledetail")
public class SyncUtilityClass {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ArrayList<Object[]> getBenReferDetails(@Param("benRegID") Long benRegID,
public String getBenReferDetailsStatus(@Param("benRegID") Long benRegID,
@Param("benVisitID") Long benVisitID);*/

@Query("SELECT benReferID, processed from BenReferDetails where beneficiaryRegID=:benRegID AND visitCode = :visitCode AND deleted=false")
@Query("SELECT benReferID, processed, serviceName from BenReferDetails where beneficiaryRegID=:benRegID AND visitCode = :visitCode AND deleted=false")
public ArrayList<Object[]> getBenReferDetailsStatus(@Param("benRegID") Long benRegID,
@Param("visitCode") Long visitCode);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,13 @@ public ArrayList<Object[]> getBenAnthropometryDetailForGraphtrends(
+ " WHERE beneficiaryRegID=:benRegID ORDER By ID DESC LIMIT 1 ")
public Double getBenLatestHeight(@Param("benRegID") Long benRegID);

@Query(nativeQuery = true, value = " SELECT visitCode FROM t_benvisitdetail "
+ " WHERE beneficiaryRegID=:benRegID ORDER By benvisitid desc limit 1 ")
public Long getBenLatestVisitCode(@Param("benRegID") Long benRegID);

@Query(nativeQuery = true, value = " SELECT Height_cm from ( "
+ " (select Height_cm from t_phy_anthropometry where visitCode=:visitCode)"
+ " union "
+"(select Height_cm from t_cancervitals where visitCode=:visitCode))a")
public Double getBenLatestHeightDetails(@Param("visitCode") Long visitCode);
}
Original file line number Diff line number Diff line change
Expand Up @@ -623,17 +623,13 @@ public String getCommonNurseMasterDataForGenopdAncNcdcarePnc(Integer visitCatego
public String getCommonDoctorMasterDataForGenopdAncNcdcarePnc(Integer visitCategoryID, int psmID, String gender,
Integer facilityID, Integer vanID) {
Map<String, Object> resMap = new HashMap<>();

ArrayList<Object[]> additionalServices = serviceMasterRepo.getAdditionalServices();
ArrayList<Object[]> instituteDetails = instituteRepo.getInstituteDetails(psmID);
resMap.put("higherHealthCare", Institute.getinstituteDetails(instituteDetails));
resMap.put("additionalServices", ServiceMaster.getServiceMaster(additionalServices));
if (visitCategoryID != 7) {
ArrayList<Object[]> counsellingTypes = counsellingTypeRepo.getCounsellingTypes();
ArrayList<Object[]> additionalServices = serviceMasterRepo.getAdditionalServices();
// Institute institute = new Institute();

ArrayList<Object[]> instituteDetails = instituteRepo.getInstituteDetails(psmID);
resMap.put("counsellingTypes", CounsellingType.getCounsellingType(counsellingTypes));
resMap.put("higherHealthCare", Institute.getinstituteDetails(instituteDetails));
resMap.put("additionalServices", ServiceMaster.getServiceMaster(additionalServices));

} else {
ArrayList<Object[]> procedures = procedureRepo.getProcedureMasterData(psmID, gender);
ArrayList<Object[]> ccList = chiefComplaintMasterRepo.getChiefComplaintMaster();
Expand All @@ -647,10 +643,10 @@ public String getCommonDoctorMasterDataForGenopdAncNcdcarePnc(Integer visitCateg
ArrayList<Object[]> ddumList = drugDurationUnitMasterRepo.getDrugDurationUnitMaster();
ArrayList<Object[]> dfrmList = drugFrequencyMasterRepo.getDrugFrequencyMaster();
ArrayList<Object[]> roaList = routeOfAdminRepo.getRouteOfAdminList();
ArrayList<ItemMaster> NonedlList=itemMasterRepo.searchEdl(psmID);
for(int i=0;i<NonedlList.size();i++)
ArrayList<ItemMaster> nonedlList=itemMasterRepo.searchEdl(psmID);
for(int i=0;i<nonedlList.size();i++)
{
NonedlList.get(i).setUnitOfMeasurement(NonedlList.get(i).getUom().getuOMName());
nonedlList.get(i).setUnitOfMeasurement(nonedlList.get(i).getUom().getuOMName());
}

ArrayList<V_DrugPrescription> itemList = new ArrayList<>();
Expand All @@ -668,7 +664,7 @@ public String getCommonDoctorMasterDataForGenopdAncNcdcarePnc(Integer visitCateg
resMap.put("drugFrequencyMaster", DrugFrequencyMaster.getDrugFrequencyMaster(dfrmList));
resMap.put("routeOfAdmin", RouteOfAdmin.getRouteOfAdminList(roaList));
resMap.put("itemMaster", itemList);
resMap.put("NonEdlMaster", NonedlList);
resMap.put("NonEdlMaster", nonedlList);

// NCD Care specific master data
if (visitCategoryID == 3) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,13 @@ public Long updateBenReferDetails(JsonObject referObj) throws IEMRException {
List<BenReferDetails> referDetailsList = new ArrayList<BenReferDetails>();

BenReferDetails referDetailsTemp = null;
List<String> serviceNamesList = new ArrayList<>();

ArrayList<Object[]> benReferDetailsStatuses = benReferDetailsRepo
.getBenReferDetailsStatus(referDetails.getBeneficiaryRegID(), referDetails.getVisitCode());

for (Object[] obj : benReferDetailsStatuses) {
serviceNamesList.add((String) obj[2]);
String processed = (String) obj[1];
if (null != processed && !"N".equals(processed)) {
processed = "U";
Expand All @@ -692,7 +694,7 @@ public Long updateBenReferDetails(JsonObject referObj) throws IEMRException {
if (referDetails.getRefrredToAdditionalServiceList() != null
&& referDetails.getRefrredToAdditionalServiceList().size() > 0) {
for (ServiceMaster sm : referDetails.getRefrredToAdditionalServiceList()) {
if (sm.getServiceName() != null) {
if (sm.getServiceName() != null && !serviceNamesList.contains(sm.getServiceName())) {
referDetailsTemp = new BenReferDetails();
referDetailsTemp.setBeneficiaryRegID(referDetails.getBeneficiaryRegID());
referDetailsTemp.setBenVisitID(referDetails.getBenVisitID());
Expand Down Expand Up @@ -726,11 +728,11 @@ public Long updateBenReferDetails(JsonObject referObj) throws IEMRException {
referDetailsList.add(referDetailsTemp);
}
}
} else {
if (referDetails.getReferredToInstituteName() != null || referDetails.getRevisitDate() != null || referDetails.getReferralReason() != null)
referDetailsList.add(referDetails);
TMReferred = 0;
}
} /*
* else { if (referDetails.getReferredToInstituteName() != null ||
* referDetails.getRevisitDate() != null || referDetails.getReferralReason() !=
* null) referDetailsList.add(referDetails); TMReferred = 0; }
*/

ArrayList<BenReferDetails> res = (ArrayList<BenReferDetails>) benReferDetailsRepo.saveAll(referDetailsList);
if (referDetailsList.size() == res.size()) {
Expand Down
Loading

0 comments on commit c904c6b

Please sign in to comment.