Commit f8a45dc035fdf4e24947f18d1ba250716fe9d14a
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 17 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntExRecordService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientCourseService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SyncDataService.java
- platform-common/src/main/java/com/lyms/platform/common/pojo/SyncMysqlDataModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AntExChuModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientCourseQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCourseFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MysqlDataInterceptor.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AntExManagerQueryRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AntExcAddRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntexChuResult.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/service/AntExRecordService.java
View file @
f8a45dc
| ... | ... | @@ -263,6 +263,7 @@ |
| 263 | 263 | antExRecordModel.setBarCode(antExChuModel.getBarCode()); |
| 264 | 264 | antExRecordModel.setCheckTime(antExChuModel.getCheckTime()); |
| 265 | 265 | antExRecordModel.setNextCheckTime(antExChuModel.getNextCheckTime()); |
| 266 | + antExRecordModel.setFirst(antExChuModel.getFirst()); | |
| 266 | 267 | |
| 267 | 268 | //高危信息 |
| 268 | 269 | List li = null; |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientCourseService.java
View file @
f8a45dc
| ... | ... | @@ -29,6 +29,16 @@ |
| 29 | 29 | return patientCourseDao.queryPatientCourseList(query.addOrder(Sort.Direction.DESC, "created")); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | + public List<PatientCourseModel> queryPatientCourseList(PatientCourseQuery patientCourseQuery,String sort) | |
| 33 | + { | |
| 34 | + MongoQuery query = patientCourseQuery.convertToQuery(); | |
| 35 | + if (StringUtils.isNotEmpty(patientCourseQuery.getNeed())) { | |
| 36 | + patientCourseQuery.mysqlBuild(patientCourseDao.queryPatientCourseListCount(patientCourseQuery.convertToQuery())); | |
| 37 | + query.start(patientCourseQuery.getOffset()).end(patientCourseQuery.getLimit()); | |
| 38 | + } | |
| 39 | + return patientCourseDao.queryPatientCourseList(query.addOrder(Sort.Direction.DESC,sort)); | |
| 40 | + } | |
| 41 | + | |
| 32 | 42 | public void addPatientCourse(PatientCourseModel model) { |
| 33 | 43 | patientCourseDao.addPatientCourse(model); |
| 34 | 44 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SyncDataService.java
View file @
f8a45dc
| ... | ... | @@ -3,7 +3,10 @@ |
| 3 | 3 | import com.lyms.platform.biz.dal.ISyncDataDao; |
| 4 | 4 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 5 | 5 | import com.lyms.platform.common.pojo.SyncDataModel; |
| 6 | +import com.lyms.platform.common.pojo.SyncMysqlDataModel; | |
| 7 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 6 | 8 | import com.lyms.platform.query.SyncDataQuery; |
| 9 | +import org.apache.commons.codec.binary.Base64; | |
| 7 | 10 | import org.apache.commons.lang.StringUtils; |
| 8 | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 12 | import org.springframework.data.domain.Sort; |
| 10 | 13 | |
| ... | ... | @@ -58,7 +61,20 @@ |
| 58 | 61 | return iSyncDataDao.querySyncData(query.addOrder(Sort.Direction.ASC, "created")); |
| 59 | 62 | } |
| 60 | 63 | |
| 64 | + public boolean savePostMysql(String sql ,String sqlId) { | |
| 65 | + SyncMysqlDataModel syncMysqlDataModel = new SyncMysqlDataModel(); | |
| 66 | + syncMysqlDataModel.setSql(Base64.encodeBase64String(sql.getBytes())); | |
| 67 | + syncMysqlDataModel.setSqlId(sqlId); | |
| 61 | 68 | |
| 62 | - | |
| 69 | + SyncDataModel model = new SyncDataModel(); | |
| 70 | + model.setStatus(1); | |
| 71 | + model.setJsonData(JsonUtil.obj2JsonString(model)); | |
| 72 | + model.setAction("POSTMYSQL"); | |
| 73 | + model.setCreated(new Date()); | |
| 74 | + model.setClassName("syncmysql"); | |
| 75 | + model.setModified(model.getCreated()); | |
| 76 | + iSyncDataDao.addSyncData(model); | |
| 77 | + return true; | |
| 78 | + } | |
| 63 | 79 | } |
platform-common/src/main/java/com/lyms/platform/common/pojo/SyncMysqlDataModel.java
View file @
f8a45dc
| 1 | +package com.lyms.platform.common.pojo; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by Administrator on 2016/9/20. | |
| 10 | + */ | |
| 11 | +public class SyncMysqlDataModel extends BaseModel { | |
| 12 | + | |
| 13 | + private static final long serialVersionUID = 27531300010L; | |
| 14 | + | |
| 15 | + private String sql; | |
| 16 | + private String sqlId; | |
| 17 | + | |
| 18 | + public String getSql() { | |
| 19 | + return sql; | |
| 20 | + } | |
| 21 | + | |
| 22 | + public void setSql(String sql) { | |
| 23 | + this.sql = sql; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public String getSqlId() { | |
| 27 | + return sqlId; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setSqlId(String sqlId) { | |
| 31 | + this.sqlId = sqlId; | |
| 32 | + } | |
| 33 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/AntExChuModel.java
View file @
f8a45dc
| ... | ... | @@ -21,9 +21,20 @@ |
| 21 | 21 | private String genRemark; // 一般检查备注 |
| 22 | 22 | private String gynRemark; // 妇科检查备注 |
| 23 | 23 | |
| 24 | + private Integer first; // 1否 2 是,是否当前医院第一次初诊 德州需求 | |
| 24 | 25 | |
| 26 | + | |
| 25 | 27 | //该字段是针对聊城东昌区妇幼保健医院保存当天孕妇的lis检查项 |
| 26 | 28 | private String lisCheckItems; |
| 29 | + | |
| 30 | + | |
| 31 | + public Integer getFirst() { | |
| 32 | + return first; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setFirst(Integer first) { | |
| 36 | + this.first = first; | |
| 37 | + } | |
| 27 | 38 | |
| 28 | 39 | public String getLisCheckItems() { |
| 29 | 40 | return lisCheckItems; |
platform-dal/src/main/java/com/lyms/platform/pojo/AntExRecordModel.java
View file @
f8a45dc
| ... | ... | @@ -84,6 +84,17 @@ |
| 84 | 84 | // 1 表示在上面各个孕周范围内的第一次检查,2或者空表示 不是 |
| 85 | 85 | private Integer isFirst; |
| 86 | 86 | |
| 87 | + | |
| 88 | + private Integer first; // 1否 2 是,是否当前医院第一次初诊 德州需求 | |
| 89 | + | |
| 90 | + public Integer getFirst() { | |
| 91 | + return first; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setFirst(Integer first) { | |
| 95 | + this.first = first; | |
| 96 | + } | |
| 97 | + | |
| 87 | 98 | public Integer getIsFirst() { |
| 88 | 99 | return isFirst; |
| 89 | 100 | } |
platform-dal/src/main/java/com/lyms/platform/query/AntExRecordQuery.java
View file @
f8a45dc
| ... | ... | @@ -41,7 +41,17 @@ |
| 41 | 41 | |
| 42 | 42 | //是否范围孕周 |
| 43 | 43 | private boolean isRangeWeek; |
| 44 | + private Integer first; // 1否 2 是,是否当前医院第一次初诊 德州需求 | |
| 44 | 45 | |
| 46 | + | |
| 47 | + public Integer getFirst() { | |
| 48 | + return first; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setFirst(Integer first) { | |
| 52 | + this.first = first; | |
| 53 | + } | |
| 54 | + | |
| 45 | 55 | public boolean isRangeWeek() { |
| 46 | 56 | return isRangeWeek; |
| 47 | 57 | } |
| ... | ... | @@ -447,6 +457,10 @@ |
| 447 | 457 | } |
| 448 | 458 | if (null != type) { |
| 449 | 459 | condition = condition.and("type", type, MongoOper.IS); |
| 460 | + } | |
| 461 | + | |
| 462 | + if (null != first) { | |
| 463 | + condition = condition.and("first", first, MongoOper.IS); | |
| 450 | 464 | } |
| 451 | 465 | if (isFirst != null) { |
| 452 | 466 | condition = condition.and("isFirst", isFirst, MongoOper.IS); |
platform-dal/src/main/java/com/lyms/platform/query/PatientCourseQuery.java
View file @
f8a45dc
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | import org.springframework.data.mongodb.core.query.Criteria; |
| 9 | 9 | |
| 10 | 10 | import java.util.Date; |
| 11 | +import java.util.List; | |
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * 孕妇预约和签到 |
| ... | ... | @@ -47,6 +48,8 @@ |
| 47 | 48 | //patientid |
| 48 | 49 | private String patientId; |
| 49 | 50 | |
| 51 | + private List<String> patientIds; | |
| 52 | + | |
| 50 | 53 | //课程id |
| 51 | 54 | private String courseId; |
| 52 | 55 | |
| ... | ... | @@ -100,6 +103,10 @@ |
| 100 | 103 | condition = condition.and("patientId", patientId, MongoOper.IS); |
| 101 | 104 | } |
| 102 | 105 | |
| 106 | + if (null != patientIds) { | |
| 107 | + condition = condition.and("patientId", patientIds, MongoOper.IN); | |
| 108 | + } | |
| 109 | + | |
| 103 | 110 | if (null != courseId) { |
| 104 | 111 | condition = condition.and("courseId", courseId, MongoOper.IS); |
| 105 | 112 | } |
| ... | ... | @@ -133,6 +140,14 @@ |
| 133 | 140 | } |
| 134 | 141 | |
| 135 | 142 | return condition.toMongoQuery(); |
| 143 | + } | |
| 144 | + | |
| 145 | + public List<String> getPatientIds() { | |
| 146 | + return patientIds; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public void setPatientIds(List<String> patientIds) { | |
| 150 | + this.patientIds = patientIds; | |
| 136 | 151 | } |
| 137 | 152 | |
| 138 | 153 | public String getQueryNo() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java
View file @
f8a45dc
| ... | ... | @@ -101,6 +101,11 @@ |
| 101 | 101 | antExRecordQuery.setCityId(antExManagerQueryRequest.getCityId()); |
| 102 | 102 | antExRecordQuery.setAreaId(antExManagerQueryRequest.getAreaId()); |
| 103 | 103 | antExRecordQuery.setStreetId(antExManagerQueryRequest.getStreetId()); |
| 104 | + if (antExManagerQueryRequest.getFirst() != null && antExManagerQueryRequest.getFirst() == 2) | |
| 105 | + { | |
| 106 | + antExRecordQuery.setFirst(antExManagerQueryRequest.getFirst()); | |
| 107 | + } | |
| 108 | + | |
| 104 | 109 | |
| 105 | 110 | |
| 106 | 111 | //产检日期 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
f8a45dc
| ... | ... | @@ -629,6 +629,7 @@ |
| 629 | 629 | personService.updatePerson(pm, pm.getId()); |
| 630 | 630 | } |
| 631 | 631 | } else if (pm.getType() != null && pm.getType() == 3) { |
| 632 | + | |
| 632 | 633 | //儿童建档时 需要修改自动分娩的产妇 |
| 633 | 634 | for (Patients patients1 : pats) { |
| 634 | 635 | //自动分娩类型 |
| 635 | 636 | |
| ... | ... | @@ -643,9 +644,11 @@ |
| 643 | 644 | patients2.setFmDate(StringUtils.isEmpty(request.getDueDate()) ? DateUtil.parseYMD(request.getBabyBirthday()) : DateUtil.parseYMD(request.getDueDate())); |
| 644 | 645 | patients2.setBuildType(0); |
| 645 | 646 | patientsService.updatePatient(patients2); |
| 647 | + | |
| 646 | 648 | } |
| 647 | 649 | } |
| 648 | 650 | } |
| 651 | + patients = patients1; | |
| 649 | 652 | } |
| 650 | 653 | } |
| 651 | 654 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCourseFacade.java
View file @
f8a45dc
| ... | ... | @@ -21,14 +21,8 @@ |
| 21 | 21 | import com.lyms.platform.permission.model.Users; |
| 22 | 22 | import com.lyms.platform.permission.service.OrganizationService; |
| 23 | 23 | import com.lyms.platform.permission.service.UsersService; |
| 24 | -import com.lyms.platform.pojo.CourseModel; | |
| 25 | -import com.lyms.platform.pojo.CourseTypeModel; | |
| 26 | -import com.lyms.platform.pojo.PatientCourseModel; | |
| 27 | -import com.lyms.platform.pojo.Patients; | |
| 28 | -import com.lyms.platform.query.CourseQuery; | |
| 29 | -import com.lyms.platform.query.CourseTypeQuery; | |
| 30 | -import com.lyms.platform.query.PatientCourseQuery; | |
| 31 | -import com.lyms.platform.query.PatientsQuery; | |
| 24 | +import com.lyms.platform.pojo.*; | |
| 25 | +import com.lyms.platform.query.*; | |
| 32 | 26 | import org.apache.commons.collections.CollectionUtils; |
| 33 | 27 | import org.apache.commons.lang.StringUtils; |
| 34 | 28 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -162,6 +156,9 @@ |
| 162 | 156 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 163 | 157 | patientsQuery.setYn(YnEnums.YES.getId()); |
| 164 | 158 | patientsQuery.setPvc(queryNo); |
| 159 | + patientsQuery.setHospitalId(hospitalId); | |
| 160 | + patientsQuery.setDesc("true"); | |
| 161 | + patientsQuery.setSort("created"); | |
| 165 | 162 | List<Patients> patientses = patientsService.queryPatient(patientsQuery); |
| 166 | 163 | if (CollectionUtils.isNotEmpty(patientses)) |
| 167 | 164 | { |
| 168 | 165 | |
| ... | ... | @@ -250,7 +247,35 @@ |
| 250 | 247 | return objectResponse; |
| 251 | 248 | } |
| 252 | 249 | } |
| 250 | + else | |
| 251 | + { | |
| 252 | + objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA); | |
| 253 | + objectResponse.setErrormsg("该课程不存在"); | |
| 254 | + return objectResponse; | |
| 255 | + } | |
| 253 | 256 | |
| 257 | + if (orderType == 2) | |
| 258 | + { | |
| 259 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 260 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 261 | + patientsQuery.setId(patientId); | |
| 262 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
| 263 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 264 | + | |
| 265 | + Patients patients = patientses.get(0); | |
| 266 | + patientsQuery.setId(null); | |
| 267 | + patientsQuery.setPid(patients.getPid()); | |
| 268 | + patientsQuery.setHospitalId(courseModels.get(0).getHospitalId()); | |
| 269 | + patientsQuery.setDesc("true"); | |
| 270 | + patientsQuery.setSort("created"); | |
| 271 | + patientses = patientsService.queryPatient(patientsQuery); | |
| 272 | + if (CollectionUtils.isNotEmpty(patientses)) | |
| 273 | + { | |
| 274 | + patientId = patientses.get(0).getId(); | |
| 275 | + } | |
| 276 | + } | |
| 277 | + } | |
| 278 | + | |
| 254 | 279 | PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); |
| 255 | 280 | patientCourseQuery.setCourseId(courseId); |
| 256 | 281 | patientCourseQuery.setYn(YnEnums.YES.getId()); |
| 257 | 282 | |
| 258 | 283 | |
| 259 | 284 | |
| ... | ... | @@ -508,11 +533,34 @@ |
| 508 | 533 | result.put("limitNum", model.getLimitNum() == null ? "0" : String.valueOf(model.getLimitNum())); |
| 509 | 534 | |
| 510 | 535 | patientCourseQuery.setCourseId(model.getId()); |
| 511 | - patientCourseQuery.setPatientId(patientId); | |
| 512 | 536 | |
| 537 | + List<String> patids = new ArrayList<>(); | |
| 513 | 538 | |
| 539 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 540 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 541 | + patientsQuery.setId(patientId); | |
| 542 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
| 543 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 544 | + | |
| 545 | + Patients patients = patientses.get(0); | |
| 546 | + patientsQuery.setId(null); | |
| 547 | + patientsQuery.setPid(patients.getPid()); | |
| 548 | + patientsQuery.setDesc("true"); | |
| 549 | + patientsQuery.setSort("created"); | |
| 550 | + patientses = patientsService.queryPatient(patientsQuery); | |
| 551 | + if (CollectionUtils.isNotEmpty(patientses)) | |
| 552 | + { | |
| 553 | + for (Patients pat : patientses) | |
| 554 | + { | |
| 555 | + patids.add(pat.getId()); | |
| 556 | + } | |
| 557 | + } | |
| 558 | + } | |
| 559 | + | |
| 560 | + patientCourseQuery.setPatientIds(patids); | |
| 561 | + | |
| 514 | 562 | Integer patientStatus = 0; |
| 515 | - List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); | |
| 563 | + List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery,"status"); | |
| 516 | 564 | if (CollectionUtils.isNotEmpty(patientCourseModels)) |
| 517 | 565 | { |
| 518 | 566 | patientStatus = patientCourseModels.get(0).getStatus(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
f8a45dc
| ... | ... | @@ -1787,6 +1787,8 @@ |
| 1787 | 1787 | //补充高危因素 |
| 1788 | 1788 | map.put("highriskDesc", data.getHighriskDesc()); |
| 1789 | 1789 | |
| 1790 | + map.put("first", (data.getFirst() == null || data.getFirst() == 1) ? "否" : "是"); | |
| 1791 | + | |
| 1790 | 1792 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 1791 | 1793 | br.setErrormsg("成功"); |
| 1792 | 1794 | br.setData(map); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/inteceptor/MysqlDataInterceptor.java
View file @
f8a45dc
| 1 | 1 | package com.lyms.platform.operate.web.inteceptor; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.lyms.platform.biz.service.SyncDataService; | |
| 4 | 5 | import com.lyms.platform.common.utils.ExceptionUtils; |
| 5 | 6 | import com.lyms.platform.operate.web.utils.SendMysqlSyncDatUtil; |
| 6 | 7 | import org.apache.commons.collections.CollectionUtils; |
| 7 | 8 | |
| ... | ... | @@ -14,13 +15,14 @@ |
| 14 | 15 | import org.apache.ibatis.reflection.MetaObject; |
| 15 | 16 | import org.apache.ibatis.session.Configuration; |
| 16 | 17 | import org.apache.ibatis.type.TypeHandlerRegistry; |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 17 | 19 | |
| 18 | 20 | import java.sql.Statement; |
| 19 | 21 | import java.text.DateFormat; |
| 20 | 22 | import java.util.*; |
| 21 | 23 | |
| 22 | 24 | /** |
| 23 | - * 同步线上mysql的操作到区域 | |
| 25 | + * 眼科和听筛执行的sql保存下来 然后把区域执行的这些sql同步到线上执行 | |
| 24 | 26 | * Created by Administrator on 2017-04-24. |
| 25 | 27 | */ |
| 26 | 28 | @Intercepts({ |
| ... | ... | @@ -29,6 +31,10 @@ |
| 29 | 31 | }) |
| 30 | 32 | public class MysqlDataInterceptor implements Interceptor { |
| 31 | 33 | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + private SyncDataService syncDataService; | |
| 37 | + | |
| 32 | 38 | //同步的表 |
| 33 | 39 | private static Set<String> uses = new HashSet<>(); |
| 34 | 40 | static { |
| 35 | 41 | |
| 36 | 42 | |
| ... | ... | @@ -71,10 +77,9 @@ |
| 71 | 77 | sql = getSql(configuration, boundSql, sqlId); |
| 72 | 78 | if (isSyncTable(sql)) |
| 73 | 79 | { |
| 74 | - | |
| 75 | 80 | System.out.println("==============delete or update sync sql = " + sql); |
| 76 | - //发送要同步的sql | |
| 77 | 81 | sql = null; |
| 82 | + syncDataService.savePostMysql(sql,sqlId); | |
| 78 | 83 | } |
| 79 | 84 | } |
| 80 | 85 | else if ("insert".equals(sqlCommandType.toLowerCase()) ) |
| 81 | 86 | |
| ... | ... | @@ -97,10 +102,8 @@ |
| 97 | 102 | List<Integer> list = (ArrayList)returnValue; |
| 98 | 103 | if (CollectionUtils.isNotEmpty(list)) |
| 99 | 104 | { |
| 100 | -// sql = sql.replaceFirst("\\(","(ID,"); | |
| 101 | -// sql = sql.substring(0,sql.lastIndexOf("(")+1)+list.get(0)+","+sql.substring(sql.lastIndexOf("(")+1,sql.length()); | |
| 102 | 105 | System.out.println("============add sync sql = " + sql); |
| 103 | - //发送要同步的sql | |
| 106 | + syncDataService.savePostMysql(sql,sqlId); | |
| 104 | 107 | sql = null; |
| 105 | 108 | } |
| 106 | 109 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AntExManagerQueryRequest.java
View file @
f8a45dc
| ... | ... | @@ -75,6 +75,16 @@ |
| 75 | 75 | //查询号 |
| 76 | 76 | private String queryNo; |
| 77 | 77 | |
| 78 | + private Integer first; // 1否 2 是,是否当前医院第一次初诊 德州需求 | |
| 79 | + | |
| 80 | + public Integer getFirst() { | |
| 81 | + return first; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setFirst(Integer first) { | |
| 85 | + this.first = first; | |
| 86 | + } | |
| 87 | + | |
| 78 | 88 | public String getQueryNo() { |
| 79 | 89 | return queryNo; |
| 80 | 90 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AntExcAddRequest.java
View file @
f8a45dc
| ... | ... | @@ -24,9 +24,20 @@ |
| 24 | 24 | private String genRemark; // 一般检查备注 |
| 25 | 25 | private String gynRemark; // 妇科检查备注 |
| 26 | 26 | |
| 27 | + | |
| 28 | + private Integer first; // 1否 2 是,是否当前医院第一次初诊 德州需求 | |
| 29 | + | |
| 27 | 30 | //该字段是针对聊城东昌区妇幼保健医院保存当天孕妇的lis检查项 |
| 28 | 31 | private String lisCheckItems; |
| 29 | 32 | |
| 33 | + public Integer getFirst() { | |
| 34 | + return first; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setFirst(Integer first) { | |
| 38 | + this.first = first; | |
| 39 | + } | |
| 40 | + | |
| 30 | 41 | public String getLisCheckItems() { |
| 31 | 42 | return lisCheckItems; |
| 32 | 43 | } |
| ... | ... | @@ -1490,6 +1501,8 @@ |
| 1490 | 1501 | antExChuModel.setYljzxs(yljzxs); |
| 1491 | 1502 | antExChuModel.setJzxgyhwmkt(jzxgyhwmkt); |
| 1492 | 1503 | antExChuModel.setEdema(edema); |
| 1504 | + | |
| 1505 | + antExChuModel.setFirst(first); | |
| 1493 | 1506 | |
| 1494 | 1507 | return antExChuModel; |
| 1495 | 1508 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/AntexChuResult.java
View file @
f8a45dc
| ... | ... | @@ -21,8 +21,8 @@ |
| 21 | 21 | |
| 22 | 22 | private String genRemark; // 一般检查备注 |
| 23 | 23 | private String gynRemark; // 妇科检查备注 |
| 24 | + private String first; // 1否 2 是,是否当前医院第一次初诊 德州需求 | |
| 24 | 25 | |
| 25 | - | |
| 26 | 26 | //该字段是针对聊城东昌区妇幼保健医院保存当天孕妇的lis检查项 |
| 27 | 27 | private String lisCheckItems; |
| 28 | 28 | |
| 29 | 29 | |
| ... | ... | @@ -34,7 +34,14 @@ |
| 34 | 34 | this.lisCheckItems = lisCheckItems; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + public String getFirst() { | |
| 38 | + return first; | |
| 39 | + } | |
| 37 | 40 | |
| 41 | + public void setFirst(String first) { | |
| 42 | + this.first = first; | |
| 43 | + } | |
| 44 | + | |
| 38 | 45 | public String getGenRemark() { |
| 39 | 46 | return genRemark; |
| 40 | 47 | } |
| ... | ... | @@ -1480,6 +1487,8 @@ |
| 1480 | 1487 | setJzxgyhwmkt(antExChuModel.getJzxgyhwmkt()); |
| 1481 | 1488 | setEdema(antExChuModel.getEdema()); |
| 1482 | 1489 | setLisCheckItems(antExChuModel.getLisCheckItems()); |
| 1490 | + | |
| 1491 | + setFirst(antExChuModel.getFirst() == null ? "" : String.valueOf(antExChuModel.getFirst())); | |
| 1483 | 1492 | |
| 1484 | 1493 | } |
| 1485 | 1494 | return this; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
View file @
f8a45dc
| ... | ... | @@ -3,42 +3,34 @@ |
| 3 | 3 | import com.lyms.platform.biz.service.*; |
| 4 | 4 | import com.lyms.platform.common.enums.YnEnums; |
| 5 | 5 | import com.lyms.platform.common.pojo.SyncDataModel; |
| 6 | -import com.lyms.platform.common.pojo.UpdateMultiData; | |
| 7 | -import com.lyms.platform.common.utils.*; | |
| 8 | -import com.lyms.platform.operate.web.request.GuideQuery; | |
| 6 | +import com.lyms.platform.common.pojo.SyncMysqlDataModel; | |
| 7 | +import com.lyms.platform.common.utils.DateUtil; | |
| 8 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
| 9 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 10 | +import com.lyms.platform.common.utils.MongoSyncUtil; | |
| 9 | 11 | import com.lyms.platform.operate.web.utils.HttpClientUtil; |
| 10 | -import com.lyms.platform.operate.web.utils.SSLClient; | |
| 11 | 12 | import com.lyms.platform.permission.model.Users; |
| 12 | 13 | import com.lyms.platform.permission.model.UsersQuery; |
| 14 | +import com.lyms.platform.permission.service.OrganizationService; | |
| 13 | 15 | import com.lyms.platform.permission.service.UsersService; |
| 14 | 16 | import com.lyms.platform.pojo.*; |
| 15 | 17 | import com.lyms.platform.query.*; |
| 16 | -import com.qiniu.util.Json; | |
| 18 | + | |
| 17 | 19 | import org.apache.commons.collections.CollectionUtils; |
| 18 | -import org.apache.commons.httpclient.HttpClient; | |
| 19 | -import org.apache.commons.httpclient.NameValuePair; | |
| 20 | -import org.apache.commons.httpclient.methods.PostMethod; | |
| 20 | + | |
| 21 | 21 | import org.apache.commons.io.FileUtils; |
| 22 | -import org.apache.commons.lang.*; | |
| 22 | + | |
| 23 | + | |
| 23 | 24 | import org.apache.commons.lang.StringUtils; |
| 24 | -import org.apache.http.HttpEntity; | |
| 25 | -import org.apache.http.HttpResponse; | |
| 26 | -import org.apache.http.client.entity.UrlEncodedFormEntity; | |
| 27 | -import org.apache.http.client.methods.HttpPost; | |
| 28 | -import org.apache.http.message.BasicNameValuePair; | |
| 29 | -import org.apache.http.util.EntityUtils; | |
| 30 | 25 | import org.joda.time.DateTime; |
| 31 | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 32 | 27 | import org.springframework.beans.factory.annotation.Qualifier; |
| 33 | -import org.springframework.data.domain.Sort; | |
| 34 | 28 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 35 | 29 | import org.springframework.stereotype.Service; |
| 36 | 30 | |
| 37 | -import javax.print.attribute.standard.DateTimeAtCompleted; | |
| 38 | 31 | import java.io.File; |
| 32 | +import java.io.UnsupportedEncodingException; | |
| 39 | 33 | import java.util.*; |
| 40 | -import java.util.concurrent.Executor; | |
| 41 | -import java.util.concurrent.Executors; | |
| 42 | 34 | |
| 43 | 35 | /** |
| 44 | 36 | * Created by riecard on 16/9/26. |
| ... | ... | @@ -102,6 +94,8 @@ |
| 102 | 94 | @Qualifier("commonThreadPool") |
| 103 | 95 | private ThreadPoolTaskExecutor commonThreadPool; |
| 104 | 96 | |
| 97 | + @Autowired | |
| 98 | + private OrganizationService organizationService; | |
| 105 | 99 | |
| 106 | 100 | /** |
| 107 | 101 | * 该方法是区域或者单体医院部署的把数据定时往某个环境上传 |
| 108 | 102 | |
| ... | ... | @@ -155,9 +149,17 @@ |
| 155 | 149 | public void run() { |
| 156 | 150 | if (CollectionUtils.isNotEmpty(tempList)) |
| 157 | 151 | { |
| 152 | + boolean boo = false; | |
| 158 | 153 | StringBuffer ids = new StringBuffer(); |
| 159 | 154 | for (SyncDataModel model : tempList) { |
| 160 | - boolean boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData()); | |
| 155 | + if ("POSTMYSQL".equals(model.getAction())) | |
| 156 | + { | |
| 157 | + boo = exceSql(model.getJsonData()); | |
| 158 | + } | |
| 159 | + else | |
| 160 | + { | |
| 161 | + boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData()); | |
| 162 | + } | |
| 161 | 163 | if (boo) { |
| 162 | 164 | ids.append(model.getId()); |
| 163 | 165 | ids.append(","); |
| ... | ... | @@ -186,6 +188,22 @@ |
| 186 | 188 | { |
| 187 | 189 | String json = HttpClientUtil.doPost(url, param, "utf-8"); |
| 188 | 190 | return json; |
| 191 | + } | |
| 192 | + | |
| 193 | + | |
| 194 | + private boolean exceSql(String json) | |
| 195 | + { | |
| 196 | + try { | |
| 197 | + SyncMysqlDataModel mysqlDataModel = JsonUtil.str2Obj(json, SyncMysqlDataModel.class); | |
| 198 | + if (mysqlDataModel != null && org.apache.commons.lang.StringUtils.isNotEmpty(mysqlDataModel.getSql())) | |
| 199 | + { | |
| 200 | + String sql = new String(org.apache.commons.codec.binary.Base64.decodeBase64(mysqlDataModel.getSql()), "utf-8"); | |
| 201 | + organizationService.execSql(sql); | |
| 202 | + } | |
| 203 | + } catch (UnsupportedEncodingException e) { | |
| 204 | + ExceptionUtils.catchException(e,"exce sql error. JSONDATA="+json); | |
| 205 | + } | |
| 206 | + return true; | |
| 189 | 207 | } |
| 190 | 208 | |
| 191 | 209 |