Commit aedc4e3c0eff4c1087857151610761349f176925
1 parent
5065893b29
Exists in
master
and in
6 other branches
添加对serInfos集合非空的判断
Showing 1 changed file with 106 additions and 104 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
View file @
aedc4e3
| ... | ... | @@ -291,130 +291,132 @@ |
| 291 | 291 | */ |
| 292 | 292 | public BaseResponse addPatientService(PatientService ps, Integer userId, String hospitalId) throws Exception { |
| 293 | 293 | List<Map<String, String>> serInfos = ps.getSerInfos(); |
| 294 | - for (Map<String, String> serInfo : serInfos) { | |
| 295 | - //先根据孕妇id和开通服务类型、开通医生进行查询,如果已经开通过则开通失败 | |
| 296 | - PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 297 | - patientQuery.setParentid(ps.getParentid()); | |
| 298 | - patientQuery.setSerType(Integer.parseInt(serInfo.get("serType"))); | |
| 294 | + if (CollectionUtils.isNotEmpty(serInfos)) { | |
| 295 | + for (Map<String, String> serInfo : serInfos) { | |
| 296 | + //先根据孕妇id和开通服务类型、开通医生进行查询,如果已经开通过则开通失败 | |
| 297 | + PatientServiceQuery patientQuery = new PatientServiceQuery(); | |
| 298 | + patientQuery.setParentid(ps.getParentid()); | |
| 299 | + patientQuery.setSerType(Integer.parseInt(serInfo.get("serType"))); | |
| 299 | 300 | |
| 300 | 301 | |
| 301 | - List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
| 302 | - if (CollectionUtils.isNotEmpty(patientServices)) { | |
| 303 | - continue; | |
| 304 | - } | |
| 302 | + List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery); | |
| 303 | + if (CollectionUtils.isNotEmpty(patientServices)) { | |
| 304 | + continue; | |
| 305 | + } | |
| 305 | 306 | |
| 306 | 307 | |
| 307 | - PatientService pser = new PatientService(); | |
| 308 | - pser.setCreateUser(ps.getCreateUser()); | |
| 309 | - pser.setCreateDate(ps.getCreateDate()); | |
| 310 | - pser.setParentid(ps.getParentid()); | |
| 311 | - //设置服务对象类型 服务人类型(1-孕妇、2-儿童) | |
| 312 | - pser.setPerType(ps.getPerType()); | |
| 313 | - if (ps.getPerType() != null && ps.getPerType() == 2) {//儿童 | |
| 314 | - BabyModel babyModel = babyService.getOneBabyById(ps.getParentid()); | |
| 315 | - if (babyModel != null) { | |
| 316 | - pser.setPid(babyModel.getPid()); | |
| 317 | - //如果有数据源id,取主档案id | |
| 318 | - if (StringUtils.isNotEmpty(babyModel.getSource())) { | |
| 319 | - pser.setParentid(babyModel.getSource()); | |
| 308 | + PatientService pser = new PatientService(); | |
| 309 | + pser.setCreateUser(ps.getCreateUser()); | |
| 310 | + pser.setCreateDate(ps.getCreateDate()); | |
| 311 | + pser.setParentid(ps.getParentid()); | |
| 312 | + //设置服务对象类型 服务人类型(1-孕妇、2-儿童) | |
| 313 | + pser.setPerType(ps.getPerType()); | |
| 314 | + if (ps.getPerType() != null && ps.getPerType() == 2) {//儿童 | |
| 315 | + BabyModel babyModel = babyService.getOneBabyById(ps.getParentid()); | |
| 316 | + if (babyModel != null) { | |
| 317 | + pser.setPid(babyModel.getPid()); | |
| 318 | + //如果有数据源id,取主档案id | |
| 319 | + if (StringUtils.isNotEmpty(babyModel.getSource())) { | |
| 320 | + pser.setParentid(babyModel.getSource()); | |
| 321 | + } | |
| 320 | 322 | } |
| 321 | - } | |
| 322 | - } else { | |
| 323 | - Patients patients = patientsService.findOnePatientById(ps.getParentid()); | |
| 324 | - if (patients != null) { | |
| 325 | - pser.setPid(patients.getPid()); | |
| 326 | - //如果有数据源id,取主档案id | |
| 327 | - if (StringUtils.isNotEmpty(patients.getSource())) { | |
| 328 | - pser.setParentid(patients.getSource()); | |
| 323 | + } else { | |
| 324 | + Patients patients = patientsService.findOnePatientById(ps.getParentid()); | |
| 325 | + if (patients != null) { | |
| 326 | + pser.setPid(patients.getPid()); | |
| 327 | + //如果有数据源id,取主档案id | |
| 328 | + if (StringUtils.isNotEmpty(patients.getSource())) { | |
| 329 | + pser.setParentid(patients.getSource()); | |
| 330 | + } | |
| 329 | 331 | } |
| 330 | 332 | } |
| 331 | - } | |
| 332 | 333 | |
| 333 | 334 | |
| 334 | - pser.setId(UUID.randomUUID().toString().replace("-", "")); | |
| 335 | - //开通医院 | |
| 336 | - pser.setHospitalId(hospitalId); | |
| 337 | - //默认开通状态 | |
| 338 | - pser.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId()); | |
| 339 | - //服务类型 | |
| 340 | - pser.setSerType(Integer.parseInt(serInfo.get("serType"))); | |
| 341 | - if (serInfo.containsKey("serDoct")) { | |
| 342 | - pser.setSerDoct(serInfo.get("serDoct")); | |
| 343 | - } | |
| 344 | - //默认已经领取 | |
| 345 | - pser.setStatus(2); | |
| 346 | - //默认待同步 | |
| 347 | - pser.setSynStatus(1); | |
| 348 | - //领取时间 | |
| 349 | - pser.setReceiveDate(new Date()); | |
| 350 | - //领取操作医生id | |
| 351 | - pser.setReceiveUser(String.valueOf(userId)); | |
| 352 | - //服务开通操作时间 | |
| 353 | - pser.setUpdateDate(new Date()); | |
| 354 | - //服务开通操作人 | |
| 355 | - pser.setUpdateUser(String.valueOf(userId)); | |
| 335 | + pser.setId(UUID.randomUUID().toString().replace("-", "")); | |
| 336 | + //开通医院 | |
| 337 | + pser.setHospitalId(hospitalId); | |
| 338 | + //默认开通状态 | |
| 339 | + pser.setSerStatus(PatientSerEnums.SerStatusEnums.kt.getId()); | |
| 340 | + //服务类型 | |
| 341 | + pser.setSerType(Integer.parseInt(serInfo.get("serType"))); | |
| 342 | + if (serInfo.containsKey("serDoct")) { | |
| 343 | + pser.setSerDoct(serInfo.get("serDoct")); | |
| 344 | + } | |
| 345 | + //默认已经领取 | |
| 346 | + pser.setStatus(2); | |
| 347 | + //默认待同步 | |
| 348 | + pser.setSynStatus(1); | |
| 349 | + //领取时间 | |
| 350 | + pser.setReceiveDate(new Date()); | |
| 351 | + //领取操作医生id | |
| 352 | + pser.setReceiveUser(String.valueOf(userId)); | |
| 353 | + //服务开通操作时间 | |
| 354 | + pser.setUpdateDate(new Date()); | |
| 355 | + //服务开通操作人 | |
| 356 | + pser.setUpdateUser(String.valueOf(userId)); | |
| 356 | 357 | |
| 357 | - if (serInfo.containsKey("device") && StringUtils.isNotEmpty(serInfo.get("device")) ) { | |
| 358 | - pser.setDevice(Integer.parseInt(serInfo.get("device"))); | |
| 359 | - } | |
| 360 | - if (serInfo.containsKey("deviceCon") && StringUtils.isNotEmpty(serInfo.get("deviceCon")) ) { | |
| 361 | - pser.setDeviceCon(Integer.parseInt(serInfo.get("deviceCon"))); | |
| 362 | - } | |
| 363 | - if (serInfo.containsKey("doctorWeek")) { | |
| 364 | - pser.setDoctorWeek(Integer.parseInt(serInfo.get("doctorWeek"))); | |
| 365 | - } | |
| 366 | - if (serInfo.containsKey("serviceWeek")) { | |
| 367 | - pser.setServiceWeek(Integer.parseInt(serInfo.get("serviceWeek"))); | |
| 368 | - } | |
| 369 | - Patients patients = patientsService.findOnePatientById(ps.getParentid()); | |
| 370 | - setServiceRecordAdd(pser, patients); | |
| 358 | + if (serInfo.containsKey("device") && StringUtils.isNotEmpty(serInfo.get("device")) ) { | |
| 359 | + pser.setDevice(Integer.parseInt(serInfo.get("device"))); | |
| 360 | + } | |
| 361 | + if (serInfo.containsKey("deviceCon") && StringUtils.isNotEmpty(serInfo.get("deviceCon")) ) { | |
| 362 | + pser.setDeviceCon(Integer.parseInt(serInfo.get("deviceCon"))); | |
| 363 | + } | |
| 364 | + if (serInfo.containsKey("doctorWeek")) { | |
| 365 | + pser.setDoctorWeek(Integer.parseInt(serInfo.get("doctorWeek"))); | |
| 366 | + } | |
| 367 | + if (serInfo.containsKey("serviceWeek")) { | |
| 368 | + pser.setServiceWeek(Integer.parseInt(serInfo.get("serviceWeek"))); | |
| 369 | + } | |
| 370 | + Patients patients = patientsService.findOnePatientById(ps.getParentid()); | |
| 371 | + setServiceRecordAdd(pser, patients); | |
| 371 | 372 | |
| 372 | - patientServiceService.addPatientService(pser); | |
| 373 | + patientServiceService.addPatientService(pser); | |
| 373 | 374 | |
| 374 | 375 | |
| 375 | - operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), pser, OptActionEnums.ADD.getId(), "开通增值服务"); | |
| 376 | + operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), pser, OptActionEnums.ADD.getId(), "开通增值服务"); | |
| 376 | 377 | |
| 377 | - if (ps.getPerType() != null && ps.getPerType() == 2) {//儿童建档服务数据处理 | |
| 378 | - if (PatientSerEnums.SerTypeEnums.babyjzzz.getId().intValue() == Integer.parseInt(serInfo.get("serType"))) { | |
| 379 | - BabyBookbuildingAddRequest babyBookbuildingAddRequest = new BabyBookbuildingAddRequest(); | |
| 380 | - babyBookbuildingAddRequest.setId(ps.getParentid()); | |
| 381 | - babyBookbuildingAddRequest.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 382 | - babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 383 | - babyBookbuildingFacade.updateBabySerInfo(babyBookbuildingAddRequest); | |
| 384 | - } else if (PatientSerEnums.SerTypeEnums.babyBzfw.getId().intValue() == Integer.parseInt(serInfo.get("serType"))) { | |
| 385 | - PatientServiceQuery query = new PatientServiceQuery(); | |
| 386 | - query.setParentid(ps.getParentid()); | |
| 387 | - query.setSerType(PatientSerEnums.SerTypeEnums.babyjzzz.getId()); | |
| 388 | - int count = patientServiceService.queryPatientServiceCount(query); | |
| 389 | - //是否有增值服务--没有则处理标准服务 | |
| 390 | - if (count == 0) { | |
| 378 | + if (ps.getPerType() != null && ps.getPerType() == 2) {//儿童建档服务数据处理 | |
| 379 | + if (PatientSerEnums.SerTypeEnums.babyjzzz.getId().intValue() == Integer.parseInt(serInfo.get("serType"))) { | |
| 391 | 380 | BabyBookbuildingAddRequest babyBookbuildingAddRequest = new BabyBookbuildingAddRequest(); |
| 392 | 381 | babyBookbuildingAddRequest.setId(ps.getParentid()); |
| 393 | - babyBookbuildingAddRequest.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
| 394 | - babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
| 382 | + babyBookbuildingAddRequest.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 383 | + babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 395 | 384 | babyBookbuildingFacade.updateBabySerInfo(babyBookbuildingAddRequest); |
| 385 | + } else if (PatientSerEnums.SerTypeEnums.babyBzfw.getId().intValue() == Integer.parseInt(serInfo.get("serType"))) { | |
| 386 | + PatientServiceQuery query = new PatientServiceQuery(); | |
| 387 | + query.setParentid(ps.getParentid()); | |
| 388 | + query.setSerType(PatientSerEnums.SerTypeEnums.babyjzzz.getId()); | |
| 389 | + int count = patientServiceService.queryPatientServiceCount(query); | |
| 390 | + //是否有增值服务--没有则处理标准服务 | |
| 391 | + if (count == 0) { | |
| 392 | + BabyBookbuildingAddRequest babyBookbuildingAddRequest = new BabyBookbuildingAddRequest(); | |
| 393 | + babyBookbuildingAddRequest.setId(ps.getParentid()); | |
| 394 | + babyBookbuildingAddRequest.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
| 395 | + babyBookbuildingAddRequest.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
| 396 | + babyBookbuildingFacade.updateBabySerInfo(babyBookbuildingAddRequest); | |
| 397 | + } | |
| 396 | 398 | } |
| 397 | - } | |
| 398 | - } else {//孕妇建档服务数据处理 | |
| 399 | - if (PatientSerEnums.SerTypeEnums.yqjzzd.getId() == Integer.parseInt(serInfo.get("serType"))) {//孕期精准指导同步到建档 | |
| 399 | + } else {//孕妇建档服务数据处理 | |
| 400 | + if (PatientSerEnums.SerTypeEnums.yqjzzd.getId() == Integer.parseInt(serInfo.get("serType"))) {//孕期精准指导同步到建档 | |
| 400 | 401 | |
| 401 | - Patients patient = new Patients(); | |
| 402 | - patient.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 403 | - patient.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 404 | - bookbuildingFacade.updatePatientSerById(ps.getParentid(), patient); | |
| 405 | - | |
| 406 | - | |
| 407 | - } else if (PatientSerEnums.SerTypeEnums.bzfw.getId().intValue() == Integer.parseInt(serInfo.get("serType"))) { | |
| 408 | - PatientServiceQuery query = new PatientServiceQuery(); | |
| 409 | - query.setParentid(ps.getParentid()); | |
| 410 | - query.setSerType(PatientSerEnums.SerTypeEnums.yqjzzd.getId()); | |
| 411 | - int count = patientServiceService.queryPatientServiceCount(query); | |
| 412 | - //是否有增值服务--没有则处理标准服务 | |
| 413 | - if (count == 0) { | |
| 414 | 402 | Patients patient = new Patients(); |
| 415 | - patient.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
| 416 | - patient.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
| 403 | + patient.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 404 | + patient.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 417 | 405 | bookbuildingFacade.updatePatientSerById(ps.getParentid(), patient); |
| 406 | + | |
| 407 | + | |
| 408 | + } else if (PatientSerEnums.SerTypeEnums.bzfw.getId().intValue() == Integer.parseInt(serInfo.get("serType"))) { | |
| 409 | + PatientServiceQuery query = new PatientServiceQuery(); | |
| 410 | + query.setParentid(ps.getParentid()); | |
| 411 | + query.setSerType(PatientSerEnums.SerTypeEnums.yqjzzd.getId()); | |
| 412 | + int count = patientServiceService.queryPatientServiceCount(query); | |
| 413 | + //是否有增值服务--没有则处理标准服务 | |
| 414 | + if (count == 0) { | |
| 415 | + Patients patient = new Patients(); | |
| 416 | + patient.setServiceType(ServiceTypeEnums.STANDARD_SERVICE.getId()); | |
| 417 | + patient.setServiceStatus(ServiceStatusEnums.STANDARD_OPEN.getId()); | |
| 418 | + bookbuildingFacade.updatePatientSerById(ps.getParentid(), patient); | |
| 419 | + } | |
| 418 | 420 | } |
| 419 | 421 | } |
| 420 | 422 | } |