Commit 97b2b9fdb98c712ede40888ca29d291631607744
1 parent
8218925fcf
Exists in
master
and in
6 other branches
儿童服务开通
Showing 7 changed files with 332 additions and 20 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/PatientSerEnums.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/MatdeliverFollowResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyBuildSerToPatientSerWorker.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BuildSerToPatientSerWorker.java
platform-common/src/main/java/com/lyms/platform/common/enums/PatientSerEnums.java
View file @
97b2b9f
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
97b2b9f
| ... | ... | @@ -19,6 +19,7 @@ |
| 19 | 19 | import com.lyms.platform.operate.web.result.HighScoreResult; |
| 20 | 20 | import com.lyms.platform.operate.web.service.IBloodPressureService; |
| 21 | 21 | import com.lyms.platform.operate.web.service.SyncDataTaskService; |
| 22 | +import com.lyms.platform.operate.web.worker.BabyBuildSerToPatientSerWorker; | |
| 22 | 23 | import com.lyms.platform.operate.web.worker.BuildSerToPatientSerWorker; |
| 23 | 24 | import com.lyms.platform.permission.model.Organization; |
| 24 | 25 | import com.lyms.platform.permission.model.OrganizationQuery; |
| ... | ... | @@ -80,9 +81,6 @@ |
| 80 | 81 | private MatDeliverService matDeliverService; |
| 81 | 82 | |
| 82 | 83 | @Autowired |
| 83 | - private BabyBookbuildingService babyBookbuildingService; | |
| 84 | - | |
| 85 | - @Autowired | |
| 86 | 84 | private BabyCheckService babyCheckService; |
| 87 | 85 | |
| 88 | 86 | @Autowired |
| ... | ... | @@ -116,6 +114,9 @@ |
| 116 | 114 | @Autowired |
| 117 | 115 | private IBloodPressureService bloodPressureService; |
| 118 | 116 | |
| 117 | + @Autowired | |
| 118 | + private BabyBookbuildingService babyBookbuildingService; | |
| 119 | + | |
| 119 | 120 | @ResponseBody |
| 120 | 121 | @RequestMapping("/init/blood/pressure") |
| 121 | 122 | public BaseResponse initBloodPressure(@RequestParam Map<String, String> param) { |
| 122 | 123 | |
| 123 | 124 | |
| 124 | 125 | |
| ... | ... | @@ -138,19 +139,63 @@ |
| 138 | 139 | return datas; |
| 139 | 140 | } |
| 140 | 141 | |
| 141 | - | |
| 142 | 142 | /** |
| 143 | - * | |
| 144 | 143 | * @param isSkip 是否增量添加 true:增量添加 |
| 145 | 144 | * @param isZjzx 是否对增值服务,开通专家咨询服务 true:开通增值服务 |
| 146 | 145 | * @return |
| 147 | 146 | */ |
| 147 | + @RequestMapping(value = "/synBabyBuildToPatientService", method = RequestMethod.GET) | |
| 148 | + @ResponseBody | |
| 149 | + public BaseResponse synBabyBuildToPatientService( | |
| 150 | + @RequestParam(value = "isSkip") boolean isSkip, | |
| 151 | + @RequestParam(value = "isZjzx") boolean isZjzx | |
| 152 | + ) { | |
| 153 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 154 | + List list = new ArrayList(); | |
| 155 | + list.add("1");//转诊,建档已接受 | |
| 156 | + list.add("2");//隐藏建档 | |
| 157 | + babyQuery.setEnableListNot(list); | |
| 158 | + List buildType = new ArrayList(); | |
| 159 | + buildType.add(1);//儿童直接建档 | |
| 160 | + buildType.add(2);//产妇分娩建档 | |
| 161 | + babyQuery.setBuildTypeList(buildType); | |
| 162 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 163 | + | |
| 164 | + int patientCount = babyBookbuildingService.queryBabyCount(babyQuery); | |
| 165 | + System.out.println("一共需要处理数据量:" + patientCount); | |
| 166 | + | |
| 167 | + //计算每个线程需要处理的数据量,默认1000,必须是分页条数的倍数,不然多线程处理的数据会重复 | |
| 168 | + int batchSize = 1000; | |
| 169 | + if (patientCount > 10000) { | |
| 170 | + batchSize = 10000; | |
| 171 | + } | |
| 172 | + | |
| 173 | + int end = 0; | |
| 174 | + for (int i = 0; i < patientCount; i += batchSize) { | |
| 175 | + end = (end + batchSize); | |
| 176 | + if (end > patientCount) { | |
| 177 | + end = patientCount; | |
| 178 | + } | |
| 179 | + System.out.println("线程处理数据量:" + i + "--至--" + end); | |
| 180 | + commonThreadPool.submit(new BabyBuildSerToPatientSerWorker(i, end, babyBookbuildingService, patientServiceService, isSkip, isZjzx, batchSize, patientCount)); | |
| 181 | + } | |
| 182 | + BaseResponse baseResponse = new BaseResponse(); | |
| 183 | + baseResponse.setErrormsg("一共需要处理数据量:" + patientCount); | |
| 184 | + return baseResponse; | |
| 185 | + } | |
| 186 | + | |
| 187 | + | |
| 188 | + /** 同步孕妇建档服务数据 | |
| 189 | + * @param isSkip 是否增量添加 true:增量添加 | |
| 190 | + * @param isZjzx 是否对增值服务,开通专家咨询服务 true:开通增值服务 | |
| 191 | + * @return | |
| 192 | + */ | |
| 148 | 193 | @RequestMapping(value = "/synBuildToPatientService", method = RequestMethod.GET) |
| 149 | 194 | @ResponseBody |
| 150 | 195 | public BaseResponse synBuildToPatientService( |
| 151 | 196 | @RequestParam(value = "isSkip") boolean isSkip, |
| 152 | 197 | @RequestParam(value = "isZjzx") boolean isZjzx |
| 153 | - ) { | |
| 198 | + ) { | |
| 154 | 199 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 155 | 200 | //排查本院隐藏建档 |
| 156 | 201 | patientsQuery.setExtEnable(false); |
| 157 | 202 | |
| ... | ... | @@ -159,11 +204,11 @@ |
| 159 | 204 | patientsQuery.setType(1); |
| 160 | 205 | |
| 161 | 206 | int patientCount = patientsService.queryPatientCount(patientsQuery); |
| 162 | - System.out.println("一共需要处理数据量:"+patientCount); | |
| 207 | + System.out.println("一共需要处理数据量:" + patientCount); | |
| 163 | 208 | |
| 164 | 209 | //计算每个线程需要处理的数据量,默认1000,必须是分页条数的倍数,不然多线程处理的数据会重复 |
| 165 | 210 | int batchSize = 1000; |
| 166 | - if(patientCount>10000){ | |
| 211 | + if (patientCount > 10000) { | |
| 167 | 212 | batchSize = 10000; |
| 168 | 213 | } |
| 169 | 214 | |
| 170 | 215 | |
| ... | ... | @@ -173,11 +218,11 @@ |
| 173 | 218 | if (end > patientCount) { |
| 174 | 219 | end = patientCount; |
| 175 | 220 | } |
| 176 | - System.out.println("线程处理数据量:"+i+"--至--"+end); | |
| 177 | - commonThreadPool.submit(new BuildSerToPatientSerWorker(i, end,patientsService,patientServiceService,isSkip,isZjzx,batchSize,patientCount)); | |
| 221 | + System.out.println("线程处理数据量:" + i + "--至--" + end); | |
| 222 | + commonThreadPool.submit(new BuildSerToPatientSerWorker(i, end, patientsService, patientServiceService, isSkip, isZjzx, batchSize, patientCount)); | |
| 178 | 223 | } |
| 179 | 224 | BaseResponse baseResponse = new BaseResponse(); |
| 180 | - baseResponse.setErrormsg("一共需要处理数据量:"+patientCount); | |
| 225 | + baseResponse.setErrormsg("一共需要处理数据量:" + patientCount); | |
| 181 | 226 | return baseResponse; |
| 182 | 227 | } |
| 183 | 228 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
97b2b9f
| ... | ... | @@ -313,6 +313,27 @@ |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | + * 修改儿童服务开通信息 | |
| 317 | + * @param request | |
| 318 | + * @return | |
| 319 | + */ | |
| 320 | + public boolean updateBabySerInfo(BabyBookbuildingAddRequest request){ | |
| 321 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 322 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 323 | + babyQuery.setId(request.getId()); | |
| 324 | + | |
| 325 | + List<BabyModel> list = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 326 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 327 | + BabyModel babyModel = list.get(0); | |
| 328 | + babyModel.setServiceType(request.getServiceType()); | |
| 329 | + babyModel.setServiceStatus(request.getServiceStatus()); | |
| 330 | + babyBookbuildingService.updateBabyBuild(babyModel, request.getId()); | |
| 331 | + } | |
| 332 | + | |
| 333 | + return true; | |
| 334 | + } | |
| 335 | + | |
| 336 | + /** | |
| 316 | 337 | * 修改儿童建档 |
| 317 | 338 | * |
| 318 | 339 | * @param request |
| ... | ... | @@ -1932,8 +1953,8 @@ |
| 1932 | 1953 | babyQuery.setQueryNo(request.getQueryNo()); |
| 1933 | 1954 | if(String.valueOf("true").equals(request.getIsArea())){ |
| 1934 | 1955 | List list = new ArrayList(); |
| 1935 | - list.add("1"); | |
| 1936 | - list.add("2"); | |
| 1956 | + list.add("1");//转诊,建档已接受 | |
| 1957 | + list.add("2");//隐藏建档 | |
| 1937 | 1958 | babyQuery.setEnableListNot(list); |
| 1938 | 1959 | OrganizationQuery organizationQuery = new OrganizationQuery(); |
| 1939 | 1960 | if(!StringUtils.isEmpty(request.getHospitalId())){ |
| ... | ... | @@ -2040,8 +2061,8 @@ |
| 2040 | 2061 | |
| 2041 | 2062 | |
| 2042 | 2063 | List buildType = new ArrayList(); |
| 2043 | - buildType.add(1); | |
| 2044 | - buildType.add(2); | |
| 2064 | + buildType.add(1);//儿童直接建档 | |
| 2065 | + buildType.add(2);//产妇分娩建档 | |
| 2045 | 2066 | babyQuery.setBuildTypeList(buildType); |
| 2046 | 2067 | |
| 2047 | 2068 | babyQuery.setYn(YnEnums.YES.getId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
View file @
97b2b9f
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | import com.lyms.platform.common.result.BaseResponse; |
| 14 | 14 | import com.lyms.platform.common.utils.DateUtil; |
| 15 | 15 | import com.lyms.platform.common.utils.StringUtils; |
| 16 | +import com.lyms.platform.operate.web.request.BabyBookbuildingAddRequest; | |
| 16 | 17 | import com.lyms.platform.operate.web.request.BasePageQueryRequest; |
| 17 | 18 | import com.lyms.platform.operate.web.request.YunBookbuildingAddRequest; |
| 18 | 19 | import com.lyms.platform.operate.web.result.PatientSerResult; |
| ... | ... | @@ -60,6 +61,8 @@ |
| 60 | 61 | private OperateLogFacade operateLogFacade; |
| 61 | 62 | @Autowired |
| 62 | 63 | private BookbuildingFacade bookbuildingFacade; |
| 64 | + @Autowired | |
| 65 | + private BabyBookbuildingFacade babyBookbuildingFacade; | |
| 63 | 66 | |
| 64 | 67 | public BaseResponse babyServiceInit(Integer userId) { |
| 65 | 68 | Map map = new HashMap(); |
| ... | ... | @@ -243,7 +246,13 @@ |
| 243 | 246 | operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), pser, OptActionEnums.ADD.getId(), "开通增值服务"); |
| 244 | 247 | |
| 245 | 248 | if (ps.getPerType() != null && ps.getPerType() == 2) {//儿童建档服务数据处理 |
| 246 | - | |
| 249 | + if(PatientSerEnums.SerTypeEnums.yqjzzd.getId() == ps.getSerType()){ | |
| 250 | + BabyBookbuildingAddRequest babyBookbuildingAddRequest = new BabyBookbuildingAddRequest(); | |
| 251 | + babyBookbuildingAddRequest.setId(ps.getParentid()); | |
| 252 | + babyBookbuildingAddRequest.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 253 | + babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 254 | + babyBookbuildingFacade.updateBabySerInfo(babyBookbuildingAddRequest); | |
| 255 | + } | |
| 247 | 256 | } else {//孕妇建档服务数据处理 |
| 248 | 257 | if (PatientSerEnums.SerTypeEnums.yqjzzd.getId() == Integer.parseInt(serInfo.get("serType"))) {//孕期精准指导同步到建档 |
| 249 | 258 | YunBookbuildingAddRequest yunBookbuildingAddRequest = new YunBookbuildingAddRequest(); |
| ... | ... | @@ -288,7 +297,20 @@ |
| 288 | 297 | patientServiceService.updatePatientService(ps); |
| 289 | 298 | |
| 290 | 299 | if (before.getPerType() != null && before.getPerType() == 2) {//儿童建档服务数据处理 |
| 291 | - | |
| 300 | + if(PatientSerEnums.SerTypeEnums.yqjzzd.getId() == ps.getSerType()){ | |
| 301 | + BabyBookbuildingAddRequest babyBookbuildingAddRequest = new BabyBookbuildingAddRequest(); | |
| 302 | + babyBookbuildingAddRequest.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 303 | + if (ps.getSerStatus() == PatientSerEnums.SerStatusEnums.kt.getId()) { | |
| 304 | + babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 305 | + } else if (ps.getSerStatus() == PatientSerEnums.SerStatusEnums.td.getId()) { | |
| 306 | + babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.UNSUBSCRIBE.getId()); | |
| 307 | + } else if (ps.getSerStatus() == PatientSerEnums.SerStatusEnums.gq.getId()) { | |
| 308 | + babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.ADD_OVERDUE.getId()); | |
| 309 | + } else if (ps.getSerStatus() == PatientSerEnums.SerStatusEnums.zt.getId()) { | |
| 310 | + babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.SUSPEND.getId()); | |
| 311 | + } | |
| 312 | + babyBookbuildingFacade.updateBabySerInfo(babyBookbuildingAddRequest); | |
| 313 | + } | |
| 292 | 314 | } else {//孕妇建档服务数据处理 |
| 293 | 315 | if (PatientSerEnums.SerTypeEnums.yqjzzd.getId() == ps.getSerType()) {//孕期精准指导同步到建档 |
| 294 | 316 | YunBookbuildingAddRequest yunBookbuildingAddRequest = new YunBookbuildingAddRequest(); |
| ... | ... | @@ -306,7 +328,7 @@ |
| 306 | 328 | } |
| 307 | 329 | } |
| 308 | 330 | PatientService after = patientServiceService.getPatientService(ps.getId()); |
| 309 | - operateLogFacade.addModifyOptLog(userId, Integer.valueOf(hospitalId), before, after, OptActionEnums.UPDATE.getId(), "修复服务"); | |
| 331 | + operateLogFacade.addModifyOptLog(userId, Integer.valueOf(hospitalId), before, after, OptActionEnums.UPDATE.getId(), "修改服务"); | |
| 310 | 332 | BaseResponse baseResponse = new BaseResponse(); |
| 311 | 333 | baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 312 | 334 | baseResponse.setErrormsg("成功"); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/MatdeliverFollowResult.java
View file @
97b2b9f
| ... | ... | @@ -261,6 +261,11 @@ |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | + if (getContactResultStr() != null && getVisitResult() == 2) {//预约联系失败,不显示预约信息 | |
| 265 | + setMakeTypeStr(""); | |
| 266 | + setMakeVisitDateStr(""); | |
| 267 | + } | |
| 268 | + | |
| 264 | 269 | if (getVisitResult() != null && getVisitResult() == 2) {//访视失败,不显示随访信息 |
| 265 | 270 | setDeliveryDateStr(""); |
| 266 | 271 | setLeaveDateStr(""); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BabyBuildSerToPatientSerWorker.java
View file @
97b2b9f
| 1 | +package com.lyms.platform.operate.web.worker; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BabyBookbuildingService; | |
| 4 | +import com.lyms.platform.common.enums.PatientSerEnums; | |
| 5 | +import com.lyms.platform.common.enums.ServiceStatusEnums; | |
| 6 | +import com.lyms.platform.common.enums.ServiceTypeEnums; | |
| 7 | +import com.lyms.platform.common.enums.YnEnums; | |
| 8 | +import com.lyms.platform.common.utils.StringUtils; | |
| 9 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 10 | +import com.lyms.platform.permission.model.PatientService; | |
| 11 | +import com.lyms.platform.permission.model.PatientServiceQuery; | |
| 12 | +import com.lyms.platform.permission.service.PatientServiceService; | |
| 13 | +import com.lyms.platform.pojo.BabyModel; | |
| 14 | +import com.lyms.platform.query.BabyModelQuery; | |
| 15 | + | |
| 16 | +import java.util.*; | |
| 17 | +import java.util.concurrent.Callable; | |
| 18 | + | |
| 19 | +/** | |
| 20 | + * @auther yangfei | |
| 21 | + * @createTime 2017年11月22日 11时28分 | |
| 22 | + * @discription | |
| 23 | + */ | |
| 24 | +public class BabyBuildSerToPatientSerWorker implements Callable { | |
| 25 | + private int startIndex; | |
| 26 | + private int endIndex; | |
| 27 | + private int batchSize; | |
| 28 | + private int allCount; | |
| 29 | + private boolean isSkip; | |
| 30 | + private boolean isZjzx; | |
| 31 | + private BabyBookbuildingService babyBookbuildingService; | |
| 32 | + private PatientServiceService patientServiceService; | |
| 33 | + | |
| 34 | + public BabyBuildSerToPatientSerWorker(int startIndex, int endIndex, BabyBookbuildingService babyBookbuildingService, PatientServiceService patientServiceService, boolean isSkip, boolean isZjzx, int batchSize, int allCount) { | |
| 35 | + this.allCount = allCount; | |
| 36 | + this.startIndex = startIndex; | |
| 37 | + this.endIndex = endIndex; | |
| 38 | + this.babyBookbuildingService = babyBookbuildingService; | |
| 39 | + this.patientServiceService = patientServiceService; | |
| 40 | + this.isSkip = isSkip; | |
| 41 | + this.isZjzx = isZjzx; | |
| 42 | + if (batchSize >= 1000) { | |
| 43 | + this.batchSize = 1000; | |
| 44 | + } else { | |
| 45 | + this.batchSize = batchSize; | |
| 46 | + } | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * Computes a result, or throws an exception if unable to do so. | |
| 51 | + * | |
| 52 | + * @return computed result | |
| 53 | + */ | |
| 54 | + @Override | |
| 55 | + public Object call() { | |
| 56 | + try { | |
| 57 | + Map<String,Integer> patientsMap = new HashMap<>(); | |
| 58 | + | |
| 59 | + for (int i = startIndex; i < endIndex; i += batchSize) { | |
| 60 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
| 61 | + List list = new ArrayList(); | |
| 62 | + list.add("1");//转诊,建档已接受 | |
| 63 | + list.add("2");//隐藏建档 | |
| 64 | + babyQuery.setEnableListNot(list); | |
| 65 | + List buildType = new ArrayList(); | |
| 66 | + buildType.add(1);//儿童直接建档 | |
| 67 | + buildType.add(2);//产妇分娩建档 | |
| 68 | + babyQuery.setBuildTypeList(buildType); | |
| 69 | + babyQuery.setYn(YnEnums.YES.getId()); | |
| 70 | + | |
| 71 | + babyQuery.setLimit(batchSize); | |
| 72 | + babyQuery.setPage((i + batchSize) / batchSize); | |
| 73 | + | |
| 74 | + System.out.println("总数据量:"+allCount+",正在处理第:" + i+"--到--"+(i+batchSize)+",page:"+babyQuery.getPage()+",limit:"+babyQuery.getLimit()); | |
| 75 | + | |
| 76 | + List<BabyModel> patients = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
| 77 | + for (BabyModel pt : patients) { | |
| 78 | + if(StringUtils.isEmpty(pt.getId())){ | |
| 79 | + System.out.println("建档主键id为空:"+pt.getId()); | |
| 80 | + }else if(patientsMap.containsKey(pt.getId())){//存在 | |
| 81 | + System.out.println("重复的主键:"+pt.getId()); | |
| 82 | + }else{ | |
| 83 | + patientsMap.put(pt.getId(),1); | |
| 84 | + } | |
| 85 | + if (pt.getServiceType() == null) { | |
| 86 | + System.out.println("服务类型不存在跳过数据:"+pt.getId()); | |
| 87 | + continue; | |
| 88 | + } | |
| 89 | + | |
| 90 | + PatientService pser = new PatientService(); | |
| 91 | + // 服务人类型(1-孕妇、2-儿童) | |
| 92 | + pser.setPerType(2); | |
| 93 | + | |
| 94 | + //服务类型 | |
| 95 | + if (pt.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId()) {//标准服务 | |
| 96 | + pser.setSerType(PatientSerEnums.SerTypeEnums.bzfw.getId()); | |
| 97 | + //标准服务状态转换成服务状态 | |
| 98 | + convertBZFWtoPserStatus(pt,pser); | |
| 99 | + | |
| 100 | + } else if (pt.getServiceType() == ServiceTypeEnums.ADD_SERVICE.getId()) {//增值服务 | |
| 101 | + //孕期精准指导 | |
| 102 | + pser.setSerType(PatientSerEnums.SerTypeEnums.yqjzzd.getId()); | |
| 103 | + //增值服务有服务医生 | |
| 104 | + pser.setSerDoct(pt.getBuildDoctor()); | |
| 105 | + | |
| 106 | + //增值服务状态转换为服务状态 | |
| 107 | + convertZZFWtoPserStatus(pt, pser); | |
| 108 | + if (isZjzx) {//增值服务是否:开通专家咨询服务 | |
| 109 | + //开通专家咨询服务 | |
| 110 | + PatientService pser2 = new PatientService(); | |
| 111 | + // 服务人类型(1-孕妇、2-儿童) | |
| 112 | + pser2.setPerType(2); | |
| 113 | + //数据转换 | |
| 114 | + convertPatient(pt, pser2); | |
| 115 | + //增值服务状态转换为服务状态 | |
| 116 | + convertZZFWtoPserStatus(pt, pser2); | |
| 117 | + | |
| 118 | + //专家咨询服务 | |
| 119 | + pser2.setSerType(PatientSerEnums.SerTypeEnums.zjzx.getId()); | |
| 120 | + if (isSkip) {//是否是增量 | |
| 121 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 122 | + patientQuery.setParentid(pt.getId()); | |
| 123 | + patientQuery.setSerType(pser2.getSerType()); | |
| 124 | + | |
| 125 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
| 126 | + if (CollectionUtils.isEmpty(patientServices)) { | |
| 127 | + //增值服务数据转换 | |
| 128 | + convertPatient(pt, pser2); | |
| 129 | + //增值服务有服务医生 | |
| 130 | + pser2.setSerDoct(pt.getBuildDoctor()); | |
| 131 | + patientServiceService.addPatientService(pser2); | |
| 132 | + } | |
| 133 | + } else { | |
| 134 | + convertPatient(pt, pser2); | |
| 135 | + //增值服务有服务医生 | |
| 136 | + pser2.setSerDoct(pt.getBuildDoctor()); | |
| 137 | + patientServiceService.addPatientService(pser2); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + } | |
| 141 | + | |
| 142 | + convertPatient(pt,pser); | |
| 143 | + if (isSkip) {//是否是增量 | |
| 144 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 145 | + patientQuery.setParentid(pt.getId()); | |
| 146 | + patientQuery.setSerType(pser.getSerType()); | |
| 147 | + | |
| 148 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
| 149 | + if (CollectionUtils.isNotEmpty(patientServices)) { | |
| 150 | + continue; | |
| 151 | + } | |
| 152 | + } | |
| 153 | + //老数据服务标记 | |
| 154 | + patientServiceService.addPatientService(pser); | |
| 155 | + } | |
| 156 | + // System.out.println("endIndex:" + endIndex + "," + i + ":" + patients.size()); | |
| 157 | + } | |
| 158 | + | |
| 159 | + System.out.println("线程处理数据完成,开始条数:"+startIndex+",结束条数:"+endIndex+",map:"+ patientsMap.size()); | |
| 160 | + } catch (Exception e) { | |
| 161 | + e.printStackTrace(); | |
| 162 | + } | |
| 163 | + return null; | |
| 164 | + } | |
| 165 | + | |
| 166 | + public void convertPatient(BabyModel pt, PatientService pser2) { | |
| 167 | + pser2.setIsOld(1); | |
| 168 | + pser2.setCreateUser(pt.getBuildDoctor()); | |
| 169 | + pser2.setCreateDate(pt.getBuildDate()); | |
| 170 | + pser2.setParentid(pt.getId()); | |
| 171 | + pser2.setPid(pt.getPid()); | |
| 172 | + pser2.setId(UUID.randomUUID().toString().replace("-", "")); | |
| 173 | + pser2.setHospitalId(pt.getHospitalId()); | |
| 174 | + //默认已经领取 | |
| 175 | + pser2.setStatus(2); | |
| 176 | + //默认待同步 | |
| 177 | + pser2.setSynStatus(1); | |
| 178 | + //领取时间 | |
| 179 | + // pser.setReceiveDate(new Date()); | |
| 180 | + //服务开通操作时间 | |
| 181 | + pser2.setUpdateDate(pt.getBuildDate()); | |
| 182 | + //服务开通操作人 | |
| 183 | + pser2.setUpdateUser(pt.getBuildDoctor()); | |
| 184 | + } | |
| 185 | + | |
| 186 | + public void convertZZFWtoPserStatus(BabyModel pt, PatientService pser) { | |
| 187 | + if(pt.getServiceStatus() == null){ | |
| 188 | + System.out.println("增值服务没有服务状态:"+pt.getId()); | |
| 189 | + } | |
| 190 | + | |
| 191 | + if (pt.getServiceStatus() == ServiceStatusEnums.ADD_OPEN.getId()) { | |
| 192 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId()); | |
| 193 | + } else if (pt.getServiceStatus() == ServiceStatusEnums.UNSUBSCRIBE.getId()) { | |
| 194 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.td.getId()); | |
| 195 | + } else if (pt.getServiceStatus() == ServiceStatusEnums.ADD_OVERDUE.getId()) { | |
| 196 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.gq.getId()); | |
| 197 | + } else if (pt.getServiceStatus() == ServiceStatusEnums.SUSPEND.getId()) { | |
| 198 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.zt.getId()); | |
| 199 | + } | |
| 200 | + } | |
| 201 | + | |
| 202 | + public void convertBZFWtoPserStatus(BabyModel pt, PatientService pser) { | |
| 203 | + if(pt.getServiceStatus() == null){ | |
| 204 | + System.out.println("增值服务没有服务状态:"+pt.getId()); | |
| 205 | + } | |
| 206 | + //默认开通状态 | |
| 207 | + if (pt.getServiceStatus() == ServiceStatusEnums.STANDARD_OPEN.getId()) { | |
| 208 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId()); | |
| 209 | + } else if (pt.getServiceStatus() == ServiceStatusEnums.NO_OPEN.getId()) { | |
| 210 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.td.getId()); | |
| 211 | + } else if (pt.getServiceStatus() == ServiceStatusEnums.STANDARD_OVERDUE.getId()) { | |
| 212 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.gq.getId()); | |
| 213 | + } | |
| 214 | + | |
| 215 | + } | |
| 216 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/BuildSerToPatientSerWorker.java
View file @
97b2b9f
| ... | ... | @@ -88,7 +88,8 @@ |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | PatientService pser = new PatientService(); |
| 91 | - | |
| 91 | + // 服务人类型(1-孕妇、2-儿童) | |
| 92 | + pser.setPerType(1); | |
| 92 | 93 | //服务类型 |
| 93 | 94 | if (pt.getServiceType() == ServiceTypeEnums.STANDARD_SERVICE.getId()) {//标准服务 |
| 94 | 95 | pser.setSerType(PatientSerEnums.SerTypeEnums.bzfw.getId()); |
| ... | ... | @@ -106,6 +107,8 @@ |
| 106 | 107 | if (isZjzx) {//增值服务是否:开通专家咨询服务 |
| 107 | 108 | //开通专家咨询服务 |
| 108 | 109 | PatientService pser2 = new PatientService(); |
| 110 | + // 服务人类型(1-孕妇、2-儿童) | |
| 111 | + pser2.setPerType(2); | |
| 109 | 112 | //数据转换 |
| 110 | 113 | convertPatient(pt, pser2); |
| 111 | 114 | //增值服务状态转换为服务状态 |