Commit e3f1087c69fde7755b643ff7d62f0d14e152a149
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 12 changed files
- .idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml
- platform-common/src/main/java/com/lyms/platform/common/enums/BregmaticEnums.java
- platform-common/src/main/java/com/lyms/platform/common/enums/VomitEnums.java
- platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java
- platform-dal/src/main/java/com/lyms/platform/pojo/NewbornVisit.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/NewbornVisitControoler.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/INewbornVisitService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/NewbornServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
- platform-sync-data/src/main/java/com/lyms/platform/sync/data/service/SyncDataService.java
- platform-sync-data/src/main/java/com/lyms/platform/sync/data/util/DataUtil.java
- platform-sync-data/src/main/java/com/lyms/platform/sync/data/util/JDBCUtil.java
.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml
View file @
e3f1087
| 1 | -<component name="libraryTable"> | |
| 2 | - <library name="Maven: org.apache.commons:commons-lang3:3.4"> | |
| 3 | - <CLASSES> | |
| 4 | - <root url="jar://D:/mavenRepository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar!/" /> | |
| 5 | - </CLASSES> | |
| 6 | - <JAVADOC> | |
| 7 | - <root url="jar://D:/mavenRepository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4-javadoc.jar!/" /> | |
| 8 | - </JAVADOC> | |
| 9 | - <SOURCES> | |
| 10 | - <root url="jar://D:/mavenRepository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4-sources.jar!/" /> | |
| 11 | - </SOURCES> | |
| 12 | - </library> | |
| 13 | -</component> |
platform-common/src/main/java/com/lyms/platform/common/enums/BregmaticEnums.java
View file @
e3f1087
| 1 | 1 | package com.lyms.platform.common.enums; |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * 前囟 正常/膨隆/凹陷/其他 | |
| 4 | + * 前囟 闭合/未闭合 | |
| 5 | 5 | * Created by lt on 2017/7/18 0018 |
| 6 | 6 | */ |
| 7 | 7 | public enum BregmaticEnums { |
| 8 | - NORMAL(1, "正常"), | |
| 9 | - BOMBE(2, "膨隆"), | |
| 10 | - SUNKEN(3, "凹陷"), | |
| 11 | - OTHER(4, "其他"); | |
| 8 | + NORMAL(1, "闭合"), | |
| 9 | + BOMBE(2, "未闭合"); | |
| 12 | 10 | |
| 13 | 11 | private Integer id; |
| 14 | 12 | private String name; |
platform-common/src/main/java/com/lyms/platform/common/enums/VomitEnums.java
View file @
e3f1087
| 1 | +package com.lyms.platform.common.enums; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 是否呕吐 | |
| 5 | + * Created by lt on 2017/7/18 0018 | |
| 6 | + */ | |
| 7 | +public enum VomitEnums { | |
| 8 | + YES(1, "是"), | |
| 9 | + NO(2, "否"); | |
| 10 | + | |
| 11 | + private Integer id; | |
| 12 | + private String name; | |
| 13 | + | |
| 14 | + public static VomitEnums get(Integer id) { | |
| 15 | + VomitEnums[] values = VomitEnums.values(); | |
| 16 | + for (VomitEnums value : values) { | |
| 17 | + if (value.getId() == id) { | |
| 18 | + return value; | |
| 19 | + } | |
| 20 | + } | |
| 21 | + return null; | |
| 22 | + } | |
| 23 | + | |
| 24 | + VomitEnums(Integer id, String name){ | |
| 25 | + this.id = id; | |
| 26 | + this.name = name; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public Integer getId() { | |
| 30 | + return id; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setId(Integer id) { | |
| 34 | + this.id = id; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public String getName() { | |
| 38 | + return name; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setName(String name) { | |
| 42 | + this.name = name; | |
| 43 | + } | |
| 44 | +} |
platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java
View file @
e3f1087
| ... | ... | @@ -27,7 +27,9 @@ |
| 27 | 27 | COUPON_NOT_UNIQUE(1002, "优惠券有多个"), |
| 28 | 28 | COUPON_TIME_OUT(1003, "当前优惠券不在使用时间范围内"), |
| 29 | 29 | COUPON_IS_USERD(1004, "优惠券已被使用"), |
| 30 | - COUPON_IS_DISABLED(1005, "优惠券已被禁用"); | |
| 30 | + COUPON_IS_DISABLED(1005, "优惠券已被禁用"), | |
| 31 | + | |
| 32 | + NEED_BUILD(1101, "未找到建档信息"); | |
| 31 | 33 | |
| 32 | 34 | private Integer code; |
| 33 | 35 | private String msg; |
platform-dal/src/main/java/com/lyms/platform/pojo/NewbornVisit.java
View file @
e3f1087
| ... | ... | @@ -21,10 +21,14 @@ |
| 21 | 21 | // 操作人ID |
| 22 | 22 | private String operationId; |
| 23 | 23 | |
| 24 | + private String hospitalId; | |
| 25 | + | |
| 24 | 26 | private String parentId; |
| 25 | 27 | |
| 26 | 28 | private String babyId; |
| 27 | 29 | |
| 30 | + private String pid; | |
| 31 | + | |
| 28 | 32 | // 访视时间 |
| 29 | 33 | private Date checkTime; |
| 30 | 34 | |
| ... | ... | @@ -32,7 +36,7 @@ |
| 32 | 36 | private String checkTimeDesc; |
| 33 | 37 | |
| 34 | 38 | // 访视机构 |
| 35 | - private String hospitalId; | |
| 39 | + private String visitHospitalId; | |
| 36 | 40 | |
| 37 | 41 | // 喂养方式 纯母乳/混合/人工 |
| 38 | 42 | private String feedType; |
| ... | ... | @@ -50,7 +54,7 @@ |
| 50 | 54 | private String height; |
| 51 | 55 | |
| 52 | 56 | // 是否呕吐 |
| 53 | - private boolean vomit; | |
| 57 | + private String vomit; | |
| 54 | 58 | |
| 55 | 59 | // 大便 |
| 56 | 60 | private String shit; |
| ... | ... | @@ -142,22 +146,6 @@ |
| 142 | 146 | // 下次访视时间说明 |
| 143 | 147 | private String nextVisitTimeDesc; |
| 144 | 148 | |
| 145 | - public String getParentId() { | |
| 146 | - return parentId; | |
| 147 | - } | |
| 148 | - | |
| 149 | - public void setParentId(String parentId) { | |
| 150 | - this.parentId = parentId; | |
| 151 | - } | |
| 152 | - | |
| 153 | - public String getBabyId() { | |
| 154 | - return babyId; | |
| 155 | - } | |
| 156 | - | |
| 157 | - public void setBabyId(String babyId) { | |
| 158 | - this.babyId = babyId; | |
| 159 | - } | |
| 160 | - | |
| 161 | 149 | public String getId() { |
| 162 | 150 | return id; |
| 163 | 151 | } |
| ... | ... | @@ -182,6 +170,46 @@ |
| 182 | 170 | this.yn = yn; |
| 183 | 171 | } |
| 184 | 172 | |
| 173 | + public String getOperationId() { | |
| 174 | + return operationId; | |
| 175 | + } | |
| 176 | + | |
| 177 | + public void setOperationId(String operationId) { | |
| 178 | + this.operationId = operationId; | |
| 179 | + } | |
| 180 | + | |
| 181 | + public String getHospitalId() { | |
| 182 | + return hospitalId; | |
| 183 | + } | |
| 184 | + | |
| 185 | + public void setHospitalId(String hospitalId) { | |
| 186 | + this.hospitalId = hospitalId; | |
| 187 | + } | |
| 188 | + | |
| 189 | + public String getParentId() { | |
| 190 | + return parentId; | |
| 191 | + } | |
| 192 | + | |
| 193 | + public void setParentId(String parentId) { | |
| 194 | + this.parentId = parentId; | |
| 195 | + } | |
| 196 | + | |
| 197 | + public String getBabyId() { | |
| 198 | + return babyId; | |
| 199 | + } | |
| 200 | + | |
| 201 | + public void setBabyId(String babyId) { | |
| 202 | + this.babyId = babyId; | |
| 203 | + } | |
| 204 | + | |
| 205 | + public String getPid() { | |
| 206 | + return pid; | |
| 207 | + } | |
| 208 | + | |
| 209 | + public void setPid(String pid) { | |
| 210 | + this.pid = pid; | |
| 211 | + } | |
| 212 | + | |
| 185 | 213 | public Date getCheckTime() { |
| 186 | 214 | return checkTime; |
| 187 | 215 | } |
| 188 | 216 | |
| ... | ... | @@ -198,12 +226,12 @@ |
| 198 | 226 | this.checkTimeDesc = checkTimeDesc; |
| 199 | 227 | } |
| 200 | 228 | |
| 201 | - public String getHospitalId() { | |
| 202 | - return hospitalId; | |
| 229 | + public String getVisitHospitalId() { | |
| 230 | + return visitHospitalId; | |
| 203 | 231 | } |
| 204 | 232 | |
| 205 | - public void setHospitalId(String hospitalId) { | |
| 206 | - this.hospitalId = hospitalId; | |
| 233 | + public void setVisitHospitalId(String visitHospitalId) { | |
| 234 | + this.visitHospitalId = visitHospitalId; | |
| 207 | 235 | } |
| 208 | 236 | |
| 209 | 237 | public String getFeedType() { |
| 210 | 238 | |
| ... | ... | @@ -246,11 +274,11 @@ |
| 246 | 274 | this.height = height; |
| 247 | 275 | } |
| 248 | 276 | |
| 249 | - public boolean isVomit() { | |
| 277 | + public String getVomit() { | |
| 250 | 278 | return vomit; |
| 251 | 279 | } |
| 252 | 280 | |
| 253 | - public void setVomit(boolean vomit) { | |
| 281 | + public void setVomit(String vomit) { | |
| 254 | 282 | this.vomit = vomit; |
| 255 | 283 | } |
| 256 | 284 | |
| ... | ... | @@ -300,14 +328,6 @@ |
| 300 | 328 | |
| 301 | 329 | public void setRespiratoryRate(String respiratoryRate) { |
| 302 | 330 | this.respiratoryRate = respiratoryRate; |
| 303 | - } | |
| 304 | - | |
| 305 | - public String getOperationId() { | |
| 306 | - return operationId; | |
| 307 | - } | |
| 308 | - | |
| 309 | - public void setOperationId(String operationId) { | |
| 310 | - this.operationId = operationId; | |
| 311 | 331 | } |
| 312 | 332 | |
| 313 | 333 | public String getSkin() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/NewbornVisitControoler.java
View file @
e3f1087
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.annotation.TokenRequired; | |
| 3 | 4 | import com.lyms.platform.common.base.BaseController; |
| 4 | 5 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 5 | 6 | import com.lyms.platform.operate.web.service.INewbornVisitService; |
| 6 | 7 | |
| ... | ... | @@ -11,13 +12,15 @@ |
| 11 | 12 | import org.springframework.web.bind.annotation.ResponseBody; |
| 12 | 13 | |
| 13 | 14 | import javax.servlet.http.HttpServletRequest; |
| 15 | +import javax.servlet.http.HttpServletResponse; | |
| 16 | +import java.util.Date; | |
| 14 | 17 | |
| 15 | 18 | /** |
| 16 | 19 | * 新生儿访视 |
| 17 | 20 | * Created by lt on 2017/7/18 0018 |
| 18 | 21 | */ |
| 19 | -@Controller("/newborn") | |
| 20 | -@RequestMapping | |
| 22 | +@Controller | |
| 23 | +@RequestMapping("/newborn") | |
| 21 | 24 | public class NewbornVisitControoler extends BaseController { |
| 22 | 25 | |
| 23 | 26 | @Autowired |
| 24 | 27 | |
| ... | ... | @@ -25,8 +28,49 @@ |
| 25 | 28 | |
| 26 | 29 | @RequestMapping(method = RequestMethod.POST) |
| 27 | 30 | @ResponseBody |
| 31 | + @TokenRequired | |
| 28 | 32 | public BaseObjectResponse add(HttpServletRequest request, NewbornVisit newbornVisit) { |
| 29 | - return visitService.add(getUserId(request), newbornVisit); | |
| 33 | + return visitService.addOrUpdate(getUserId(request), newbornVisit); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 新生儿访视管理 | |
| 38 | + * @param startDate 访视开始日期 | |
| 39 | + * @param endDate 访视结束日期 | |
| 40 | + * @param doctor 访视医生 | |
| 41 | + * @param key 儿童姓名(模糊查询)/母亲联系方式/母亲证件号 | |
| 42 | + * @return | |
| 43 | + */ | |
| 44 | + @RequestMapping(method = RequestMethod.GET) | |
| 45 | + @ResponseBody | |
| 46 | + @TokenRequired | |
| 47 | + public BaseObjectResponse list(HttpServletRequest request, Date startDate, Date endDate, String doctor, String key, Integer page, Integer limit) { | |
| 48 | + return visitService.list(startDate, endDate, doctor, getUserId(request), key, page, limit); | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * 新生儿访视查询 | |
| 53 | + * @param pid | |
| 54 | + * @return | |
| 55 | + */ | |
| 56 | + @RequestMapping(value = "/query", method = RequestMethod.GET) | |
| 57 | + @ResponseBody | |
| 58 | + @TokenRequired | |
| 59 | + public BaseObjectResponse query(HttpServletRequest request, String pid) { | |
| 60 | + return visitService.query(getUserId(request), pid); | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * 新生儿访视导出 | |
| 65 | + * @param startDate 访视开始日期 | |
| 66 | + * @param endDate 访视结束日期 | |
| 67 | + * @param doctor 访视医生 | |
| 68 | + * @param key 儿童姓名(模糊查询)/母亲联系方式/母亲证件号 | |
| 69 | + * @return | |
| 70 | + */ | |
| 71 | + @RequestMapping(value = "/export", method = RequestMethod.GET) | |
| 72 | + public void export(HttpServletRequest request, HttpServletResponse response, Date startDate, Date endDate, String doctor, String key, Integer page, Integer limit) { | |
| 73 | + visitService.export(startDate, endDate, doctor, getUserId(request), response, key); | |
| 30 | 74 | } |
| 31 | 75 | |
| 32 | 76 | @RequestMapping(value = "/init", method = RequestMethod.GET) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/INewbornVisitService.java
View file @
e3f1087
| ... | ... | @@ -5,12 +5,17 @@ |
| 5 | 5 | |
| 6 | 6 | import javax.servlet.http.HttpServletResponse; |
| 7 | 7 | import java.util.Date; |
| 8 | -import java.util.Map; | |
| 9 | 8 | |
| 10 | 9 | public interface INewbornVisitService extends IBaseService { |
| 11 | 10 | |
| 12 | 11 | BaseObjectResponse init(); |
| 13 | 12 | |
| 14 | - BaseObjectResponse add(Integer userId, NewbornVisit newbornVisit); | |
| 13 | + BaseObjectResponse addOrUpdate(Integer userId, NewbornVisit newbornVisit); | |
| 14 | + | |
| 15 | + BaseObjectResponse list(Date startDate, Date endDate, String doctor, Integer userId, String key, Integer page, Integer limit); | |
| 16 | + | |
| 17 | + void export(Date startDate, Date endDate, String doctor, Integer userId, HttpServletResponse response, String key); | |
| 18 | + | |
| 19 | + BaseObjectResponse query(Integer userId, String pid); | |
| 15 | 20 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/NewbornServiceImpl.java
View file @
e3f1087
| 1 | 1 | package com.lyms.platform.operate.web.service.impl; |
| 2 | 2 | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | -import com.lyms.hospitalapi.pojo.ReportModel; | |
| 5 | -import com.lyms.platform.biz.service.CommonService; | |
| 3 | +import com.lyms.platform.biz.service.DataPermissionService; | |
| 6 | 4 | import com.lyms.platform.common.enums.*; |
| 7 | 5 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 8 | 6 | import com.lyms.platform.common.result.PageResult; |
| 9 | 7 | import com.lyms.platform.common.result.RespBuilder; |
| 8 | +import com.lyms.platform.common.result.ResponseCode; | |
| 10 | 9 | import com.lyms.platform.common.utils.DateUtil; |
| 11 | 10 | import com.lyms.platform.common.utils.EnumUtil; |
| 12 | -import com.lyms.platform.operate.web.dao.IReportDao; | |
| 13 | -import com.lyms.platform.operate.web.facade.AccessPermissionFacade; | |
| 11 | +import com.lyms.platform.common.utils.MongoConvertHelper; | |
| 12 | +import com.lyms.platform.common.utils.ReflectionUtils; | |
| 14 | 13 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 15 | 14 | import com.lyms.platform.operate.web.service.INewbornVisitService; |
| 16 | -import com.lyms.platform.operate.web.service.IReportService; | |
| 17 | -import com.lyms.platform.operate.web.utils.*; | |
| 18 | -import com.lyms.platform.permission.dao.master.CouponMapper; | |
| 19 | -import com.lyms.platform.permission.model.Organization; | |
| 15 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 16 | +import com.lyms.platform.operate.web.utils.MongoUtil; | |
| 17 | +import com.lyms.platform.operate.web.utils.ResponseUtil; | |
| 18 | +import com.lyms.platform.permission.dao.slave.UsersMapper; | |
| 20 | 19 | import com.lyms.platform.permission.model.Users; |
| 21 | -import com.lyms.platform.permission.service.OrganizationService; | |
| 22 | -import com.lyms.platform.permission.service.UsersService; | |
| 23 | 20 | import com.lyms.platform.pojo.*; |
| 24 | -import com.lymsh.platform.reportdata.model.echarts.Series; | |
| 25 | -import org.apache.commons.collections.MapUtils; | |
| 21 | +import com.lyms.platform.query.DataPermissionsModelQuery; | |
| 26 | 22 | import org.apache.commons.lang.StringUtils; |
| 27 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 28 | 24 | import org.springframework.data.domain.Sort; |
| 29 | 25 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 30 | 26 | import org.springframework.data.mongodb.core.query.Criteria; |
| 31 | 27 | import org.springframework.data.mongodb.core.query.Query; |
| 28 | +import org.springframework.data.mongodb.core.query.Update; | |
| 32 | 29 | import org.springframework.stereotype.Service; |
| 33 | 30 | import org.springframework.util.Assert; |
| 34 | -import scala.Int; | |
| 35 | 31 | |
| 36 | 32 | import javax.servlet.http.HttpServletResponse; |
| 37 | -import java.sql.PreparedStatement; | |
| 38 | -import java.sql.ResultSet; | |
| 39 | -import java.sql.SQLException; | |
| 40 | 33 | import java.util.*; |
| 41 | 34 | |
| 42 | 35 | /** |
| ... | ... | @@ -50,6 +43,18 @@ |
| 50 | 43 | @Autowired |
| 51 | 44 | private MongoTemplate mongoTemplate; |
| 52 | 45 | |
| 46 | + @Autowired | |
| 47 | + private DataPermissionService dataPermissionService; | |
| 48 | + | |
| 49 | + @Autowired | |
| 50 | + private AutoMatchFacade autoMatchFacade; | |
| 51 | + | |
| 52 | + @Autowired | |
| 53 | + private MongoUtil mongoUtil; | |
| 54 | + | |
| 55 | +// @Autowired | |
| 56 | + private UsersMapper usersMapper; | |
| 57 | + | |
| 53 | 58 | @Override |
| 54 | 59 | public BaseObjectResponse init() { |
| 55 | 60 | List<Map<String, Object>> feedType = EnumUtil.toJson(FeedTypeEnums.class); |
| 56 | 61 | |
| 57 | 62 | |
| 58 | 63 | |
| 59 | 64 | |
| ... | ... | @@ -58,21 +63,175 @@ |
| 58 | 63 | List<Map<String, Object>> bregmatic = EnumUtil.toJson(BregmaticEnums.class); |
| 59 | 64 | List<Map<String, Object>> umbilicalCord = EnumUtil.toJson(UmbilicalCordEnums.class); |
| 60 | 65 | List<Map<String, Object>> nextVisitTime = EnumUtil.toJson(NextVisitTimeEnums.class); |
| 66 | + List<Map<String, Object>> vomit = EnumUtil.toJson(VomitEnums.class); | |
| 61 | 67 | return RespBuilder.buildSuccess("feedType", feedType, "skin", skin, "complexion", complexion |
| 62 | - , "bregmatic", bregmatic, "umbilicalCord", umbilicalCord, "nextVisitTime", nextVisitTime); | |
| 68 | + , "bregmatic", bregmatic, "umbilicalCord", umbilicalCord, "nextVisitTime", nextVisitTime, "vomit", vomit); | |
| 63 | 69 | } |
| 64 | 70 | |
| 65 | 71 | @Override |
| 66 | - public BaseObjectResponse add(Integer userId, NewbornVisit newbornVisit) { | |
| 67 | - newbornVisit.setOperationId(userId.toString()); | |
| 68 | - newbornVisit.setCreated(new Date()); | |
| 69 | - newbornVisit.setYn("1"); | |
| 72 | + public BaseObjectResponse addOrUpdate(Integer userId, NewbornVisit newbornVisit) { | |
| 70 | 73 | newbornVisit.setFeedType(newbornVisit.getFeedType() == null ? null : FeedTypeEnums.get(Integer.parseInt(newbornVisit.getFeedType())).getName()); |
| 71 | 74 | newbornVisit.setSkin(newbornVisit.getSkin() == null ? null : SkinEnums.get(Integer.parseInt(newbornVisit.getSkin())).getName()); |
| 72 | - newbornVisit.setFeedType(newbornVisit.getFeedType() == null ? null : FeedTypeEnums.get(Integer.parseInt(newbornVisit.getFeedType())).getName()); | |
| 73 | - newbornVisit.setFeedType(newbornVisit.getFeedType() == null ? null : FeedTypeEnums.get(Integer.parseInt(newbornVisit.getFeedType())).getName()); | |
| 74 | - mongoTemplate.save(newbornVisit); | |
| 75 | + newbornVisit.setComplexion(newbornVisit.getComplexion() == null ? null : BregmaticEnums.get(Integer.parseInt(newbornVisit.getComplexion())).getName()); | |
| 76 | + newbornVisit.setUmbilicalCord(newbornVisit.getUmbilicalCord() == null ? null : UmbilicalCordEnums.get(Integer.parseInt(newbornVisit.getUmbilicalCord())).getName()); | |
| 77 | + newbornVisit.setHospitalId(autoMatchFacade.getHospitalId(userId)); | |
| 78 | + // newbornVisit.setNextVisitTime(newbornVisit.getUmbilicalCord() == null ? null : UmbilicalCordEnums.get(Integer.parseInt(newbornVisit.getUmbilicalCord())).getName()); | |
| 79 | + if(StringUtils.isEmpty(newbornVisit.getId())) { | |
| 80 | + String babyId = null; | |
| 81 | + if(!buildArchive(userId, newbornVisit.getPid(), babyId)) { | |
| 82 | + return RespBuilder.buildSuccess(ResponseCode.NEED_BUILD); | |
| 83 | + } | |
| 84 | + newbornVisit.setBabyId(babyId); | |
| 85 | + newbornVisit.setId(UUID.randomUUID().toString().replace("-", "")); | |
| 86 | + newbornVisit.setOperationId(userId.toString()); | |
| 87 | + newbornVisit.setCreated(new Date()); | |
| 88 | + newbornVisit.setYn("1"); | |
| 89 | + mongoTemplate.save(newbornVisit); | |
| 90 | + } else { | |
| 91 | + newbornVisit.setId(UUID.randomUUID().toString().replace("-", "")); | |
| 92 | + newbornVisit.setOperationId(userId.toString()); | |
| 93 | + newbornVisit.setCreated(new Date()); | |
| 94 | + newbornVisit.setYn("1"); | |
| 95 | + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(newbornVisit)); | |
| 96 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(newbornVisit.getId())), update, NewbornVisit.class); | |
| 97 | + | |
| 98 | + } | |
| 75 | 99 | return RespBuilder.buildSuccess(); |
| 76 | 100 | } |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 隐藏建档 | |
| 104 | + * @param userId | |
| 105 | + * @return | |
| 106 | + */ | |
| 107 | + private boolean buildArchive(Integer userId, String pid, String babyId) { | |
| 108 | + Assert.notNull(pid, "pid 不能为null"); | |
| 109 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 110 | + // 如果本院已有记录 直接走正常流程 | |
| 111 | + BabyModel baby = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("hospitalId").is(hospitalId)).with(new Sort(Sort.Direction.DESC, "created")), BabyModel.class); | |
| 112 | + if(baby != null) { | |
| 113 | + babyId = baby.getId(); | |
| 114 | + return true; | |
| 115 | + } | |
| 116 | + | |
| 117 | + DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); | |
| 118 | + dataPermissionsModelQuery.setUserId(userId); | |
| 119 | + List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); | |
| 120 | + if (CollectionUtils.isNotEmpty(permissionsModels)) { | |
| 121 | + Set<String> set = permissionsModels.get(0).getData().keySet(); | |
| 122 | + Iterator<String> it = set.iterator(); | |
| 123 | + BabyModel babyModel = mongoTemplate.findOne(Query.query(Criteria.where("hospitalId").in(set) | |
| 124 | + .and("pid").is(pid)).with(new Sort(Sort.Direction.DESC, "created")), BabyModel.class); | |
| 125 | + if(babyModel == null) { | |
| 126 | + return false; // 需要建档 | |
| 127 | + } | |
| 128 | + babyId = UUID.randomUUID().toString().replace("-", ""); | |
| 129 | + babyModel.setId(babyId); | |
| 130 | + babyModel.setHospitalId(hospitalId); | |
| 131 | + babyModel.setEnable("2"); | |
| 132 | + babyModel.setCreated(new Date()); | |
| 133 | + mongoTemplate.save(babyModel); | |
| 134 | + return true; | |
| 135 | + } | |
| 136 | + return false; | |
| 137 | + } | |
| 138 | + | |
| 139 | + @Override | |
| 140 | + public BaseObjectResponse list(Date startDate, Date endDate, String doctor, Integer userId, String key, Integer page, Integer limit) { | |
| 141 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 142 | + Criteria criteria = Criteria.where("yn").ne("0").and("hospitalId").is(hospitalId); | |
| 143 | + if(startDate != null && endDate != null) { | |
| 144 | + criteria.and("checkTime").gte(startDate).lt(DateUtil.addDay(endDate, 1)); | |
| 145 | + } | |
| 146 | + if(StringUtils.isNotBlank(doctor)) { | |
| 147 | + criteria.and("doctor").is(doctor); | |
| 148 | + } | |
| 149 | + PageResult pageResult = findMongoPage(NewbornVisit.class, new Query(criteria), page, limit); | |
| 150 | + List<NewbornVisit> newbornVisits = (List<NewbornVisit>) pageResult.getGrid(); | |
| 151 | + List<Map<String, Object>> restMap = new ArrayList<>(); | |
| 152 | + for (NewbornVisit visit : newbornVisits) { | |
| 153 | + Map<String, Object> temp = new HashMap<>(); | |
| 154 | + | |
| 155 | + temp.put("checkTime", visit.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(visit.getCheckTime())); // 复查访视时间 | |
| 156 | + String pid = visit.getPid(); | |
| 157 | + if(StringUtils.isNotBlank(pid)) { | |
| 158 | + PersonModel person = mongoTemplate.findById(pid, PersonModel.class); | |
| 159 | + if(person != null) { | |
| 160 | + temp.put("cardNo", person.getCardNo()); | |
| 161 | + temp.put("name", person.getName()); | |
| 162 | + temp.put("age", DateUtil.getAge(person.getBirth())); | |
| 163 | + temp.put("phone", person.getPhone()); | |
| 164 | + } | |
| 165 | + Patients patients = mongoTemplate.findById(visit.getParentId(), Patients.class); | |
| 166 | + if(patients != null) { | |
| 167 | + int days = DateUtil.daysBetween(patients.getFmDate(), new Date()); | |
| 168 | + temp.put("days", "产后"+days+"天"); | |
| 169 | + } | |
| 170 | + temp.put("count", mongoTemplate.count(new Query(criteria), NewbornVisit.class)); | |
| 171 | + temp.put("benyuan", mongoTemplate.count(new Query(criteria.and("visitHositalId").is(hospitalId)), NewbornVisit.class)); | |
| 172 | + Users users = usersMapper.getUsers(Integer.parseInt(visit.getDoctor())); | |
| 173 | + temp.put("doctorName", users == null ? null : users.getName()); | |
| 174 | + } | |
| 175 | + | |
| 176 | + } | |
| 177 | + return RespBuilder.buildSuccess(newbornVisits); | |
| 178 | + } | |
| 179 | + | |
| 180 | + @Override | |
| 181 | + public void export(Date startDate, Date endDate, String doctor, Integer userId, HttpServletResponse response, String key) { | |
| 182 | + BaseObjectResponse rest = list(startDate, endDate, doctor, userId, key, 1, Integer.MAX_VALUE); | |
| 183 | + PageResult pageResult = (PageResult) rest.getData(); | |
| 184 | + List<Map<String, Object>> datas = (List<Map<String, Object>>) pageResult.getGrid(); | |
| 185 | + Map<String, String> cnames = new LinkedHashMap<>(); | |
| 186 | +// Map<String, String> cnames = new LinkedHashMap<>(); | |
| 187 | + cnames.put("id", "#"); | |
| 188 | + cnames.put("checkTime", "复查访视日期"); | |
| 189 | + cnames.put("cardNo", "证件号"); | |
| 190 | + cnames.put("name", "姓名"); | |
| 191 | + cnames.put("age", "年龄"); | |
| 192 | + cnames.put("day", "产后天数"); | |
| 193 | + cnames.put("count", "访视次数"); | |
| 194 | + cnames.put("benyuan", "本院访视次数"); | |
| 195 | + cnames.put("doctorName", "访视医生"); | |
| 196 | + cnames.put("phone", "联系电话"); | |
| 197 | + | |
| 198 | + List<Map<String,Object>> results = new ArrayList<>(); | |
| 199 | + if(org.apache.commons.collections.CollectionUtils.isNotEmpty(datas)) { | |
| 200 | + int i = 0; | |
| 201 | + for (Map<String, Object> data : datas) { | |
| 202 | + Map<String, Object> result = new LinkedHashMap<>(); | |
| 203 | + result.put("id", ++i); | |
| 204 | + result.put("checkTime", data.get("checkTime")); | |
| 205 | + result.put("cardNo", data.get("cardNo")); | |
| 206 | + result.put("name", data.get("name")); | |
| 207 | + result.put("age", data.get("age")); | |
| 208 | + result.put("day", data.get("day")); | |
| 209 | + result.put("count", data.get("count")); | |
| 210 | + result.put("benyuan", data.get("benyuan")); | |
| 211 | + result.put("doctorName", data.get("doctorName")); | |
| 212 | + result.put("phone", data.get("phone")); | |
| 213 | + results.add(result); | |
| 214 | + } | |
| 215 | + } | |
| 216 | + | |
| 217 | + ResponseUtil.responseExcel(cnames, results, response); | |
| 218 | + } | |
| 219 | + | |
| 220 | + @Override | |
| 221 | + public BaseObjectResponse query(Integer userId, String pid) { | |
| 222 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 223 | + List<NewbornVisit> newbornVisits = mongoTemplate.find(Query.query(Criteria.where("pid").is(pid).and("hospitalId").is(hospitalId)) | |
| 224 | + .with(new Sort(Sort.Direction.ASC, "checkTime")), NewbornVisit.class); | |
| 225 | + List<Map<String, Object>> rest = new ArrayList<>(); | |
| 226 | + for (NewbornVisit newbornVisit : newbornVisits) { | |
| 227 | + Map<String, Object> temp = new HashMap<>(); | |
| 228 | + temp.put("pid", newbornVisit.getPid()); | |
| 229 | + temp.put("checkTime", newbornVisit.getCheckTime() == null ? null : DateUtil.getyyyy_MM_dd(newbornVisit.getCheckTime())); | |
| 230 | + temp.put("checkTimeDesc", newbornVisit.getCheckTimeDesc()); | |
| 231 | + rest.add(temp); | |
| 232 | + } | |
| 233 | + return RespBuilder.buildSuccess(rest); | |
| 234 | + } | |
| 235 | + | |
| 77 | 236 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MongoUtil.java
View file @
e3f1087
platform-sync-data/src/main/java/com/lyms/platform/sync/data/service/SyncDataService.java
View file @
e3f1087
| ... | ... | @@ -174,7 +174,7 @@ |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | public void syncBabyData(String oracleHid, Integer mysqlHid) { |
| 177 | - DataUtil.initData(mysqlHid); | |
| 177 | + DataUtil.initData(mysqlHid,oracleHid); | |
| 178 | 178 | initBabyGuides(); |
| 179 | 179 | new workerBaby(oracleHid).start(); |
| 180 | 180 | } |
| ... | ... | @@ -215,7 +215,7 @@ |
| 215 | 215 | public void syncPatientData(String oracleHid,Integer mysqlHid) { |
| 216 | 216 | |
| 217 | 217 | //初始化数据 |
| 218 | - DataUtil.initData(mysqlHid); | |
| 218 | + DataUtil.initData(mysqlHid,oracleHid); | |
| 219 | 219 | |
| 220 | 220 | String sql = "select replace(mp.P_NO,'-','') as PID,mp.*,p_birthday,p_name,floor((trunc(sysdate) - trunc(mp.P_LASTMENSTRUALPERIOD)+1) /7) as weeks,vc.VC_CARDNO from MOMMY_PATIENT mp left join Plat_Patient pp " + |
| 221 | 221 | " on mp.p_platpatientid=pp.p_id left join (select max(VC_OPERTIME) as OPERTIME,VC_CARDNO,VC_PATIENTNO from MOMMY_VISITCARD group by VC_CARDNO,VC_PATIENTNO) vc on vc.VC_PATIENTNO = mp.P_NO " + |
| ... | ... | @@ -638,8 +638,7 @@ |
| 638 | 638 | patients.setAddressPostRest(DataUtil.getString(map.get("P_HUSBANDRRSTREET"))); // 详细地址 |
| 639 | 639 | patients.setFileCode(DataUtil.getString(map.get("P_FILENUMBER"))); //建档编号 |
| 640 | 640 | patients.setVcCardNo(DataUtil.getString(map.get("VC_CARDNO"))); //就诊卡号 |
| 641 | - //是否隐藏 0 隐藏 1 显示 | |
| 642 | - patients.setEnable("1"); | |
| 641 | + | |
| 643 | 642 | |
| 644 | 643 | mongoTemplate.save(patients); |
| 645 | 644 | System.out.println(patients.getId() + "============"); |
platform-sync-data/src/main/java/com/lyms/platform/sync/data/util/DataUtil.java
View file @
e3f1087
| ... | ... | @@ -18,9 +18,9 @@ |
| 18 | 18 | private static Integer orgId = 0; |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public static void initData(Integer mysqlHid) { | |
| 21 | + public static void initData(Integer mysqlHid,String oracleHid) { | |
| 22 | 22 | orgId = mysqlHid; |
| 23 | - List<Map<String, Object>> listEmp = JDBCUtil.getOracleListDataBySql("select e.e_name,e.e_id from mommy_employee e"); | |
| 23 | + List<Map<String, Object>> listEmp = JDBCUtil.getOracleListDataBySql("select e.e_name,e.e_id from mommy_employee e where e.e_hospitalid = '" + oracleHid+"'"); | |
| 24 | 24 | for (Map<String, Object> map : listEmp) { |
| 25 | 25 | employees.put(getString(map.get("E_ID")), getString(map.get("E_NAME"))); |
| 26 | 26 | } |
platform-sync-data/src/main/java/com/lyms/platform/sync/data/util/JDBCUtil.java
View file @
e3f1087
| ... | ... | @@ -43,7 +43,7 @@ |
| 43 | 43 | Connection con = null; |
| 44 | 44 | try { |
| 45 | 45 | Class.forName("com.mysql.jdbc.Driver"); |
| 46 | - String url = "jdbc:mysql://192.168.1.26:3306/sync_platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
| 46 | + String url = "jdbc:mysql://192.168.1.39:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8"; | |
| 47 | 47 | String userName = "platform"; |
| 48 | 48 | String pwd = "platform123"; |
| 49 | 49 | con = DriverManager.getConnection(url, userName, pwd); |