From 938e5813f43cf5cf22190e043ed8be136c8f945a Mon Sep 17 00:00:00 2001 From: liquanyu Date: Tue, 25 Dec 2018 17:16:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=BD=95=E4=BA=A7=E6=A3=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lyms/platform/operate/web/Test.java | 23 +++++++ .../web/controller/PatientWeightController.java | 20 +++--- .../operate/web/controller/TestController.java | 10 +++ .../platform/operate/web/facade/LisFacade.java | 76 ++++++++++++---------- .../operate/web/service/PatientWeightService.java | 4 +- .../web/service/impl/PatientWeightServiceImpl.java | 36 ++++++++-- 6 files changed, 119 insertions(+), 50 deletions(-) diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java index 9c1eca2..5263698 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/Test.java @@ -162,6 +162,29 @@ public class Test { // System.out.println(tzzs); // System.out.println(df.format(tzzs)); + + System.out.println(getLevel(11)); + System.out.println(8&11); + + } + + + public static Integer getLevel(Integer total) { + if (total == null) { + return 0; + } else if (total == 0) { + return 0; + } else if ((total&8)==8) { + return 8; + } else if ((total&4)==4) { + return 4; + } else if ((total&1)==1) { + return 1; + } else if ((total&2)==2) { + return 2; + } else { + return 0; + } } public static void configData(BasicConfig bs, List basicConfigList,Map> slaveBasicConfigMap) { diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java index 825e734..19aa625 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java @@ -158,8 +158,8 @@ public class PatientWeightController extends BaseController { */ @ResponseBody @RequestMapping(value = "/last/check", method = RequestMethod.GET) - public BaseResponse patientLastCheck(String pid) { - return patientWeightService.lastCheckTime(pid); + public BaseResponse patientLastCheck(String pid,@RequestParam(required = false) String time) { + return patientWeightService.lastCheckTime(pid,time); } /** @@ -170,8 +170,8 @@ public class PatientWeightController extends BaseController { */ @ResponseBody @RequestMapping(value = "/recipe/info", method = RequestMethod.GET) - public BaseResponse patientRecipeInfo(String pid) { - return patientWeightService.patientRecipeInfo(pid, 2); + public BaseResponse patientRecipeInfo(String pid,@RequestParam(required = false) String time) { + return patientWeightService.patientRecipeInfo(pid, 2,time); } /** @@ -182,8 +182,8 @@ public class PatientWeightController extends BaseController { */ @ResponseBody @RequestMapping(value = "/suggest/info", method = RequestMethod.GET) - public BaseResponse patientSuggestInfo(String pid) { - return patientWeightService.patientRecipeInfo(pid, 3); + public BaseResponse patientSuggestInfo(String pid,@RequestParam(required = false) String time) { + return patientWeightService.patientRecipeInfo(pid, 3,time); } /** @@ -194,8 +194,8 @@ public class PatientWeightController extends BaseController { */ @ResponseBody @RequestMapping(value = "/guide/info", method = RequestMethod.GET) - public BaseResponse patientGuideInfo(String pid) { - return patientWeightService.patientRecipeInfo(pid, 1); + public BaseResponse patientGuideInfo(String pid,@RequestParam(required = false) String time) { + return patientWeightService.patientRecipeInfo(pid, 1,time); } /** @@ -206,8 +206,8 @@ public class PatientWeightController extends BaseController { */ @ResponseBody @RequestMapping(value = "/cookbook/info", method = RequestMethod.GET) - public BaseResponse patientCookbookInfo(String pid) { - return patientWeightService.patientRecipeInfo(pid, 4); + public BaseResponse patientCookbookInfo(String pid,@RequestParam(required = false) String time) { + return patientWeightService.patientRecipeInfo(pid, 4,time); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java index 13e6fd5..45e4270 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java @@ -3116,4 +3116,14 @@ public class TestController extends BaseController { } } + + @RequestMapping(value = "/his/getGkyyIdByIdCard", method = RequestMethod.GET) + @ResponseBody + public Map getGkyyIdByIdCard(@RequestParam(required = true) String vcCardNo) + { + Map map = new HashMap<>(); + map.put("id,","2134123412431"); + return map; + } + } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java index 36ec9f5..d8ca5df 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java @@ -258,43 +258,53 @@ public class LisFacade { lises = queryLisWhfyData(vcCardNo, cardNo,model); } else { - PatientsQuery patientsQuery = new PatientsQuery(); - String[] strs = new String[]{phone, vcCardNo, cardNo}; - patientsQuery.setPv(strs); - patientsQuery.setHospitalId(hospitalId); - patientsQuery.setYn(YnEnums.YES.getId()); - //通过医院id和就诊卡号或者手机号码查询到孕妇信息 - List list = patientsService.queryPatient(patientsQuery); - if (CollectionUtils.isNotEmpty(list)) { - Patients patients = list.get(0); - patientsQuery.setPid(patients.getPid()); - patientsQuery.setVcCardNo(null); - patientsQuery.setHospitalId(null); - patientsQuery.setPv(null); - - //通过上面就诊号查询到的人的所有建档记录 包括其他医院的建档记录 - list = patientsService.queryPatient(patientsQuery); - if (CollectionUtils.isNotEmpty(list)) { - for (Patients pat : list) { - if (pat != null && StringUtils.isNotEmpty(pat.getHospitalId())) { - if (StringUtils.isEmpty(pat.getVcCardNo()) && StringUtils.isEmpty(pat.getPhone()) && StringUtils.isEmpty(pat.getCardNo())) { - continue; - } + //秦皇岛港口医院 + if ("216".equals(hospitalId)) + { + //通过就诊卡号和医院id查询到医院下面的lis记录 + lises = queryLisData(vcCardNo, phone, cardNo,perType, model); + } + else + { + PatientsQuery patientsQuery = new PatientsQuery(); + String[] strs = new String[]{phone, vcCardNo, cardNo}; + patientsQuery.setPv(strs); + patientsQuery.setHospitalId(hospitalId); + patientsQuery.setYn(YnEnums.YES.getId()); + //通过医院id和就诊卡号或者手机号码查询到孕妇信息 + List list = patientsService.queryPatient(patientsQuery); + if (CollectionUtils.isNotEmpty(list)) { + Patients patients = list.get(0); + patientsQuery.setPid(patients.getPid()); + patientsQuery.setVcCardNo(null); + patientsQuery.setHospitalId(null); + patientsQuery.setPv(null); + + //通过上面就诊号查询到的人的所有建档记录 包括其他医院的建档记录 + list = patientsService.queryPatient(patientsQuery); + if (CollectionUtils.isNotEmpty(list)) { + for (Patients pat : list) { + if (pat != null && StringUtils.isNotEmpty(pat.getHospitalId())) { + + if (StringUtils.isEmpty(pat.getVcCardNo()) && StringUtils.isEmpty(pat.getPhone()) && StringUtils.isEmpty(pat.getCardNo())) { + continue; + } - //获取医院的名称 - hospitalName = hIdNames.get(pat.getHospitalId()); - if (!StringUtils.isNotEmpty(hospitalName)) { - organizationQuery.setId(Integer.parseInt(pat.getHospitalId())); - List hospitals = organizationService.queryOrganization(organizationQuery); - if (CollectionUtils.isNotEmpty(hospitals)) { - hospitalName = hospitals.get(0).getName(); - hIdNames.put(hospitals.get(0).getId() + "", hospitalName); + //获取医院的名称 + hospitalName = hIdNames.get(pat.getHospitalId()); + if (!StringUtils.isNotEmpty(hospitalName)) { + organizationQuery.setId(Integer.parseInt(pat.getHospitalId())); + List hospitals = organizationService.queryOrganization(organizationQuery); + if (CollectionUtils.isNotEmpty(hospitals)) { + hospitalName = hospitals.get(0).getName(); + hIdNames.put(hospitals.get(0).getId() + "", hospitalName); + } } + model.setHospitalId(pat.getHospitalId()); + //通过就诊卡号和医院id查询到医院下面的lis记录 + lises = queryLisData(pat.getVcCardNo(), pat.getPhone(), pat.getCardNo(),perType, model); } - model.setHospitalId(pat.getHospitalId()); - //通过就诊卡号和医院id查询到医院下面的lis记录 - lises = queryLisData(pat.getVcCardNo(), pat.getPhone(), pat.getCardNo(),perType, model); } } } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java index 36edc0e..67ae80f 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java @@ -13,9 +13,9 @@ public interface PatientWeightService extends IBaseService { BaseResponse findRiskDietaryPrinciples(String patientId); - BaseResponse lastCheckTime(String pid); + BaseResponse lastCheckTime(String pid,String time); BaseResponse init(); - BaseResponse patientRecipeInfo(String pid,Integer type); + BaseResponse patientRecipeInfo(String pid,Integer type,String time); BaseResponse addOrUpdate(Integer userId, PatientWeight patientWeight); BaseResponse list(String key, String vcCardNo, Integer currentWeekStart, Integer currentWeekEnd, Integer age, Integer page, Integer limit, Integer userId); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index a142f61..6c8f323 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -420,19 +420,29 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return patientWeight; } - public BaseResponse lastCheckTime(String pid) { + public BaseResponse lastCheckTime(String pid,String time) { PatientWeight patientWeight = queryPatientWeight(pid); Integer week = 0; if (null != patientWeight) { Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); if (patients != null) { - week = DateUtil.getWeek2(patients.getLastMenses(), patientWeight.getModified()); + + Date recordDate = patientWeight.getModified(); + Map dayWeights = patientWeight.getDayWeights(); + if (dayWeights != null && dayWeights.size() > 0) + { + if (StringUtils.isNotEmpty(dayWeights.get(time))) + { + recordDate = DateUtil.parseYMD(time); + } + } + week = DateUtil.getWeek2(patients.getLastMenses(), recordDate); } } return new BaseObjectResponse().setData(week).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); } - public BaseResponse patientRecipeInfo(String pid, Integer type) { + public BaseResponse patientRecipeInfo(String pid, Integer type,String time) { PatientWeight patientWeight = queryPatientWeight(pid); Map map = new LinkedHashMap<>(); if (null != patientWeight) { @@ -441,7 +451,23 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient Integer week = null; if (patients != null) { - week = DateUtil.getWeek2(patients.getLastMenses(), new Date()); + + String nowWeight = patientWeight.getNowWeight(); + Date recordDate = new Date(); + if (StringUtils.isNotEmpty(time)) + { + Map dayWeights = patientWeight.getDayWeights(); + if (dayWeights != null && dayWeights.size() > 0) + { + if (StringUtils.isNotEmpty(dayWeights.get(time))) + { + nowWeight = dayWeights.get(time); + recordDate = DateUtil.parseYMD(time); + } + } + } + + week = DateUtil.getWeek2(patients.getLastMenses(), recordDate); BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(org.getProvinceId()); if (week != null && StringUtils.isNotEmpty(patientWeight.getBmi())) { @@ -449,7 +475,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient if (week > 5 && week < 41) { double bmi = Double.parseDouble(patientWeight.getBmi()); Map kmap = getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()), - Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic()); + Double.parseDouble(nowWeight), week, bmi, patientWeight.getBregmatic()); if (1 == type) { setGuide(week, map,patientWeight.getHospitalId()); // 设置指南 -- 1.8.3.1