Commit ec799075e4deb519f0939e3e470a496ba0475444

Authored by liquanyu
1 parent d8a8bceb54

体重管理

Showing 7 changed files with 242 additions and 7 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java View file @ ec79907
... ... @@ -341,6 +341,17 @@
341 341 //承德 病人id
342 342 private String blNum;
343 343  
  344 + //面部信息
  345 + private String face;
  346 +
  347 + public String getFace() {
  348 + return face;
  349 + }
  350 +
  351 + public void setFace(String face) {
  352 + this.face = face;
  353 + }
  354 +
344 355 public String getBlNum() {
345 356 return blNum;
346 357 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MeasureInfoController.java View file @ ec79907
... ... @@ -140,15 +140,46 @@
140 140 * @param request
141 141 * @return
142 142 */
143   - @RequestMapping(method = RequestMethod.POST, value = "/addtNutritionInfo")
  143 + @RequestMapping(method = RequestMethod.POST, value = "/addNutritionInfo")
144 144 @ResponseBody
145   - public BaseObjectResponse addtNutritionInfo(@RequestBody NutritionInfoRequest nutritionInfoRequest,
  145 + public BaseObjectResponse addNutritionInfo(@RequestBody NutritionInfoRequest nutritionInfoRequest,
146 146 HttpServletRequest request
147 147 )
148 148 {
149   - return measureInfoFacade.addtNutritionInfo(nutritionInfoRequest);
  149 + return measureInfoFacade.addNutritionInfo(nutritionInfoRequest);
150 150 }
151 151  
  152 +
  153 + /**
  154 + * 获取面部信息
  155 + * @param patientId
  156 + * @param request
  157 + * @return
  158 + */
  159 + @RequestMapping(method = RequestMethod.GET, value = "/getFaceInfo")
  160 + @ResponseBody
  161 + public BaseObjectResponse getFaceInfo(@RequestParam(value = "patientId", required = true) String patientId,
  162 + HttpServletRequest request
  163 + )
  164 + {
  165 + return measureInfoFacade.getFaceInfo(patientId);
  166 + }
  167 +
  168 +
  169 + /**
  170 + * 添加面部信息
  171 + * @param nutritionInfoRequest
  172 + * @param request
  173 + * @return
  174 + */
  175 + @RequestMapping(method = RequestMethod.POST, value = "/addFaceInfo")
  176 + @ResponseBody
  177 + public BaseResponse addFaceInfo(@RequestBody NutritionInfoRequest nutritionInfoRequest,
  178 + HttpServletRequest request
  179 + )
  180 + {
  181 + return measureInfoFacade.addFaceInfo(nutritionInfoRequest);
  182 + }
152 183  
153 184  
154 185  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MeasureInfoFacade.java View file @ ec79907
... ... @@ -8,13 +8,16 @@
8 8 import com.lyms.platform.common.result.BaseListResponse;
9 9 import com.lyms.platform.common.result.BaseObjectResponse;
10 10 import com.lyms.platform.common.result.BaseResponse;
  11 +import com.lyms.platform.common.result.RespBuilder;
11 12 import com.lyms.platform.common.utils.DateUtil;
12 13 import com.lyms.platform.common.utils.ExceptionUtils;
13 14 import com.lyms.platform.operate.web.request.MeasureInfoRequest;
14 15 import com.lyms.platform.operate.web.request.NutritionInfoRequest;
15 16 import com.lyms.platform.operate.web.result.MeasureBaseInfoResult;
16 17 import com.lyms.platform.operate.web.result.MeasureInfoResult;
  18 +import com.lyms.platform.operate.web.service.PatientWeightService;
17 19 import com.lyms.platform.operate.web.utils.CommonsHelper;
  20 +import com.lyms.platform.permission.dao.master.CouponMapper;
18 21 import com.lyms.platform.permission.model.Organization;
19 22 import com.lyms.platform.permission.service.MeasureDataInfoService;
20 23 import com.lyms.platform.permission.service.MeasureUserInfoService;
... ... @@ -22,6 +25,7 @@
22 25 import com.lyms.platform.pojo.*;
23 26 import com.lyms.platform.query.*;
24 27 import org.apache.commons.collections.CollectionUtils;
  28 +import org.apache.commons.collections.MapUtils;
25 29 import org.apache.commons.dbutils.DbUtils;
26 30 import org.apache.commons.dbutils.QueryRunner;
27 31 import org.apache.commons.dbutils.handlers.BeanListHandler;
... ... @@ -31,6 +35,7 @@
31 35 import org.springframework.data.mongodb.core.query.Query;
32 36 import org.springframework.stereotype.Component;
33 37  
  38 +import java.math.BigDecimal;
34 39 import java.sql.Connection;
35 40 import java.util.*;
36 41  
37 42  
... ... @@ -58,8 +63,13 @@
58 63 @Autowired
59 64 private AntenatalExaminationService antenatalExaminationService;
60 65  
  66 + @Autowired
  67 + private PatientWeightService patientWeightService;
61 68  
62 69 @Autowired
  70 + private CouponMapper couponMapper;
  71 +
  72 + @Autowired
63 73 private BasicConfigService basicConfigService;
64 74  
65 75 private static String[] blood_item = new String[]{"--","--","--","--","--","--","--","--","--"};
... ... @@ -692,6 +702,8 @@
692 702 patInfo.put("dueDate",DateUtil.getyyyy_MM_dd(DateUtil.addDay(pat.getLastMenses(), 280)));
693 703 patInfo.put("phone",pat.getPhone());
694 704 patInfo.put("vcCardNo",pat.getVcCardNo());
  705 + patInfo.put("certType",String.valueOf(certType));
  706 + patInfo.put("certNo",certNo);
695 707  
696 708 String beforeWeight = "";
697 709 String beforeHeight = "";
... ... @@ -736,8 +748,112 @@
736 748 return objectResponse;
737 749 }
738 750  
739   - public BaseObjectResponse addtNutritionInfo(NutritionInfoRequest nutritionInfoRequest) {
740   - return null;
  751 + public BaseObjectResponse addNutritionInfo(NutritionInfoRequest nutritionInfoRequest) {
  752 +
  753 + Patients patients = patientsService.findOnePatientById(nutritionInfoRequest.getPatientId());
  754 + List<PatientWeight> patientWeights = patientWeightService2.queryPatientWeight(Query.query(Criteria.where("patientId").is(nutritionInfoRequest.getPatientId())));
  755 + String hospitalId = nutritionInfoRequest.getHospitalId();
  756 +
  757 + Map<String, String> dayWeights = new LinkedHashMap<>();
  758 + List<Map<String, Object>> dayWeights2 = new ArrayList<>();
  759 +
  760 + String currentWeight = nutritionInfoRequest.getCurrentWeight();
  761 + if (CollectionUtils.isNotEmpty(patientWeights))
  762 + {
  763 + PatientWeight pw = patientWeights.get(0);
  764 +
  765 + if(pw != null) {
  766 + if(MapUtils.isNotEmpty(pw.getDayWeights())) {
  767 + dayWeights = pw.getDayWeights();
  768 + }
  769 + dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), currentWeight);
  770 + pw.setDayWeights(dayWeights);
  771 + pw.setNowWeight(currentWeight);
  772 +
  773 + String ymdDate = DateUtil.getyyyy_MM_dd(new Date());
  774 + boolean flag = true;
  775 + if(com.lyms.platform.operate.web.utils.CollectionUtils.isNotEmpty(pw.getDayWeights2())) {
  776 + dayWeights2 = pw.getDayWeights2();
  777 + }
  778 + for (Map<String, Object> map : dayWeights2) {
  779 + if(map.get("date").equals(ymdDate)) {
  780 + flag = false;
  781 + map.put("hospitalId", hospitalId);
  782 + map.put("hospitalName", couponMapper.getHospitalName(hospitalId));
  783 + map.put("date", ymdDate);
  784 + map.put("nowWeight", currentWeight);
  785 + }
  786 + }
  787 + if(flag) {
  788 + Map<String, Object> m = new HashMap<>();
  789 + m.put("hospitalId", hospitalId);
  790 + m.put("hospitalName", couponMapper.getHospitalName(hospitalId));
  791 + m.put("date", ymdDate);
  792 + m.put("nowWeight", currentWeight);
  793 + dayWeights2.add(m);
  794 + }
  795 + pw.setDayWeights2(dayWeights2);
  796 + pw.setModified(new Date());
  797 + patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw);
  798 + }
  799 + }
  800 + else
  801 + {
  802 + PatientWeight patientWeight = new PatientWeight();
  803 + patientWeight.setNowWeight(currentWeight);
  804 + patientWeight.setPatientId(patients.getId());
  805 + patientWeight.setBeforeWeight(nutritionInfoRequest.getBeforeWeight());
  806 + patientWeight.setBeforeHeight(nutritionInfoRequest.getBeforeHeight());
  807 +
  808 + dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), currentWeight);
  809 + patientWeight.setPid(patients.getPid());
  810 + patientWeight.setDayWeights(dayWeights);
  811 + patientWeight.setHospitalId(hospitalId);
  812 +// patientWeight.setOperaterId(userId.toString());
  813 + patientWeight.setCreated(new Date());
  814 + if(StringUtils.isNotBlank(currentWeight) && nutritionInfoRequest.getBeforeHeight() != null) {
  815 + patientWeight.setBmi(patientWeightService.getBmi(currentWeight, nutritionInfoRequest.getBeforeHeight()));
  816 + }
  817 + patientWeight.setYn("1");
  818 +
  819 + Map<String, Object> m = new HashMap<>();
  820 + m.put("hospitalId", hospitalId);
  821 + m.put("hospitalName", couponMapper.getHospitalName(hospitalId));
  822 + m.put("date", DateUtil.getyyyy_MM_dd(new Date()));
  823 + m.put("nowWeight", currentWeight);
  824 + dayWeights2.add(m);
  825 + patientWeight.setDayWeights2(dayWeights2);
  826 +
  827 + patientWeight.setModified(new Date());
  828 + patientWeightService2.add(patientWeight);
  829 +
  830 + }
  831 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  832 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  833 + objectResponse.setErrormsg("成功");
  834 + return objectResponse;
  835 + }
  836 +
  837 + public BaseObjectResponse getFaceInfo(String patientId) {
  838 + Patients patients = patientsService.findOnePatientById(patientId);
  839 + Map<String,String> faceData = new HashMap<>();
  840 + faceData.put("face",patients.getFace() == null ? "" : patients.getFace());
  841 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  842 + objectResponse.setData(faceData);
  843 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  844 + objectResponse.setErrormsg("成功");
  845 + return objectResponse;
  846 + }
  847 +
  848 + public BaseResponse addFaceInfo(NutritionInfoRequest nutritionInfoRequest) {
  849 + Patients patients = patientsService.findOnePatientById(nutritionInfoRequest.getPatientId());
  850 + patients.setFace(nutritionInfoRequest.getFace());
  851 + patientsService.updatePatient(patients);
  852 +
  853 + BaseResponse objectResponse = new BaseResponse();
  854 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  855 + objectResponse.setErrormsg("成功");
  856 + return objectResponse;
741 857 }
742 858 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/NutritionInfoRequest.java View file @ ec79907
... ... @@ -4,5 +4,74 @@
4 4 * Created by Administrator on 2018-05-07.
5 5 */
6 6 public class NutritionInfoRequest {
  7 +
  8 + private String patientId;
  9 +
  10 + // 当前体重currentWeight
  11 + private String currentWeight;
  12 +
  13 + private String hospitalId;
  14 +
  15 + private String beforeWeight;
  16 + private String beforeHeight;
  17 + private String tireNumber;
  18 +
  19 + private String face;
  20 +
  21 + public String getBeforeWeight() {
  22 + return beforeWeight;
  23 + }
  24 +
  25 + public void setBeforeWeight(String beforeWeight) {
  26 + this.beforeWeight = beforeWeight;
  27 + }
  28 +
  29 + public String getBeforeHeight() {
  30 + return beforeHeight;
  31 + }
  32 +
  33 + public void setBeforeHeight(String beforeHeight) {
  34 + this.beforeHeight = beforeHeight;
  35 + }
  36 +
  37 + public String getTireNumber() {
  38 + return tireNumber;
  39 + }
  40 +
  41 + public void setTireNumber(String tireNumber) {
  42 + this.tireNumber = tireNumber;
  43 + }
  44 +
  45 + public String getFace() {
  46 + return face;
  47 + }
  48 +
  49 + public void setFace(String face) {
  50 + this.face = face;
  51 + }
  52 +
  53 + public String getHospitalId() {
  54 + return hospitalId;
  55 + }
  56 +
  57 + public void setHospitalId(String hospitalId) {
  58 + this.hospitalId = hospitalId;
  59 + }
  60 +
  61 + public String getPatientId() {
  62 + return patientId;
  63 + }
  64 +
  65 + public void setPatientId(String patientId) {
  66 + this.patientId = patientId;
  67 + }
  68 +
  69 + public String getCurrentWeight() {
  70 + return currentWeight;
  71 + }
  72 +
  73 + public void setCurrentWeight(String currentWeight) {
  74 + this.currentWeight = currentWeight;
  75 + }
7 76 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java View file @ ec79907
... ... @@ -27,6 +27,8 @@
27 27  
28 28 BaseResponse wxAddOrUpdateSync(PatientWeight patientWeight);
29 29  
  30 + String getBmi(String weight, String height);
  31 +
30 32 BaseResponse update(Integer userId, String id, String beforeWeight, String beforeHeight, String date, String nowWeight, String bregmatic, String bregmaticOther, boolean sync);
31 33 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ ec79907
... ... @@ -275,7 +275,8 @@
275 275 }
276 276  
277 277 // 体质指数(BMI)=孕前体重(kg)÷孕前身高^2(m)
278   - public static String getBmi(String weight, String height) {
  278 + @Override
  279 + public String getBmi(String weight, String height) {
279 280 if(StringUtils.isNotBlank(weight) && StringUtils.isNotEmpty(height)) {
280 281 Double w = Double.parseDouble(weight);
281 282 Double h = Double.parseDouble(height) / 100l;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java View file @ ec79907
... ... @@ -4,6 +4,7 @@
4 4 import com.alibaba.fastjson.JSONObject;
5 5 import com.lyms.hospitalapi.pojo.ReportModel;
6 6 import com.lyms.platform.biz.service.CommonService;
  7 +import com.lyms.platform.biz.service.PatientWeightService2;
7 8 import com.lyms.platform.common.enums.*;
8 9 import com.lyms.platform.common.result.BaseObjectResponse;
9 10 import com.lyms.platform.common.result.PageResult;
... ... @@ -16,6 +17,7 @@
16 17 import com.lyms.platform.operate.web.facade.AccessPermissionFacade;
17 18 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
18 19 import com.lyms.platform.operate.web.service.IReportService;
  20 +import com.lyms.platform.operate.web.service.PatientWeightService;
19 21 import com.lyms.platform.operate.web.utils.*;
20 22 import com.lyms.platform.permission.dao.master.CouponMapper;
21 23 import com.lyms.platform.permission.model.Organization;
... ... @@ -79,6 +81,9 @@
79 81 private UsersService usersService;
80 82  
81 83 @Autowired
  84 + private PatientWeightService patientWeightService;
  85 +
  86 + @Autowired
82 87 private CommonService commonService;
83 88  
84 89 private static final Map<String, String> colorMap = new HashMap<>();
... ... @@ -1013,7 +1018,7 @@
1013 1018 if(tzFlag) {
1014 1019 for (AntExChuModel antExChuModel : antExChuModels) {
1015 1020 if(hospitalId.equals(antExChuModel.getHospitalId()) && StringUtils.isNotEmpty(antExChuModel.getYqWeight()) && StringUtils.isNotEmpty(antExChuModel.getHeight())) {
1016   - setReport(tzMap, weights, antExChuModel.getYqWeight(), PatientWeightServiceImpl.getBmi(antExChuModel.getYqWeight(), antExChuModel.getHeight()));
  1021 + setReport(tzMap, weights, antExChuModel.getYqWeight(), patientWeightService.getBmi(antExChuModel.getYqWeight(), antExChuModel.getHeight()));
1017 1022 break;
1018 1023 }
1019 1024 }