Commit 71870b62ac62d5256b6bb1aacf26ebab503f08b7
1 parent
8e03af3e24
Exists in
master
and in
6 other branches
update
Showing 11 changed files with 754 additions and 9 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/DiagnoseConfigService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AutoBabyRiskRecord.java
- platform-dal/src/main/java/com/lyms/platform/pojo/DiagnoseConfigModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/DiagnoseItemModel.java
- platform-dal/src/main/java/com/lyms/platform/query/DiagnoseConfigQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DiagnoseConfigController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyAutoDiagnoseRiskFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DiagnoseConfigFacde.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyAutoRiskRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/DiagnoseConfigRequest.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/DiagnoseConfigService.java
View file @
71870b6
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | diagnoseConfigQuery.mysqlBuild(diagnoseConfigDao.queryDiagnoseConfigCount(diagnoseConfigQuery.convertToQuery())); |
34 | 34 | query.start(diagnoseConfigQuery.getOffset()).end(diagnoseConfigQuery.getLimit()); |
35 | 35 | } |
36 | - return diagnoseConfigDao.queryDiagnoseConfigs(query.addOrder(Sort.Direction.DESC, "created")); | |
36 | + return diagnoseConfigDao.queryDiagnoseConfigs(query.addOrder(Direction.ASC, "created")); | |
37 | 37 | } |
38 | 38 | public DiagnoseConfigModel saveDiagnoseConfig(DiagnoseConfigModel data){ |
39 | 39 | return diagnoseConfigDao.saveDiagnoseConfig(data); |
platform-dal/src/main/java/com/lyms/platform/pojo/AutoBabyRiskRecord.java
View file @
71870b6
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.List; | |
9 | + | |
10 | + | |
11 | +/** | |
12 | + * 儿童自动诊断高危实体类 | |
13 | + */ | |
14 | +@Document(collection="lyms_baby_auto_risk_record") | |
15 | +public class AutoBabyRiskRecord extends BaseModel { | |
16 | + | |
17 | + private static final long serialVersionUID = SerialIdEnum.TrackCountRecord.getCid(); | |
18 | + | |
19 | + private String id; | |
20 | + private String fid; | |
21 | + private String hospitalId; | |
22 | + private String pid; | |
23 | + private String patientId; | |
24 | + //高危评分 | |
25 | + private Integer hScore; | |
26 | + //高危等级 | |
27 | + private List hLevel; | |
28 | + //风险因素 | |
29 | + private List hRisk; | |
30 | + private Date created; | |
31 | + private Date modified; | |
32 | + //状态 0 未确认 已经确认 | |
33 | + private Integer status; | |
34 | + //诊断来源 0建档 1初诊 2复诊 | |
35 | + private Integer type; | |
36 | + | |
37 | + public String getId() { | |
38 | + return id; | |
39 | + } | |
40 | + | |
41 | + public void setId(String id) { | |
42 | + this.id = id; | |
43 | + } | |
44 | + | |
45 | + public String getFid() { | |
46 | + return fid; | |
47 | + } | |
48 | + | |
49 | + public void setFid(String fid) { | |
50 | + this.fid = fid; | |
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 getPid() { | |
62 | + return pid; | |
63 | + } | |
64 | + | |
65 | + public void setPid(String pid) { | |
66 | + this.pid = pid; | |
67 | + } | |
68 | + | |
69 | + public String getPatientId() { | |
70 | + return patientId; | |
71 | + } | |
72 | + | |
73 | + public void setPatientId(String patientId) { | |
74 | + this.patientId = patientId; | |
75 | + } | |
76 | + | |
77 | + public Integer gethScore() { | |
78 | + return hScore; | |
79 | + } | |
80 | + | |
81 | + public void sethScore(Integer hScore) { | |
82 | + this.hScore = hScore; | |
83 | + } | |
84 | + | |
85 | + public List gethLevel() { | |
86 | + return hLevel; | |
87 | + } | |
88 | + | |
89 | + public void sethLevel(List hLevel) { | |
90 | + this.hLevel = hLevel; | |
91 | + } | |
92 | + | |
93 | + public List gethRisk() { | |
94 | + return hRisk; | |
95 | + } | |
96 | + | |
97 | + public void sethRisk(List hRisk) { | |
98 | + this.hRisk = hRisk; | |
99 | + } | |
100 | + | |
101 | + public Date getCreated() { | |
102 | + return created; | |
103 | + } | |
104 | + | |
105 | + public void setCreated(Date created) { | |
106 | + this.created = created; | |
107 | + } | |
108 | + | |
109 | + public Date getModified() { | |
110 | + return modified; | |
111 | + } | |
112 | + | |
113 | + public void setModified(Date modified) { | |
114 | + this.modified = modified; | |
115 | + } | |
116 | + | |
117 | + public Integer getStatus() { | |
118 | + return status; | |
119 | + } | |
120 | + | |
121 | + public void setStatus(Integer status) { | |
122 | + this.status = status; | |
123 | + } | |
124 | + | |
125 | + public Integer getType() { | |
126 | + return type; | |
127 | + } | |
128 | + | |
129 | + public void setType(Integer type) { | |
130 | + this.type = type; | |
131 | + } | |
132 | + | |
133 | + | |
134 | + | |
135 | + | |
136 | + | |
137 | + | |
138 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/DiagnoseConfigModel.java
View file @
71870b6
... | ... | @@ -26,6 +26,19 @@ |
26 | 26 | private Date created; |
27 | 27 | private Date modified; |
28 | 28 | |
29 | + /*儿童自动诊断新增字段*/ | |
30 | + //默认是孕妇类型,type=2是儿童类型 | |
31 | + private String type; | |
32 | + | |
33 | + | |
34 | + | |
35 | + public String getType() { | |
36 | + return type; | |
37 | + } | |
38 | + | |
39 | + public void setType(String type) { | |
40 | + this.type = type; | |
41 | + } | |
29 | 42 | |
30 | 43 | public Date getCreated() { |
31 | 44 | return created; |
platform-dal/src/main/java/com/lyms/platform/pojo/DiagnoseItemModel.java
View file @
71870b6
... | ... | @@ -30,18 +30,24 @@ |
30 | 30 | private String valueFive; |
31 | 31 | private String valueSix; |
32 | 32 | private String valueSeven; |
33 | - | |
34 | - | |
35 | 33 | private Date created; |
36 | 34 | private Date modified; |
37 | - | |
38 | 35 | //权重 |
39 | 36 | private Integer weight; |
40 | - | |
41 | - //高危id | |
37 | + //高危id,20200827新增儿童的,“高危儿诊断项目” | |
42 | 38 | private List<String> riskIds; |
43 | 39 | |
44 | 40 | |
41 | + /*儿童自动诊断新增字段*/ | |
42 | + //畸形详情,在转换成MaternalDeliverModel.Baby判断使用 | |
43 | + private Map<String,Object> tejx; | |
44 | + //母亲存在的高危因素 | |
45 | + private List<String> riskFactorIds; | |
46 | + //20200827新增儿童的,“高危儿详情项” | |
47 | + private List<String> riskBabyInfoIds; | |
48 | + | |
49 | + | |
50 | + | |
45 | 51 | public String getValueSix() { |
46 | 52 | return valueSix; |
47 | 53 | } |
... | ... | @@ -52,6 +58,31 @@ |
52 | 58 | |
53 | 59 | public String getValueSeven() { |
54 | 60 | return valueSeven; |
61 | + } | |
62 | + | |
63 | + | |
64 | + public Map <String, Object> getTejx() { | |
65 | + return tejx; | |
66 | + } | |
67 | + | |
68 | + public void setTejx(Map <String, Object> tejx) { | |
69 | + this.tejx = tejx; | |
70 | + } | |
71 | + | |
72 | + public List <String> getRiskFactorIds() { | |
73 | + return riskFactorIds; | |
74 | + } | |
75 | + | |
76 | + public void setRiskFactorIds(List <String> riskFactorIds) { | |
77 | + this.riskFactorIds = riskFactorIds; | |
78 | + } | |
79 | + | |
80 | + public List <String> getRiskBabyInfoIds() { | |
81 | + return riskBabyInfoIds; | |
82 | + } | |
83 | + | |
84 | + public void setRiskBabyInfoIds(List <String> riskBabyInfoIds) { | |
85 | + this.riskBabyInfoIds = riskBabyInfoIds; | |
55 | 86 | } |
56 | 87 | |
57 | 88 | public void setValueSeven(String valueSeven) { |
platform-dal/src/main/java/com/lyms/platform/query/DiagnoseConfigQuery.java
View file @
71870b6
... | ... | @@ -20,7 +20,26 @@ |
20 | 20 | private String hospitalId; |
21 | 21 | //是否启用 0停用 1启用 |
22 | 22 | private Integer enable; |
23 | + //默认是孕妇类型,type=2是儿童类型 | |
24 | + private String type; | |
25 | + private boolean typeb; | |
23 | 26 | |
27 | + public boolean isTypeb() { | |
28 | + return typeb; | |
29 | + } | |
30 | + | |
31 | + public void setTypeb(boolean typeb) { | |
32 | + this.typeb = typeb; | |
33 | + } | |
34 | + | |
35 | + public String getType() { | |
36 | + return type; | |
37 | + } | |
38 | + | |
39 | + public void setType(String type) { | |
40 | + this.type = type; | |
41 | + } | |
42 | + | |
24 | 43 | @Override |
25 | 44 | public MongoQuery convertToQuery() { |
26 | 45 | MongoCondition condition = MongoCondition.newInstance(); |
... | ... | @@ -36,7 +55,12 @@ |
36 | 55 | if (null != enable) { |
37 | 56 | condition = condition.and("enable", enable, MongoOper.IS); |
38 | 57 | } |
39 | - | |
58 | + if (null != type) { | |
59 | + condition = condition.and("type", type, MongoOper.IS); | |
60 | + } | |
61 | + if (typeb) { | |
62 | + condition = condition.and("type", null, MongoOper.IS); | |
63 | + } | |
40 | 64 | Criteria c1 = null; |
41 | 65 | |
42 | 66 | if (null != c1) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DiagnoseConfigController.java
View file @
71870b6
... | ... | @@ -66,9 +66,10 @@ |
66 | 66 | @ResponseBody |
67 | 67 | @TokenRequired |
68 | 68 | public BaseResponse queryDiagnoseConfig(@RequestParam("hospitalId")String hospitalId, |
69 | + @RequestParam(required = false) String type, | |
69 | 70 | HttpServletRequest request) { |
70 | 71 | |
71 | - return diagnoseConfigFacde.queryDiagnoseConfig(hospitalId, getUserId(request)); | |
72 | + return diagnoseConfigFacde.queryDiagnoseConfig(hospitalId,type, getUserId(request)); | |
72 | 73 | } |
73 | 74 | |
74 | 75 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyAutoDiagnoseRiskFacade.java
View file @
71870b6
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
4 | +import com.lyms.platform.biz.service.DiagnoseConfigService; | |
5 | +import com.lyms.platform.biz.service.MatDeliverService; | |
6 | +import com.lyms.platform.biz.service.PatientsService; | |
7 | +import com.lyms.platform.common.enums.BabyAutoDiagnoseEnums; | |
8 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
9 | +import com.lyms.platform.common.utils.JsonUtil; | |
10 | +import com.lyms.platform.operate.web.request.BabyAutoRiskRequest; | |
11 | +import com.lyms.platform.operate.web.request.MatDeliverAddRequest; | |
12 | +import com.lyms.platform.pojo.*; | |
13 | +import com.lyms.platform.query.DiagnoseConfigQuery; | |
14 | +import com.lyms.platform.query.DiagnoseItemsQuery; | |
15 | +import com.lyms.platform.query.MatDeliverQuery; | |
16 | +import org.apache.commons.collections.CollectionUtils; | |
17 | +import org.apache.commons.lang.StringUtils; | |
18 | +import org.springframework.beans.factory.annotation.Autowired; | |
19 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
20 | +import org.springframework.data.mongodb.core.query.Criteria; | |
21 | +import org.springframework.data.mongodb.core.query.Query; | |
22 | +import org.springframework.stereotype.Component; | |
23 | + | |
24 | +import java.util.*; | |
25 | + | |
26 | +/** | |
27 | + * 儿童自动诊断高危逻辑类 | |
28 | + */ | |
29 | +@Component | |
30 | +public class BabyAutoDiagnoseRiskFacade { | |
31 | + @Autowired | |
32 | + private DiagnoseConfigFacde diagnoseConfigFacde; | |
33 | + @Autowired | |
34 | + private BasicConfigFacade basicConfigFacade; | |
35 | + @Autowired | |
36 | + private DiagnoseConfigService diagnoseConfigService; | |
37 | + @Autowired | |
38 | + private PatientsService patientsService; | |
39 | + @Autowired | |
40 | + private BasicConfigService basicConfigService; | |
41 | + @Autowired | |
42 | + private MongoTemplate mongoTemplate; | |
43 | + @Autowired | |
44 | + private MatDeliverService matDeliverService; | |
45 | + | |
46 | + /** | |
47 | + * 儿童建档,自动高危自动挡 | |
48 | + * | |
49 | + * @param babyAutoRiskRequest | |
50 | + * @param userId | |
51 | + * @Author: 武涛涛 | |
52 | + * @Date: 2020/8/31 13:52 | |
53 | + */ | |
54 | + public void autoBabyRisk(BabyAutoRiskRequest babyAutoRiskRequest, Integer userId) { | |
55 | + /* | |
56 | + 儿童建档分两种方式: | |
57 | + 1 孕妇分娩自动建档, | |
58 | + 分娩建档,通过parentId获取,分娩信息自动生成高危 | |
59 | + | |
60 | + 2 儿童模块中直接建档, | |
61 | + 通过儿童档案id(buildId),获取儿童档案信息,自动生成高危 | |
62 | + | |
63 | + 儿童检查: | |
64 | + 通过检查信息,判断符合条件,自动生成高危(注意儿童检查好像就一个体重,需要自动生成) | |
65 | + */ | |
66 | + | |
67 | + | |
68 | + List <Map <String, String>> riskList = autoRisk(babyAutoRiskRequest, babyAutoRiskRequest.getHospitalId(), 0); | |
69 | +// saveAutoRisk(riskList, null, pat.getHospitalId(), pat.getPid(), pat.getId(), 0); | |
70 | + } | |
71 | + | |
72 | + /** | |
73 | + * 儿童,自动判定高危因素 | |
74 | + * | |
75 | + * @param hospitalId | |
76 | + * @param type 0 孕妇分娩儿童建档, 1儿童直接建档,2 儿童检查 | |
77 | + * @Author: 武涛涛 | |
78 | + * @Date: 2020/8/31 14:56 | |
79 | + */ | |
80 | + private List <Map <String, String>> autoRisk(BabyAutoRiskRequest babyAutoRiskRequest, String hospitalId, Integer type) { | |
81 | + Set <String> list = new HashSet <>(); | |
82 | + List <Map <String, String>> riskList = new ArrayList <>(); | |
83 | + | |
84 | + //获取儿童诊断配置 | |
85 | + DiagnoseConfigQuery diagnoseConfigQuery = new DiagnoseConfigQuery(); | |
86 | + diagnoseConfigQuery.setHospitalId(hospitalId); | |
87 | + diagnoseConfigQuery.setType("2"); | |
88 | + List <DiagnoseConfigModel> configModels = diagnoseConfigService.queryDiagnoseConfigs(diagnoseConfigQuery); | |
89 | + | |
90 | + //存储儿童诊断配置,单个项目状态信息 | |
91 | + Map <String, String> status = new HashMap <>(); | |
92 | + if (CollectionUtils.isNotEmpty(configModels)) { | |
93 | + DiagnoseConfigModel model = configModels.get(0); | |
94 | + List <Map <String, String>> configs = model.getConfigs(); | |
95 | + | |
96 | + //判断儿童诊断配置是否开启 | |
97 | + if (model == null || "0".equals(model.getEnable()) || configs == null || configs.size() == 0) { | |
98 | + return riskList; | |
99 | + } | |
100 | + if (CollectionUtils.isNotEmpty(configs)) { | |
101 | + for (Map <String, String> map : configs) { | |
102 | + status.put(map.get("id"), map.get("status")); | |
103 | + } | |
104 | + } | |
105 | + } | |
106 | + | |
107 | + //获取诊断项详情 | |
108 | + Map <Integer, List <DiagnoseItemModel>> mapItems = getRiskConfig(configModels); | |
109 | + if (mapItems != null && mapItems.size() > 0) { | |
110 | + | |
111 | + MaternalDeliverModel maternalDeliverModel = null; | |
112 | + if (type == 0) { | |
113 | + MatDeliverQuery deliverQuery = new MatDeliverQuery(); | |
114 | + deliverQuery.setParentId(babyAutoRiskRequest.getParentId()); | |
115 | + List <MaternalDeliverModel> maternalDeliverModels = matDeliverService.query(deliverQuery); | |
116 | + if (CollectionUtils.isNotEmpty(maternalDeliverModels)) { | |
117 | + maternalDeliverModel = maternalDeliverModels.get(0); | |
118 | + } | |
119 | + } else if (type == 1) { | |
120 | + maternalDeliverModel = new MaternalDeliverModel(); | |
121 | + | |
122 | + // 儿童查询获取母亲档案信息,执行“孕母存在高危因素” | |
123 | + | |
124 | + //儿童建档就将建档信息,复制到分娩类来使用 | |
125 | + } | |
126 | + | |
127 | + | |
128 | + /*孕母存在高危因素*/ | |
129 | + if (isEnableItem(status, BabyAutoDiagnoseEnums.BabyDiagnoseEnums.ymczgwys.getId()) && type == 0) { | |
130 | + Patients patients = patientsService.findOnePatientById(babyAutoRiskRequest.getParentId()); | |
131 | + if (patients != null && CollectionUtils.isNotEmpty(patients.getRiskFactorId())) { | |
132 | + List <String> riskFactorId = patients.getRiskFactorId();//孕妇存在的高危 | |
133 | + //诊断项 | |
134 | + List <DiagnoseItemModel> items = mapItems.get(BabyAutoDiagnoseEnums.BabyDiagnoseEnums.ymczgwys.getId()); | |
135 | + if (CollectionUtils.isNotEmpty(items)) { | |
136 | + for (DiagnoseItemModel item : items) { | |
137 | + if (ymczgwys(riskFactorId, item)) { | |
138 | + list.addAll(item.getRiskIds());//item.getRiskIds() 诊断项,高危儿诊断项目 | |
139 | + } | |
140 | + } | |
141 | + } | |
142 | + } | |
143 | + } | |
144 | + | |
145 | + | |
146 | + /*分娩孕周*/ | |
147 | + | |
148 | + /*胎方位*/ | |
149 | + if (isEnableItem(status, BabyAutoDiagnoseEnums.BabyDiagnoseEnums.tfw.getId()) && maternalDeliverModel != null) { | |
150 | + List placentas = maternalDeliverModel.getPlacentas(); | |
151 | + if (CollectionUtils.isNotEmpty(placentas)) { | |
152 | + MatDeliverAddRequest.Placenta placenta = (MatDeliverAddRequest.Placenta) placentas.get(0); | |
153 | + if (placenta != null && StringUtils.isNotEmpty(placenta.getFetalPosition())) { | |
154 | + String fetalPosition = placenta.getFetalPosition(); | |
155 | + List <DiagnoseItemModel> items = mapItems.get(BabyAutoDiagnoseEnums.BabyDiagnoseEnums.tfw.getId()); | |
156 | + if (CollectionUtils.isNotEmpty(items)) { | |
157 | + for (DiagnoseItemModel item : items) { | |
158 | + | |
159 | + String valueTwo = item.getValueTwo(); | |
160 | + if (valueTwo.equals(fetalPosition)) { | |
161 | + list.addAll(item.getRiskIds());//item.getRiskIds() 诊断项,高危儿诊断项目 | |
162 | + } | |
163 | + | |
164 | + } | |
165 | + } | |
166 | + | |
167 | + } | |
168 | + } | |
169 | + } | |
170 | + /*脐带长度*/ | |
171 | + if (isEnableItem(status, BabyAutoDiagnoseEnums.BabyDiagnoseEnums.twcd.getId()) && maternalDeliverModel != null) { | |
172 | + List <MaternalDeliverModel.ExtPlacenta> extPlacentas = maternalDeliverModel.getExtPlacentas(); | |
173 | + if (CollectionUtils.isNotEmpty(extPlacentas)) { | |
174 | + MaternalDeliverModel.ExtPlacenta extPlacenta = extPlacentas.get(0); | |
175 | + | |
176 | + if (extPlacenta != null && StringUtils.isNotEmpty(extPlacenta.getUmbilicalCordLength())) { | |
177 | + String umbilicalCordLength = extPlacenta.getUmbilicalCordLength(); | |
178 | + | |
179 | + List <DiagnoseItemModel> items = mapItems.get(BabyAutoDiagnoseEnums.BabyDiagnoseEnums.twcd.getId()); | |
180 | + if (CollectionUtils.isNotEmpty(items)) { | |
181 | + for (DiagnoseItemModel item : items) { | |
182 | + if (compare(item, umbilicalCordLength) && CollectionUtils.isNotEmpty(item.getRiskIds())) { | |
183 | + list.addAll(item.getRiskIds()); | |
184 | + } | |
185 | + | |
186 | + } | |
187 | + } | |
188 | + } | |
189 | + } | |
190 | + } | |
191 | + /*脐带异常类型*/ | |
192 | + if (isEnableItem(status, BabyAutoDiagnoseEnums.BabyDiagnoseEnums.qdyclx.getId()) && maternalDeliverModel != null) { | |
193 | + List <MaternalDeliverModel.ExtPlacenta> extPlacentas = maternalDeliverModel.getExtPlacentas(); | |
194 | + if (CollectionUtils.isNotEmpty(extPlacentas)) { | |
195 | + MaternalDeliverModel.ExtPlacenta extPlacenta = extPlacentas.get(0); | |
196 | + | |
197 | + if (extPlacenta != null && StringUtils.isNotEmpty(extPlacenta.getUmbilicalCordExType())) { | |
198 | + String umbilicalCordExType = extPlacenta.getUmbilicalCordExType(); | |
199 | + List <DiagnoseItemModel> items = mapItems.get(BabyAutoDiagnoseEnums.BabyDiagnoseEnums.qdyclx.getId()); | |
200 | + if (CollectionUtils.isNotEmpty(items)) { | |
201 | + for (DiagnoseItemModel item : items) { | |
202 | + | |
203 | + String valueTwo = item.getValueTwo(); | |
204 | + if (valueTwo.equals(umbilicalCordExType)) { | |
205 | + list.addAll(item.getRiskIds()); | |
206 | + } | |
207 | + | |
208 | + } | |
209 | + } | |
210 | + } | |
211 | + } | |
212 | + } | |
213 | + | |
214 | + /*分娩方式*/ | |
215 | + if (isEnableItem(status, BabyAutoDiagnoseEnums.BabyDiagnoseEnums.fmfs.getId()) && maternalDeliverModel != null) { | |
216 | + | |
217 | + if (StringUtils.isNotEmpty(maternalDeliverModel.getDeliveryMode())) { | |
218 | + String deliveryMode = maternalDeliverModel.getDeliveryMode(); | |
219 | + Map m = JsonUtil.str2Obj(deliveryMode, Map.class); | |
220 | + String fmfs = null; | |
221 | + if (m != null) { | |
222 | + Object b = m.get("fmfs"); | |
223 | + if (b != null) { | |
224 | + fmfs = b.toString(); | |
225 | + } | |
226 | + } | |
227 | + if(StringUtils.isNotEmpty(fmfs)){ | |
228 | + List <DiagnoseItemModel> items = mapItems.get(BabyAutoDiagnoseEnums.BabyDiagnoseEnums.fmfs.getId()); | |
229 | + if (CollectionUtils.isNotEmpty(items)) { | |
230 | + for (DiagnoseItemModel item : items) { | |
231 | + | |
232 | + String valueTwo = item.getValueTwo(); | |
233 | + if (valueTwo.equals(fmfs)) { | |
234 | + list.addAll(item.getRiskIds()); | |
235 | + } | |
236 | + | |
237 | + } | |
238 | + } | |
239 | + } | |
240 | + | |
241 | + } | |
242 | + } | |
243 | + /*胎儿畸形*/ | |
244 | + if (isEnableItem(status, BabyAutoDiagnoseEnums.BabyDiagnoseEnums.tejx.getId()) && maternalDeliverModel != null) { | |
245 | + List <MaternalDeliverModel.Baby> baby = maternalDeliverModel.getBaby(); | |
246 | + if (CollectionUtils.isNotEmpty(baby)) { | |
247 | + MaternalDeliverModel.Baby baby1 = baby.get(0); | |
248 | + if (baby1 != null) { | |
249 | + List <DiagnoseItemModel> items = mapItems.get(BabyAutoDiagnoseEnums.BabyDiagnoseEnums.tejx.getId()); | |
250 | + if (CollectionUtils.isNotEmpty(items)) { | |
251 | + for (DiagnoseItemModel item : items) { | |
252 | + | |
253 | + String valueTwo = item.getValueTwo(); | |
254 | + /*if (valueTwo.equals(umbilicalCordExType)) { | |
255 | + list.addAll(item.getRiskIds()); | |
256 | + }*/ | |
257 | + | |
258 | + } | |
259 | + } | |
260 | + | |
261 | + | |
262 | + } | |
263 | + } | |
264 | + } | |
265 | + | |
266 | + | |
267 | + | |
268 | + } | |
269 | + | |
270 | + | |
271 | + if (list.size() > 0) { | |
272 | + List <String> ids = new ArrayList <>(); | |
273 | + for (String id : list) { | |
274 | + ids.add(id); | |
275 | + } | |
276 | + riskList = diagnoseConfigFacde.getRiskName(ids); | |
277 | + } | |
278 | + System.out.println(riskList.toString()); | |
279 | + return riskList; | |
280 | + } | |
281 | + | |
282 | + /** | |
283 | + * 母存在高危因素,比较 | |
284 | + * | |
285 | + * @param riskFactorId | |
286 | + * @param item | |
287 | + * @Author: 武涛涛 | |
288 | + * @Date: 2020/9/1 9:38 | |
289 | + */ | |
290 | + private boolean ymczgwys(List <String> riskFactorId, DiagnoseItemModel item) { | |
291 | + List <String> riskFactorIds = item.getRiskFactorIds();//诊断项,母亲存在的高危因素 | |
292 | + for (String ris : riskFactorIds) { | |
293 | + //孕妇存在的高危,诊断项,母亲存在的高危因素都有,说明符合,就添加 | |
294 | + if (!riskFactorId.contains(ris)) { | |
295 | + return false; | |
296 | + } | |
297 | + } | |
298 | + return true; | |
299 | + } | |
300 | + | |
301 | + /** | |
302 | + * 胎方位,比较 | |
303 | + * | |
304 | + * @param items | |
305 | + * @param fetalPosition | |
306 | + * @Author: 武涛涛 | |
307 | + * @Date: 2020/8/31 17:05 | |
308 | + */ | |
309 | + private boolean compare(List <DiagnoseItemModel> items, String fetalPosition) { | |
310 | + if (CollectionUtils.isNotEmpty(items)) { | |
311 | + for (DiagnoseItemModel item : items) { | |
312 | + String valueTwo = item.getValueTwo(); | |
313 | + if (valueTwo.equals(fetalPosition)) { | |
314 | + return true; | |
315 | + } | |
316 | + } | |
317 | + } | |
318 | + return false; | |
319 | + } | |
320 | + | |
321 | + | |
322 | + private boolean contain(String value, String content) { | |
323 | + return content.contains(value); | |
324 | + } | |
325 | + | |
326 | + /** | |
327 | + * 获取诊断项详情 | |
328 | + * | |
329 | + * @param configModels | |
330 | + * @Author: 武涛涛 | |
331 | + * @Date: 2020/8/31 14:48 | |
332 | + */ | |
333 | + private Map <Integer, List <DiagnoseItemModel>> getRiskConfig(List <DiagnoseConfigModel> configModels) { | |
334 | + Map <Integer, List <DiagnoseItemModel>> mapItems = new HashMap <>(); | |
335 | + | |
336 | + if (CollectionUtils.isNotEmpty(configModels)) { | |
337 | + DiagnoseConfigModel configModel = configModels.get(0); | |
338 | + | |
339 | + DiagnoseItemsQuery diagnoseItemsQuery = new DiagnoseItemsQuery(); | |
340 | + diagnoseItemsQuery.setConfigId(configModel.getId()); | |
341 | + //通过ConfigId获取儿童诊断配置-- 诊断配置项详情 | |
342 | + List <DiagnoseItemModel> diagnoseItemModels = diagnoseConfigService.queryDiagnoseItems(diagnoseItemsQuery); | |
343 | + if (CollectionUtils.isNotEmpty(diagnoseItemModels)) { | |
344 | + | |
345 | + //遍历诊断依据枚举检查与诊断配置项是否匹配,将匹配的诊断项存储mapItems key是id,value DiagnoseItemModelList | |
346 | + for (BabyAutoDiagnoseEnums.BabyDiagnoseEnums diagnoses : BabyAutoDiagnoseEnums.BabyDiagnoseEnums.values()) { | |
347 | + List <DiagnoseItemModel> diagnoseItemList = new ArrayList <>(); | |
348 | + for (DiagnoseItemModel item : diagnoseItemModels) { | |
349 | + if (diagnoses.getId() == Integer.parseInt(item.getParentId())) { | |
350 | + diagnoseItemList.add(item); | |
351 | + } | |
352 | + } | |
353 | + mapItems.put(diagnoses.getId(), diagnoseItemList); | |
354 | + } | |
355 | + } | |
356 | + } | |
357 | + | |
358 | + return mapItems; | |
359 | + } | |
360 | + | |
361 | + /** | |
362 | + * 每一项是否启用 | |
363 | + * | |
364 | + * @param status | |
365 | + * @param id | |
366 | + * @Author: 武涛涛 | |
367 | + * @Date: 2020/8/31 13:58 | |
368 | + */ | |
369 | + private boolean isEnableItem(Map <String, String> status, Integer id) { | |
370 | + if (status != null && status.size() > 0) { | |
371 | + if ("true".equals(status.get(String.valueOf(id)))) { | |
372 | + return true; | |
373 | + } | |
374 | + } | |
375 | + return false; | |
376 | + } | |
377 | + | |
378 | + /** | |
379 | + * @param expId 表达式id | |
380 | + * @param value 计算值 | |
381 | + * @param calValue 被计算值 | |
382 | + * @return | |
383 | + */ | |
384 | + private boolean compare(String expId, String value, String calValue) { | |
385 | + try { | |
386 | + Double compareValue = Double.parseDouble(calValue); | |
387 | + | |
388 | + Integer id = Integer.parseInt(expId); | |
389 | + switch (id) { | |
390 | + case 1: | |
391 | + return compareValue > Double.parseDouble(value); | |
392 | + case 2: | |
393 | + return compareValue >= Double.parseDouble(value); | |
394 | + case 3: | |
395 | + return compareValue < Double.parseDouble(value); | |
396 | + case 4: | |
397 | + return compareValue <= Double.parseDouble(value); | |
398 | + case 5: | |
399 | + return compareValue == Double.parseDouble(value); | |
400 | + case 6: | |
401 | + return compareValue != Double.parseDouble(value); | |
402 | + default: | |
403 | + return false; | |
404 | + } | |
405 | + } catch (Exception e) { | |
406 | + ExceptionUtils.catchException(e, "risk compare error"); | |
407 | + } | |
408 | + return false; | |
409 | + } | |
410 | + | |
411 | + private boolean compare(DiagnoseItemModel item, String calValue) { | |
412 | + String expId1 = item.getValueOne(); | |
413 | + String value1 = item.getValueTwo(); | |
414 | + String logic = item.getValueThree(); | |
415 | + String expId2 = item.getValueFour(); | |
416 | + String value2 = item.getValueFive(); | |
417 | + | |
418 | + if (StringUtils.isNotEmpty(expId1) && | |
419 | + StringUtils.isNotEmpty(value1) && | |
420 | + StringUtils.isNotEmpty(expId2) && | |
421 | + StringUtils.isNotEmpty(value2) && | |
422 | + StringUtils.isNotEmpty(logic)) { | |
423 | + Integer logicId = Integer.parseInt(logic); | |
424 | + switch (logicId) { | |
425 | + case 1: | |
426 | + return compare(expId1, value1, calValue) && compare(expId2, value2, calValue); | |
427 | + case 2: | |
428 | + return compare(expId1, value1, calValue) || compare(expId2, value2, calValue); | |
429 | + default: | |
430 | + return false; | |
431 | + } | |
432 | + } else if (StringUtils.isNotEmpty(expId1) && StringUtils.isNotEmpty(value1)) { | |
433 | + return compare(expId1, value1, calValue); | |
434 | + } | |
435 | + return false; | |
436 | + } | |
437 | + | |
438 | + /** | |
439 | + * 保存,儿童自动诊断高危 | |
440 | + * | |
441 | + * @param risks 高危因素 | |
442 | + * @param fid 产检id(初诊、复诊) | |
443 | + * @param hospitalId 医院id | |
444 | + * @param pid | |
445 | + * @param patientId | |
446 | + * @param type 0 建档诊断 1产检诊断 | |
447 | + * @Author: 武涛涛 | |
448 | + * @Date: 2020/8/31 13:56 | |
449 | + */ | |
450 | + private void saveAutoRisk(List <Map <String, String>> risks, String fid, String hospitalId, String pid, String patientId, Integer type) { | |
451 | + if (CollectionUtils.isNotEmpty(risks)) { | |
452 | + List rLevel = new ArrayList(); | |
453 | + List hRisk = new ArrayList(); | |
454 | + Integer score = 0; | |
455 | + for (Map <String, String> risk : risks) { | |
456 | + rLevel.add(risk.get("riskLevel")); | |
457 | + hRisk.add(risk.get("id")); | |
458 | + score += StringUtils.isNotEmpty(risk.get("code")) ? Integer.parseInt(risk.get("code")) : 0; | |
459 | + } | |
460 | + | |
461 | + if (StringUtils.isNotEmpty(fid)) { | |
462 | + Query query = new Query(); | |
463 | + query.addCriteria(Criteria.where("fid").is(fid)); | |
464 | + AutoRiskRecord autoRisk = mongoTemplate.findOne(query, AutoRiskRecord.class); | |
465 | + if (autoRisk != null) { | |
466 | + return; | |
467 | + } | |
468 | + } | |
469 | + AutoRiskRecord riskRecord = new AutoRiskRecord(); | |
470 | + riskRecord.setPatientId(patientId); | |
471 | + riskRecord.setFid(fid); | |
472 | + riskRecord.setPid(pid); | |
473 | + riskRecord.setHospitalId(hospitalId); | |
474 | + riskRecord.setStatus(0); | |
475 | + riskRecord.setType(type); | |
476 | + riskRecord.sethRisk(hRisk); | |
477 | + riskRecord.sethLevel(rLevel); | |
478 | + riskRecord.sethScore(score); | |
479 | + riskRecord.setCreated(new Date()); | |
480 | + riskRecord.setModified(new Date()); | |
481 | + mongoTemplate.save(riskRecord); | |
482 | + | |
483 | + } | |
484 | + | |
485 | + } | |
486 | + | |
487 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/DiagnoseConfigFacde.java
View file @
71870b6
... | ... | @@ -185,10 +185,16 @@ |
185 | 185 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); |
186 | 186 | } |
187 | 187 | |
188 | - public BaseResponse queryDiagnoseConfig(String hospitalId, Integer userId) { | |
188 | + public BaseResponse queryDiagnoseConfig(String hospitalId,String type, Integer userId) { | |
189 | 189 | |
190 | 190 | DiagnoseConfigQuery diagnoseConfigQuery = new DiagnoseConfigQuery(); |
191 | 191 | diagnoseConfigQuery.setHospitalId(hospitalId); |
192 | + if(StringUtils.isNotEmpty(type)){ | |
193 | + diagnoseConfigQuery.setType(type); | |
194 | + }else { | |
195 | + diagnoseConfigQuery.setTypeb(true); | |
196 | + } | |
197 | + | |
192 | 198 | List<DiagnoseConfigModel> configModels = diagnoseConfigService.queryDiagnoseConfigs(diagnoseConfigQuery); |
193 | 199 | if (CollectionUtils.isEmpty(configModels)) |
194 | 200 | { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
71870b6
... | ... | @@ -79,6 +79,8 @@ |
79 | 79 | @Autowired |
80 | 80 | private MatDeliverService matDeliverService; |
81 | 81 | @Autowired |
82 | + private BabyAutoDiagnoseRiskFacade babyAutoDiagnoseRiskFacade; | |
83 | + @Autowired | |
82 | 84 | private MatDeliverFollowService matDeliverFollowService; |
83 | 85 | @Autowired |
84 | 86 | private AntenatalExaminationFacade antenatalExaminationFacade; |
... | ... | @@ -446,6 +448,17 @@ |
446 | 448 | |
447 | 449 | //新增分娩信息 |
448 | 450 | matDeliverService.addMatDeliver(maternalDeliverModel); |
451 | + | |
452 | + //儿童自动诊断 | |
453 | + try { | |
454 | + BabyAutoRiskRequest babyAutoRiskRequest = new BabyAutoRiskRequest(); | |
455 | + babyAutoRiskRequest.setParentId(maternalDeliverModel.getParentId()); | |
456 | + | |
457 | + babyAutoDiagnoseRiskFacade.autoBabyRisk(babyAutoRiskRequest,userId); | |
458 | + } catch (Exception e) { | |
459 | + e.printStackTrace(); | |
460 | + } | |
461 | + | |
449 | 462 | |
450 | 463 | operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), maternalDeliverModel, OptActionEnums.ADD.getId(), "添加分娩"); |
451 | 464 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyAutoRiskRequest.java
View file @
71870b6
1 | +package com.lyms.platform.operate.web.request; | |
2 | + | |
3 | +/** | |
4 | + * | |
5 | + * 儿童检查,自动高危入参类 | |
6 | + * @Author: 武涛涛 | |
7 | + * @Date: 2020/8/31 14:03 | |
8 | + */ | |
9 | +public class BabyAutoRiskRequest extends MatDeliverAddRequest { | |
10 | + | |
11 | + | |
12 | + private String hospitalId; | |
13 | + public String getHospitalId() { | |
14 | + return hospitalId; | |
15 | + } | |
16 | + | |
17 | + public void setHospitalId(String hospitalId) { | |
18 | + this.hospitalId = hospitalId; | |
19 | + } | |
20 | + | |
21 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/DiagnoseConfigRequest.java
View file @
71870b6
... | ... | @@ -20,7 +20,17 @@ |
20 | 20 | //是否启用 0停用 1启用 |
21 | 21 | private String enable; |
22 | 22 | private List<Map<String,String>> configs; |
23 | + //默认是孕妇类型,type=2是儿童类型 | |
24 | + private String type; | |
23 | 25 | |
26 | + public String getType() { | |
27 | + return type; | |
28 | + } | |
29 | + | |
30 | + public void setType(String type) { | |
31 | + this.type = type; | |
32 | + } | |
33 | + | |
24 | 34 | public String getId() { |
25 | 35 | return id; |
26 | 36 | } |
... | ... | @@ -59,6 +69,7 @@ |
59 | 69 | model.setId(id); |
60 | 70 | model.setEnable(enable); |
61 | 71 | model.setHospitalId(hospitalId); |
72 | + model.setType(type); | |
62 | 73 | return model; |
63 | 74 | } |
64 | 75 | } |