Commit 99c7bd4de53065a5e2bfde2983bee8afe12bec65
1 parent
2582cb9317
Exists in
master
and in
6 other branches
血压相关
Showing 9 changed files with 489 additions and 0 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBloodPressureDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BloodPressureDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BloodPressureService.java
- platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BloodPressure.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodPressureController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodPressureService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBloodPressureDao.java
View file @
99c7bd4
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.pojo.BloodPressure; | |
| 4 | +import org.springframework.data.mongodb.core.query.Query; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 血压 | |
| 8 | + */ | |
| 9 | +public interface IBloodPressureDao { | |
| 10 | + | |
| 11 | + void add(BloodPressure bloodPressure); | |
| 12 | + | |
| 13 | + void updateXy(Query query, BloodPressure bloodPressure); | |
| 14 | + | |
| 15 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BloodPressureDaoImpl.java
View file @
99c7bd4
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IBloodPressureDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.pojo.BloodPressure; | |
| 6 | +import org.springframework.data.mongodb.core.query.Query; | |
| 7 | +import org.springframework.stereotype.Repository; | |
| 8 | + | |
| 9 | +@Repository | |
| 10 | +public class BloodPressureDaoImpl extends BaseMongoDAOImpl<BloodPressure> implements IBloodPressureDao { | |
| 11 | + | |
| 12 | + @Override | |
| 13 | + public void add(BloodPressure bloodPressure) { | |
| 14 | + save(bloodPressure); | |
| 15 | + } | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + public void updateXy(Query query, BloodPressure bloodPressure) { | |
| 19 | + update(query, bloodPressure); | |
| 20 | + } | |
| 21 | + | |
| 22 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BloodPressureService.java
View file @
99c7bd4
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.lyms.platform.biz.dal.IBloodPressureDao; | |
| 5 | +import com.lyms.platform.pojo.BloodPressure; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 8 | +import org.springframework.data.mongodb.core.query.Query; | |
| 9 | +import org.springframework.stereotype.Service; | |
| 10 | + | |
| 11 | +@Service | |
| 12 | +public class BloodPressureService { | |
| 13 | + | |
| 14 | + @Autowired | |
| 15 | + private IBloodPressureDao bloodPressureDao; | |
| 16 | + | |
| 17 | + public void add(BloodPressure bloodPressure) { | |
| 18 | + bloodPressureDao.add(bloodPressure); | |
| 19 | + } | |
| 20 | + | |
| 21 | + public void update(BloodPressure bloodPressure) { | |
| 22 | + bloodPressureDao.updateXy(Query.query(Criteria.where("id").is(bloodPressure.getId())), bloodPressure); | |
| 23 | + } | |
| 24 | + | |
| 25 | +} |
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
View file @
99c7bd4
| ... | ... | @@ -57,6 +57,7 @@ |
| 57 | 57 | PatientCheckTicket("PatientCheckTicket", 97531000450L), |
| 58 | 58 | AntExPRecordModel("AntExPRecordModel", 97531000451L), |
| 59 | 59 | PatientWeight("PatientWeight", 97531000111L), |
| 60 | + BloodPressure("BloodPressure", 97531333111L), | |
| 60 | 61 | last("last", 97531009990L); |
| 61 | 62 | private String cname; |
| 62 | 63 | private Long cid; |
platform-dal/src/main/java/com/lyms/platform/pojo/BloodPressure.java
View file @
99c7bd4
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.beans.SerialIdEnum; | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 6 | + | |
| 7 | +import java.util.Date; | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 血压 | |
| 12 | + */ | |
| 13 | +@Document(collection="lyms_blood_pressure") | |
| 14 | +public class BloodPressure extends BaseModel { | |
| 15 | + | |
| 16 | + private static final long serialVersionUID = SerialIdEnum.PatientWeight.getCid(); | |
| 17 | + | |
| 18 | + private String id; | |
| 19 | + | |
| 20 | + private String parentId; | |
| 21 | + | |
| 22 | + private Date created; | |
| 23 | + | |
| 24 | + private Date modified; | |
| 25 | + | |
| 26 | + private Integer yn; | |
| 27 | + | |
| 28 | + private Integer operaterId; | |
| 29 | + | |
| 30 | + private String hospitalId; | |
| 31 | + | |
| 32 | + // 舒张压 | |
| 33 | + private String szy; | |
| 34 | + // 收缩压 | |
| 35 | + private String ssy; | |
| 36 | + // 脉搏 | |
| 37 | + private Integer pulse; | |
| 38 | + | |
| 39 | + private Map<String, Map<String, Object>> infos; | |
| 40 | + | |
| 41 | + public String getSzy() { | |
| 42 | + return szy; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setSzy(String szy) { | |
| 46 | + this.szy = szy; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getSsy() { | |
| 50 | + return ssy; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setSsy(String ssy) { | |
| 54 | + this.ssy = ssy; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public Integer getPulse() { | |
| 58 | + return pulse; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setPulse(Integer pulse) { | |
| 62 | + this.pulse = pulse; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getId() { | |
| 66 | + return id; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setId(String id) { | |
| 70 | + this.id = id; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public String getParentId() { | |
| 74 | + return parentId; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public void setParentId(String parentId) { | |
| 78 | + this.parentId = parentId; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public Date getCreated() { | |
| 82 | + return created; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public void setCreated(Date created) { | |
| 86 | + this.created = created; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public Date getModified() { | |
| 90 | + return modified; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setModified(Date modified) { | |
| 94 | + this.modified = modified; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public Integer getYn() { | |
| 98 | + return yn; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setYn(Integer yn) { | |
| 102 | + this.yn = yn; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public Integer getOperaterId() { | |
| 106 | + return operaterId; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setOperaterId(Integer operaterId) { | |
| 110 | + this.operaterId = operaterId; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public String getHospitalId() { | |
| 114 | + return hospitalId; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public void setHospitalId(String hospitalId) { | |
| 118 | + this.hospitalId = hospitalId; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public Map<String, Map<String, Object>> getInfos() { | |
| 122 | + return infos; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public void setInfos(Map<String, Map<String, Object>> infos) { | |
| 126 | + this.infos = infos; | |
| 127 | + } | |
| 128 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BloodPressureController.java
View file @
99c7bd4
| 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.result.BaseResponse; | |
| 6 | +import com.lyms.platform.operate.web.service.IBloodPressureService; | |
| 7 | +import com.lyms.platform.pojo.BloodPressure; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.stereotype.Controller; | |
| 10 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 13 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 14 | + | |
| 15 | +import javax.servlet.http.HttpServletRequest; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 血压 | |
| 19 | + */ | |
| 20 | +@Controller | |
| 21 | +@RequestMapping("/xy") | |
| 22 | +public class BloodPressureController extends BaseController { | |
| 23 | + | |
| 24 | + @Autowired | |
| 25 | + private IBloodPressureService bloodPressureService; | |
| 26 | + | |
| 27 | + @ResponseBody | |
| 28 | + @RequestMapping(method = RequestMethod.POST) | |
| 29 | + @TokenRequired | |
| 30 | + public BaseResponse addOrUpdate(BloodPressure bloodPressure, HttpServletRequest request) { | |
| 31 | + return bloodPressureService.addOrUpdate(getUserId(request), bloodPressure); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @ResponseBody | |
| 35 | + @RequestMapping(method = RequestMethod.GET) | |
| 36 | + @TokenRequired | |
| 37 | + public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, HttpServletRequest request) { | |
| 38 | + return bloodPressureService.list(key, vcCardNo, weekStart, weekEnd, age, page, limit, getUserId(request)); | |
| 39 | + } | |
| 40 | + | |
| 41 | + @ResponseBody | |
| 42 | + @RequestMapping(value = "/{id}", method = RequestMethod.GET) | |
| 43 | + @TokenRequired | |
| 44 | + public BaseResponse info(@PathVariable String id) { | |
| 45 | + return bloodPressureService.info(id); | |
| 46 | + } | |
| 47 | + | |
| 48 | + | |
| 49 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodPressureService.java
View file @
99c7bd4
| 1 | +package com.lyms.platform.operate.web.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseResponse; | |
| 4 | +import com.lyms.platform.pojo.BloodPressure; | |
| 5 | + | |
| 6 | +public interface IBloodPressureService extends IBaseService { | |
| 7 | + | |
| 8 | + BaseResponse addOrUpdate(Integer userId, BloodPressure bloodPressure); | |
| 9 | + | |
| 10 | + BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId); | |
| 11 | + | |
| 12 | + BaseResponse info(String id); | |
| 13 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java
View file @
99c7bd4
| 1 | +package com.lyms.platform.operate.web.service.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BloodPressureService; | |
| 4 | +import com.lyms.platform.biz.service.CommonService; | |
| 5 | +import com.lyms.platform.common.enums.YnEnums; | |
| 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.facade.AccessPermissionFacade; | |
| 12 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
| 13 | +import com.lyms.platform.operate.web.service.IBloodPressureService; | |
| 14 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 15 | +import com.lyms.platform.operate.web.utils.MongoUtil; | |
| 16 | +import com.lyms.platform.pojo.BloodPressure; | |
| 17 | +import com.lyms.platform.pojo.Patients; | |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | +import org.springframework.data.domain.Sort; | |
| 20 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 21 | +import org.springframework.data.mongodb.core.query.Criteria; | |
| 22 | +import org.springframework.data.mongodb.core.query.Query; | |
| 23 | +import org.springframework.stereotype.Service; | |
| 24 | + | |
| 25 | +import java.util.*; | |
| 26 | + | |
| 27 | +@Service | |
| 28 | +public class BloodPressureServiceImpl extends BaseServiceImpl implements IBloodPressureService { | |
| 29 | + | |
| 30 | + @Autowired | |
| 31 | + private BloodPressureService bloodPressureService; | |
| 32 | + | |
| 33 | + @Autowired | |
| 34 | + private MongoTemplate mongoTemplate; | |
| 35 | + | |
| 36 | + @Autowired | |
| 37 | + private AutoMatchFacade autoMatchFacade; | |
| 38 | + | |
| 39 | + @Autowired | |
| 40 | + private MongoUtil mongoUtil; | |
| 41 | + | |
| 42 | + @Autowired | |
| 43 | + private CommonService commonService; | |
| 44 | + | |
| 45 | + @Autowired | |
| 46 | + private AccessPermissionFacade accessPermissionFacade; | |
| 47 | + | |
| 48 | + | |
| 49 | + public BaseResponse addOrUpdate(Integer userId, BloodPressure bloodPressure) { | |
| 50 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 51 | + Map<String, Object> temp = new LinkedHashMap<>(); | |
| 52 | + temp.put("szy", bloodPressure.getSzy()); | |
| 53 | + temp.put("ssy", bloodPressure.getSsy()); | |
| 54 | + temp.put("pulse", bloodPressure.getPulse()); | |
| 55 | + temp.put("hospitalId", hospitalId); | |
| 56 | + if(StringUtils.isEmpty(bloodPressure.getId())) { | |
| 57 | + String parentId = mongoUtil.doHidePatient(bloodPressure.getParentId(), hospitalId); | |
| 58 | + bloodPressure.setParentId(parentId); | |
| 59 | + bloodPressure.setYn(YnEnums.YES.getId()); | |
| 60 | + bloodPressure.setCreated(new Date()); | |
| 61 | + bloodPressure.setHospitalId(hospitalId); | |
| 62 | + bloodPressure.setOperaterId(userId); | |
| 63 | + Map<String, Map<String, Object>> infos = new LinkedHashMap<>(); | |
| 64 | + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); | |
| 65 | + bloodPressure.setInfos(infos); | |
| 66 | + bloodPressureService.add(bloodPressure); | |
| 67 | + } else { | |
| 68 | + Map<String, Map<String, Object>> infos = mongoTemplate.findById(bloodPressure.getId(), BloodPressure.class).getInfos(); | |
| 69 | + infos.put(DateUtil.getyyyy_MM_dd(new Date()), temp); | |
| 70 | + bloodPressureService.update(bloodPressure); | |
| 71 | + } | |
| 72 | + return RespBuilder.buildSuccess(); | |
| 73 | + } | |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public BaseResponse list(String key, String vcCardNo, Integer weekStart, Integer weekEnd, Integer age, Integer page, Integer limit, Integer userId) { | |
| 77 | + List<String> hospitalIds = accessPermissionFacade.getCurrentUserHospPermissions(userId); | |
| 78 | + Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospitalIds); | |
| 79 | + Criteria pCriteria = Criteria.where("yn").ne("0").and("hospitalId").in(hospitalIds); | |
| 80 | + if(StringUtils.isNotEmpty(key)) { | |
| 81 | + pCriteria.orOperator(Criteria.where("phone").regex(key), Criteria.where("username").regex(key), Criteria.where("cardNo").is(key)); | |
| 82 | + } | |
| 83 | + if(StringUtils.isNotEmpty(vcCardNo)) { | |
| 84 | + pCriteria.and("vcCardNo").is(vcCardNo); | |
| 85 | + } | |
| 86 | + if(weekStart != null && weekEnd != null) { | |
| 87 | + Date start = DateUtil.getWeekStart(weekEnd); | |
| 88 | + Date end = DateUtil.getWeekEnd(weekStart); | |
| 89 | + pCriteria.and("lastMenses").gt(start).lte(end); | |
| 90 | + } | |
| 91 | + if(age != null) { | |
| 92 | + Date start = DateUtil.getBeforeAge(age); | |
| 93 | + Date end = DateUtil.getBeforeAge(age + 1); | |
| 94 | + pCriteria.and("birth").gt(end).lte(start); | |
| 95 | + } | |
| 96 | + List<Patients> patients = mongoTemplate.find(Query.query(pCriteria), Patients.class); | |
| 97 | + List<String> ids = new ArrayList<>(); | |
| 98 | + if(CollectionUtils.isNotEmpty(patients)) { | |
| 99 | + for (Patients patient : patients) { | |
| 100 | + ids.add(patient.getId()); | |
| 101 | + } | |
| 102 | + } | |
| 103 | + criteria.and("parentId").in(ids); | |
| 104 | + PageResult pageResult = findMongoPage(BloodPressure.class, new Query(criteria).with(new Sort(Sort.Direction.DESC, "created")), page, limit); | |
| 105 | + List<BloodPressure> bloodPressures = (List<BloodPressure>) pageResult.getGrid(); | |
| 106 | + List<Map<String, Object>> restList = new ArrayList<>(); | |
| 107 | + for (BloodPressure bloodPressure : bloodPressures) { | |
| 108 | + Map<String, Object> temp = new HashMap<>(); | |
| 109 | + Patients p = mongoTemplate.findById(bloodPressure.getParentId(), Patients.class); | |
| 110 | + temp.put("id", bloodPressure.getId()); | |
| 111 | + if(p != null) { | |
| 112 | + temp.put("username", p.getUsername()); | |
| 113 | + temp.put("age", DateUtil.getAge(p.getBirth())); | |
| 114 | + temp.put("week", DateUtil.getWeekDesc(p.getLastMenses(), new Date())); | |
| 115 | + temp.put("riskLevel", mongoUtil.getRiskLevels(p)); //高危等级(颜色) | |
| 116 | + temp.put("riskFactor", mongoUtil.getRiskFactor(p)); // 高危因素 | |
| 117 | + temp.put("dueDate", DateUtil.getyyyy_MM_dd(p.getDueDate())); | |
| 118 | + temp.put("bloodPressure", bloodPressure.getSsy() + "/" + bloodPressure.getSzy() + "mmHg"); | |
| 119 | + temp.put("pulse", bloodPressure.getPulse()); | |
| 120 | + temp.put("status", getPulseStatus(bloodPressure.getSsy(), bloodPressure.getSzy())); | |
| 121 | + } | |
| 122 | + restList.add(temp); | |
| 123 | + } | |
| 124 | + pageResult.setGrid(restList); | |
| 125 | + return RespBuilder.buildSuccess(pageResult); | |
| 126 | + } | |
| 127 | + | |
| 128 | + @Override | |
| 129 | + public BaseResponse info(String id) { | |
| 130 | + BloodPressure bloodPressure = mongoTemplate.findById(id, BloodPressure.class); | |
| 131 | + List<Map<String, Object>> xyInfos = new ArrayList<>(); | |
| 132 | + List<Map<String, List<Object>>> lines = new ArrayList<>(); | |
| 133 | + List<Integer> szyMin = Arrays.asList( 60, 60, 60, 60, 60, 60); | |
| 134 | + List<Integer> ssyMax = Arrays.asList(140, 140, 140, 140, 140, 140); | |
| 135 | + List<Object> ssy = new ArrayList<>(); | |
| 136 | + List<Object> szy = new ArrayList<>(); | |
| 137 | + List<Integer> pulse = new ArrayList<>(); | |
| 138 | + List<String> xAxis = new ArrayList<>(); | |
| 139 | + if(bloodPressure != null) { | |
| 140 | + List<String> betweenDay = DateUtil.getBetweenDay(7); | |
| 141 | + Map<String, Map<String, Object>> infos = bloodPressure.getInfos(); | |
| 142 | + for (String date : betweenDay) { | |
| 143 | + Map<String, Object> temp = new HashMap<>(); | |
| 144 | + xyInfos.add(temp); | |
| 145 | + | |
| 146 | + temp.put("date", date); | |
| 147 | + temp.put("ssy", infos.containsKey(date) ? infos.get(date).get("ssy") : "--"); | |
| 148 | + temp.put("szy", infos.containsKey(date) ? infos.get(date).get("szy") : "--"); | |
| 149 | + | |
| 150 | + xAxis.add(date.replace("-", "/")); | |
| 151 | + ssy.add(infos.containsKey(date) ? infos.get(date).get("ssy") : 0); | |
| 152 | + szy.add(infos.containsKey(date) ? infos.get(date).get("szy") : 0); | |
| 153 | + pulse.add(infos.containsKey(date) ? (Integer) infos.get(date).get("pulse") : 0); | |
| 154 | + } | |
| 155 | + } | |
| 156 | + | |
| 157 | + return RespBuilder.buildSuccess("xyInfos", xyInfos, "szyMin", szyMin, "ssyMax", ssyMax, "ssy", ssy, "szy", szy, pulse); | |
| 158 | + } | |
| 159 | + | |
| 160 | + private String getPulseStatus(String ssy, String szy) { | |
| 161 | + String status = ""; | |
| 162 | + if(StringUtils.isNotEmpty(ssy) && StringUtils.isNotEmpty(szy)) { | |
| 163 | + if(Double.parseDouble(ssy) < 90 || Double.parseDouble(szy) < 60) { | |
| 164 | + status = "低血压"; | |
| 165 | + } else if(Double.parseDouble(ssy) > 140 || Double.parseDouble(szy) < 90) { | |
| 166 | + status = "高血压"; | |
| 167 | + } else { | |
| 168 | + status = "正常"; | |
| 169 | + } | |
| 170 | + } | |
| 171 | + return status; | |
| 172 | + } | |
| 173 | + | |
| 174 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
99c7bd4
| 1 | 1 | package com.lyms.platform.operate.web.utils; |
| 2 | 2 | |
| 3 | +import com.alibaba.fastjson.JSONArray; | |
| 3 | 4 | import com.lyms.platform.biz.service.BabyBookbuildingService; |
| 5 | +import com.lyms.platform.biz.service.PatientsService; | |
| 4 | 6 | import com.lyms.platform.common.enums.RiskDefaultTypeEnum; |
| 5 | 7 | import com.lyms.platform.common.utils.DateUtil; |
| 8 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 6 | 9 | import com.lyms.platform.common.utils.StringUtils; |
| 7 | 10 | import com.lyms.platform.operate.web.facade.AccessPermissionFacade; |
| 8 | 11 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| ... | ... | @@ -51,6 +54,9 @@ |
| 51 | 54 | @Autowired |
| 52 | 55 | private CouponMapper couponMapper; |
| 53 | 56 | |
| 57 | + @Autowired | |
| 58 | + private PatientsService patientsService; | |
| 59 | + | |
| 54 | 60 | public void setIdNames(List<BasicConfig> basicConfigs, List<Map<String, Object>> restList) { |
| 55 | 61 | for (BasicConfig config : basicConfigs) { |
| 56 | 62 | Map<String, Object> temp = new HashMap<>(); |
| ... | ... | @@ -520,5 +526,61 @@ |
| 520 | 526 | } |
| 521 | 527 | return restList; |
| 522 | 528 | } |
| 529 | + | |
| 530 | + /** | |
| 531 | + * 隐藏建档 | |
| 532 | + */ | |
| 533 | + public String doHidePatient(String parentId, String hospitalId) { | |
| 534 | + Patients patients = mongoTemplate.findById(parentId, Patients.class); | |
| 535 | + if(patients != null && !hospitalId.equals(patients.getHospitalId())) { | |
| 536 | + patients.setId(null); | |
| 537 | + patients.setHospitalId(hospitalId); | |
| 538 | + patients.setEnable("2"); | |
| 539 | + patients.setSource(patients.getId()); | |
| 540 | + patients.setCreated(new Date()); | |
| 541 | + patientsService.addPatient(patients); | |
| 542 | + } | |
| 543 | + return patients.getId(); | |
| 544 | + } | |
| 545 | + | |
| 546 | + /** | |
| 547 | + * 获取高危等级(颜色) | |
| 548 | + */ | |
| 549 | + public List<String> getRiskLevels(Patients p) { | |
| 550 | + List<String> colors = new ArrayList<>(); | |
| 551 | + if (p != null && StringUtils.isNotEmpty(p.getRiskLevelId())) { | |
| 552 | + List<String> ids = JsonUtil.jkstr2Obj(p.getRiskLevelId(), List.class); | |
| 553 | + if(CollectionUtils.isNotEmpty(ids)) { | |
| 554 | + for (String id : ids) { | |
| 555 | + String name = findName(id); | |
| 556 | + if(StringUtils.isNotEmpty(name)) { | |
| 557 | + colors.add( "risk_" + RiskDefaultTypeEnum.getColor(name)); | |
| 558 | + } | |
| 559 | + } | |
| 560 | + } | |
| 561 | + } | |
| 562 | + return colors; | |
| 563 | + } | |
| 564 | + | |
| 565 | + /** | |
| 566 | + * 获取高危因素 | |
| 567 | + */ | |
| 568 | + public String getRiskFactor(Patients p) { | |
| 569 | + StringBuilder sb = new StringBuilder(); | |
| 570 | + if (p != null && CollectionUtils.isNotEmpty(p.getRiskFactorId())) { | |
| 571 | + List<String> ids = p.getRiskFactorId(); | |
| 572 | + if(CollectionUtils.isNotEmpty(ids)) { | |
| 573 | + for (String id : ids) { | |
| 574 | + String name = findName(id); | |
| 575 | + if(StringUtils.isNotEmpty(name)) { | |
| 576 | + sb.append(name); | |
| 577 | + } | |
| 578 | + } | |
| 579 | + } | |
| 580 | + } | |
| 581 | + return sb.length() > 0 ? sb.substring(0, sb.length() - 1).toString() : sb.toString(); | |
| 582 | + } | |
| 583 | + | |
| 584 | + | |
| 523 | 585 | } |