Commit 2a8115cf466b8aea555d2a04a1f25da61d005ef4
1 parent
3e6d1705bf
Exists in
master
and in
6 other branches
自定义高危数据
Showing 9 changed files with 728 additions and 3 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IHosptialHightRiskDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/HosptialHighRiskDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/HosptialHighRiskService.java
- platform-dal/src/main/java/com/lyms/platform/pojo/HosptialHighRisk.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/HosptialHighRiskQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HosptialHighRiskFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntexcOtherHighRiskWorker.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IHosptialHightRiskDao.java
View file @
2a8115c
1 | +package com.lyms.platform.biz.dal; | |
2 | + | |
3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
4 | +import com.lyms.platform.common.dao.operator.Page; | |
5 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
6 | + | |
7 | +import java.util.Collection; | |
8 | +import java.util.List; | |
9 | + | |
10 | +public interface IHosptialHightRiskDao { | |
11 | + | |
12 | + public HosptialHighRisk addHosptialHighRisk(HosptialHighRisk obj); | |
13 | + | |
14 | + public void updateHosptialHighRisk(HosptialHighRisk obj, String id); | |
15 | + | |
16 | + public void deleteHosptialHighRisk(String id); | |
17 | + | |
18 | + public HosptialHighRisk getHosptialHighRisk(String id); | |
19 | + | |
20 | + public int queryHosptialHighRiskCount(MongoQuery query); | |
21 | + | |
22 | + public List<HosptialHighRisk> queryHosptialHighRisk(MongoQuery query); | |
23 | + | |
24 | + public Page<HosptialHighRisk> findPage(MongoQuery query); | |
25 | + | |
26 | + public HosptialHighRisk getOneHosptialHighRiskById(String id); | |
27 | + | |
28 | + public void batchSave(Collection<HosptialHighRisk> list); | |
29 | + | |
30 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/HosptialHighRiskDaoImpl.java
View file @
2a8115c
1 | +package com.lyms.platform.biz.dal.impl; | |
2 | + | |
3 | +import com.lyms.platform.biz.dal.IHosptialHightRiskDao; | |
4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
8 | +import com.lyms.platform.common.dao.operator.Page; | |
9 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
10 | +import org.springframework.stereotype.Repository; | |
11 | + | |
12 | +import java.util.Collection; | |
13 | +import java.util.List; | |
14 | + | |
15 | +@Repository("hosptialHighRiskDao") | |
16 | +public class HosptialHighRiskDaoImpl extends BaseMongoDAOImpl<HosptialHighRisk> implements IHosptialHightRiskDao { | |
17 | + public HosptialHighRisk addHosptialHighRisk(HosptialHighRisk obj) { | |
18 | + return save(obj); | |
19 | + } | |
20 | + | |
21 | + public void updateHosptialHighRisk(HosptialHighRisk obj, String id) { | |
22 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
23 | + } | |
24 | + | |
25 | + public void deleteHosptialHighRisk(String id) { | |
26 | + delete(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery()); | |
27 | + } | |
28 | + | |
29 | + public void batchSave(Collection<HosptialHighRisk> list) { | |
30 | + super.batchSave(list); | |
31 | + } | |
32 | + | |
33 | + public HosptialHighRisk getHosptialHighRisk(String id) { | |
34 | + return findById(id); | |
35 | + } | |
36 | + | |
37 | + public int queryHosptialHighRiskCount(MongoQuery query) { | |
38 | + return (int) count(query.convertToMongoQuery()); | |
39 | + } | |
40 | + | |
41 | + public List<HosptialHighRisk> queryHosptialHighRisk(MongoQuery query) { | |
42 | + return find(query.convertToMongoQuery()); | |
43 | + } | |
44 | + | |
45 | + public Page<HosptialHighRisk> findPage(MongoQuery query) { | |
46 | + return findPage(query.convertToMongoQuery()); | |
47 | + } | |
48 | + | |
49 | + @Override | |
50 | + public HosptialHighRisk getOneHosptialHighRiskById(String id) { | |
51 | + return findById(id); | |
52 | + } | |
53 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/HosptialHighRiskService.java
View file @
2a8115c
1 | +package com.lyms.platform.biz.service; | |
2 | + | |
3 | +import com.google.common.cache.CacheLoader; | |
4 | +import com.google.common.cache.LoadingCache; | |
5 | +import com.lyms.platform.biz.dal.IHosptialHightRiskDao; | |
6 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
7 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
8 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
9 | +import com.lyms.platform.common.dao.operator.Page; | |
10 | +import com.lyms.platform.common.enums.YnEnums; | |
11 | +import com.lyms.platform.common.utils.CacheHelper; | |
12 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
13 | +import com.lyms.platform.query.HosptialHighRiskQuery; | |
14 | +import org.apache.commons.lang.StringUtils; | |
15 | +import org.springframework.beans.factory.InitializingBean; | |
16 | +import org.springframework.beans.factory.annotation.Autowired; | |
17 | +import org.springframework.data.domain.Sort.Direction; | |
18 | +import org.springframework.stereotype.Service; | |
19 | + | |
20 | +import java.util.*; | |
21 | + | |
22 | +@Service | |
23 | +public class HosptialHighRiskService implements InitializingBean { | |
24 | + | |
25 | + @Autowired | |
26 | + private IHosptialHightRiskDao hosptialHightRiskDao; | |
27 | + | |
28 | + private LoadingCache<String, HosptialHighRisk> cached=null; | |
29 | + | |
30 | + public void addHosptialHighRisk(HosptialHighRisk obj) { | |
31 | + obj.setModifiedDate(System.currentTimeMillis()); | |
32 | + hosptialHightRiskDao.addHosptialHighRisk(obj); | |
33 | + } | |
34 | + | |
35 | + public void updateHosptialHighRisk(HosptialHighRisk obj) { | |
36 | + hosptialHightRiskDao.updateHosptialHighRisk(obj, obj.getId()); | |
37 | + } | |
38 | + | |
39 | + public List<HosptialHighRisk> queryHosptialHighRisk(HosptialHighRiskQuery hosptialHighRiskQuery) { | |
40 | + MongoQuery query = hosptialHighRiskQuery.convertToQuery(); | |
41 | + if (StringUtils.isNotEmpty(hosptialHighRiskQuery.getNeed())) { | |
42 | + hosptialHighRiskQuery.mysqlBuild(hosptialHightRiskDao.queryHosptialHighRiskCount(hosptialHighRiskQuery.convertToQuery())); | |
43 | + query.start(hosptialHighRiskQuery.getOffset()).end(hosptialHighRiskQuery.getLimit()); | |
44 | + } | |
45 | + return hosptialHightRiskDao.queryHosptialHighRisk(query.addOrder(Direction.DESC, "weight")); | |
46 | + } | |
47 | + | |
48 | + | |
49 | + public void batchSave(Collection<HosptialHighRisk> list) { | |
50 | + hosptialHightRiskDao.batchSave(list); | |
51 | + } | |
52 | + | |
53 | + public List<HosptialHighRisk> queryParentConfig() { | |
54 | + return hosptialHightRiskDao.queryHosptialHighRisk(MongoCondition.newInstance("parentId", "0", MongoOper.IS).and("yn", YnEnums.YES.getId(), MongoOper.IS).toMongoQuery() | |
55 | + .addOrder(Direction.ASC, "id")); | |
56 | + } | |
57 | + | |
58 | + public List<Map<String, Object>> getEnumByParentId(String parentId) { | |
59 | + List<HosptialHighRisk> basicConfigs = queryByParentId(parentId); | |
60 | + List<Map<String, Object>> list = new ArrayList<>(); | |
61 | + for (HosptialHighRisk basicConfig : basicConfigs) { | |
62 | + Map<String, Object> temp = new HashMap<>(); | |
63 | + temp.put("id", basicConfig.getId()); | |
64 | + temp.put("name", basicConfig.getName()); | |
65 | + list.add(temp); | |
66 | + } | |
67 | + return list; | |
68 | + } | |
69 | + | |
70 | + | |
71 | + public HosptialHighRisk getOneHosptialHighRiskById(String id) { | |
72 | + try{ | |
73 | + return cached.get(id); | |
74 | + }catch (Exception e){ | |
75 | + } | |
76 | + return hosptialHightRiskDao.getOneHosptialHighRiskById(id); | |
77 | + } | |
78 | + | |
79 | + public List<HosptialHighRisk> queryByParentId(String parentId) { | |
80 | + return hosptialHightRiskDao.queryHosptialHighRisk(MongoCondition.newInstance("parentId", parentId, MongoOper.IS).and("yn", YnEnums.YES.getId(), MongoOper.IS).toMongoQuery().addOrder(Direction.DESC, "weight")); | |
81 | + } | |
82 | + | |
83 | + public Page<HosptialHighRisk> queryGuidesAndPage(int start, int end) { | |
84 | + return hosptialHightRiskDao.findPage(MongoCondition.newInstance().toMongoQuery().start(start).end(end).addOrder(Direction.ASC, "id")); | |
85 | + } | |
86 | + | |
87 | + @Override | |
88 | + public void afterPropertiesSet() throws Exception { | |
89 | + //cache size 为400 缓存3分钟 | |
90 | + cached = CacheHelper.cached(new CacheLoader<String, HosptialHighRisk>() { | |
91 | + @Override | |
92 | + public HosptialHighRisk load(String key) throws Exception { | |
93 | + return hosptialHightRiskDao.getOneHosptialHighRiskById(key); | |
94 | + } | |
95 | + },400,3); | |
96 | + } | |
97 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/HosptialHighRisk.java
View file @
2a8115c
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.annotation.Id; | |
6 | +import org.springframework.data.mongodb.core.mapping.Document; | |
7 | + | |
8 | +/** | |
9 | + * 医院自定义高危 | |
10 | + */ | |
11 | +@Document(collection="lyms_hosptial_hight_risk") | |
12 | +public class HosptialHighRisk extends BaseModel { | |
13 | + | |
14 | + private static final long serialVersionUID = SerialIdEnum.BasicConfig.getCid(); | |
15 | + | |
16 | + @Id | |
17 | + private String id; | |
18 | + | |
19 | + private String code; | |
20 | + | |
21 | + private String name; | |
22 | + | |
23 | + private Integer enable; | |
24 | + | |
25 | + private String hospitalId; | |
26 | + | |
27 | + private String typeId; | |
28 | + | |
29 | + //权重 | |
30 | + private Integer weight; | |
31 | + | |
32 | + private Long createDate; | |
33 | + private Long modifiedDate; | |
34 | + | |
35 | + private Integer score; | |
36 | + private String describe; | |
37 | + private String color; | |
38 | + | |
39 | + public Integer getWeight() { | |
40 | + return weight; | |
41 | + } | |
42 | + | |
43 | + public void setWeight(Integer weight) { | |
44 | + this.weight = weight; | |
45 | + } | |
46 | + | |
47 | + public String getColor() { | |
48 | + return color; | |
49 | + } | |
50 | + | |
51 | + public void setColor(String color) { | |
52 | + this.color = color; | |
53 | + } | |
54 | + | |
55 | + public Integer getScore() { | |
56 | + return score; | |
57 | + } | |
58 | + | |
59 | + public void setScore(Integer score) { | |
60 | + this.score = score; | |
61 | + } | |
62 | + | |
63 | + public String getDescribe() { | |
64 | + return describe; | |
65 | + } | |
66 | + | |
67 | + public void setDescribe(String describe) { | |
68 | + this.describe = describe; | |
69 | + } | |
70 | + | |
71 | + public static long getSerialVersionUID() { | |
72 | + return serialVersionUID; | |
73 | + } | |
74 | + | |
75 | + public String getHospitalId() { | |
76 | + return hospitalId; | |
77 | + } | |
78 | + | |
79 | + public void setHospitalId(String hospitalId) { | |
80 | + this.hospitalId = hospitalId; | |
81 | + } | |
82 | + | |
83 | + public Long getCreateDate() { | |
84 | + return createDate; | |
85 | + } | |
86 | + | |
87 | + public void setCreateDate(Long createDate) { | |
88 | + this.createDate = createDate; | |
89 | + } | |
90 | + | |
91 | + public Long getModifiedDate() { | |
92 | + return modifiedDate; | |
93 | + } | |
94 | + | |
95 | + public void setModifiedDate(Long modifiedDate) { | |
96 | + this.modifiedDate = modifiedDate; | |
97 | + } | |
98 | + | |
99 | + public String getTypeId() { | |
100 | + return typeId; | |
101 | + } | |
102 | + | |
103 | + public void setTypeId(String typeId) { | |
104 | + this.typeId = typeId; | |
105 | + } | |
106 | + | |
107 | + public Integer getEnable() { | |
108 | + return enable; | |
109 | + } | |
110 | + | |
111 | + public void setEnable(Integer enable) { | |
112 | + this.enable = enable; | |
113 | + } | |
114 | + | |
115 | + public String getName() { | |
116 | + return name; | |
117 | + } | |
118 | + | |
119 | + public void setName(String name) { | |
120 | + this.name = name; | |
121 | + } | |
122 | + | |
123 | + private Integer yn; | |
124 | + | |
125 | + public String getId() { | |
126 | + return id; | |
127 | + } | |
128 | + | |
129 | + public void setId(String id) { | |
130 | + this.id = id; | |
131 | + } | |
132 | + | |
133 | + public String getCode() { | |
134 | + return code; | |
135 | + } | |
136 | + | |
137 | + public void setCode(String code) { | |
138 | + this.code = code; | |
139 | + } | |
140 | + | |
141 | + public Integer getYn() { | |
142 | + return yn; | |
143 | + } | |
144 | + | |
145 | + public void setYn(Integer yn) { | |
146 | + this.yn = yn; | |
147 | + } | |
148 | +} |
platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
View file @
2a8115c
... | ... | @@ -34,6 +34,8 @@ |
34 | 34 | private Date checkTimeStart; |
35 | 35 | private Date checkTimeEnd; |
36 | 36 | private String checkDoctor; |
37 | + // 其他高危 | |
38 | + private String otherHighRisk; | |
37 | 39 | |
38 | 40 | public String getCheckDoctor() { |
39 | 41 | return checkDoctor; |
... | ... | @@ -183,6 +185,9 @@ |
183 | 185 | if (null != pid) { |
184 | 186 | condition = condition.and("pid", pid, MongoOper.IS); |
185 | 187 | } |
188 | + if (null != otherHighRisk) { | |
189 | + condition = condition.and("otherHighRisk", otherHighRisk, MongoOper.NE); | |
190 | + } | |
186 | 191 | if(CollectionUtils.isNotEmpty(parentIds)){ |
187 | 192 | condition = condition.and("parentId", parentIds, MongoOper.IN); |
188 | 193 | } |
... | ... | @@ -220,6 +225,14 @@ |
220 | 225 | condition = condition.andCondition(new MongoCondition(c)); |
221 | 226 | } |
222 | 227 | return condition.toMongoQuery(); |
228 | + } | |
229 | + | |
230 | + public String getOtherHighRisk() { | |
231 | + return otherHighRisk; | |
232 | + } | |
233 | + | |
234 | + public void setOtherHighRisk(String otherHighRisk) { | |
235 | + this.otherHighRisk = otherHighRisk; | |
223 | 236 | } |
224 | 237 | |
225 | 238 | public String getParentId() { |
platform-dal/src/main/java/com/lyms/platform/query/HosptialHighRiskQuery.java
View file @
2a8115c
1 | +package com.lyms.platform.query; | |
2 | + | |
3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
4 | +import com.lyms.platform.common.dao.BaseQuery; | |
5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
8 | +import com.lyms.platform.common.enums.YnEnums; | |
9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
10 | + | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * 医院自定义高危 | |
15 | + */ | |
16 | +public class HosptialHighRiskQuery extends BaseQuery implements IConvertToNativeQuery { | |
17 | + | |
18 | + private String id; | |
19 | + | |
20 | + private List ids; | |
21 | + | |
22 | + private String parentId; | |
23 | + | |
24 | + private List<String> parentIds; | |
25 | + | |
26 | + private String code; | |
27 | + | |
28 | + private String name; | |
29 | + private String orName; | |
30 | + | |
31 | + private String hospitalId; | |
32 | + | |
33 | + private String keyword; | |
34 | + | |
35 | + private Integer enable; | |
36 | + | |
37 | + private String typeId; | |
38 | + // | |
39 | + private Boolean existweight; | |
40 | + | |
41 | + public String getHospitalId() { | |
42 | + return hospitalId; | |
43 | + } | |
44 | + | |
45 | + public void setHospitalId(String hospitalId) { | |
46 | + this.hospitalId = hospitalId; | |
47 | + } | |
48 | + | |
49 | + public Boolean getExistweight() { | |
50 | + return existweight; | |
51 | + } | |
52 | + | |
53 | + public void setExistweight(Boolean existweight) { | |
54 | + this.existweight = existweight; | |
55 | + } | |
56 | + | |
57 | + public Integer getEnable() { | |
58 | + return enable; | |
59 | + } | |
60 | + | |
61 | + public void setEnable(Integer enable) { | |
62 | + this.enable = enable; | |
63 | + } | |
64 | + | |
65 | + public MongoQuery convertToQuery() { | |
66 | +// MongoCondition condition = MongoCondition.newInstance("1","1",MongoOper.IS); | |
67 | + MongoCondition condition = MongoCondition.newInstance("yn", YnEnums.YES.getId(),MongoOper.IS); | |
68 | + if (null != id) { | |
69 | + condition = condition.and("id", id, MongoOper.IS); | |
70 | + } | |
71 | + | |
72 | + if (null != ids && ids.size() > 0) { | |
73 | + Criteria c = Criteria.where("id").in(ids); | |
74 | + condition.andCondition( new MongoCondition(c)); | |
75 | + } | |
76 | + | |
77 | + if (null != code) { | |
78 | + condition = condition.and("code", code, MongoOper.IS); | |
79 | + } | |
80 | + if (null != hospitalId) { | |
81 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
82 | + } | |
83 | + if (null != name) { | |
84 | + condition = condition.and("name", name, MongoOper.IS); | |
85 | + } | |
86 | + if (null != orName) { | |
87 | + MongoCondition con1= MongoCondition.newInstance("alias", orName, MongoOper.LIKE); | |
88 | + MongoCondition con = MongoCondition.newInstance("name", orName, MongoOper.IS); | |
89 | + condition = condition.orCondition(new MongoCondition[]{con1, con}); | |
90 | + } | |
91 | + if (null != parentId) { | |
92 | + condition = condition.and("parentId", parentId, MongoOper.IS); | |
93 | + } | |
94 | + | |
95 | + if (null != parentIds) { | |
96 | + condition = condition.and("parentId", parentIds, MongoOper.IN); | |
97 | + } | |
98 | + | |
99 | + if (null != typeId) { | |
100 | + condition = condition.and("typeId", typeId, MongoOper.IS); | |
101 | + } | |
102 | + if(null!=enable){ | |
103 | + condition = condition.and("enable", enable, MongoOper.IS); | |
104 | + } | |
105 | + if(null!=existweight){ | |
106 | + condition = condition.and("weight", existweight, MongoOper.EXISTS); | |
107 | + } | |
108 | + | |
109 | + if (null != keyword) { | |
110 | + MongoCondition con1= MongoCondition.newInstance("code", keyword, MongoOper.LIKE); | |
111 | + MongoCondition con = MongoCondition.newInstance("name", keyword, MongoOper.LIKE); | |
112 | + condition = condition.orCondition(new MongoCondition[]{con1,con}); | |
113 | + } | |
114 | + | |
115 | + return condition.toMongoQuery(); | |
116 | + } | |
117 | + | |
118 | + public List<String> getParentIds() { | |
119 | + return parentIds; | |
120 | + } | |
121 | + | |
122 | + public void setParentIds(List<String> parentIds) { | |
123 | + this.parentIds = parentIds; | |
124 | + } | |
125 | + | |
126 | + public String getOrName() { | |
127 | + return orName; | |
128 | + } | |
129 | + | |
130 | + public void setOrName(String orName) { | |
131 | + this.orName = orName; | |
132 | + } | |
133 | + | |
134 | + public List getIds() { | |
135 | + return ids; | |
136 | + } | |
137 | + | |
138 | + public void setIds(List ids) { | |
139 | + this.ids = ids; | |
140 | + } | |
141 | + | |
142 | + public String getTypeId() { | |
143 | + return typeId; | |
144 | + } | |
145 | + | |
146 | + public void setTypeId(String typeId) { | |
147 | + this.typeId = typeId; | |
148 | + } | |
149 | + | |
150 | + public String getKeyword() { | |
151 | + return keyword; | |
152 | + } | |
153 | + | |
154 | + public void setKeyword(String keyword) { | |
155 | + this.keyword = keyword; | |
156 | + } | |
157 | + | |
158 | + public String getName() { | |
159 | + return name; | |
160 | + } | |
161 | + | |
162 | + public void setName(String name) { | |
163 | + this.name = name; | |
164 | + } | |
165 | + | |
166 | + private int yn; | |
167 | + | |
168 | + public String getId() { | |
169 | + return id; | |
170 | + } | |
171 | + | |
172 | + public void setId(String id) { | |
173 | + this.id = id; | |
174 | + } | |
175 | + | |
176 | + public String getParentId() { | |
177 | + return parentId; | |
178 | + } | |
179 | + | |
180 | + public void setParentId(String parentId) { | |
181 | + this.parentId = parentId; | |
182 | + } | |
183 | + | |
184 | + public String getCode() { | |
185 | + return code; | |
186 | + } | |
187 | + | |
188 | + public void setCode(String code) { | |
189 | + this.code = code; | |
190 | + } | |
191 | + | |
192 | + public int getYn() { | |
193 | + return yn; | |
194 | + } | |
195 | + | |
196 | + public void setYn(int yn) { | |
197 | + this.yn = yn; | |
198 | + } | |
199 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
2a8115c
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | import com.lyms.platform.operate.web.result.HighScoreResult; |
20 | 20 | import com.lyms.platform.operate.web.service.IBloodPressureService; |
21 | 21 | import com.lyms.platform.operate.web.service.SyncDataTaskService; |
22 | +import com.lyms.platform.operate.web.worker.AntexcOtherHighRiskWorker; | |
22 | 23 | import com.lyms.platform.operate.web.worker.BabyBuildSerToPatientSerWorker; |
23 | 24 | import com.lyms.platform.operate.web.worker.BuildSerToPatientSerWorker; |
24 | 25 | import com.lyms.platform.permission.model.Organization; |
... | ... | @@ -40,7 +41,10 @@ |
40 | 41 | import org.springframework.data.mongodb.core.query.Query; |
41 | 42 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
42 | 43 | import org.springframework.stereotype.Controller; |
43 | -import org.springframework.web.bind.annotation.*; | |
44 | +import org.springframework.web.bind.annotation.RequestMapping; | |
45 | +import org.springframework.web.bind.annotation.RequestMethod; | |
46 | +import org.springframework.web.bind.annotation.RequestParam; | |
47 | +import org.springframework.web.bind.annotation.ResponseBody; | |
44 | 48 | |
45 | 49 | import java.io.File; |
46 | 50 | import java.io.IOException; |
47 | 51 | |
... | ... | @@ -97,8 +101,9 @@ |
97 | 101 | |
98 | 102 | @Autowired |
99 | 103 | private GenSequenceIdService genIdService; |
104 | + @Autowired | |
105 | + private BasicConfigService basicConfigService; | |
100 | 106 | |
101 | - | |
102 | 107 | @Autowired |
103 | 108 | private AntExRecordService recordService; |
104 | 109 | |
... | ... | @@ -110,6 +115,8 @@ |
110 | 115 | private ThreadPoolTaskExecutor commonThreadPool; |
111 | 116 | @Autowired |
112 | 117 | private PatientServiceService patientServiceService; |
118 | + @Autowired | |
119 | + private HosptialHighRiskService hosptialHighRiskService; | |
113 | 120 | |
114 | 121 | @Autowired |
115 | 122 | private IBloodPressureService bloodPressureService; |
116 | 123 | |
117 | 124 | |
... | ... | @@ -146,8 +153,30 @@ |
146 | 153 | return datas; |
147 | 154 | } |
148 | 155 | |
156 | + | |
149 | 157 | /** |
158 | + * 孕妇初诊数据自定义高危数据处理 | |
159 | + * | |
160 | + * @return | |
161 | + */ | |
162 | + @RequestMapping(value = "/synAntexcOtherHighRisk", method = RequestMethod.GET) | |
163 | + @ResponseBody | |
164 | + public BaseResponse synAntexcOtherHighRisk() { | |
165 | + AntExChuQuery antExChuQuery1 = new AntExChuQuery(); | |
166 | + antExChuQuery1.setOtherHighRisk("{}"); | |
167 | + int patientCount = antenatalExaminationService.queryAntExChuCount(antExChuQuery1.convertToQuery()); | |
168 | + System.out.println("一共需要处理数据量:" + patientCount); | |
169 | + | |
170 | + commonThreadPool.execute(new AntexcOtherHighRiskWorker(0, patientCount, antenatalExaminationService, hosptialHighRiskService, basicConfigService, 1000, patientCount)); | |
171 | + BaseResponse baseResponse = new BaseResponse(); | |
172 | + baseResponse.setErrormsg("一共需要处理数据量:" + patientCount); | |
173 | + return baseResponse; | |
174 | + } | |
175 | + | |
176 | + | |
177 | + /** | |
150 | 178 | * 儿童建档服务数据处理 |
179 | + * | |
151 | 180 | * @param isSkip 是否增量添加 true:增量添加 |
152 | 181 | * @return |
153 | 182 | */ |
... | ... | @@ -191,7 +220,9 @@ |
191 | 220 | } |
192 | 221 | |
193 | 222 | |
194 | - /** 同步孕妇建档服务数据 | |
223 | + /** | |
224 | + * 同步孕妇建档服务数据 | |
225 | + * | |
195 | 226 | * @param isSkip 是否增量添加 true:增量添加 |
196 | 227 | * @param isZjzx 是否对增值服务,开通专家咨询服务 true:开通增值服务 |
197 | 228 | * @return |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/HosptialHighRiskFacade.java
View file @
2a8115c
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.HosptialHighRiskService; | |
4 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
5 | +import org.springframework.beans.factory.annotation.Autowired; | |
6 | + | |
7 | +/** | |
8 | + * @auther yangfei | |
9 | + * @createTime 2017年12月28日 15时27分 | |
10 | + * @discription 医院自定义高危 | |
11 | + */ | |
12 | +public class HosptialHighRiskFacade { | |
13 | + @Autowired | |
14 | + private HosptialHighRiskService hosptialHighRiskService; | |
15 | + | |
16 | + /** | |
17 | + * 新增自定义高危 | |
18 | + * @param hosptialHighRisk | |
19 | + * @return | |
20 | + */ | |
21 | + public boolean addHosptialHighRisk(HosptialHighRisk hosptialHighRisk){ | |
22 | + hosptialHighRiskService.addHosptialHighRisk(hosptialHighRisk); | |
23 | + return true; | |
24 | + } | |
25 | + | |
26 | + | |
27 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/AntexcOtherHighRiskWorker.java
View file @
2a8115c
1 | +package com.lyms.platform.operate.web.worker; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
5 | +import com.lyms.platform.biz.service.HosptialHighRiskService; | |
6 | +import com.lyms.platform.common.enums.YnEnums; | |
7 | +import com.lyms.platform.common.utils.JsonUtil; | |
8 | +import com.lyms.platform.common.utils.StringUtils; | |
9 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
10 | +import com.lyms.platform.operate.web.utils.FunvCommonUtil; | |
11 | +import com.lyms.platform.pojo.AntExChuModel; | |
12 | +import com.lyms.platform.pojo.HosptialHighRisk; | |
13 | +import com.lyms.platform.query.AntExChuQuery; | |
14 | +import com.lyms.platform.query.HosptialHighRiskQuery; | |
15 | + | |
16 | +import java.util.HashMap; | |
17 | +import java.util.List; | |
18 | +import java.util.Map; | |
19 | + | |
20 | +/** | |
21 | + * @auther yangfei | |
22 | + * @createTime 2017年11月22日 11时28分 | |
23 | + * @discription | |
24 | + */ | |
25 | +public class AntexcOtherHighRiskWorker implements Runnable { | |
26 | + private int startIndex; | |
27 | + private int endIndex; | |
28 | + private int batchSize; | |
29 | + private int allCount; | |
30 | + private AntenatalExaminationService antenatalExaminationService; | |
31 | + private HosptialHighRiskService hosptialHighRiskService; | |
32 | + private BasicConfigService basicConfigService; | |
33 | + | |
34 | + public AntexcOtherHighRiskWorker(int startIndex, int endIndex, AntenatalExaminationService antenatalExaminationService, HosptialHighRiskService hosptialHighRiskService, BasicConfigService basicConfigService, int batchSize, int allCount) { | |
35 | + this.allCount = allCount; | |
36 | + this.startIndex = startIndex; | |
37 | + this.endIndex = endIndex; | |
38 | + this.antenatalExaminationService = antenatalExaminationService; | |
39 | + this.hosptialHighRiskService = hosptialHighRiskService; | |
40 | + this.basicConfigService = basicConfigService; | |
41 | + if (batchSize >= 1000) { | |
42 | + this.batchSize = 1000; | |
43 | + } else { | |
44 | + this.batchSize = batchSize; | |
45 | + } | |
46 | + } | |
47 | + | |
48 | + /** | |
49 | + * Computes a result, or throws an exception if unable to do so. | |
50 | + * | |
51 | + * @return computed result | |
52 | + */ | |
53 | + @Override | |
54 | + public void run() { | |
55 | + try { | |
56 | + Map<String, Integer> patientsMap = new HashMap<>(); | |
57 | + | |
58 | + for (int i = startIndex; i < endIndex; i += batchSize) { | |
59 | + AntExChuQuery antExChuQuery1 = new AntExChuQuery(); | |
60 | + antExChuQuery1.setOtherHighRisk("{}"); | |
61 | + antExChuQuery1.setLimit(batchSize); | |
62 | + antExChuQuery1.setPage((i + batchSize) / batchSize); | |
63 | + | |
64 | + List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery1.convertToQuery()); | |
65 | + System.out.println("查询数据" + antExChuModels.size()); | |
66 | + for (AntExChuModel chu : antExChuModels) { | |
67 | + System.out.println(chu.getOtherHighRisk()); | |
68 | + String otherHighRisk = chu.getOtherHighRisk(); | |
69 | + String hospital = chu.getHospitalId(); | |
70 | + String color = ""; | |
71 | + String pingfen = ""; | |
72 | + String yinsu = ""; | |
73 | + | |
74 | + Map<String, String> otherMap = JsonUtil.jkstr2Obj(otherHighRisk, Map.class); | |
75 | + if (otherMap != null) { | |
76 | + if (StringUtils.isNotEmpty(otherMap.get("fyyse"))) { | |
77 | + color = otherMap.get("fyyse").toString(); | |
78 | + // color = FunvCommonUtil.getBaseicConfigByid(id, basicConfigService); | |
79 | + // if (color.indexOf("预警") > -1) { | |
80 | + // color = color.replace("预警", ""); | |
81 | + // } | |
82 | + } else { | |
83 | + continue; | |
84 | + } | |
85 | + if (StringUtils.isNotEmpty(otherMap.get("fxpf"))) { | |
86 | + String id = otherMap.get("fxpf").toString(); | |
87 | + pingfen = FunvCommonUtil.getBaseicConfigByid(id, basicConfigService); | |
88 | + } else { | |
89 | + continue; | |
90 | + } | |
91 | + if (StringUtils.isNotEmpty(otherMap.get("fxysu"))) { | |
92 | + yinsu = otherMap.get("fxysu").toString(); | |
93 | + } else { | |
94 | + continue; | |
95 | + } | |
96 | + } else { | |
97 | + continue; | |
98 | + } | |
99 | + | |
100 | + HosptialHighRiskQuery hosptialHighRiskQuery = new HosptialHighRiskQuery(); | |
101 | + hosptialHighRiskQuery.setHospitalId(hospital); | |
102 | + hosptialHighRiskQuery.setName(yinsu); | |
103 | + | |
104 | + List<HosptialHighRisk> hosptialHighRisks = hosptialHighRiskService.queryHosptialHighRisk(hosptialHighRiskQuery); | |
105 | + if (CollectionUtils.isEmpty(hosptialHighRisks)) { | |
106 | + HosptialHighRisk hosptialHighRisk = new HosptialHighRisk(); | |
107 | + hosptialHighRisk.setHospitalId(hospital); | |
108 | + hosptialHighRisk.setCode(pingfen); | |
109 | + hosptialHighRisk.setName(yinsu); | |
110 | + hosptialHighRisk.setEnable(YnEnums.YES.getId()); | |
111 | + hosptialHighRisk.setYn(YnEnums.YES.getId()); | |
112 | + hosptialHighRisk.setColor(color); | |
113 | + hosptialHighRiskService.addHosptialHighRisk(hosptialHighRisk); | |
114 | + } | |
115 | + } | |
116 | + | |
117 | + | |
118 | + System.out.println("总数据量:" + allCount + ",正在处理第:" + i + "--到--" + (i + batchSize) + ",page:" + antExChuQuery1.getPage() + ",limit:" + antExChuQuery1.getLimit()); | |
119 | + | |
120 | + | |
121 | + System.out.println("线程处理数据完成,开始条数:" + startIndex + ",结束条数:" + endIndex + ",map:" + patientsMap.size()); | |
122 | + } | |
123 | + } catch (Exception e) { | |
124 | + e.printStackTrace(); | |
125 | + } | |
126 | + } | |
127 | +} |