Commit b9c4450acbfd20d831f7e302d965d74525cf3466
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 21 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IYunBookBuildingDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/YunBookbuildingDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SyncDataService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/YunBookbuildingService.java
- platform-common/src/main/java/com/lyms/platform/common/enums/CourseStatusEnums.java
- platform-common/src/main/java/com/lyms/platform/common/enums/SmsServiceEnums.java
- platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java
- platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
- platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/CourseTypeModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PatientCourseModel.java
- platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/service/IMsgGenerateService.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/CourseMsgGenerateWorker.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java
- platform-operate-api/src/main/java/com/lyms/hospitalapi/pojo/HealthRecord.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CourseRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CourseResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IYunBookBuildingDao.java
View file @
b9c4450
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/YunBookbuildingDaoImpl.java
View file @
b9c4450
... | ... | @@ -37,6 +37,11 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | @Override |
40 | + public int queryPatientCount(MongoQuery query) { | |
41 | + return (int) count(query.convertToMongoQuery()); | |
42 | + } | |
43 | + | |
44 | + @Override | |
40 | 45 | public void updatePatient(Patients obj, String id) { |
41 | 46 | update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); |
42 | 47 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SyncDataService.java
View file @
b9c4450
... | ... | @@ -4,6 +4,7 @@ |
4 | 4 | import com.lyms.platform.common.dao.operator.MongoQuery; |
5 | 5 | import com.lyms.platform.common.pojo.SyncDataModel; |
6 | 6 | import com.lyms.platform.common.pojo.SyncMysqlDataModel; |
7 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
7 | 8 | import com.lyms.platform.common.utils.JsonUtil; |
8 | 9 | import com.lyms.platform.common.utils.SerializUtils; |
9 | 10 | import com.lyms.platform.query.SyncDataQuery; |
... | ... | @@ -14,6 +15,7 @@ |
14 | 15 | import org.springframework.stereotype.Service; |
15 | 16 | |
16 | 17 | import java.io.Serializable; |
18 | +import java.io.UnsupportedEncodingException; | |
17 | 19 | import java.util.Date; |
18 | 20 | import java.util.List; |
19 | 21 | |
... | ... | @@ -64,14 +66,18 @@ |
64 | 66 | } |
65 | 67 | |
66 | 68 | public boolean savePostMysql(String sql ,String sqlId) { |
67 | - SyncDataModel model = new SyncDataModel(); | |
68 | - model.setStatus(1); | |
69 | - model.setJsonData(Base64.encodeBase64String(sql.getBytes())); | |
70 | - model.setAction("POSTMYSQL"); | |
71 | - model.setCreated(new Date()); | |
72 | - model.setClassName("syncmysql"); | |
73 | - model.setModified(model.getCreated()); | |
74 | - iSyncDataDao.addSyncData(model); | |
69 | + try { | |
70 | + SyncDataModel model = new SyncDataModel(); | |
71 | + model.setStatus(1); | |
72 | + model.setJsonData(Base64.encodeBase64String(sql.getBytes("utf-8"))); | |
73 | + model.setAction("POSTMYSQL"); | |
74 | + model.setCreated(new Date()); | |
75 | + model.setClassName("syncmysql"); | |
76 | + model.setModified(model.getCreated()); | |
77 | + iSyncDataDao.addSyncData(model); | |
78 | + } catch (UnsupportedEncodingException e) { | |
79 | + ExceptionUtils.catchException(e,"savePostMysql UnsupportedEncodingException"); | |
80 | + } | |
75 | 81 | return true; |
76 | 82 | } |
77 | 83 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/YunBookbuildingService.java
View file @
b9c4450
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | import com.lyms.platform.pojo.AntExChuModel; |
7 | 7 | import com.lyms.platform.query.AntExChuQuery; |
8 | 8 | import com.lyms.platform.query.PatientsQuery; |
9 | +import org.apache.commons.lang.StringUtils; | |
9 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
10 | 11 | import org.springframework.data.domain.Sort; |
11 | 12 | import org.springframework.stereotype.Service; |
... | ... | @@ -58,8 +59,12 @@ |
58 | 59 | } |
59 | 60 | |
60 | 61 | public List<Patients> queryPregnantWithQuery(PatientsQuery patientsQuery) { |
61 | - MongoQuery query = patientsQuery.convertToQuery(); | |
62 | - return yunBookBuildingDao.queryPatientWithQuery(query.addOrder(Sort.Direction.DESC, "created")); | |
62 | + MongoQuery query = patientsQuery.convertToQuery(); | |
63 | + if (StringUtils.isNotEmpty(patientsQuery.getNeed())) { | |
64 | + patientsQuery.mysqlBuild(yunBookBuildingDao.queryPatientCount(query)); | |
65 | + query.start(patientsQuery.getOffset()).end(patientsQuery.getLimit()); | |
66 | + } | |
67 | + return yunBookBuildingDao.queryPatientWithQuery(query.addOrder(Sort.Direction.DESC, "created")); | |
63 | 68 | } |
64 | 69 | |
65 | 70 | public List<Patients> queryPregnantWithQuery(PatientsQuery patientsQuery,String sortkey,Sort.Direction sort) { |
platform-common/src/main/java/com/lyms/platform/common/enums/CourseStatusEnums.java
View file @
b9c4450
... | ... | @@ -43,5 +43,44 @@ |
43 | 43 | } |
44 | 44 | return ""; |
45 | 45 | } |
46 | + | |
47 | + public enum CourseObjEnums | |
48 | + { | |
49 | + ALL(0,"全部"),YQ(1,"孕期"),BABY(2,"儿童"),CH(3,"产后"); | |
50 | + CourseObjEnums(int id, String name) { | |
51 | + this.id = id; | |
52 | + this.name = name; | |
53 | + } | |
54 | + | |
55 | + private int id; | |
56 | + private String name; | |
57 | + | |
58 | + public String getName() { | |
59 | + return name; | |
60 | + } | |
61 | + | |
62 | + public void setName(String name) { | |
63 | + this.name = name; | |
64 | + } | |
65 | + | |
66 | + public int getId() { | |
67 | + return id; | |
68 | + } | |
69 | + | |
70 | + public void setId(int id) { | |
71 | + this.id = id; | |
72 | + } | |
73 | + | |
74 | + | |
75 | + public static String getNameById(int id) { | |
76 | + for (CourseObjEnums e : CourseObjEnums.values()) { | |
77 | + if(e.getId() == id) | |
78 | + { | |
79 | + return e.getName(); | |
80 | + } | |
81 | + } | |
82 | + return ""; | |
83 | + } | |
84 | + } | |
46 | 85 | } |
platform-common/src/main/java/com/lyms/platform/common/enums/SmsServiceEnums.java
View file @
b9c4450
... | ... | @@ -39,7 +39,8 @@ |
39 | 39 | YBYYTX(25,"儿童眼保键预约提醒",14,"2"), |
40 | 40 | TSYYTX(26,"儿童听力筛查预约提醒",14,"2"), |
41 | 41 | TYZDYYTX(27,"儿童听力诊断预约提醒",14,"2"), |
42 | - TLZDYYTX(28,"儿童听力随访预约提醒",14,"2"); | |
42 | + TLZDYYTX(28,"儿童听力随访预约提醒",14,"2"), | |
43 | + YFXXKCTX(29,"孕妇学校课程提醒",21,"1,3"); | |
43 | 44 | |
44 | 45 | private SmsServiceEnums(int id,String name,int pid,String serviceObj){ |
45 | 46 | this.id = id; |
platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java
View file @
b9c4450
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | YUN_YI_BAN_ZHI_DAO("98i1P6zh3slBxEKLftweaESnnem4w6SDmzvJIBWRXNE","孕妇一般指导"),//孕妇 |
22 | 22 | CHAN_YI_BAN_ZHI_DAO("H2_ucLqVEbsZAv-EZcmUDpD1Zul5NGqMoJktHT0u4gw","产妇一般指导"),//产妇 |
23 | 23 | BABY_YI_BAN_ZHI_DAO("dqvyESU8UXx1V3cIMQDqj4PLxI6T9-sgihQcs3ZGL9E","儿童一般指导"),//儿童 |
24 | + YUN_XUE_KE_CHEN_TX("","孕妇学校课程提醒"),//孕妇学校课程提醒 | |
24 | 25 | |
25 | 26 | YI_SHENG_ZHI_DAO("OggqiSHitLkCgSLCaCH72reCZzaw5NyG8iO56InQiQg","医生指导");//指导 |
26 | 27 | // WEI_JI_ZHI_DAO("fNkkLSp_gS-YWvzji6gwgdTddl4XBlk8SNP7FRksrfk","危急值提醒");//危急值提醒 |
platform-dal/src/main/java/com/lyms/platform/beans/SerialIdEnum.java
View file @
b9c4450
... | ... | @@ -66,6 +66,11 @@ |
66 | 66 | DiagnoseConfigModel("DiagnoseConfigModel", 97531039990L), |
67 | 67 | DiagnoseItemModel("DiagnoseItemModel", 97531039590L), |
68 | 68 | CancerScreeningModel("CancerScreeningModel", 97531039591L), |
69 | + | |
70 | + CourseModel("CourseModel", 97531029990L), | |
71 | + CourseTypeModel("CourseTypeModel", 97831039590L), | |
72 | + PatientCourseModel("PatientCourseModel", 92531039591L), | |
73 | + | |
69 | 74 | BabyEyeCheck("BabyEyeCheck", 97521039591L); |
70 | 75 | private String cname; |
71 | 76 | private Long cid; |
platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.java
View file @
b9c4450
1 | 1 | package com.lyms.platform.pojo; |
2 | 2 | |
3 | +import com.lyms.platform.beans.SerialIdEnum; | |
3 | 4 | import com.lyms.platform.common.result.BaseModel; |
4 | 5 | import org.springframework.data.mongodb.core.mapping.Document; |
5 | 6 | |
... | ... | @@ -12,6 +13,8 @@ |
12 | 13 | @Document(collection="lyms_course") |
13 | 14 | public class CourseModel extends BaseModel { |
14 | 15 | |
16 | + private static final long serialVersionUID = SerialIdEnum.CourseModel.getCid(); | |
17 | + | |
15 | 18 | private String id; |
16 | 19 | //课程名称 |
17 | 20 | private String courseName; |
... | ... | @@ -65,6 +68,28 @@ |
65 | 68 | private Integer yn; |
66 | 69 | |
67 | 70 | private String hospitalId; |
71 | + | |
72 | + //课程对象id 0全部/空 1孕期 2儿童 ,3产后 | |
73 | + private Integer courseObjId; | |
74 | + | |
75 | + //是否发送过推送 字段不存在表示未推送,1已推送 | |
76 | + private Integer isSend; | |
77 | + | |
78 | + public Integer getIsSend() { | |
79 | + return isSend; | |
80 | + } | |
81 | + | |
82 | + public void setIsSend(Integer isSend) { | |
83 | + this.isSend = isSend; | |
84 | + } | |
85 | + | |
86 | + public Integer getCourseObjId() { | |
87 | + return courseObjId; | |
88 | + } | |
89 | + | |
90 | + public void setCourseObjId(Integer courseObjId) { | |
91 | + this.courseObjId = courseObjId; | |
92 | + } | |
68 | 93 | |
69 | 94 | public Date getCourseEndTime() { |
70 | 95 | return courseEndTime; |
platform-dal/src/main/java/com/lyms/platform/pojo/CourseTypeModel.java
View file @
b9c4450
1 | 1 | package com.lyms.platform.pojo; |
2 | 2 | |
3 | +import com.lyms.platform.beans.SerialIdEnum; | |
3 | 4 | import com.lyms.platform.common.result.BaseModel; |
4 | 5 | import org.springframework.data.mongodb.core.mapping.Document; |
5 | 6 | |
... | ... | @@ -11,6 +12,8 @@ |
11 | 12 | */ |
12 | 13 | @Document(collection="lyms_coursetype") |
13 | 14 | public class CourseTypeModel extends BaseModel { |
15 | + | |
16 | + private static final long serialVersionUID = SerialIdEnum.CourseTypeModel.getCid(); | |
14 | 17 | |
15 | 18 | private String id; |
16 | 19 | //课程类型名称 |
platform-dal/src/main/java/com/lyms/platform/pojo/PatientCourseModel.java
View file @
b9c4450
1 | 1 | package com.lyms.platform.pojo; |
2 | 2 | |
3 | +import com.lyms.platform.beans.SerialIdEnum; | |
3 | 4 | import com.lyms.platform.common.result.BaseModel; |
4 | 5 | import org.springframework.data.mongodb.core.mapping.Document; |
5 | 6 | |
... | ... | @@ -11,6 +12,8 @@ |
11 | 12 | */ |
12 | 13 | @Document(collection="lyms_patient_course") |
13 | 14 | public class PatientCourseModel extends BaseModel { |
15 | + | |
16 | + private static final long serialVersionUID = SerialIdEnum.PatientCourseModel.getCid(); | |
14 | 17 | |
15 | 18 | private String id; |
16 | 19 |
platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java
View file @
b9c4450
... | ... | @@ -75,6 +75,8 @@ |
75 | 75 | private Date courseEndTime; |
76 | 76 | private String keyword; |
77 | 77 | |
78 | + private boolean isSend; | |
79 | + | |
78 | 80 | @Override |
79 | 81 | public MongoQuery convertToQuery() { |
80 | 82 | MongoCondition condition = MongoCondition.newInstance(); |
... | ... | @@ -114,6 +116,10 @@ |
114 | 116 | condition = condition.and("status", status, MongoOper.IS); |
115 | 117 | } |
116 | 118 | |
119 | + if (!isSend) { | |
120 | + condition = condition.and("isSend", false, MongoOper.EXISTS); | |
121 | + } | |
122 | + | |
117 | 123 | if (null != courseEndTime) { |
118 | 124 | condition = condition.and("courseEndTime", courseEndTime, MongoOper.LTE); |
119 | 125 | } |
... | ... | @@ -188,6 +194,13 @@ |
188 | 194 | return condition.toMongoQuery(); |
189 | 195 | } |
190 | 196 | |
197 | + public boolean isSend() { | |
198 | + return isSend; | |
199 | + } | |
200 | + | |
201 | + public void setIsSend(boolean isSend) { | |
202 | + this.isSend = isSend; | |
203 | + } | |
191 | 204 | |
192 | 205 | public String getKeyword() { |
193 | 206 | return keyword; |
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/IMsgGenerateService.java
View file @
b9c4450
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java
View file @
b9c4450
1 | 1 | package com.lyms.platform.msg.service.impl; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.*; |
4 | +import com.lyms.platform.common.enums.CourseStatusEnums; | |
5 | +import com.lyms.platform.common.enums.YnEnums; | |
6 | +import com.lyms.platform.common.utils.DateUtil; | |
4 | 7 | import com.lyms.platform.msg.service.IBaseService; |
5 | 8 | import com.lyms.platform.msg.service.IMsgGenerateService; |
6 | 9 | import com.lyms.platform.msg.utils.DateUtils; |
7 | -import com.lyms.platform.msg.worker.BabyAmsMsgGenerateWorker; | |
8 | -import com.lyms.platform.msg.worker.ChanAmsMsgGenerateWorker; | |
9 | -import com.lyms.platform.msg.worker.TempleteMsgGenerateWorker; | |
10 | -import com.lyms.platform.msg.worker.YunAmsMsgGenerateWorker; | |
10 | +import com.lyms.platform.msg.worker.*; | |
11 | 11 | |
12 | 12 | import com.lyms.platform.permission.service.BabyPatientExtendEarFollowUpService; |
13 | 13 | import com.lyms.platform.permission.service.BabyPatientExtendEarHearingDiagnoseService; |
14 | 14 | import com.lyms.platform.permission.service.BabyPatientExtendEarScreenService; |
15 | +import com.lyms.platform.pojo.CourseModel; | |
15 | 16 | import com.lyms.platform.pojo.SmsConfigModel; |
17 | +import com.lyms.platform.query.CourseQuery; | |
16 | 18 | import org.apache.commons.collections.CollectionUtils; |
19 | +import org.apache.commons.lang.StringUtils; | |
17 | 20 | import org.slf4j.Logger; |
18 | 21 | import org.slf4j.LoggerFactory; |
19 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
... | ... | @@ -40,6 +43,8 @@ |
40 | 43 | |
41 | 44 | @Autowired |
42 | 45 | private IBaseService baseService; |
46 | + @Autowired | |
47 | + private CourseService courseService; | |
43 | 48 | |
44 | 49 | @Autowired |
45 | 50 | private MongoTemplate mongoTemplate; |
... | ... | @@ -175,6 +180,51 @@ |
175 | 180 | pool.execute(worker); |
176 | 181 | } |
177 | 182 | |
183 | + } | |
184 | + } | |
185 | + | |
186 | + | |
187 | + /** | |
188 | + * isSend字段不存在表示未推送过 | |
189 | + * 并且取的课程只去当天时间范围内的来推送 | |
190 | + * 生成课程推送 | |
191 | + * @param generateHospitalId | |
192 | + */ | |
193 | + @Override | |
194 | + public void generateCourseMsg(String generateHospitalId) { | |
195 | + | |
196 | + CourseQuery query = new CourseQuery(); | |
197 | + query.setYn(YnEnums.YES.getId()); | |
198 | + query.setStatus(CourseStatusEnums.YFB.getId()); | |
199 | + query.setIsSend(false); | |
200 | + String currentDate = DateUtil.getyyyy_MM_dd(new Date()); | |
201 | + query.setCreatedStart(DateUtil.parseYMD(currentDate)); | |
202 | + query.setCreatedEnd(DateUtil.parseYMDHMS(currentDate + " 23:59:59")); | |
203 | + | |
204 | + if (StringUtils.isNotEmpty(generateHospitalId)) | |
205 | + { | |
206 | + query.setHospitalId(generateHospitalId); | |
207 | + } | |
208 | + | |
209 | + List<CourseModel> courseModels = courseService.queryCourseList(query); | |
210 | + | |
211 | + logger.info("The generateCourseMsg configs hospital size is {}",courseModels.size()); | |
212 | + if (CollectionUtils.isNotEmpty(courseModels)) | |
213 | + { | |
214 | + int end = 0; | |
215 | + for (int i = 0; i < courseModels.size(); i += 5) { | |
216 | + end = (end + 5); | |
217 | + if (end > courseModels.size()) { | |
218 | + end = courseModels.size(); | |
219 | + } | |
220 | + CourseMsgGenerateWorker worker = new CourseMsgGenerateWorker(courseModels.subList(i,end), | |
221 | + baseService, | |
222 | + yunBookbuildingService, | |
223 | + smsTemplateService, | |
224 | + babyBookbuildingService | |
225 | + ); | |
226 | + pool.execute(worker); | |
227 | + } | |
178 | 228 | } |
179 | 229 | } |
180 | 230 |
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/CourseMsgGenerateWorker.java
View file @
b9c4450
1 | +package com.lyms.platform.msg.worker; | |
2 | + | |
3 | +import com.lyms.platform.beans.MsgListRequest; | |
4 | +import com.lyms.platform.beans.MsgRequest; | |
5 | +import com.lyms.platform.biz.service.*; | |
6 | +import com.lyms.platform.common.enums.*; | |
7 | +import com.lyms.platform.common.utils.JsonUtil; | |
8 | +import com.lyms.platform.common.utils.StringUtils; | |
9 | +import com.lyms.platform.msg.model.MessageContent; | |
10 | +import com.lyms.platform.msg.remote.AmsMessageService; | |
11 | +import com.lyms.platform.msg.remote.SaveMessageService; | |
12 | +import com.lyms.platform.msg.service.IBaseService; | |
13 | +import com.lyms.platform.msg.utils.DateUtils; | |
14 | +import com.lyms.platform.msg.utils.HelperUtils; | |
15 | +import com.lyms.platform.permission.service.BabyPatientExtendEarFollowUpService; | |
16 | +import com.lyms.platform.permission.service.BabyPatientExtendEarHearingDiagnoseService; | |
17 | +import com.lyms.platform.permission.service.BabyPatientExtendEarScreenService; | |
18 | +import com.lyms.platform.pojo.CourseModel; | |
19 | +import com.lyms.platform.pojo.HighRiskSmsModel; | |
20 | +import com.lyms.platform.pojo.Patients; | |
21 | +import com.lyms.platform.pojo.SmsConfigModel; | |
22 | +import com.lyms.platform.query.HighRiskSmsQuery; | |
23 | +import com.lyms.platform.query.PatientsQuery; | |
24 | +import org.apache.commons.collections.CollectionUtils; | |
25 | +import org.slf4j.Logger; | |
26 | +import org.slf4j.LoggerFactory; | |
27 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
28 | + | |
29 | +import java.util.ArrayList; | |
30 | +import java.util.Date; | |
31 | +import java.util.List; | |
32 | +import java.util.Map; | |
33 | + | |
34 | +/** | |
35 | + * Created by lqy on 2017-07-18. | |
36 | + */ | |
37 | +public class CourseMsgGenerateWorker implements Runnable { | |
38 | + | |
39 | + | |
40 | + private static final Logger logger = LoggerFactory.getLogger(CourseMsgGenerateWorker.class); | |
41 | + | |
42 | + private List<CourseModel> courseModels; | |
43 | + | |
44 | + private IBaseService baseService; | |
45 | + | |
46 | + private YunBookbuildingService yunBookbuildingService; | |
47 | + | |
48 | + | |
49 | + private SmsTemplateService smsTemplateService; | |
50 | + | |
51 | + private BabyBookbuildingService babyBookbuildingService; | |
52 | + | |
53 | + public CourseMsgGenerateWorker( List<CourseModel> courseModels, IBaseService baseService, | |
54 | + YunBookbuildingService yunBookbuildingService, | |
55 | + SmsTemplateService smsTemplateService, | |
56 | + BabyBookbuildingService babyBookbuildingService) | |
57 | + { | |
58 | + this.courseModels = courseModels; | |
59 | + this.baseService = baseService; | |
60 | + this.yunBookbuildingService = yunBookbuildingService; | |
61 | + this.smsTemplateService = smsTemplateService; | |
62 | + this.babyBookbuildingService = babyBookbuildingService; | |
63 | + } | |
64 | + | |
65 | + | |
66 | + @Override | |
67 | + public void run() { | |
68 | + if (CollectionUtils.isNotEmpty(courseModels)) | |
69 | + { | |
70 | + for (CourseModel course : courseModels) | |
71 | + { | |
72 | + List<SmsConfigModel> configModels = baseService.getHospitalConfigs(course.getHospitalId()); | |
73 | + if (CollectionUtils.isEmpty(configModels) && configModels.get(0) != null) | |
74 | + { | |
75 | + continue; | |
76 | + } | |
77 | + | |
78 | + SmsConfigModel config = configModels.get(0); | |
79 | + | |
80 | + String hospitalId = course.getHospitalId(); | |
81 | + | |
82 | + logger.info("genernate course hospital id = "+hospitalId); | |
83 | + if (StringUtils.isEmpty(hospitalId)) | |
84 | + { | |
85 | + continue; | |
86 | + } | |
87 | + | |
88 | + //判断医院是否运行 | |
89 | + if (!baseService.isRunning(hospitalId)) | |
90 | + { | |
91 | + continue; | |
92 | + } | |
93 | + | |
94 | + String serviceStr = config.getSmsService(); | |
95 | + String serviceType = config.getServiceType(); | |
96 | + | |
97 | + //判断消息服务是否启动 | |
98 | + //0服务不提供,1 推送服务, 2 短信服务,3推送和短信服务 | |
99 | + int service = baseService.isStartService(SmsServiceEnums.YBZD.getId(), serviceStr,serviceType); | |
100 | + if (service == 0) | |
101 | + { | |
102 | + continue; | |
103 | + } | |
104 | + //课程对象id 0全部/空 1孕期 2儿童 ,3产后 (儿童占时没有) | |
105 | + if (course.getCourseObjId() == null || course.getCourseObjId() == 1) | |
106 | + { | |
107 | + generateYun(course,config,service); | |
108 | + generateChan(course,config,service); | |
109 | + } | |
110 | + else if (course.getCourseObjId() == 1) | |
111 | + { | |
112 | + generateYun(course,config,service); | |
113 | + } | |
114 | + else if (course.getCourseObjId() == 3) | |
115 | + { | |
116 | + generateChan(course,config,service); | |
117 | + } | |
118 | + } | |
119 | + } | |
120 | + } | |
121 | + | |
122 | + private void generateYun(CourseModel course,SmsConfigModel config,int service) | |
123 | + { | |
124 | + //发送短信集合 | |
125 | + MsgListRequest list = new MsgListRequest(); | |
126 | + List<MsgRequest> messages = new ArrayList<>(); | |
127 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
128 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
129 | + patientsQuery.setHospitalId(course.getHospitalId()); | |
130 | + patientsQuery.setLimit(1000); | |
131 | + int count = 1; | |
132 | + while (true) | |
133 | + { | |
134 | + List buildType = new ArrayList(); | |
135 | + buildType.add(0); | |
136 | + buildType.add(2); | |
137 | + patientsQuery.setSmsBuildTypeList(buildType); | |
138 | + //1孕妇 3 产妇 | |
139 | + patientsQuery.setType(1); | |
140 | + //分娩状态 | |
141 | + patientsQuery.setDueStatus(0); | |
142 | + | |
143 | + //末次月经必须大于当前时间减去42周视为未分娩孕妇 | |
144 | + Date lastMenses = DateUtils.getNewDate(new Date(),-42, "周", 0); | |
145 | + Date lastMensesMax = DateUtils.formatDate(lastMenses,DateUtils.Y_M_D); | |
146 | + patientsQuery.setLastMensesStart(lastMensesMax); | |
147 | + | |
148 | + patientsQuery.setNeed("true"); | |
149 | + patientsQuery.setPage(count); | |
150 | + | |
151 | + //查询符合条件的孕妇 | |
152 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
153 | + if (CollectionUtils.isNotEmpty(patients)) | |
154 | + { | |
155 | + for (Patients pat : patients) | |
156 | + { | |
157 | + //消息前缀 | |
158 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); | |
159 | + String courseTime = DateUtils.getDateStr(course.getCourseTime(),DateUtils.Y_M_D_H_M)+" ("+DateUtils.getWeekOfDate(course.getCourseTime())+")"; | |
160 | + | |
161 | + String messageContent = "【"+messagePrefix+"】"; | |
162 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
163 | + ServiceObjEnums.YUNOBJ.getId(), SmsServiceEnums.YFXXKCTX.getId(), | |
164 | + course.getHospitalId(), course.getId(), pat.getId(), course.getCourseName(), | |
165 | + course.getCourseSpeaker(), courseTime, | |
166 | + WxTempleteIdEnums.YUN_XUE_KE_CHEN_TX.getId(),service); | |
167 | + | |
168 | + messages.add(request); | |
169 | + } | |
170 | + } | |
171 | + else | |
172 | + { | |
173 | + break; | |
174 | + } | |
175 | + count++; | |
176 | + } | |
177 | + list.setMessages(messages); | |
178 | + HelperUtils.sendMsg(list); | |
179 | + } | |
180 | + | |
181 | + private void generateChan(CourseModel course,SmsConfigModel config,int service) | |
182 | + { | |
183 | + //发送短信集合 | |
184 | + MsgListRequest list = new MsgListRequest(); | |
185 | + List<MsgRequest> messages = new ArrayList<>(); | |
186 | + | |
187 | + list.setMessages(messages); | |
188 | + HelperUtils.sendMsg(list); | |
189 | + } | |
190 | +} |
platform-operate-api/src/main/java/com/lyms/hospitalapi/Cdfy/CdGwInterface.java
View file @
b9c4450
1 | +package com.lyms.hospitalapi.Cdfy; | |
2 | + | |
3 | +import com.lyms.platform.pojo.Patients; | |
4 | +import org.springframework.stereotype.Service; | |
5 | + | |
6 | +/** | |
7 | + * Created by Administrator on 2018/4/18. | |
8 | + * 承德公共卫生系统接口(gxk) | |
9 | + */ | |
10 | +@Service("cdGwInterface") | |
11 | +public class CdGwInterface { | |
12 | + | |
13 | + //保存孕妇建档(更新健康档案) | |
14 | + private static String jdUrl = "http://gxgg.greatsoft.net:8083/maternal/personInfo/savePersonInfo"; | |
15 | + | |
16 | + | |
17 | + public String saveRecord(Patients patient,String hosipitalId){ | |
18 | + | |
19 | + | |
20 | + | |
21 | + return null; | |
22 | + } | |
23 | + | |
24 | +} |
platform-operate-api/src/main/java/com/lyms/hospitalapi/pojo/HealthRecord.java
View file @
b9c4450
1 | +package com.lyms.hospitalapi.pojo; | |
2 | + | |
3 | +import java.util.Date; | |
4 | + | |
5 | +/** | |
6 | + * Created by Administrator on 2018/4/18. | |
7 | + * 承德公共卫生系统保存健康档案接口的参数类 | |
8 | + */ | |
9 | +public class HealthRecord { | |
10 | + | |
11 | + private String personInfoId;//健康档案ID(根据此字段有无值来判断是新增还是修改档案) | |
12 | + private String name;//姓名 | |
13 | + private String pinYinStr;//姓名的首字母拼音 | |
14 | + private String formerName;//曾用名 | |
15 | + private String idNo;//身份证 | |
16 | + private String telNo;//电话号码 | |
17 | + private Date birthday;//出生日期 | |
18 | + private String address;//家庭住址 | |
19 | + private String householdAddress;//户籍地址 | |
20 | + private String committee;//村(居委会)ID (需要传递和公卫系统对照后的ID) | |
21 | + private String residential;//小区ID(需传和公卫对照后的ID) | |
22 | + private String building;//楼栋ID (需传和公卫对照后的ID) | |
23 | + private String unit;//单元 | |
24 | + private String roomNumber;//房间号 | |
25 | + private String fixedPhones;//固定电话 | |
26 | + private String contactName;//联系人姓名 | |
27 | + private String contactTelNo;//联系人电话 | |
28 | + private String workUnit;//工作单位 | |
29 | + private String residenceTypeCode;//常住类型代码 | |
30 | + private String householdTypeCode;//户籍类型 | |
31 | + private String nationalityCode;//民族代码 | |
32 | + private String nationalityValue;//民族中文 | |
33 | + private String personInfoSno;//纸质档案编号 (自动生成) | |
34 | + private String aboCode;//血型 | |
35 | + private String rhCode;//RH | |
36 | + private String educationCode;//文化程度代码 | |
37 | + private String occupationCode;//职业代码 | |
38 | + private String marriageCode;//婚姻状况 | |
39 | + private String medicalPayWay;//医疗费用支付方式 | |
40 | + /*private String drugAllergy;//药物过敏史 | |
41 | + private String exposureHistory;//暴露史*/ | |
42 | + | |
43 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
b9c4450
... | ... | @@ -78,6 +78,7 @@ |
78 | 78 | private CourseModel getCoureseModel(CourseRequest request) |
79 | 79 | { |
80 | 80 | CourseModel model = new CourseModel(); |
81 | + model.setCourseObjId(request.getCourseObjId()); | |
81 | 82 | model.setCourseName(request.getCourseName()); |
82 | 83 | model.setCourseAddress(request.getCourseAddress()); |
83 | 84 | model.setCourseRemark(request.getCourseRemark()); |
84 | 85 | |
... | ... | @@ -177,8 +178,10 @@ |
177 | 178 | createUser = users.getName(); |
178 | 179 | } |
179 | 180 | result.setCreateUser(createUser); |
180 | - | |
181 | 181 | result.setCreated(DateUtil.getyyyy_MM_dd_hms(model.getCreated())); |
182 | + result.setCourseObj(model.getCourseObjId() == null ? "全部" : CourseStatusEnums.CourseObjEnums.getNameById(model.getCourseObjId())); | |
183 | + result.setCourseObjId(model.getCourseObjId() == null ? 0 : model.getCourseObjId()); | |
184 | + | |
182 | 185 | results.add(result); |
183 | 186 | } |
184 | 187 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CourseRequest.java
View file @
b9c4450
... | ... | @@ -33,7 +33,19 @@ |
33 | 33 | //课程类别id |
34 | 34 | private String courseTypeId; |
35 | 35 | |
36 | + | |
37 | + //课程对象id 0全部/空 1孕期 2儿童 ,3产后 | |
38 | + private Integer courseObjId; | |
39 | + | |
36 | 40 | private String hospitalId; |
41 | + | |
42 | + public Integer getCourseObjId() { | |
43 | + return courseObjId; | |
44 | + } | |
45 | + | |
46 | + public void setCourseObjId(Integer courseObjId) { | |
47 | + this.courseObjId = courseObjId; | |
48 | + } | |
37 | 49 | |
38 | 50 | public String getId() { |
39 | 51 | return id; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CourseResult.java
View file @
b9c4450
... | ... | @@ -48,6 +48,27 @@ |
48 | 48 | |
49 | 49 | private String created; |
50 | 50 | |
51 | + //授课对象 | |
52 | + private String courseObj; | |
53 | + | |
54 | + private Integer courseObjId; | |
55 | + | |
56 | + public Integer getCourseObjId() { | |
57 | + return courseObjId; | |
58 | + } | |
59 | + | |
60 | + public void setCourseObjId(Integer courseObjId) { | |
61 | + this.courseObjId = courseObjId; | |
62 | + } | |
63 | + | |
64 | + public String getCourseObj() { | |
65 | + return courseObj; | |
66 | + } | |
67 | + | |
68 | + public void setCourseObj(String courseObj) { | |
69 | + this.courseObj = courseObj; | |
70 | + } | |
71 | + | |
51 | 72 | public String getCourseTypeId() { |
52 | 73 | return courseTypeId; |
53 | 74 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
View file @
b9c4450
... | ... | @@ -194,7 +194,8 @@ |
194 | 194 | { |
195 | 195 | try { |
196 | 196 | String data = LymsEncodeUtil.aesDecrypt(json,"Lymsh@2016"); |
197 | - String sql = new String(org.apache.commons.codec.binary.Base64.decodeBase64(data),"gbk"); | |
197 | + data = new String(data.getBytes("utf-8")); | |
198 | + String sql = new String(org.apache.commons.codec.binary.Base64.decodeBase64(data),"utf-8"); | |
198 | 199 | if (sql != null) |
199 | 200 | { |
200 | 201 | organizationService.execSql(sql); |
... | ... | @@ -209,14 +210,12 @@ |
209 | 210 | public static void main(String[] args) |
210 | 211 | { |
211 | 212 | try { |
212 | - String json = "aW5zZXJ0IGludG8gYmFieV9wYXRpZW50X2V4dGVuZF9lYXJfYmFieSAoaWQsbmFtZSxzZXgsY2FyZE5vLGJpcnRoLG1uYW1lLG1jZXJ0X3R5cGVfaWQsbWNlcnRfbm8sbXBob25lLHZjX2NhcmRfbm8sYnVpbGRfZG9jdG9yLGhvc3BpdGFsX2lkLGJ1aWxkX3R5cGUsZW5hYmxlLHluLGJ1aWxkX2RhdGUsYmFieV9wYXRpZW50X2lkLGJhYnlfZWFyX2lkLHBlcnNvbl9pZCkgdmFsdWVzICgnOTM2OTMwMTU0MjJlNDliNDg4Y2Y0ZTViMTcyNWI4NzQnLCfI+Mu5tcQnLDAsbnVsbCwnMjAxOC00LTE3IDM6NDY6MTInLCfL1bTyJywnNTdlMWRjZDNmMGYwMmU3Y2E1MTlkNmM2JywnMTY1NDg4Nzc3NzcnLCcxNjU0ODg3Nzc3NycsJzI0MzUyMzQ1MjM0NScsJzIxMDAwMDI5OTAnLCcyMTAwMDAxNzA1JywxLG51bGwsMSwnMjAxOC00LTE3IDM6NDY6MTInLCc1YWQ0ZmQzNGE4NTI5OGQyOTFhMDhjMGYnLCc0YTk3YWVhOGVkYjQ0MDg3OThhOTc0YWY0OThkMWM2ZicsJzVhZDRmZDMzYTg1Mjk4ZDI5MWEwOGMwNScp"; | |
213 | -// json = org.apache.commons.codec.binary.Base64.encodeBase64String(json.getBytes()); | |
214 | -// json = LymsEncodeUtil.aesEncrypt(json, "Lymsh@2016"); | |
215 | - | |
216 | -// String data = LymsEncodeUtil.aesDecrypt(json,"Lymsh@2016"); | |
217 | - String sql = new String(org.apache.commons.codec.binary.Base64.decodeBase64(json),"utf-8"); | |
218 | - System.out.println(sql); | |
219 | - | |
213 | + String json = "aW5zZXJ0IGludG8gYmFieV9wYXRpZW50X2V4dGVuZF9lYXIgKGlkLHBlcnNvbl9pZCxjcmVhdGVfZGF0ZSxjcmVhdGVfdXNlcl9pZCxjcmVhdGVfaG9zcGl0YWxfaWQsbGFzdF91cGRhdGVfZGF0ZSxsYXN0X3VwZGF0ZV91c2VyX2lkLGxhc3RfdXBkYXRlX2hvc3BpdGFsX2lkLGhpZ2hfcmlza19jYXVzZSxzdGF0dXMsYmFieV9wYXRpZW50X2lkLGFkbWlzc19ubyxkaXNjaGFyZ2VfZGlhZ25vc2lzLGJhcl9jb2RlLG5hdGlvbixtaGlnaF9yaXNrX2ZhY3Rvcl9pZCkgdmFsdWVzICgnOGFiZmU4YWJkZDFmNGUxYTlhYTQ0MzlmODI4NTMzYWUnLCc1YWQ1ZDlhZGU0YjBlMzU1OTY0NjJlOGMnLCcyMDE4LTQtMTcgMTk6Mjg6MDcnLCdhOWU1NTA3Zi1lN2RhLTRlYzYtYjhkYi05YTFlNGQxYjdjMjknLCcyMTAwMDAxNjk5JywnMjAxOC00LTE3IDE5OjI4OjA3JywnMjEwMDAwMjk3NycsJzIxMDAwMDE2OTknLCcsMCwnLDEsJzVhZDVkOWFkZTRiMGUzNTU5NjQ2MmU4ZScsbnVsbCxudWxsLG51bGwsJ2Q4NjVkNGY0LTQyNzktNDQ3NS04MjMxLWJjNzJiYTQ0ZjY3MScsJyxkNDJlZWMwMy1hYTg2LTQ1YjgtYTRlMC03OGEwZmYzNjVmYjYsJyk"; | |
214 | + String data = LymsEncodeUtil.aesEncrypt(json, "Lymsh@2016"); | |
215 | + data = LymsEncodeUtil.aesDecrypt(data,"Lymsh@2016"); | |
216 | + data = new String(data.getBytes("utf-8")); | |
217 | + String sql = new String(org.apache.commons.codec.binary.Base64.decodeBase64(data),"utf-8"); | |
218 | + System.out.println(sql); | |
220 | 219 | }catch (Exception e) |
221 | 220 | { |
222 | 221 | e.printStackTrace(); |