Commit bd7ca545d159d4271d88b3f4009d15861db20c3f
1 parent
c4a3ab0a18
Exists in
master
and in
6 other branches
update code
Showing 11 changed files with 987 additions and 1 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ISieveRecordDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/SieveRecordDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SieveRecordService.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
- platform-dal/src/main/java/com/lyms/platform/pojo/SieveRecordModel.java
- platform-dal/src/main/java/com/lyms/platform/query/SieveRecordQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveRecordController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveRecordFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ISieveRecordDao.java
View file @
bd7ca54
1 | +package com.lyms.platform.biz.dal; | |
2 | + | |
3 | + | |
4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
5 | +import com.lyms.platform.pojo.SieveRecordModel; | |
6 | + | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * Created by Administrator on 2016/6/30 0030. | |
11 | + */ | |
12 | +public interface ISieveRecordDao { | |
13 | + | |
14 | + | |
15 | + List<SieveRecordModel> query(MongoQuery mongoQuery); | |
16 | + | |
17 | + void saveObj(SieveRecordModel model); | |
18 | + | |
19 | + int querySieveRecordCount(MongoQuery query); | |
20 | + | |
21 | + void update(SieveRecordModel model, String id); | |
22 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/SieveRecordDaoImpl.java
View file @
bd7ca54
1 | +package com.lyms.platform.biz.dal.impl; | |
2 | + | |
3 | +import com.lyms.platform.biz.dal.ISieveRecordDao; | |
4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
5 | + | |
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.pojo.SieveRecordModel; | |
10 | + | |
11 | +import org.springframework.stereotype.Repository; | |
12 | + | |
13 | +import java.util.Date; | |
14 | +import java.util.List; | |
15 | + | |
16 | + | |
17 | +/** | |
18 | + * Created by Administrator on 2016/6/30 0030. | |
19 | + */ | |
20 | +@Repository("sieveRecordDao") | |
21 | +public class SieveRecordDaoImpl extends BaseMongoDAOImpl<SieveRecordModel> implements ISieveRecordDao { | |
22 | + | |
23 | + @Override | |
24 | + public List<SieveRecordModel> query(MongoQuery mongoQuery) { | |
25 | + return find(mongoQuery.convertToMongoQuery()); | |
26 | + } | |
27 | + | |
28 | + @Override | |
29 | + public void saveObj(SieveRecordModel model) { | |
30 | + save(model); | |
31 | + } | |
32 | + | |
33 | + @Override | |
34 | + public int querySieveRecordCount(MongoQuery query) { | |
35 | + return (int)count(query.convertToMongoQuery()); | |
36 | + } | |
37 | + | |
38 | + @Override | |
39 | + public void update(SieveRecordModel model, String id) { | |
40 | + model.setModified(new Date()); | |
41 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), model); | |
42 | + } | |
43 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SieveRecordService.java
View file @
bd7ca54
1 | +package com.lyms.platform.biz.service; | |
2 | + | |
3 | +import com.lyms.platform.biz.dal.ISieveRecordDao; | |
4 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
5 | +import com.lyms.platform.pojo.SieveRecordModel; | |
6 | +import com.lyms.platform.query.SieveRecordQuery; | |
7 | +import org.apache.commons.lang.StringUtils; | |
8 | +import org.springframework.beans.factory.annotation.Autowired; | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +import java.util.List; | |
12 | + | |
13 | + | |
14 | +/** | |
15 | + * Created by Administrator on 2016/6/30 0030. | |
16 | + */ | |
17 | +@Service("sieveRecordService") | |
18 | +public class SieveRecordService { | |
19 | + | |
20 | + @Autowired | |
21 | + private ISieveRecordDao sieveRecordDao; | |
22 | + | |
23 | + public List<SieveRecordModel> query(SieveRecordQuery sieveRecordQuery) { | |
24 | + MongoQuery query = sieveRecordQuery.convertToQuery(); | |
25 | + if (StringUtils.isNotEmpty(sieveRecordQuery.getNeed())) { | |
26 | + sieveRecordQuery.mysqlBuild(sieveRecordDao.querySieveRecordCount(query)); | |
27 | + query.start(sieveRecordQuery.getOffset()).end(sieveRecordQuery.getLimit()); | |
28 | + } | |
29 | + | |
30 | + return sieveRecordDao.query(query); | |
31 | + } | |
32 | + | |
33 | + public void save(SieveRecordModel model) { | |
34 | + sieveRecordDao.saveObj(model); | |
35 | + } | |
36 | + | |
37 | + public void update(SieveRecordModel model, String id) { | |
38 | + sieveRecordDao.update(model,id); | |
39 | + } | |
40 | +} |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
bd7ca54
... | ... | @@ -235,6 +235,18 @@ |
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
238 | + | |
239 | + public static String gety_m_dhm(Date d) { | |
240 | + if (d == null) { | |
241 | + return null; | |
242 | + } | |
243 | + try { | |
244 | + return y_m_d_h_m1.format(d); | |
245 | + } catch (Exception e) { | |
246 | + return null; | |
247 | + } | |
248 | + } | |
249 | + | |
238 | 250 | /** |
239 | 251 | * @return 返回当前年月日字符串 :20131025 |
240 | 252 | */ |
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
View file @
bd7ca54
... | ... | @@ -47,6 +47,7 @@ |
47 | 47 | SieveApplyOrderModel("SieveApplyOrderModel", 97531000370L), |
48 | 48 | SieveModel("SieveModel", 97531000380L), |
49 | 49 | SieveResultModel("SieveResultModel", 97531000390L), |
50 | + SieveRecordModel("SieveRecordModel", 97531010390L), | |
50 | 51 | SmsConfigModel("SmsConfigModel", 97531000400L), |
51 | 52 | SmsTemplateModel("SmsTemplateModel", 97531000410L), |
52 | 53 | StopPregModel("StopPregModel", 97531000420L), |
platform-dal/src/main/java/com/lyms/platform/pojo/SieveRecordModel.java
View file @
bd7ca54
1 | +package com.lyms.platform.pojo; | |
2 | + | |
3 | +import com.lyms.platform.beans.SerialIdEnum; | |
4 | +import org.springframework.data.mongodb.core.mapping.Document; | |
5 | + | |
6 | +import java.util.Date; | |
7 | + | |
8 | +/** | |
9 | + * 产筛记录 | |
10 | + * <p> | |
11 | + */ | |
12 | +@Document(collection = "lyms_sieverecord") | |
13 | +public class SieveRecordModel { | |
14 | + | |
15 | + private static final long serialVersionUID = SerialIdEnum.SieveResultModel.getCid(); | |
16 | + | |
17 | + private String id; | |
18 | + | |
19 | + private String patientId; | |
20 | + | |
21 | + private String pid; | |
22 | + | |
23 | + private String hospitalId; | |
24 | + | |
25 | + //姓名 | |
26 | + private String name; | |
27 | + | |
28 | + //就诊卡号 | |
29 | + private String vcCardNo; | |
30 | + | |
31 | + //证件号 | |
32 | + private String certNo; | |
33 | + | |
34 | + //手机号码 | |
35 | + private String phone; | |
36 | + | |
37 | + //生日 | |
38 | + private Date birth; | |
39 | + | |
40 | + //末次月经 | |
41 | + private Date lastMenses; | |
42 | + | |
43 | + //预产期 | |
44 | + private Date dueDate; | |
45 | + | |
46 | + //是否导出过 0 未导出 1导出 | |
47 | + private Integer status; | |
48 | + | |
49 | + private Date created; | |
50 | + | |
51 | + private Date modified; | |
52 | + | |
53 | + private Integer yn; | |
54 | + | |
55 | + public Integer getStatus() { | |
56 | + return status; | |
57 | + } | |
58 | + | |
59 | + public void setStatus(Integer status) { | |
60 | + this.status = status; | |
61 | + } | |
62 | + | |
63 | + public Integer getYn() { | |
64 | + return yn; | |
65 | + } | |
66 | + | |
67 | + public void setYn(Integer yn) { | |
68 | + this.yn = yn; | |
69 | + } | |
70 | + | |
71 | + public String getHospitalId() { | |
72 | + return hospitalId; | |
73 | + } | |
74 | + | |
75 | + public void setHospitalId(String hospitalId) { | |
76 | + this.hospitalId = hospitalId; | |
77 | + } | |
78 | + | |
79 | + public String getPatientId() { | |
80 | + return patientId; | |
81 | + } | |
82 | + | |
83 | + public void setPatientId(String patientId) { | |
84 | + this.patientId = patientId; | |
85 | + } | |
86 | + | |
87 | + public String getPid() { | |
88 | + return pid; | |
89 | + } | |
90 | + | |
91 | + public void setPid(String pid) { | |
92 | + this.pid = pid; | |
93 | + } | |
94 | + | |
95 | + public String getId() { | |
96 | + return id; | |
97 | + } | |
98 | + | |
99 | + public void setId(String id) { | |
100 | + this.id = id; | |
101 | + } | |
102 | + | |
103 | + public String getName() { | |
104 | + return name; | |
105 | + } | |
106 | + | |
107 | + public void setName(String name) { | |
108 | + this.name = name; | |
109 | + } | |
110 | + | |
111 | + public String getVcCardNo() { | |
112 | + return vcCardNo; | |
113 | + } | |
114 | + | |
115 | + public void setVcCardNo(String vcCardNo) { | |
116 | + this.vcCardNo = vcCardNo; | |
117 | + } | |
118 | + | |
119 | + public String getCertNo() { | |
120 | + return certNo; | |
121 | + } | |
122 | + | |
123 | + public void setCertNo(String certNo) { | |
124 | + this.certNo = certNo; | |
125 | + } | |
126 | + | |
127 | + public String getPhone() { | |
128 | + return phone; | |
129 | + } | |
130 | + | |
131 | + public void setPhone(String phone) { | |
132 | + this.phone = phone; | |
133 | + } | |
134 | + | |
135 | + public Date getBirth() { | |
136 | + return birth; | |
137 | + } | |
138 | + | |
139 | + public void setBirth(Date birth) { | |
140 | + this.birth = birth; | |
141 | + } | |
142 | + | |
143 | + public Date getLastMenses() { | |
144 | + return lastMenses; | |
145 | + } | |
146 | + | |
147 | + public void setLastMenses(Date lastMenses) { | |
148 | + this.lastMenses = lastMenses; | |
149 | + } | |
150 | + | |
151 | + public Date getDueDate() { | |
152 | + return dueDate; | |
153 | + } | |
154 | + | |
155 | + public void setDueDate(Date dueDate) { | |
156 | + this.dueDate = dueDate; | |
157 | + } | |
158 | + | |
159 | + public Date getCreated() { | |
160 | + return created; | |
161 | + } | |
162 | + | |
163 | + public void setCreated(Date created) { | |
164 | + this.created = created; | |
165 | + } | |
166 | + | |
167 | + public Date getModified() { | |
168 | + return modified; | |
169 | + } | |
170 | + | |
171 | + public void setModified(Date modified) { | |
172 | + this.modified = modified; | |
173 | + } | |
174 | +} |
platform-dal/src/main/java/com/lyms/platform/query/SieveRecordQuery.java
View file @
bd7ca54
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.utils.StringUtils; | |
9 | +import org.springframework.data.mongodb.core.query.Criteria; | |
10 | + | |
11 | +import java.util.Date; | |
12 | + | |
13 | +/** | |
14 | + * 产前筛查 | |
15 | + * <p> | |
16 | + * Created by Administrator on 2016/7/5 0005. | |
17 | + */ | |
18 | +public class SieveRecordQuery extends BaseQuery implements IConvertToNativeQuery { | |
19 | + | |
20 | + private String id; | |
21 | + | |
22 | + private String patientId; | |
23 | + | |
24 | + private String pid; | |
25 | + | |
26 | + private String hospitalId; | |
27 | + | |
28 | + //姓名 | |
29 | + private String name; | |
30 | + | |
31 | + //就诊卡号 | |
32 | + private String vcCardNo; | |
33 | + | |
34 | + //证件号 | |
35 | + private String certNo; | |
36 | + | |
37 | + //手机号码 | |
38 | + private String phone; | |
39 | + | |
40 | + //生日 | |
41 | + private Date birth; | |
42 | + | |
43 | + //末次月经 | |
44 | + private Date lastMensesStart; | |
45 | + private Date lastMensesEnd; | |
46 | + | |
47 | + //创建 | |
48 | + private Date createTimeStart; | |
49 | + private Date createTimeEnd; | |
50 | + | |
51 | + //预产期 | |
52 | + private Date dueDate; | |
53 | + //查询号 | |
54 | + private String queryNo; | |
55 | + | |
56 | + private Integer yn; | |
57 | + | |
58 | + //是否导出过 0 未导出 1导出 | |
59 | + private Integer status; | |
60 | + | |
61 | + public Date getCreateTimeEnd() { | |
62 | + return createTimeEnd; | |
63 | + } | |
64 | + | |
65 | + public void setCreateTimeEnd(Date createTimeEnd) { | |
66 | + this.createTimeEnd = createTimeEnd; | |
67 | + } | |
68 | + | |
69 | + public Date getCreateTimeStart() { | |
70 | + return createTimeStart; | |
71 | + } | |
72 | + | |
73 | + public void setCreateTimeStart(Date createTimeStart) { | |
74 | + this.createTimeStart = createTimeStart; | |
75 | + } | |
76 | + | |
77 | + public Integer getStatus() { | |
78 | + return status; | |
79 | + } | |
80 | + | |
81 | + public void setStatus(Integer status) { | |
82 | + this.status = status; | |
83 | + } | |
84 | + | |
85 | + public Date getLastMensesEnd() { | |
86 | + return lastMensesEnd; | |
87 | + } | |
88 | + | |
89 | + public void setLastMensesEnd(Date lastMensesEnd) { | |
90 | + this.lastMensesEnd = lastMensesEnd; | |
91 | + } | |
92 | + | |
93 | + public Date getLastMensesStart() { | |
94 | + return lastMensesStart; | |
95 | + } | |
96 | + | |
97 | + public void setLastMensesStart(Date lastMensesStart) { | |
98 | + this.lastMensesStart = lastMensesStart; | |
99 | + } | |
100 | + | |
101 | + public String getHospitalId() { | |
102 | + return hospitalId; | |
103 | + } | |
104 | + | |
105 | + public void setHospitalId(String hospitalId) { | |
106 | + this.hospitalId = hospitalId; | |
107 | + } | |
108 | + | |
109 | + public String getPatientId() { | |
110 | + return patientId; | |
111 | + } | |
112 | + | |
113 | + public void setPatientId(String patientId) { | |
114 | + this.patientId = patientId; | |
115 | + } | |
116 | + | |
117 | + public String getPid() { | |
118 | + return pid; | |
119 | + } | |
120 | + | |
121 | + public void setPid(String pid) { | |
122 | + this.pid = pid; | |
123 | + } | |
124 | + | |
125 | + public String getVcCardNo() { | |
126 | + return vcCardNo; | |
127 | + } | |
128 | + | |
129 | + public void setVcCardNo(String vcCardNo) { | |
130 | + this.vcCardNo = vcCardNo; | |
131 | + } | |
132 | + | |
133 | + public String getCertNo() { | |
134 | + return certNo; | |
135 | + } | |
136 | + | |
137 | + public void setCertNo(String certNo) { | |
138 | + this.certNo = certNo; | |
139 | + } | |
140 | + | |
141 | + public Date getBirth() { | |
142 | + return birth; | |
143 | + } | |
144 | + | |
145 | + public void setBirth(Date birth) { | |
146 | + this.birth = birth; | |
147 | + } | |
148 | + | |
149 | + | |
150 | + | |
151 | + public Date getDueDate() { | |
152 | + return dueDate; | |
153 | + } | |
154 | + | |
155 | + public void setDueDate(Date dueDate) { | |
156 | + this.dueDate = dueDate; | |
157 | + } | |
158 | + | |
159 | + public String getQueryNo() { | |
160 | + return queryNo; | |
161 | + } | |
162 | + | |
163 | + public void setQueryNo(String queryNo) { | |
164 | + this.queryNo = queryNo; | |
165 | + } | |
166 | + | |
167 | + public String getId() { | |
168 | + return id; | |
169 | + } | |
170 | + | |
171 | + public void setId(String id) { | |
172 | + this.id = id; | |
173 | + } | |
174 | + | |
175 | + public String getName() { | |
176 | + return name; | |
177 | + } | |
178 | + | |
179 | + public void setName(String name) { | |
180 | + this.name = name; | |
181 | + } | |
182 | + | |
183 | + public String getPhone() { | |
184 | + return phone; | |
185 | + } | |
186 | + | |
187 | + public void setPhone(String phone) { | |
188 | + this.phone = phone; | |
189 | + } | |
190 | + | |
191 | + public Integer getYn() { | |
192 | + return yn; | |
193 | + } | |
194 | + | |
195 | + public void setYn(Integer yn) { | |
196 | + this.yn = yn; | |
197 | + } | |
198 | + | |
199 | + @Override | |
200 | + public MongoQuery convertToQuery() { | |
201 | + | |
202 | + MongoCondition condition = MongoCondition.newInstance(); | |
203 | + if (null != id) { | |
204 | + condition = condition.and("id", id, MongoOper.IS); | |
205 | + } | |
206 | + if (StringUtils.isNotEmpty(certNo)) { | |
207 | + condition = condition.and("certNo", certNo, MongoOper.IS); | |
208 | + } | |
209 | + if (null != patientId) { | |
210 | + condition = condition.and("patientId", patientId, MongoOper.IS); | |
211 | + } | |
212 | + if (null != hospitalId) { | |
213 | + condition = condition.and("hospitalId", hospitalId, MongoOper.IS); | |
214 | + } | |
215 | + if (null != pid) { | |
216 | + condition = condition.and("pid", pid, MongoOper.IS); | |
217 | + } | |
218 | + if (StringUtils.isNotEmpty(name)) { | |
219 | + condition = condition.and("name", name, MongoOper.LIKE); | |
220 | + } | |
221 | + | |
222 | + if (StringUtils.isNotEmpty(phone)) { | |
223 | + condition = condition.and("phone", phone, MongoOper.IS); | |
224 | + } | |
225 | + | |
226 | + if (status != null) { | |
227 | + condition = condition.and("status", status, MongoOper.IS); | |
228 | + } | |
229 | + | |
230 | + if (null != yn) { | |
231 | + condition = condition.and("yn", yn, MongoOper.IS); | |
232 | + } | |
233 | + | |
234 | + Criteria c1 = null; | |
235 | + if (null != lastMensesStart) { | |
236 | + if (null != c1) { | |
237 | + c1 = c1.and("lastMenses").gte(lastMensesStart); | |
238 | + } else { | |
239 | + c1 = Criteria.where("lastMenses").gte(lastMensesStart); | |
240 | + } | |
241 | + } | |
242 | + if (null != lastMensesEnd) { | |
243 | + if (c1 != null) { | |
244 | + c1 = c1.lte(lastMensesEnd); | |
245 | + } else { | |
246 | + c1 = Criteria.where("lastMenses").lte(lastMensesEnd); | |
247 | + } | |
248 | + } | |
249 | + | |
250 | + | |
251 | + if (null != createTimeStart) { | |
252 | + if (null != c1) { | |
253 | + c1 = c1.and("created").gte(createTimeStart); | |
254 | + } else { | |
255 | + c1 = Criteria.where("created").gte(createTimeStart); | |
256 | + } | |
257 | + } | |
258 | + if (null != createTimeEnd) { | |
259 | + if (c1 != null) { | |
260 | + c1 = c1.lte(createTimeEnd); | |
261 | + } else { | |
262 | + c1 = Criteria.where("created").lte(createTimeEnd); | |
263 | + } | |
264 | + } | |
265 | + | |
266 | + if (StringUtils.isNotEmpty(queryNo)) { | |
267 | + MongoCondition c = MongoCondition.newInstance(); | |
268 | + MongoCondition con1 = MongoCondition.newInstance("phone", queryNo, MongoOper.IS); | |
269 | + MongoCondition con2 = MongoCondition.newInstance("name", queryNo, MongoOper.LIKE); | |
270 | + MongoCondition con3 = MongoCondition.newInstance("certNo", queryNo, MongoOper.IS); | |
271 | + MongoCondition con4 = MongoCondition.newInstance("vcCardNo", vcCardNo, MongoOper.IS); | |
272 | + if(c1!=null) { | |
273 | + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con2,con3,con4}).getCriteria()); | |
274 | + }else { | |
275 | + c1 = c.orCondition(new MongoCondition[]{con1, con2, con3, con4}).getCriteria(); | |
276 | + } | |
277 | + } | |
278 | + | |
279 | + if (null != c1) { | |
280 | + condition = condition.andCondition(new MongoCondition(c1)); | |
281 | + } | |
282 | + | |
283 | + return condition.toMongoQuery(); | |
284 | + } | |
285 | + | |
286 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SieveRecordController.java
View file @
bd7ca54
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.base.LoginContext; | |
6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
7 | +import com.lyms.platform.common.enums.*; | |
8 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
9 | +import com.lyms.platform.common.result.BaseResponse; | |
10 | +import com.lyms.platform.operate.web.facade.SieveFacade; | |
11 | +import com.lyms.platform.operate.web.facade.SieveRecordFacade; | |
12 | +import com.lyms.platform.operate.web.request.ChanQianDiaAddRequest; | |
13 | +import com.lyms.platform.operate.web.request.CqSieveQueryRequest; | |
14 | +import com.lyms.platform.operate.web.request.SieveAddRequest; | |
15 | +import org.springframework.beans.factory.annotation.Autowired; | |
16 | +import org.springframework.stereotype.Controller; | |
17 | +import org.springframework.web.bind.annotation.*; | |
18 | + | |
19 | +import javax.servlet.http.HttpServletRequest; | |
20 | +import javax.servlet.http.HttpServletResponse; | |
21 | +import javax.validation.Valid; | |
22 | +import java.util.ArrayList; | |
23 | +import java.util.HashMap; | |
24 | +import java.util.List; | |
25 | +import java.util.Map; | |
26 | + | |
27 | +/** | |
28 | + * 秦皇岛产筛记录 | |
29 | + * <p> | |
30 | + */ | |
31 | +@Controller | |
32 | +public class SieveRecordController extends BaseController { | |
33 | + @Autowired | |
34 | + private SieveRecordFacade sieveRecordFacade; | |
35 | + | |
36 | + /** | |
37 | + * 判断当前用户是否保存过基本信息记录 | |
38 | + * | |
39 | + * @return | |
40 | + */ | |
41 | + @ResponseBody | |
42 | + @RequestMapping(value = "/isSaveSieveRecord",method = RequestMethod.GET) | |
43 | + @TokenRequired | |
44 | + public BaseResponse addOneSieve(@RequestParam("patientId")String patientId,HttpServletRequest request) { | |
45 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
46 | + return sieveRecordFacade.isSaveSieveRecord(patientId, loginState.getId()); | |
47 | + } | |
48 | + | |
49 | + | |
50 | + /** | |
51 | + * 保存秦皇岛产晒孕妇的基本信息 | |
52 | + * @param patientId | |
53 | + * @param request | |
54 | + * @return | |
55 | + */ | |
56 | + @ResponseBody | |
57 | + @RequestMapping(value = "/saveSieveRecord",method = RequestMethod.GET) | |
58 | + @TokenRequired | |
59 | + public BaseResponse saveSieveRecord(@RequestParam("patientId")String patientId,HttpServletRequest request) { | |
60 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
61 | + return sieveRecordFacade.saveSieveRecord(patientId, loginState.getId()); | |
62 | + } | |
63 | + | |
64 | + | |
65 | + /** | |
66 | + * 查询保存的基本信息列表 | |
67 | + * | |
68 | + * @param status 0 未导出 1 已经导出 2 全部 | |
69 | + * @return | |
70 | + */ | |
71 | + @ResponseBody | |
72 | + @RequestMapping(value = "/getSieveRecords",method = RequestMethod.GET) | |
73 | + @TokenRequired | |
74 | + public BaseResponse getSieveRecords(@RequestParam(required = false)Integer status, | |
75 | + @RequestParam(required = true)Integer page, | |
76 | + @RequestParam(required = true)Integer limit, | |
77 | + @RequestParam(required = false)String createTime, | |
78 | + @RequestParam(required = false)String keyword, | |
79 | + HttpServletRequest request) { | |
80 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
81 | + return sieveRecordFacade.getSieveRecords(status, createTime, keyword, page, limit, loginState.getId()); | |
82 | + } | |
83 | + | |
84 | + | |
85 | + /** | |
86 | + * 导出信息 | |
87 | + * @param request | |
88 | + * @param response | |
89 | + */ | |
90 | + @RequestMapping(value = "/exportSieveRecords", method = RequestMethod.GET) | |
91 | + @TokenRequired | |
92 | + public void exportSieveRecords(HttpServletRequest request, | |
93 | + HttpServletResponse response, | |
94 | + @RequestParam(required = false)Integer status, | |
95 | + @RequestParam(required = true)Integer page, | |
96 | + @RequestParam(required = true)Integer limit, | |
97 | + @RequestParam(required = false)String createTime, | |
98 | + @RequestParam(required = false)String keyword) | |
99 | + { | |
100 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
101 | + sieveRecordFacade.exportSieveRecords(status, createTime, keyword, loginState.getId(),response); | |
102 | + } | |
103 | + | |
104 | + | |
105 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
View file @
bd7ca54
... | ... | @@ -145,7 +145,7 @@ |
145 | 145 | // System.out.println("用户未登录!"); |
146 | 146 | // return; |
147 | 147 | // } |
148 | - Map<String, Object> map = viewFacade.expPostReview(id,null); | |
148 | + Map<String, Object> map = viewFacade.expPostReview(id, null); | |
149 | 149 | try { |
150 | 150 | // 验证License |
151 | 151 | if (!getLicense()) { |
... | ... | @@ -474,6 +474,23 @@ |
474 | 474 | @TokenRequired |
475 | 475 | public BaseObjectResponse findPatientData(@RequestParam("id") String id) { |
476 | 476 | return viewFacade.findPatientData(id); |
477 | + } | |
478 | + | |
479 | + | |
480 | + /** | |
481 | + * 秦皇岛获取产筛孕妇的基本信息 | |
482 | + * | |
483 | + * @param cardNo 孕妇证件号 | |
484 | + * @param vcCardNo 孕妇就诊卡号 | |
485 | + * @return | |
486 | + */ | |
487 | + @RequestMapping(value = "/findSievePatientData", method = RequestMethod.GET) | |
488 | + @ResponseBody | |
489 | + @TokenRequired | |
490 | + public BaseObjectResponse findSievePatientData(@RequestParam(required = false) String cardNo, | |
491 | + @RequestParam(required = false) String vcCardNo, | |
492 | + HttpServletRequest httpServletRequest) { | |
493 | + return viewFacade.findSievePatientData(cardNo,vcCardNo,getUserId(httpServletRequest)); | |
477 | 494 | } |
478 | 495 | |
479 | 496 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SieveRecordFacade.java
View file @
bd7ca54
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.*; | |
4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
5 | +import com.lyms.platform.common.enums.YnEnums; | |
6 | +import com.lyms.platform.common.result.BaseListResponse; | |
7 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
8 | +import com.lyms.platform.common.result.BaseResponse; | |
9 | +import com.lyms.platform.common.utils.DateUtil; | |
10 | +import com.lyms.platform.common.utils.ExcelUtil; | |
11 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
12 | +import com.lyms.platform.common.utils.JsonUtil; | |
13 | +import com.lyms.platform.operate.web.request.ChanQianDiaAddRequest; | |
14 | +import com.lyms.platform.operate.web.request.CqSieveQueryRequest; | |
15 | +import com.lyms.platform.operate.web.request.SieveAddRequest; | |
16 | +import com.lyms.platform.operate.web.result.SieveDetailResult; | |
17 | +import com.lyms.platform.operate.web.result.SieveListResult; | |
18 | +import com.lyms.platform.operate.web.result.SieveResult; | |
19 | +import com.lyms.platform.operate.web.worker.SieveWorker; | |
20 | +import com.lyms.platform.permission.model.Organization; | |
21 | +import com.lyms.platform.permission.service.OrganizationService; | |
22 | +import com.lyms.platform.pojo.*; | |
23 | +import com.lyms.platform.query.*; | |
24 | +import org.apache.commons.collections.CollectionUtils; | |
25 | +import org.apache.commons.lang.StringUtils; | |
26 | +import org.apache.commons.lang.math.NumberUtils; | |
27 | +import org.springframework.beans.factory.annotation.Autowired; | |
28 | +import org.springframework.beans.factory.annotation.Qualifier; | |
29 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
30 | +import org.springframework.stereotype.Component; | |
31 | + | |
32 | +import javax.servlet.http.HttpServletResponse; | |
33 | +import java.io.IOException; | |
34 | +import java.io.OutputStream; | |
35 | +import java.util.*; | |
36 | +import java.util.concurrent.Future; | |
37 | +import java.util.concurrent.TimeUnit; | |
38 | + | |
39 | +/** | |
40 | + * 秦皇岛产筛查询 | |
41 | + */ | |
42 | +@Component | |
43 | +public class SieveRecordFacade { | |
44 | + @Autowired | |
45 | + private SieveRecordService sieveRecordService; | |
46 | + | |
47 | + @Autowired | |
48 | + private PatientsService patientsService; | |
49 | + | |
50 | + @Autowired | |
51 | + private AutoMatchFacade autoMatchFacade; | |
52 | + | |
53 | + | |
54 | + public BaseResponse isSaveSieveRecord(String patientId, Integer userId) { | |
55 | + | |
56 | + SieveRecordQuery query = new SieveRecordQuery(); | |
57 | + query.setYn(YnEnums.YES.getId()); | |
58 | + query.setPatientId(patientId); | |
59 | + | |
60 | + List<SieveRecordModel> list = sieveRecordService.query(query); | |
61 | + if (CollectionUtils.isNotEmpty(list)) | |
62 | + { | |
63 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.DATA_EXIST).setErrormsg("已经存在记录"); | |
64 | + } | |
65 | + | |
66 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
67 | + } | |
68 | + | |
69 | + | |
70 | + public BaseResponse saveSieveRecord(String patientId, Integer id) { | |
71 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
72 | + patientsQuery.setId(patientId); | |
73 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
74 | + | |
75 | + List<Patients> list = patientsService.queryPatient(patientsQuery); | |
76 | + | |
77 | + try { | |
78 | + if (CollectionUtils.isNotEmpty(list)) | |
79 | + { | |
80 | + Patients patients = list.get(0); | |
81 | + SieveRecordModel model = new SieveRecordModel(); | |
82 | + model.setPatientId(patientId); | |
83 | + model.setPid(patients.getPid()); | |
84 | + model.setYn(YnEnums.YES.getId()); | |
85 | + model.setStatus(0); | |
86 | + model.setBirth(patients.getBirth()); | |
87 | + model.setCertNo(patients.getCardNo()); | |
88 | + model.setHospitalId(patients.getHospitalId()); | |
89 | + model.setDueDate(patients.getDueDate()); | |
90 | + model.setLastMenses(patients.getLastMenses()); | |
91 | + model.setPhone(patients.getPhone()); | |
92 | + model.setVcCardNo(patients.getVcCardNo()); | |
93 | + model.setName(patients.getUsername()); | |
94 | + model.setCreated(new Date()); | |
95 | + model.setModified(new Date()); | |
96 | + sieveRecordService.save(model); | |
97 | + } | |
98 | + } | |
99 | + catch (Exception e) | |
100 | + { | |
101 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION); | |
102 | + } | |
103 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
104 | + } | |
105 | + | |
106 | + public BaseResponse getSieveRecords(Integer status, String createTime,String keyword, Integer page, Integer limit, Integer userId) { | |
107 | + | |
108 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
109 | + SieveRecordQuery query = new SieveRecordQuery(); | |
110 | + query.setYn(YnEnums.YES.getId()); | |
111 | + | |
112 | + query.setPage(page); | |
113 | + query.setLimit(limit); | |
114 | + query.setNeed("true"); | |
115 | + query.setQueryNo(keyword); | |
116 | + query.setHospitalId(hospitalId); | |
117 | + if (status != null && status != 2) | |
118 | + { | |
119 | + query.setStatus(status); | |
120 | + } | |
121 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(createTime)) { | |
122 | + String[] dates = createTime.split(" - "); | |
123 | + query.setCreateTimeStart(DateUtil.parseYMD(dates[0])); | |
124 | + if (dates.length == 2) { | |
125 | + query.setCreateTimeEnd(DateUtil.parseYMD(dates[1])); | |
126 | + } | |
127 | + } | |
128 | + | |
129 | + List<Map<String,Object>> result = getListData(query); | |
130 | + | |
131 | + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setData(result).setPageInfo(query.getPageInfo()); | |
132 | + } | |
133 | + | |
134 | + | |
135 | + private List<Map<String,Object>> getListData(SieveRecordQuery query) | |
136 | + { | |
137 | + List<SieveRecordModel> list = sieveRecordService.query(query); | |
138 | + List<Map<String,Object>> result = new ArrayList<>(); | |
139 | + | |
140 | + if (CollectionUtils.isNotEmpty(list)) | |
141 | + { | |
142 | + for (SieveRecordModel model : list) | |
143 | + { | |
144 | + Map<String,Object> map = new HashMap<>(); | |
145 | + map.put("id",model.getId()); | |
146 | + map.put("name",model.getName()); //身份证号码 | |
147 | + map.put("vcCardNo",model.getVcCardNo()); //就诊卡号 | |
148 | + map.put("certNo",model.getCertNo()); //证件号 | |
149 | + map.put("phone",model.getPhone());//手机号码 | |
150 | + map.put("birth",DateUtil.getyyyy_MM_dd(model.getBirth())); //出生日期 | |
151 | + map.put("age",DateUtil.getAge(model.getBirth(), model.getCreated())); //年龄 | |
152 | + map.put("lastMenses",DateUtil.getyyyy_MM_dd(model.getLastMenses())); //末次月经 | |
153 | + map.put("currentDueWeek",DateUtil.getWeekDesc(model.getLastMenses(), model.getCreated())); //当前孕周 | |
154 | + map.put("dueDate",DateUtil.getyyyy_MM_dd(model.getDueDate())); //预产期 | |
155 | + map.put("created",DateUtil.gety_m_dhm(model.getCreated()));//创建日期 | |
156 | + map.put("status",model.getStatus() == 0 ? "未导出" : "已导出");//导出状态 | |
157 | + result.add(map); | |
158 | + } | |
159 | + } | |
160 | + | |
161 | + return result; | |
162 | + } | |
163 | + | |
164 | + public void exportSieveRecords(Integer status, String createTime, String keyword, Integer userId, HttpServletResponse response) { | |
165 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
166 | + SieveRecordQuery query = new SieveRecordQuery(); | |
167 | + query.setYn(YnEnums.YES.getId()); | |
168 | + if (status != null && status != 2) | |
169 | + { | |
170 | + query.setStatus(status); | |
171 | + } | |
172 | + query.setQueryNo(keyword); | |
173 | + query.setHospitalId(hospitalId); | |
174 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(createTime)) { | |
175 | + String[] dates = createTime.split(" - "); | |
176 | + query.setCreateTimeStart(DateUtil.parseYMD(dates[0])); | |
177 | + if (dates.length == 2) { | |
178 | + query.setCreateTimeEnd(DateUtil.parseYMD(dates[1])); | |
179 | + } | |
180 | + } | |
181 | + | |
182 | + List<Map<String,Object>> datas = getListData(query); | |
183 | + | |
184 | + OutputStream out = null; | |
185 | + try { | |
186 | + out = response.getOutputStream(); | |
187 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
188 | + cnames.put("name","身份证号码"); //身份证号码 | |
189 | + cnames.put("vcCardNo","就诊卡号"); //就诊卡号 | |
190 | + cnames.put("certNo","证件号"); //证件号 | |
191 | + cnames.put("phone","手机号码");//手机号码 | |
192 | + cnames.put("birth","出生日期"); //出生日期 | |
193 | + cnames.put("age","年龄"); //年龄 | |
194 | + cnames.put("lastMenses","末次月经"); //末次月经 | |
195 | + cnames.put("currentDueWeek","当前孕周"); //当前孕周 | |
196 | + cnames.put("dueDate","预产期"); //预产期 | |
197 | + cnames.put("created","创建日期");//创建日期 | |
198 | + cnames.put("status","导出状态");//导出状态 | |
199 | + response.setContentType("application/octet-stream"); | |
200 | + response.setCharacterEncoding("UTF-8"); | |
201 | + response.setHeader("Content-Disposition", "attachment;fileName=datas.xls"); | |
202 | + ExcelUtil.toExcel(out, datas, cnames); | |
203 | + updateStatus(datas); | |
204 | + } catch (IOException e) { | |
205 | + e.printStackTrace(); | |
206 | + } | |
207 | + } | |
208 | + | |
209 | + | |
210 | + /** | |
211 | + * 更新导出状态 | |
212 | + * @param datas | |
213 | + */ | |
214 | + private void updateStatus(List<Map<String,Object>> datas) | |
215 | + { | |
216 | + if (CollectionUtils.isNotEmpty(datas)) | |
217 | + { | |
218 | + for (Map map : datas) | |
219 | + { | |
220 | + Object objId = map.get("id"); | |
221 | + SieveRecordModel model = new SieveRecordModel(); | |
222 | + model.setStatus(1); | |
223 | + sieveRecordService.update(model,objId.toString()); | |
224 | + } | |
225 | + } | |
226 | + | |
227 | + } | |
228 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
bd7ca54
... | ... | @@ -82,6 +82,14 @@ |
82 | 82 | @Autowired |
83 | 83 | private MongoUtil mongoUtil; |
84 | 84 | |
85 | + @Autowired | |
86 | + private OrganizationGroupsFacade groupsFacade; | |
87 | + | |
88 | + | |
89 | + @Autowired | |
90 | + private YunBookbuildingService yunBookbuildingService; | |
91 | + | |
92 | + | |
85 | 93 | /** |
86 | 94 | * 建档查询 |
87 | 95 | * |
... | ... | @@ -3600,6 +3608,56 @@ |
3600 | 3608 | result.setId(model.getId()); |
3601 | 3609 | |
3602 | 3610 | return result; |
3611 | + } | |
3612 | + | |
3613 | + public BaseObjectResponse findSievePatientData(String cardNo, String vcCardNo,Integer userId) { | |
3614 | + | |
3615 | + List<Patients> patients = new ArrayList<>(); | |
3616 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
3617 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
3618 | + patientsQuery.setBuildType(1); | |
3619 | + //查询主档案 | |
3620 | + patientsQuery.setExtEnable(false); | |
3621 | + | |
3622 | + //如果身份证号码不为空就以身份证号码查询 | |
3623 | + if (StringUtils.isNotEmpty(cardNo)) { | |
3624 | + patientsQuery.setCardNo(cardNo); | |
3625 | + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery, "bookbuildingDate", Sort.Direction.DESC); | |
3626 | + } | |
3627 | + //否则用就诊卡号 查询到这个孕妇的身份证号码 再用身份证号码查询该孕妇的所有建档 包括产妇记录 | |
3628 | + else if (StringUtils.isNotEmpty(vcCardNo)) { | |
3629 | + | |
3630 | + patientsQuery.setVcCardNo(vcCardNo); | |
3631 | + patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(userId)); | |
3632 | + //优先查询本院通过就诊卡 | |
3633 | + List<Patients> localPatients = patientsService.queryPatient(patientsQuery); | |
3634 | + patientsQuery.setHospitalId(null); | |
3635 | + if (CollectionUtils.isNotEmpty(localPatients)) { | |
3636 | + patients = localPatients; | |
3637 | + } | |
3638 | + else | |
3639 | + { | |
3640 | + //区域模式 | |
3641 | + patientsQuery.setHospitalList(groupsFacade.findGroupHospital(userId, false)); | |
3642 | + | |
3643 | + List<Patients> patientsVc = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
3644 | + if (CollectionUtils.isNotEmpty(patientsVc)) { | |
3645 | + if (patientsVc.get(0) == null || com.lyms.platform.common.utils.StringUtils.isEmpty(patientsVc.get(0).getCardNo())) { | |
3646 | + patients = patientsVc; | |
3647 | + } else { | |
3648 | + patientsQuery.setHospitalId(null); | |
3649 | + patientsQuery.setVcCardNo(null); | |
3650 | + patientsQuery.setCardNo(patientsVc.get(0).getCardNo()); | |
3651 | + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery, "bookbuildingDate", Sort.Direction.DESC); | |
3652 | + } | |
3653 | + } | |
3654 | + } | |
3655 | + } | |
3656 | + if (CollectionUtils.isNotEmpty(patients) && patients.get(0) != null) | |
3657 | + { | |
3658 | + return findPatientData(patients.get(0).getId()); | |
3659 | + } | |
3660 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.NO_DATA).setErrormsg("未查询到数据"); | |
3603 | 3661 | } |
3604 | 3662 | } |