diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/FetalEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/FetalEnums.java index 7c1218b..53874ef 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/FetalEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/FetalEnums.java @@ -24,6 +24,17 @@ public enum FetalEnums { return null; } + public static String getTitle2(String id){ + if (StringUtils.isNotEmpty(id)){ + for (FetalEnums fetalEnums:FetalEnums.values()){ + if (fetalEnums.getId().equals(id)){ + return fetalEnums.getName(); + } + } + } + return "--"; + } + private FetalEnums(String name,String id){ this.name=name; this.id=id; diff --git a/platform-common/src/main/java/com/lyms/platform/common/enums/FuZhongEnums.java b/platform-common/src/main/java/com/lyms/platform/common/enums/FuZhongEnums.java index 24ed25a..3748897 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/enums/FuZhongEnums.java +++ b/platform-common/src/main/java/com/lyms/platform/common/enums/FuZhongEnums.java @@ -13,6 +13,17 @@ public enum FuZhongEnums { this.id=id; this.name=name; } + + public static String getName(String id) { + FuZhongEnums[] values = FuZhongEnums.values(); + for (FuZhongEnums value : values) { + if(value.getId().equals(id)) { + return value.getName(); + } + } + return "--"; + } + private String id; private String name; diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java index f66adbe..2315cff 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ReportController.java @@ -9,10 +9,7 @@ import com.lyms.platform.operate.web.service.IReportService; import com.lyms.platform.operate.web.utils.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +28,16 @@ public class ReportController extends BaseController { @Autowired private IReportService reportService; + + /** + * 聊城曲线图 + */ + @ResponseBody + @RequestMapping(value = "/health/{parentId}", method = RequestMethod.GET) + public BaseObjectResponse health(@PathVariable String parentId) { + return reportService.health(parentId); + } + /** * 建档统计 * @param statistType 1=占比 2=环比 diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RemoteFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RemoteFacade.java index 05df327..b1de90c 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RemoteFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RemoteFacade.java @@ -52,7 +52,7 @@ public class RemoteFacade { if(StringUtils.isNotEmpty(bpStatus)) { patients = (patients == null ? mongoTemplate.findById(bloodPressure.getParentId(), Patients.class) : patients); setTempInfo(bloodPressure.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, - entry.getValue().get("ssy") + "/" + entry.getValue().get("szy") + "mmHg", bpStatus, "(收缩压:90-140 舒张压:60-90)", ErrorPatientEnums.BLOOD_PRESSURE, bloodPressure.getModified()); + entry.getValue().get("ssy") + "/" + entry.getValue().get("szy"), bpStatus, "(收缩压:90-140 舒张压:60-90)", ErrorPatientEnums.BLOOD_PRESSURE, bloodPressure.getModified()); } } } @@ -132,7 +132,7 @@ public class RemoteFacade { if(DateUtil.parseYMD(entry.getKey()).getTime() >= yesterday.getTime()) { if(entry.getValue() < 36D || entry.getValue() > 38.5D ) { patients = (patients == null ? mongoTemplate.findById(tempModel.getParentId(), Patients.class) : patients); - setTempInfo(tempModel.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, entry.getValue() + " °C", entry.getValue() < 36D ? "低热" : "高热", + setTempInfo(tempModel.getId() + ID_SEPARATOR + entry.getKey(), temp, patients, entry.getValue() + "", entry.getValue() < 36D ? "低热" : "高热", "(36-37.4)", ErrorPatientEnums.TEMP, tempModel.getModified()); } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java index 30b0065..1b76088 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IReportService.java @@ -103,4 +103,6 @@ public interface IReportService extends IBaseService { void patientsExport(String provinceId, String cityId, String aredId, String streetId, Integer statistType, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId, HttpServletResponse response); void patientsExport2(String provinceId, String cityId, String areaId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId, HttpServletResponse response); + + BaseObjectResponse health(String parentId); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java index 73d71b6..ba7e543 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java @@ -1,9 +1,12 @@ package com.lyms.platform.operate.web.service.impl; import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.lyms.hospitalapi.pojo.ReportModel; import com.lyms.platform.biz.service.CommonService; import com.lyms.platform.common.enums.CouponEnums; +import com.lyms.platform.common.enums.FetalEnums; +import com.lyms.platform.common.enums.FuZhongEnums; import com.lyms.platform.common.result.BaseObjectResponse; import com.lyms.platform.common.result.PageResult; import com.lyms.platform.common.result.RespBuilder; @@ -589,6 +592,85 @@ public class ReportServiceImpl extends BaseServiceImpl implements IReportService ResponseUtil.responseExcel(cnames, results, response); } + @Override + public BaseObjectResponse health(String parentId) { + List> restList = new ArrayList<>(); + Patients p = mongoTemplate.findById(parentId, Patients.class); + AntExChuModel antExChuModel = mongoTemplate.findOne(Query.query(Criteria.where("parentId").is(parentId).and("yn").is(1).and("hospitalId").is("216")).with(new Sort(Sort.Direction.DESC, "checkTime")), AntExChuModel.class); + List antexModels = mongoTemplate.find(Query.query(Criteria.where("parentId").is(parentId).and("yn").is(1)).with(new Sort(Sort.Direction.DESC, "checkTime")), AntenatalExaminationModel.class); + +// antExChuModels.get() + + for (AntenatalExaminationModel antexModel : antexModels) { + Map temp = new HashMap<>(); + temp.put("checkTime", DateUtil.getyyyy_MM_dd(antexModel.getCheckDate())); + temp.put("week", DateUtil.getWeek(p.getLastMenses(), antexModel.getCheckDate())); + temp.put("weight", antexModel.getWeight()); + temp.put("bp", JSONObject.parseObject(antexModel.getBp()).getString("ssy") + "/" + JSONObject.parseObject(antexModel.getBp()).getString("szy")); + temp.put("gonggao", antexModel.getGongGao()); + temp.put("abdominalCircumference", antexModel.getAbdominalCircumference());// 腹围 + + List tireData = antexModel.getTireData(); + String fetalPosition = ""; + String heartRate = ""; + String fetalPresentation = ""; + if(CollectionUtils.isNotEmpty(tireData)) { + for (Map tireDatum : tireData) { + fetalPosition = fetalPosition.length() > 0 ? "/" + tireDatum.get("fetalPosition") : tireDatum.get("fetalPosition") + ""; + heartRate = heartRate.length() > 0 ? "/" + tireDatum.get("heartRate") : tireDatum.get("heartRate") + ""; + fetalPresentation = fetalPresentation.length() > 0 ? "/" + FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")) : FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")); + } + } else { + fetalPosition = "--"; + heartRate = "--"; + fetalPresentation = "--"; + } + temp.put("fetalPosition", fetalPosition); // 胎位 + temp.put("heartRate", heartRate); // 胎心 + temp.put("fetalPresentation", fetalPresentation); // 先露 + temp.put("edema",FuZhongEnums.getName(antexModel.getEdema())); // 水肿 + temp.put("urineProtein", antexModel.getUrineProtein()); // 尿蛋白 + temp.put("hemoglobin", antexModel.getHemoglobin()); // 血红素 + restList.add(temp); + } + + // 添加初诊list + Map temp = new HashMap<>(); + temp.put("checkTime", DateUtil.getyyyy_MM_dd(antExChuModel.getCheckTime())); + temp.put("week", DateUtil.getWeek(p.getLastMenses(), antExChuModel.getCheckTime())); + temp.put("weight", antExChuModel.getWeight()); + temp.put("bp", JSONObject.parseObject(antExChuModel.getBp()).getString("ssy") + "/" + JSONObject.parseObject(antExChuModel.getBp()).getString("szy")); + temp.put("gonggao", antExChuModel.getGonggao()); + temp.put("abdominalCircumference", antExChuModel.getFuwei());// 腹围 + + List tireData = antExChuModel.getPlacentas(); + String fetalPosition = ""; + String heartRate = ""; + String fetalPresentation = ""; + if(CollectionUtils.isNotEmpty(tireData)) { + for (Map tireDatum : tireData) { + fetalPosition = fetalPosition.length() > 0 ? "/" + tireDatum.get("fetalPosition") : tireDatum.get("fetalPosition") + ""; + heartRate = heartRate.length() > 0 ? "/" + tireDatum.get("heartRate") : tireDatum.get("heartRate") + ""; + fetalPresentation = fetalPresentation.length() > 0 ? "/" + FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")) : FetalEnums.getTitle2((String) tireDatum.get("fetalPosition")); + } + } else { + fetalPosition = "--"; + heartRate = "--"; + fetalPresentation = "--"; + } + + temp.put("fetalPosition", fetalPosition); // 胎位 + temp.put("heartRate", heartRate); // 胎心 + temp.put("fetalPresentation", fetalPresentation); // 先露 + temp.put("edema",FuZhongEnums.getName(antExChuModel.getEdema())); // 水肿 + temp.put("urineProtein", antExChuModel.getNdb()); // 尿蛋白 + temp.put("hemoglobin", antExChuModel.getXhdb()); // 血红素 + restList.add(temp); + + + return RespBuilder.buildSuccess(restList); + } + private List getPatients(String provinceId, String cityId, String aredId, String streetId, Integer ageType, Integer patientType, Date startDate, Date endDate, Integer userId) { List> hospitalInfos = mongoUtil.getHospitals(userId, provinceId, cityId, aredId, streetId);