Commit 64c71411f017872a7b1104bbf28739bef57b73c2

Authored by wangbo
1 parent 297b5e79ec

血压临时表接口

Showing 14 changed files with 1258 additions and 2 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITemporaryBloodDao.java View file @ 64c7141
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.pojo.TemporaryBloodModel;
  4 +import org.springframework.data.mongodb.core.query.Query;
  5 +
  6 +public interface ITemporaryBloodDao {
  7 +
  8 + void updateTemporaryBlood(Query query, TemporaryBloodModel weightModel);
  9 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ITemporaryBloodSugarDao.java View file @ 64c7141
  1 +package com.lyms.platform.biz.dal;
  2 +
  3 +import com.lyms.platform.pojo.TemporaryBloodSugar;
  4 +import org.springframework.data.mongodb.core.query.Query;
  5 +
  6 +public interface ITemporaryBloodSugarDao {
  7 +
  8 + void updateTemporaryBloodSugar(Query query, TemporaryBloodSugar weightModel);
  9 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TemporaryBloodSugarDaoImpl.java View file @ 64c7141
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.ITemporaryBloodSugarDao;
  4 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  5 +import com.lyms.platform.pojo.TemporaryBloodSugar;
  6 +import org.springframework.data.mongodb.core.query.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +@Repository("temporaryBloodSugarDao")
  10 +public class TemporaryBloodSugarDaoImpl extends BaseMongoDAOImpl<TemporaryBloodSugar> implements ITemporaryBloodSugarDao {
  11 +
  12 +
  13 + @Override
  14 + public void updateTemporaryBloodSugar(Query query, TemporaryBloodSugar bloodSugarModel) {
  15 + update(query, bloodSugarModel);
  16 + }
  17 +}
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/TemporayBloodDaoImpl.java View file @ 64c7141
  1 +package com.lyms.platform.biz.dal.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.ITemporaryBloodDao;
  4 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  5 +import com.lyms.platform.pojo.TemporaryBloodModel;
  6 +import org.springframework.data.mongodb.core.query.Query;
  7 +import org.springframework.stereotype.Repository;
  8 +
  9 +@Repository("temporayBloodDao")
  10 +public class TemporayBloodDaoImpl extends BaseMongoDAOImpl<TemporaryBloodModel> implements ITemporaryBloodDao {
  11 +
  12 + @Override
  13 + public void updateTemporaryBlood(Query query, TemporaryBloodModel bloodModel) {
  14 + update(query, bloodModel);
  15 + }
  16 +}
platform-dal/src/main/java/com/lyms/platform/pojo/TemporaryBloodModel.java View file @ 64c7141
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +import org.springframework.data.mongodb.core.mapping.Document;
  5 +
  6 +import java.util.Date;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +@Document(collection = "lyms_temporary_blood")
  11 +public class TemporaryBloodModel extends BaseModel {
  12 +
  13 + private String id;
  14 +
  15 + private String userName;
  16 +
  17 + private Integer age;
  18 +
  19 + private String phone;
  20 +
  21 + private Date lastMenses;
  22 + // 孕前体重
  23 + private String beforeWeight;
  24 + // 孕前身高
  25 + private String beforeHeight;
  26 + // 当前体重
  27 + private String nowWeight;
  28 +
  29 + private String cardID;
  30 +
  31 + private Date created;
  32 +
  33 + private Date modified;
  34 + //记录次数
  35 + private Integer number;
  36 + //高危因素
  37 + private List riskFactorId;
  38 + // 其他高危
  39 + private String highriskDesc;
  40 + //高危补充说明
  41 + private List otherRisk;
  42 + // 舒张压
  43 + private String szy;
  44 + // 收缩压
  45 + private String ssy;
  46 + // 脉搏
  47 + private Integer pulse;
  48 +
  49 + // 前囟 单胎/双胎/多胎
  50 + private String bregmatic;
  51 +
  52 +
  53 + private Integer yn;
  54 + private Map<String, Map<String, Object>> infos;
  55 +
  56 + public Map<String, Map<String, Object>> getInfos() {
  57 + return infos;
  58 + }
  59 +
  60 + public void setInfos(Map<String, Map<String, Object>> infos) {
  61 + this.infos = infos;
  62 + }
  63 +
  64 + public Integer getYn() {
  65 + return yn;
  66 + }
  67 +
  68 + public void setYn(Integer yn) {
  69 + this.yn = yn;
  70 + }
  71 +
  72 + public String getSzy() {
  73 + return szy;
  74 + }
  75 +
  76 + public void setSzy(String szy) {
  77 + this.szy = szy;
  78 + }
  79 +
  80 + public String getSsy() {
  81 + return ssy;
  82 + }
  83 +
  84 + public void setSsy(String ssy) {
  85 + this.ssy = ssy;
  86 + }
  87 +
  88 + public Integer getPulse() {
  89 + return pulse;
  90 + }
  91 +
  92 + public void setPulse(Integer pulse) {
  93 + this.pulse = pulse;
  94 + }
  95 +
  96 + public String getBregmatic() {
  97 + return bregmatic;
  98 + }
  99 +
  100 + public void setBregmatic(String bregmatic) {
  101 + this.bregmatic = bregmatic;
  102 + }
  103 +
  104 + public String getId() {
  105 + return id;
  106 + }
  107 +
  108 + public void setId(String id) {
  109 + this.id = id;
  110 + }
  111 +
  112 + public String getUserName() {
  113 + return userName;
  114 + }
  115 +
  116 + public void setUserName(String userName) {
  117 + this.userName = userName;
  118 + }
  119 +
  120 + public Integer getAge() {
  121 + return age;
  122 + }
  123 +
  124 + public void setAge(Integer age) {
  125 + this.age = age;
  126 + }
  127 +
  128 + public String getPhone() {
  129 + return phone;
  130 + }
  131 +
  132 + public void setPhone(String phone) {
  133 + this.phone = phone;
  134 + }
  135 +
  136 + public Date getLastMenses() {
  137 + return lastMenses;
  138 + }
  139 +
  140 + public void setLastMenses(Date lastMenses) {
  141 + this.lastMenses = lastMenses;
  142 + }
  143 +
  144 + public String getBeforeWeight() {
  145 + return beforeWeight;
  146 + }
  147 +
  148 + public void setBeforeWeight(String beforeWeight) {
  149 + this.beforeWeight = beforeWeight;
  150 + }
  151 +
  152 + public String getBeforeHeight() {
  153 + return beforeHeight;
  154 + }
  155 +
  156 + public void setBeforeHeight(String beforeHeight) {
  157 + this.beforeHeight = beforeHeight;
  158 + }
  159 +
  160 + public String getNowWeight() {
  161 + return nowWeight;
  162 + }
  163 +
  164 + public void setNowWeight(String nowWeight) {
  165 + this.nowWeight = nowWeight;
  166 + }
  167 +
  168 + public String getCardID() {
  169 + return cardID;
  170 + }
  171 +
  172 + public void setCardID(String cardID) {
  173 + this.cardID = cardID;
  174 + }
  175 +
  176 + public Date getCreated() {
  177 + return created;
  178 + }
  179 +
  180 + public void setCreated(Date created) {
  181 + this.created = created;
  182 + }
  183 +
  184 + public Date getModified() {
  185 + return modified;
  186 + }
  187 +
  188 + public void setModified(Date modified) {
  189 + this.modified = modified;
  190 + }
  191 +
  192 + public Integer getNumber() {
  193 + return number;
  194 + }
  195 +
  196 + public void setNumber(Integer number) {
  197 + this.number = number;
  198 + }
  199 +
  200 + public List getRiskFactorId() {
  201 + return riskFactorId;
  202 + }
  203 +
  204 + public void setRiskFactorId(List riskFactorId) {
  205 + this.riskFactorId = riskFactorId;
  206 + }
  207 +
  208 + public String getHighriskDesc() {
  209 + return highriskDesc;
  210 + }
  211 +
  212 + public void setHighriskDesc(String highriskDesc) {
  213 + this.highriskDesc = highriskDesc;
  214 + }
  215 +
  216 + public List getOtherRisk() {
  217 + return otherRisk;
  218 + }
  219 +
  220 + public void setOtherRisk(List otherRisk) {
  221 + this.otherRisk = otherRisk;
  222 + }
  223 +}
platform-dal/src/main/java/com/lyms/platform/pojo/TemporaryBloodSugar.java View file @ 64c7141
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.common.result.BaseModel;
  4 +
  5 +import java.util.Date;
  6 +import java.util.List;
  7 +
  8 +public class TemporaryBloodSugar extends BaseModel {
  9 + private String id;
  10 +
  11 + private String userName;
  12 +
  13 + private Integer age;
  14 +
  15 + private String phone;
  16 +
  17 + private Date lastMenses;
  18 + // 孕前体重
  19 + private String beforeWeight;
  20 + // 孕前身高
  21 + private String beforeHeight;
  22 + // 当前体重
  23 + private String nowWeight;
  24 +
  25 + private String cardID;
  26 +
  27 + private Date created;
  28 +
  29 + private Date modified;
  30 + private List riskFactorId;
  31 + // 其他高危
  32 + private String highriskDesc;
  33 + //高危补充说明
  34 + private List otherRisk;
  35 + //监测状态 1 非药物治疗,监测不足 2 非药物治疗,监测次数达标,血糖控制不理想
  36 + //3 非药物治疗,监测次数达标,血糖控制良好 4 药物治疗,监测不足s
  37 + //5 药物治疗,监测次数达标,血糖波动较大 6 药物治疗,监测次数达标,血糖控制良好
  38 + //7 药物治疗,监测次数达标,血糖平稳但不理想
  39 + private Integer monitorStatus;
  40 + //报告高危类型 1 无需药物治疗 2 需药物治疗
  41 + private Integer type;
  42 + //报告时间
  43 + private Date reportDate;
  44 +
  45 +
  46 + private Integer bloodSugarType;
  47 +
  48 + public Integer getBloodSugarType() {
  49 + return bloodSugarType;
  50 + }
  51 +
  52 + public void setBloodSugarType(Integer bloodSugarType) {
  53 + this.bloodSugarType = bloodSugarType;
  54 + }
  55 +
  56 + //报告状态 1未查看 2查看
  57 + private Integer status;
  58 + private Integer yn;
  59 +
  60 + public String getId() {
  61 + return id;
  62 + }
  63 +
  64 + public void setId(String id) {
  65 + this.id = id;
  66 + }
  67 +
  68 + public String getUserName() {
  69 + return userName;
  70 + }
  71 +
  72 + public void setUserName(String userName) {
  73 + this.userName = userName;
  74 + }
  75 +
  76 + public Integer getAge() {
  77 + return age;
  78 + }
  79 +
  80 + public void setAge(Integer age) {
  81 + this.age = age;
  82 + }
  83 +
  84 + public String getPhone() {
  85 + return phone;
  86 + }
  87 +
  88 + public void setPhone(String phone) {
  89 + this.phone = phone;
  90 + }
  91 +
  92 + public Date getLastMenses() {
  93 + return lastMenses;
  94 + }
  95 +
  96 + public void setLastMenses(Date lastMenses) {
  97 + this.lastMenses = lastMenses;
  98 + }
  99 +
  100 + public String getBeforeWeight() {
  101 + return beforeWeight;
  102 + }
  103 +
  104 + public void setBeforeWeight(String beforeWeight) {
  105 + this.beforeWeight = beforeWeight;
  106 + }
  107 +
  108 + public String getBeforeHeight() {
  109 + return beforeHeight;
  110 + }
  111 +
  112 + public void setBeforeHeight(String beforeHeight) {
  113 + this.beforeHeight = beforeHeight;
  114 + }
  115 +
  116 + public String getNowWeight() {
  117 + return nowWeight;
  118 + }
  119 +
  120 + public void setNowWeight(String nowWeight) {
  121 + this.nowWeight = nowWeight;
  122 + }
  123 +
  124 + public String getCardID() {
  125 + return cardID;
  126 + }
  127 +
  128 + public void setCardID(String cardID) {
  129 + this.cardID = cardID;
  130 + }
  131 +
  132 + public Date getCreated() {
  133 + return created;
  134 + }
  135 +
  136 + public void setCreated(Date created) {
  137 + this.created = created;
  138 + }
  139 +
  140 + public Date getModified() {
  141 + return modified;
  142 + }
  143 +
  144 + public void setModified(Date modified) {
  145 + this.modified = modified;
  146 + }
  147 +
  148 + public List getRiskFactorId() {
  149 + return riskFactorId;
  150 + }
  151 +
  152 + public void setRiskFactorId(List riskFactorId) {
  153 + this.riskFactorId = riskFactorId;
  154 + }
  155 +
  156 + public String getHighriskDesc() {
  157 + return highriskDesc;
  158 + }
  159 +
  160 + public void setHighriskDesc(String highriskDesc) {
  161 + this.highriskDesc = highriskDesc;
  162 + }
  163 +
  164 + public List getOtherRisk() {
  165 + return otherRisk;
  166 + }
  167 +
  168 + public void setOtherRisk(List otherRisk) {
  169 + this.otherRisk = otherRisk;
  170 + }
  171 +
  172 + public Integer getMonitorStatus() {
  173 + return monitorStatus;
  174 + }
  175 +
  176 + public void setMonitorStatus(Integer monitorStatus) {
  177 + this.monitorStatus = monitorStatus;
  178 + }
  179 +
  180 + public Integer getType() {
  181 + return type;
  182 + }
  183 +
  184 + public void setType(Integer type) {
  185 + this.type = type;
  186 + }
  187 +
  188 + public Date getReportDate() {
  189 + return reportDate;
  190 + }
  191 +
  192 + public void setReportDate(Date reportDate) {
  193 + this.reportDate = reportDate;
  194 + }
  195 +
  196 + public Integer getStatus() {
  197 + return status;
  198 + }
  199 +
  200 + public void setStatus(Integer status) {
  201 + this.status = status;
  202 + }
  203 +
  204 + public Integer getYn() {
  205 + return yn;
  206 + }
  207 +
  208 + public void setYn(Integer yn) {
  209 + this.yn = yn;
  210 + }
  211 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TemporaryBloodController.java View file @ 64c7141
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.BaseController;
  5 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  6 +import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.operate.web.service.ITemporaryBloodService;
  8 +import com.lyms.platform.pojo.TemporaryBloodModel;
  9 +import org.apache.commons.lang.StringUtils;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Controller;
  12 +import org.springframework.web.bind.annotation.*;
  13 +
  14 +import javax.servlet.http.HttpServletRequest;
  15 +import java.util.Date;
  16 +
  17 +
  18 +@Controller
  19 +@RequestMapping(value = "/temporary/blood")
  20 +public class TemporaryBloodController extends BaseController {
  21 +
  22 + @Autowired
  23 + private ITemporaryBloodService temporaryBloodService;
  24 +
  25 + @RequestMapping(value = "/addOrUpdate", method = RequestMethod.POST)
  26 + @TokenRequired
  27 + @ResponseBody
  28 + public BaseResponse addTemporaryBlood(TemporaryBloodModel temporaryBloodModel, HttpServletRequest request) {
  29 + return temporaryBloodService.addTemporaryBlood(temporaryBloodModel);
  30 + }
  31 +
  32 + @RequestMapping(value = "/update", method = RequestMethod.PUT)
  33 + @TokenRequired
  34 + public BaseResponse udateTemporaryBlood() {
  35 + return new BaseResponse();
  36 + }
  37 +
  38 + @RequestMapping(value = "/delete", method = RequestMethod.DELETE)
  39 + @TokenRequired
  40 + @ResponseBody
  41 + public BaseResponse delete(@RequestParam(value = "id") String id) {
  42 + return temporaryBloodService.deleteTemporaryBlood(id);
  43 + }
  44 +
  45 + @RequestMapping(value = "/queryOne", method = RequestMethod.GET)
  46 + @TokenRequired
  47 + @ResponseBody
  48 + public BaseResponse queryOne(String id) {
  49 + return temporaryBloodService.queryOne(id);
  50 + }
  51 +
  52 + @RequestMapping(value = "/queryAll", method = RequestMethod.GET)
  53 + @TokenRequired
  54 + @ResponseBody
  55 + public BaseResponse queryAll(Integer page, Integer limit) {
  56 + return temporaryBloodService.queryAll(page, limit);
  57 + }
  58 +
  59 + @ResponseBody
  60 + @RequestMapping(value = "/{id}/{startDate}", method = RequestMethod.GET)
  61 + @TokenRequired
  62 + public BaseResponse info(@PathVariable String id, @PathVariable Date startDate) {
  63 + return temporaryBloodService.info(id, startDate);
  64 + }
  65 +
  66 + @ResponseBody
  67 + @RequestMapping(value = "/presentation/{id}", method = RequestMethod.GET)
  68 + public BaseResponse getXyPresentation(@PathVariable String id) {
  69 + if (StringUtils.isEmpty(id) || "null".equals(id)) {
  70 + return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("id参数不能为空");
  71 + }
  72 + return temporaryBloodService.getXyPresentation(id);
  73 + }
  74 +
  75 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TemporaryBloodSugarController.java View file @ 64c7141
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +import com.lyms.platform.common.base.BaseController;
  4 +import com.lyms.platform.common.result.BaseResponse;
  5 +import org.springframework.stereotype.Controller;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +
  8 +
  9 +@RequestMapping("/blood/sugar")
  10 +@Controller
  11 +public class TemporaryBloodSugarController extends BaseController {
  12 +
  13 +
  14 + @RequestMapping(value = "/addAndUpate")
  15 + public BaseResponse addTempraryBloodSugar() {
  16 +
  17 + return new BaseResponse();
  18 + }
  19 +
  20 + @RequestMapping(value = "/delete")
  21 + public BaseResponse deleteBloodSugar() {
  22 + return new BaseResponse();
  23 + }
  24 +
  25 +
  26 + @RequestMapping(value = "/querOne")
  27 + public BaseResponse queryOne() {
  28 + return new BaseResponse();
  29 +
  30 + }
  31 +
  32 + @RequestMapping(value = "/queryAll")
  33 + public BaseResponse queryAll() {
  34 + return new BaseResponse();
  35 + }
  36 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TemporaryWeightController.java View file @ 64c7141
... ... @@ -3,7 +3,6 @@
3 3  
4 4 import com.lyms.platform.common.annotation.TokenRequired;
5 5 import com.lyms.platform.common.base.BaseController;
6   -import com.lyms.platform.common.base.LoginContext;
7 6 import com.lyms.platform.common.constants.ErrorCodeConstants;
8 7 import com.lyms.platform.common.result.BaseObjectResponse;
9 8 import com.lyms.platform.common.result.BaseResponse;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/ITemporaryBloodService.java View file @ 64c7141
  1 +package com.lyms.platform.operate.web.service;
  2 +
  3 +import com.lyms.platform.common.result.BaseResponse;
  4 +import com.lyms.platform.pojo.TemporaryBloodModel;
  5 +
  6 +import java.util.Date;
  7 +
  8 +public interface ITemporaryBloodService extends IBaseService {
  9 +
  10 + BaseResponse addTemporaryBlood(TemporaryBloodModel bloodModel);
  11 +
  12 + BaseResponse deleteTemporaryBlood(String id);
  13 +
  14 + BaseResponse queryOne(String id);
  15 +
  16 + BaseResponse queryAll(Integer page, Integer limit);
  17 +
  18 + BaseResponse info(String id, Date startDate);
  19 +
  20 + public BaseResponse getXyPresentation(String bloodId);
  21 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/ITemporaryBloodSugarService.java View file @ 64c7141
  1 +package com.lyms.platform.operate.web.service;
  2 +
  3 +import com.lyms.platform.common.result.BaseResponse;
  4 +import com.lyms.platform.pojo.TemporaryBloodSugar;
  5 +
  6 +public interface ITemporaryBloodSugarService extends IBaseService {
  7 +
  8 + BaseResponse addAndUpdate(TemporaryBloodSugar bloodSugar);
  9 +
  10 + BaseResponse deleteBloodSugar(String id);
  11 +
  12 + BaseResponse queryOne(String id);
  13 +
  14 + BaseResponse queryAll(Integer page, Integer limit);
  15 +
  16 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryBloodServiceImpl.java View file @ 64c7141
  1 +package com.lyms.platform.operate.web.service.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.ITemporaryBloodDao;
  4 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  5 +import com.lyms.platform.common.result.BaseObjectResponse;
  6 +import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.common.result.PageResult;
  8 +import com.lyms.platform.common.result.RespBuilder;
  9 +import com.lyms.platform.common.utils.DateUtil;
  10 +import com.lyms.platform.common.utils.StringUtils;
  11 +import com.lyms.platform.operate.web.service.ITemporaryBloodService;
  12 +import com.lyms.platform.operate.web.service.PatientWeightService;
  13 +import com.lyms.platform.operate.web.utils.ReportConfig;
  14 +import com.lyms.platform.pojo.BloodPressure;
  15 +import com.lyms.platform.pojo.Patients;
  16 +import com.lyms.platform.pojo.TemporaryBloodModel;
  17 +import com.lyms.platform.pojo.XyPresentationModel;
  18 +import org.apache.commons.collections.CollectionUtils;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.data.domain.Sort;
  21 +import org.springframework.data.mongodb.core.MongoTemplate;
  22 +import org.springframework.data.mongodb.core.query.Criteria;
  23 +import org.springframework.data.mongodb.core.query.Query;
  24 +import org.springframework.data.mongodb.core.query.Update;
  25 +import org.springframework.stereotype.Service;
  26 +
  27 +import java.util.*;
  28 +
  29 +@Service
  30 +public class TemporaryBloodServiceImpl extends BaseServiceImpl implements ITemporaryBloodService {
  31 + @Autowired
  32 + private MongoTemplate mongoTemplate;
  33 +
  34 +
  35 + @Autowired
  36 + private ITemporaryBloodDao temporaryBloodDao;
  37 +
  38 + @Autowired
  39 + private PatientWeightService patientWeightService;
  40 +
  41 + @Override
  42 + public BaseResponse addTemporaryBlood(TemporaryBloodModel bloodModel) {
  43 + List<TemporaryBloodModel> models = mongoTemplate.findAll(TemporaryBloodModel.class);
  44 + if (CollectionUtils.isNotEmpty(models)) {
  45 + TemporaryBloodModel bloodModel1 = mongoTemplate.findOne(Query.query(Criteria.where("phone").is(bloodModel.getPhone())), TemporaryBloodModel.class);
  46 + if (bloodModel1 == null) {
  47 + bloodModel.setYn(1);
  48 + bloodModel.setModified(new Date());
  49 + bloodModel.setCreated(new Date());
  50 + Map<String, Object> temp = new LinkedHashMap<>();
  51 + bloodModel.setModified(new Date());
  52 + temp.put("szy", bloodModel.getSzy());
  53 + temp.put("ssy", bloodModel.getSsy());
  54 + temp.put("pulse", bloodModel.getPulse());
  55 + temp.put("timestamp", DateUtil.getyyyy_MM_dd_hms(new Date()));
  56 + Map<String, Map<String, Object>> infos = new LinkedHashMap<>();
  57 + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp);
  58 + bloodModel.setInfos(infos);
  59 + mongoTemplate.insert(bloodModel);
  60 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("添加成功");
  61 + } else {
  62 + bloodModel.setModified(new Date());
  63 + temporaryBloodDao.updateTemporaryBlood(Query.query(Criteria.where("_id").is(bloodModel.getId())), bloodModel);
  64 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("修改成功");
  65 + }
  66 + } else {
  67 + bloodModel.setYn(1);
  68 + bloodModel.setModified(new Date());
  69 + bloodModel.setCreated(new Date());
  70 + Map<String, Object> temp = new LinkedHashMap<>();
  71 + bloodModel.setModified(new Date());
  72 + temp.put("szy", bloodModel.getSzy());
  73 + temp.put("ssy", bloodModel.getSsy());
  74 + temp.put("pulse", bloodModel.getPulse());
  75 + temp.put("timestamp", DateUtil.getyyyy_MM_dd_hms(new Date()));
  76 + Map<String, Map<String, Object>> infos = new LinkedHashMap<>();
  77 + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp);
  78 + bloodModel.setInfos(infos);
  79 + mongoTemplate.insert(bloodModel);
  80 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("添加成功");
  81 + }
  82 +
  83 + }
  84 +
  85 + @Override
  86 + public BaseResponse deleteTemporaryBlood(String id) {
  87 + mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(id)), Update.update("yn", 1), TemporaryBloodModel.class);
  88 + return RespBuilder.buildSuccess();
  89 + }
  90 +
  91 + @Override
  92 + public BaseResponse queryOne(String id) {
  93 + TemporaryBloodModel bloodModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id)), TemporaryBloodModel.class);
  94 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(bloodModel);
  95 + }
  96 +
  97 + @Override
  98 + public BaseResponse queryAll(Integer page, Integer limit) {
  99 + Criteria criteria = Criteria.where("yn").ne(0);
  100 + PageResult pageResult = findMongoPage(TemporaryBloodModel.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "modified")), page, limit);
  101 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(pageResult);
  102 + }
  103 +
  104 + @Override
  105 + public BaseResponse info(String id, Date startDate) {
  106 + TemporaryBloodModel bloodPressure = mongoTemplate.findById(id, TemporaryBloodModel.class);
  107 + List<Map<String, Object>> xyInfos = new ArrayList<>();
  108 + List<Integer> szyMin = Arrays.asList(60, 60, 60, 60, 60, 60, 60);
  109 + List<Integer> ssyMax = Arrays.asList(140, 140, 140, 140, 140, 140, 140);
  110 + List<Object> ssy = new ArrayList<>();
  111 + List<Object> szy = new ArrayList<>();
  112 + List<Object> pulse = new ArrayList<>();
  113 + List<String> xAxis = new ArrayList<>();
  114 + if (bloodPressure != null) {
  115 + List<String> betweenDay = DateUtil.getBetweenDay(startDate, 7);
  116 + com.lyms.platform.operate.web.utils.CollectionUtils.reverse(betweenDay);
  117 + Map<String, Map<String, Object>> infos = bloodPressure.getInfos();
  118 + for (String date : betweenDay) {
  119 + Map<String, Object> temp = new HashMap<>();
  120 + xyInfos.add(temp);
  121 +
  122 + temp.put("date", date);
  123 + temp.put("ssy", infos.containsKey(date) ? infos.get(date).get("ssy") : "--");
  124 + temp.put("szy", infos.containsKey(date) ? infos.get(date).get("szy") : "--");
  125 +
  126 + xAxis.add(date.replace("-", "/"));
  127 + ssy.add(infos.containsKey(date) ? infos.get(date).get("ssy") : 0);
  128 + szy.add(infos.containsKey(date) ? infos.get(date).get("szy") : 0);
  129 + pulse.add(infos.containsKey(date) ? (Integer) infos.get(date).get("pulse") : "--");
  130 + }
  131 + }
  132 + return RespBuilder.buildSuccess("xyInfos", xyInfos, "szyMin", szyMin, "ssyMax", ssyMax, "ssy", ssy, "szy", szy, "pulse", pulse);
  133 + }
  134 +
  135 + @Override
  136 + public BaseResponse getXyPresentation(String id) {
  137 + //1.通过血压ID 查询到pnationId
  138 + Map<String, Object> datas = new HashMap<>();
  139 + Map<String, Map<Integer, Double>> series = new HashMap<>();
  140 + //BloodPressure bloodPressure = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(bloodId)), BloodPressure.class);
  141 + TemporaryBloodModel bloodModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id)), TemporaryBloodModel.class);
  142 + //1.1回去bim值 String getBmi(String weight, String height);
  143 + String weight = bloodModel.getBeforeWeight();
  144 + String height = bloodModel.getBeforeHeight();
  145 + String bregmatic = bloodModel.getBregmatic();
  146 + //2.通过pnationId ID获取到相应的信息例如:末次月经
  147 + if (StringUtils.isNotEmpty(weight) && StringUtils.isNotEmpty(height) && StringUtils.isNotEmpty(bregmatic)) {
  148 + //Patients patients = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(bloodPressure.getParentId())), Patients.class);
  149 + Integer weeks = DateUtil.getWeek(bloodModel.getLastMenses(), bloodModel.getModified());
  150 + System.out.println("孕周:" + weeks);
  151 + Map paMap = new HashMap();
  152 + // paMap.put("vcCardNo", patients.getVcCardNo());
  153 + paMap.put("username", bloodModel.getUserName());
  154 + paMap.put("phone", bloodModel.getPhone());
  155 + paMap.put("age", bloodModel.getAge());
  156 + //paMap.put("dueDate", DateUtil.getyyyy_MM_dd(bloodModel.getDueDate()));
  157 + paMap.put("height", bloodModel.getBeforeHeight());
  158 + paMap.put("beforWeight", bloodModel.getBeforeWeight());
  159 + paMap.put("weeks", weeks);
  160 + datas.put("userInfo", paMap);
  161 + Double bmiD = Double.valueOf(patientWeightService.getBmi(weight, height)).doubleValue();
  162 + String bmiStr = "";
  163 + //空和1表示单胎
  164 + if (!org.apache.commons.lang.StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) {
  165 + if (bmiD < 18.5) {
  166 + bmiStr = "BMI<18.5";
  167 + } else if (bmiD >= 18.5 && bmiD <= 24.99) {
  168 + bmiStr = "BMI=18.5-24.9";
  169 + } else if (bmiD > 24.9 && bmiD < 30) {
  170 + bmiStr = "BMI=25-29.9";
  171 + } else if (bmiD >= 30) {
  172 + bmiStr = "BMI≥30";
  173 + }
  174 + } else {
  175 + if (bmiD <= 24.9) {
  176 + bmiStr = "BMI≤24.9";
  177 + } else if (bmiD >= 25 && bmiD <= 29.99) {
  178 + bmiStr = "BMI=25-29.9";
  179 + } else if (bmiD >= 30) {
  180 + bmiStr = "BMI≥30";
  181 + }
  182 + }
  183 + //计算出区间范围
  184 + double low = 0.0;
  185 + double high = 0.0;
  186 + this.getSeries(series, bmiStr, bregmatic);
  187 + Map<Integer, Double> lowMap = series.get("lowData");
  188 + for (Map.Entry<Integer, Double> entry : lowMap.entrySet()) {
  189 + if (entry.getKey() == weeks) {
  190 + }
  191 + }
  192 + Map<Integer, Double> highMap = series.get("highData");
  193 + for (Map.Entry<Integer, Double> entry : highMap.entrySet()) {
  194 + if (entry.getKey() == weeks) {
  195 + high = entry.getValue();
  196 + }
  197 + }
  198 + //计算出属于那种类型 偏重 还事负重 还是正常 当前体重-孕前体重
  199 + Double residualWeight = Double.valueOf(bloodModel.getNowWeight()).doubleValue() - Double.valueOf(bloodModel.getBeforeWeight()).doubleValue();
  200 + //把厘米转换成米
  201 + Double heights = (Double.valueOf(bloodModel.getBeforeHeight()).doubleValue()) / 100d;
  202 + int cals = this.getRounding((int) this.getCal(bregmatic, residualWeight, low, high, weeks, bmiD, bloodModel, heights));
  203 + String calStr = cals + "kcal";
  204 + List<XyPresentationModel> xyPresentationModels = mongoTemplate.find(Query.query(Criteria.where("originWeek").lte(weeks).and("endWeek").gte(weeks)), XyPresentationModel.class);
  205 + XyPresentationModel xy = mongoTemplate.findOne(Query.query(Criteria.where("quantityHeat").is(calStr)), XyPresentationModel.class);
  206 + if (xy != null) {
  207 + Map mapxy = new HashMap();
  208 + if (weeks >= 0 && weeks <= 12) {
  209 + mapxy.put("proposal", "建议(孕早期)");
  210 + mapxy.put("proposalInfo", xy.getEarlySuggests());
  211 + } else if (weeks >= 13 && weeks <= 28) {
  212 + mapxy.put("proposal", "建议(孕中期)");
  213 + mapxy.put("proposalInfo", xy.getMiddleSuggests());
  214 + } else if (weeks >= 29 && weeks <= 40) {
  215 + mapxy.put("proposal", "建议(孕晚期)");
  216 + mapxy.put("proposalInfo", xy.getLaterSuggests());
  217 + }
  218 + mapxy.put("quantityHeat", xy.getQuantityHeat());
  219 + mapxy.put("breakfast", xy.getBreakfast());
  220 + mapxy.put("breakfastAdd", xy.getBreakfastAdd());
  221 + mapxy.put("lunch", xy.getLunch());
  222 + mapxy.put("lunchAdd", xy.getLunchAdd());
  223 + mapxy.put("dinner", xy.getDinner());
  224 + mapxy.put("dinnerAdd", xy.getDinnerAdd());
  225 + mapxy.put("northSouth", xy.getNorthSouth());
  226 + datas.put("recipes", mapxy);
  227 + } else {
  228 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("未获取到热量值");
  229 + }
  230 + if (xyPresentationModels.isEmpty()) {
  231 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("没有对应的数据");
  232 + } else {
  233 + List<Map> motionList = new ArrayList<>();
  234 + for (XyPresentationModel p : xyPresentationModels) {
  235 + Map map = new HashMap();
  236 + map.put("title", p.getTitle());
  237 + map.put("content", p.getContent());
  238 + map.put("modular", p.getModular());
  239 + map.put("type", p.getType());
  240 + if (3 == p.getType()) {
  241 + motionList.add(map);
  242 + } else if (2 == p.getType()) {
  243 + datas.put("guide", map);
  244 + } else if (0 == p.getType()) {
  245 + datas.put("pregnancy", map);
  246 + }
  247 + }
  248 + datas.put("motion", motionList);
  249 + }
  250 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(datas);
  251 + } else {
  252 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("失败").setData("请检查数据是否填写完整!");
  253 + }
  254 + }
  255 +
  256 + public void getSeries(Map<String, Map<Integer, Double>> series, String bmiStr, String bregmatic) {
  257 + Map<Integer, Double> highMap = new LinkedHashMap<>();
  258 + Map<Integer, Double> normalMap = new LinkedHashMap<>();
  259 + Map<Integer, Double> lowMap = new LinkedHashMap<>();
  260 +
  261 + double low = 1;
  262 + double high = 1.5D;
  263 +
  264 + double avg = Double.valueOf(String.format("%.2f", low / 12));
  265 + for (int i = 1; i <= 12; i++) {
  266 + lowMap.put(i, Double.valueOf(String.format("%.2f", i * avg)));
  267 + }
  268 +
  269 + double highAvg = Double.valueOf(String.format("%.2f", high / 12));
  270 + for (int i = 1; i <= 12; i++) {
  271 + highMap.put(i, Double.valueOf(String.format("%.2f", i * highAvg)));
  272 + }
  273 +
  274 + for (int i = 13; i <= 40; i++) {
  275 +
  276 + String range = "";
  277 + //空和1表示单胎
  278 + if (!org.apache.commons.lang.StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) {
  279 + range = ReportConfig.getWeightRange(bmiStr + "孕" + i + "周");
  280 + } else {
  281 + range = ReportConfig.getDWeightRange(bmiStr + "孕" + i + "周");
  282 + }
  283 +
  284 + if (org.apache.commons.lang.StringUtils.isNotEmpty(range)) {
  285 + String[] array = range.split("-");
  286 + lowMap.put(i, Double.valueOf(String.format("%.2f", Double.valueOf(array[0]))));
  287 + highMap.put(i, Double.valueOf(String.format("%.2f", Double.valueOf(array[1]))));
  288 + }
  289 + }
  290 +
  291 + for (int i = 1; i <= 40; i++) {
  292 + normalMap.put(i, Double.valueOf(String.format("%.2f", (highMap.get(i) + lowMap.get(i)) / 2)));
  293 + }
  294 + series.put("lowData", lowMap);
  295 + series.put("highData", highMap);
  296 + series.put("normalData", normalMap);
  297 + }
  298 +
  299 + public double getCal(String bregmatic, double residualWeight, double low, double high, int weeks, double bmiD, TemporaryBloodModel bloodModel, double heights) {
  300 + Double beforWeight = Double.valueOf(bloodModel.getBeforeWeight()).doubleValue();
  301 + int age = bloodModel.getAge();
  302 + Double number = 354 - 6.91 * age + 1.12 * (9.36 * beforWeight + 726 * heights);
  303 + //单胎
  304 + if ("1".equals(bregmatic) && StringUtils.isNotEmpty(bregmatic)) {
  305 + if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD < 18.5 && weeks >= 0 && weeks <= 12) {
  306 + return number;
  307 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD < 18.5 && weeks >= 13 && weeks <= 28) {
  308 + return number + 380;
  309 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD < 18.5 && weeks >= 29 && weeks <= 40) {
  310 + return number + 500;
  311 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 18.5 && bmiD <= 24.9 && weeks >= 0 && weeks <= 12) {
  312 + return number;
  313 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 18.5 && bmiD < 24.9 && weeks >= 13 && weeks <= 28) {
  314 + return number + 340;
  315 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 18.5 && bmiD < 24.9 && weeks >= 29 && weeks <= 40) {
  316 + return number + 450;
  317 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 0 && weeks <= 12) {
  318 + return number;
  319 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 13 && weeks <= 28) {
  320 + return number + 200;
  321 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 29 && weeks <= 40) {
  322 + return number + 250;
  323 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 30 && weeks >= 0 && weeks <= 12) {
  324 + return number;
  325 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 30 && weeks >= 13 && weeks <= 28) {
  326 + return number + 120;
  327 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 30 && weeks >= 29 && weeks <= 40) {
  328 + return number + 160;
  329 + //增重超过曲线上限1kg
  330 + } else if (residualWeight > high + 1.0 && bmiD < 18.5 && weeks >= 0 && weeks <= 12) {
  331 + return number - 300;
  332 + } else if (residualWeight > high + 1.0 && bmiD < 18.5 && weeks >= 13 && weeks <= 28) {
  333 + return number + 380 - 300;
  334 + } else if (residualWeight > high + 1.0 && bmiD < 18.5 && weeks >= 29 && weeks <= 40) {
  335 + return number + 500 - 300;
  336 + //BMI=18.5-24.9
  337 + } else if (residualWeight > high + 1.0 && bmiD >= 18.5 && bmiD <= 24.9 && weeks >= 0 && weeks <= 12) {
  338 + return number - 300;
  339 + } else if (residualWeight > high + 1.0 && bmiD >= 18.5 && bmiD <= 24.9 && weeks >= 13 && weeks <= 28) {
  340 + return number + 340 - 300;
  341 + } else if (residualWeight > high + 1.0 && bmiD >= 18.5 && bmiD <= 24.9 && weeks >= 29 && weeks <= 40) {
  342 + return number + 450 - 300;
  343 + //BMI=25-29.9
  344 + } else if (residualWeight > high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 0 && weeks <= 12) {
  345 + return number - 300;
  346 + } else if (residualWeight > high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 13 && weeks <= 28) {
  347 + return number + 200 - 300;
  348 + } else if (residualWeight > high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 29 && weeks <= 40) {
  349 + return number + 250 - 300;
  350 + //BMI≥30
  351 + } else if (residualWeight > high + 1.0 && bmiD >= 30 && weeks >= 0 && weeks <= 12) {
  352 + return number - 300;
  353 + } else if (residualWeight > high + 1.0 && bmiD >= 30 && weeks >= 13 && weeks <= 28) {
  354 + return number + 120 - 300;
  355 + } else if (residualWeight > high + 1.0 && bmiD >= 30 && weeks >= 29 && weeks <= 40) {
  356 + return number + 160 - 300;
  357 + //体重为正增长,但增长未达到曲线下限,且低于1kg
  358 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD < 18.5 && weeks >= 0 && weeks <= 12) {
  359 + return number + 300;
  360 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD < 18.5 && weeks >= 13 && weeks <= 28) {
  361 + return number + 380 + 300;
  362 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD < 18.5 && weeks >= 29 && weeks <= 40) {
  363 + return number + 500 + 300;
  364 + //BMI=18.5-24.9
  365 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 18.5 && bmiD <= 24.9 && weeks >= 0 && weeks <= 12) {
  366 + return number - 300;
  367 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 18.5 && bmiD <= 24.9 && weeks >= 13 && weeks <= 28) {
  368 + return number + 340 + 300;
  369 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 18.5 && bmiD <= 24.9 && weeks >= 29 && weeks <= 40) {
  370 + return number + 450 + 300;
  371 + //BMI=25-29.9
  372 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 0 && weeks <= 12) {
  373 + return number - 300;
  374 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 18.5 && bmiD <= 29.9 && weeks >= 13 && weeks <= 28) {
  375 + return number + 200 + 300;
  376 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 18.5 && bmiD <= 29.9 && weeks >= 29 && weeks <= 40) {
  377 + return number + 250 + 300;
  378 + //BMI≥30
  379 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 30 && weeks >= 0 && weeks <= 12) {
  380 + return number - 300;
  381 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 30 && bmiD <= 29.9 && weeks >= 13 && weeks <= 28) {
  382 + return number + 120 + 300;
  383 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 30 && bmiD <= 29.9 && weeks >= 29 && weeks <= 40) {
  384 + return number + 160 + 300;
  385 + }
  386 + //体重为负增长(按当前体重重新算BMI)
  387 + else if (residualWeight < 0) {
  388 + //重新计算bmi值
  389 + String weight = bloodModel.getNowWeight();
  390 + String height = bloodModel.getBeforeHeight();
  391 + Double bmiDs = Double.valueOf(patientWeightService.getBmi(weight, height)).doubleValue();
  392 + if (bmiDs < 18.5 && weeks >= 0 && weeks <= 12) {
  393 + return number + 300;
  394 + } else if (bmiDs < 18.5 && weeks >= 13 && weeks <= 28) {
  395 + return number + 380 + 300;
  396 + } else if (bmiDs < 18.5 && weeks >= 29 && weeks <= 40) {
  397 + return number + 500 + 300;
  398 + } else if (bmiDs >= 18.5 && bmiDs <= 24.9 && weeks >= 0 && weeks <= 12) {
  399 + return number + 300;
  400 + } else if (bmiDs >= 18.5 && bmiDs <= 24.9 && weeks >= 13 && weeks <= 28) {
  401 + return number + 340 + 300;
  402 + } else if (bmiDs >= 18.5 && bmiDs <= 24.9 && weeks >= 29 && weeks <= 40) {
  403 + return number + 450 + 300;
  404 + }
  405 + //BMI=25-29.9
  406 + else if (bmiDs >= 25 && bmiDs <= 29.9 && weeks >= 0 && weeks <= 12) {
  407 + return number + 300;
  408 + } else if (bmiDs >= 25 && bmiDs <= 29.9 && weeks >= 13 && weeks <= 28) {
  409 + return number + 200 + 300;
  410 + } else if (bmiDs >= 25 && bmiDs <= 29.9 && weeks >= 29 && weeks <= 40) {
  411 + return number + 250 + 300;
  412 + }
  413 + //BMI≥30
  414 + else if (bmiDs >= 30 && weeks >= 0 && weeks <= 12) {
  415 + return number + 300;
  416 + } else if (bmiDs >= 30 && weeks >= 13 && weeks <= 28) {
  417 + return number + 120 + 300;
  418 + } else if (bmiDs >= 30 && weeks >= 29 && weeks <= 40) {
  419 + return number + 160 + 300;
  420 + }
  421 + }
  422 + //双胎
  423 + } else {
  424 + //正常范围
  425 + if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD <= 24.9 && weeks >= 0 && weeks <= 12) {
  426 + return number;
  427 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD <= 24.9 && weeks >= 13 && weeks <= 28) {
  428 + return number + 540;
  429 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD <= 24.9 && weeks >= 29 && weeks <= 40) {
  430 + return number + 700;
  431 + //BMI25-29.9
  432 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 0 && weeks <= 12) {
  433 + return number;
  434 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 25 && bmiD < 29.9 && weeks >= 13 && weeks <= 28) {
  435 + return number + 470;
  436 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 25 && bmiD < 29.9 && weeks >= 29 && weeks <= 40) {
  437 + return number + 620;
  438 + //BMI≥30
  439 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 30 && weeks >= 0 && weeks <= 12) {
  440 + return number;
  441 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 30 && weeks >= 13 && weeks <= 28) {
  442 + return number + 340;
  443 + } else if (residualWeight >= low - 1.0 && residualWeight <= high + 1.0 && bmiD >= 30 && weeks >= 29 && weeks <= 40) {
  444 + return number + 450;
  445 + //双胎 增重超过曲线上限1kg
  446 + } else if (residualWeight > high + 1.0 && bmiD <= 24.9 && weeks >= 0 && weeks <= 12) {
  447 + return number - 300;
  448 + } else if (residualWeight > high + 1.0 && bmiD <= 24.9 && weeks >= 13 && weeks <= 28) {
  449 + return number + 540 - 300;
  450 + } else if (residualWeight > high + 1.0 && bmiD <= 24.9 && weeks >= 29 && weeks <= 40) {
  451 + return number + 620 - 300;
  452 + //BMI25-29.9
  453 + } else if (residualWeight > high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 0 && weeks <= 12) {
  454 + return number - 300;
  455 + } else if (residualWeight > high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 13 && weeks <= 28) {
  456 + return number + 470 - 300;
  457 + } else if (residualWeight > high + 1.0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 29 && weeks <= 40) {
  458 + return number + 620 - 300;
  459 + //BMI≥30
  460 + } else if (residualWeight > high + 1.0 && bmiD >= 30 && weeks >= 0 && weeks <= 12) {
  461 + return number - 300;
  462 + } else if (residualWeight > high + 1.0 && bmiD >= 30 && weeks >= 13 && weeks <= 28) {
  463 + return number + 340 - 300;
  464 + } else if (residualWeight > high + 1.0 && bmiD >= 30 && weeks >= 29 && weeks <= 40) {
  465 + return number + 450 - 300;
  466 + //BMI≤24.9 双胎 体重为正增长,但增长未达到曲线下限,且低于1kg
  467 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD <= 24.9 && weeks >= 0 && weeks <= 12) {
  468 + return number - 300;
  469 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD <= 24.9 && weeks >= 13 && weeks <= 28) {
  470 + return number + 540 + 300;
  471 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD <= 24.9 && weeks >= 29 && weeks <= 40) {
  472 + return number + 700 + 300;
  473 + }
  474 + //BMI25-29.9
  475 + else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 0 && weeks <= 12) {
  476 + return number + 300;
  477 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 13 && weeks <= 28) {
  478 + return number + 470 + 300;
  479 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 25 && bmiD <= 29.9 && weeks >= 29 && weeks <= 40) {
  480 + return number + 620 + 300;
  481 + }
  482 + //BMI≥30
  483 + else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 30 && weeks >= 0 && weeks <= 12) {
  484 + return number - 300;
  485 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 30 && weeks >= 13 && weeks <= 28) {
  486 + return number + 340 + 300;
  487 + } else if (residualWeight < low - 1.0 && residualWeight >= 0 && bmiD >= 30 && weeks >= 29 && weeks <= 40) {
  488 + return number + 450 + 300;
  489 + //四、体重为负增长(按当前体重重新算BMI)
  490 + } else if (residualWeight < 0) {
  491 + //重新计算bmi值
  492 + String weight = bloodModel.getNowWeight();
  493 + String height = bloodModel.getBeforeHeight();
  494 + Double bmiDs = Double.valueOf(patientWeightService.getBmi(weight, height)).doubleValue();
  495 + if (bmiDs <= 24.9 && weeks >= 0 && weeks <= 12) {
  496 + return number + 300;
  497 + } else if (bmiDs <= 24.9 && weeks >= 13 && weeks <= 28) {
  498 + return number + 540 + 300;
  499 + } else if (bmiDs <= 24.9 && weeks >= 29 && weeks <= 40) {
  500 + return number + 700 + 300;
  501 + } else if (bmiDs >= 25 && bmiDs <= 29.9 && weeks >= 0 && weeks <= 12) {
  502 + return number + 300;
  503 + } else if (bmiDs >= 25 && bmiDs <= 29.9 && weeks >= 13 && weeks <= 28) {
  504 + return number + 470 + 300;
  505 + } else if (bmiDs >= 25 && bmiDs <= 29.9 && weeks >= 29 && weeks <= 40) {
  506 + return number + 620 + 300;
  507 + }
  508 + //BMI≥30
  509 + else if (bmiDs >= 30 && weeks >= 0 && weeks <= 12) {
  510 + return number + 300;
  511 + } else if (bmiDs >= 30 && weeks >= 13 && weeks <= 28) {
  512 + return number + 340 + 300;
  513 + } else if (bmiDs >= 30 && weeks >= 29 && weeks <= 40) {
  514 + return number + 450 + 300;
  515 + }
  516 + }
  517 + }
  518 + return 0.0;
  519 + }
  520 +
  521 + public int getRounding(Integer number) {
  522 + if (number <= 1000) {
  523 + return 1000;
  524 + } else if (number >= 3300) {
  525 + return 3300;
  526 + }
  527 + if (number / 10 % 10 >= 5) {
  528 + int g = 0; //s % 10;
  529 + int sw = 0;//s / 10 % 10;
  530 + int b = number / 100 % 10 + 1;
  531 + int q = number / 1000 % 10;
  532 + int num = q * 1000 + b * 100 + sw * 0 + g * 0;
  533 + return num;
  534 + } else {
  535 + int g = 0; //s % 10;
  536 + int sw = 0;//s / 10 % 10;
  537 + int b = number / 100 % 10;
  538 + int q = number / 1000 % 10;
  539 + int num = q * 1000 + b * 100 + sw * 0 + g * 0;
  540 + return num;
  541 + }
  542 + }
  543 +
  544 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryBloodSugarServiceImpl.java View file @ 64c7141
  1 +package com.lyms.platform.operate.web.service.impl;
  2 +
  3 +import com.lyms.platform.biz.dal.ITemporaryBloodSugarDao;
  4 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  5 +import com.lyms.platform.common.result.BaseObjectResponse;
  6 +import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.common.result.PageResult;
  8 +import com.lyms.platform.common.result.RespBuilder;
  9 +import com.lyms.platform.operate.web.service.ITemporaryBloodSugarService;
  10 +import com.lyms.platform.pojo.TemporaryBloodSugar;
  11 +import org.apache.commons.collections.CollectionUtils;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.data.domain.Sort;
  14 +import org.springframework.data.mongodb.core.MongoTemplate;
  15 +import org.springframework.data.mongodb.core.query.Criteria;
  16 +import org.springframework.data.mongodb.core.query.Query;
  17 +import org.springframework.data.mongodb.core.query.Update;
  18 +import org.springframework.stereotype.Service;
  19 +
  20 +import java.util.Date;
  21 +import java.util.List;
  22 +
  23 +
  24 +@Service
  25 +public class TemporaryBloodSugarServiceImpl extends BaseServiceImpl implements ITemporaryBloodSugarService {
  26 +
  27 + @Autowired
  28 + private MongoTemplate mongoTemplate;
  29 +
  30 + @Autowired
  31 + private ITemporaryBloodSugarDao temporaryBloodSugarDao;
  32 +
  33 +
  34 + @Override
  35 +
  36 + public BaseResponse addAndUpdate(TemporaryBloodSugar bloodSugar) {
  37 + List<TemporaryBloodSugar> bloodSugars = mongoTemplate.findAll(TemporaryBloodSugar.class);
  38 + if (CollectionUtils.isNotEmpty(bloodSugars)) {
  39 + TemporaryBloodSugar temporaryBloodSugar = mongoTemplate.findOne(Query.query(Criteria.where("phone").is(bloodSugar.getPhone()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), TemporaryBloodSugar.class);
  40 + if (temporaryBloodSugar != null) {
  41 + bloodSugar.setModified(new Date());
  42 + temporaryBloodSugarDao.updateTemporaryBloodSugar(Query.query(Criteria.where("_id").is(bloodSugar.getId()).and("bloodSugarType").is(bloodSugar.getBloodSugarType())), bloodSugar);
  43 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("修改成功");
  44 + } else {
  45 + bloodSugar.setModified(new Date());
  46 + bloodSugar.setCreated(new Date());
  47 + bloodSugar.setYn(1);
  48 + mongoTemplate.insert(bloodSugar);
  49 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("添加成功");
  50 + }
  51 + } else {
  52 + bloodSugar.setModified(new Date());
  53 + bloodSugar.setCreated(new Date());
  54 + bloodSugar.setYn(1);
  55 + mongoTemplate.insert(bloodSugar);
  56 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("添加成功");
  57 + }
  58 + }
  59 +
  60 + @Override
  61 + public BaseResponse deleteBloodSugar(String id) {
  62 + mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(id)), Update.update("yn", 1), TemporaryBloodSugar.class);
  63 + return RespBuilder.buildSuccess();
  64 + }
  65 +
  66 + @Override
  67 + public BaseResponse queryOne(String id) {
  68 + TemporaryBloodSugar bloodModel = mongoTemplate.findOne(Query.query(Criteria.where("_id").is(id)), TemporaryBloodSugar.class);
  69 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(bloodModel);
  70 + }
  71 +
  72 + @Override
  73 + public BaseResponse queryAll(Integer page, Integer limit) {
  74 + Criteria criteria = Criteria.where("yn").ne(0);
  75 + PageResult pageResult = findMongoPage(TemporaryBloodSugar.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "modified")), page, limit);
  76 + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(pageResult);
  77 +
  78 + }
  79 +
  80 +
  81 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/TemporaryWeightServiceImpl.java View file @ 64c7141
... ... @@ -49,7 +49,6 @@
49 49 @Autowired
50 50 private OrganizationService organizationService;
51 51  
52   -
53 52 @Autowired
54 53 private ComputeKulServiceManager computeKulServiceManager;
55 54