Commit 843b6709676daa3937af0ab88c9e3c55c1a714c4
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 10 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.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/AutoMatchFacade.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/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ResidentsArchiveResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPatientDao.java
View file @
843b670
| ... | ... | @@ -34,6 +34,8 @@ |
| 34 | 34 | |
| 35 | 35 | void updatePatientOneCol(String id, Object colValue); |
| 36 | 36 | |
| 37 | + void updatePatientLastCheckEmployeeIdOne(String id, String lastCheckEmployeeId); | |
| 38 | + | |
| 37 | 39 | List<PredictedStatisticsCountModel> predictedStatistics(); |
| 38 | 40 | |
| 39 | 41 | List<HashMap> aggregateOne(MongoQuery mongoQuery); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PatientDaoImpl.java
View file @
843b670
| ... | ... | @@ -43,6 +43,11 @@ |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | @Override |
| 46 | + public void updatePatientLastCheckEmployeeIdOne(String id, String lastCheckEmployeeId){ | |
| 47 | + this.mongoTemplate.updateFirst(new Query(Criteria.where("id").is(id)), Update.update("lastCheckEmployeeId", lastCheckEmployeeId), Patients.class); | |
| 48 | + } | |
| 49 | + | |
| 50 | + @Override | |
| 46 | 51 | public List<PredictedStatisticsCountModel> predictedStatistics() { |
| 47 | 52 | // List<PredictedStatisticsCountModel> predictedStatisticsCountModelList = new ArrayList<>(); |
| 48 | 53 | // DBCollection dbCollection = this.mongoTemplate.getCollection("lyms_patient"); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PatientsService.java
View file @
843b670
| ... | ... | @@ -117,6 +117,10 @@ |
| 117 | 117 | iPatientDao.updatePatientOneCol(id,colValue); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | + public void updatePatientLastCheckEmployeeIdOne(String id, String lastCheckEmployeeId) { | |
| 121 | + iPatientDao.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
| 122 | + } | |
| 123 | + | |
| 120 | 124 | /** |
| 121 | 125 | * 满足孕15+3至20+6之间和有产筛申请单的数据 |
| 122 | 126 | */ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
843b670
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.hospitalapi.qhdfy.QhdfyHisService; |
| 4 | -import com.lyms.platform.biz.JdbcUtil; | |
| 5 | 4 | import com.lyms.platform.biz.service.AntenatalExaminationService; |
| 6 | 5 | import com.lyms.platform.biz.service.AssayConfigService; |
| 7 | 6 | import com.lyms.platform.biz.service.PatientsService; |
| ... | ... | @@ -9,7 +8,6 @@ |
| 9 | 8 | import com.lyms.platform.common.enums.YnEnums; |
| 10 | 9 | import com.lyms.platform.common.utils.DateUtil; |
| 11 | 10 | import com.lyms.platform.common.utils.JsonUtil; |
| 12 | -import com.lyms.platform.common.utils.StringUtils; | |
| 13 | 11 | import com.lyms.platform.operate.web.service.SyncDataTaskService; |
| 14 | 12 | import com.lyms.platform.permission.service.OrganizationService; |
| 15 | 13 | import com.lyms.platform.pojo.AntExChuModel; |
| ... | ... | @@ -21,6 +19,7 @@ |
| 21 | 19 | import com.lyms.platform.query.PatientsQuery; |
| 22 | 20 | import org.apache.commons.collections.CollectionUtils; |
| 23 | 21 | import org.apache.commons.io.FileUtils; |
| 22 | +import org.apache.commons.lang.StringUtils; | |
| 24 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 25 | 24 | import org.springframework.data.domain.Sort; |
| 26 | 25 | import org.springframework.data.mongodb.core.MongoTemplate; |
| ... | ... | @@ -31,8 +30,6 @@ |
| 31 | 30 | import org.springframework.web.bind.annotation.ResponseBody; |
| 32 | 31 | |
| 33 | 32 | import java.io.File; |
| 34 | -import java.io.IOException; | |
| 35 | -import java.text.CollationElementIterator; | |
| 36 | 33 | import java.util.*; |
| 37 | 34 | |
| 38 | 35 | /** |
| 39 | 36 | |
| ... | ... | @@ -341,10 +338,77 @@ |
| 341 | 338 | } |
| 342 | 339 | } |
| 343 | 340 | } |
| 344 | - }); | |
| 341 | + }).start(); | |
| 345 | 342 | } |
| 346 | 343 | |
| 347 | 344 | return "syncPatNextTime finish"; |
| 345 | + } | |
| 346 | + | |
| 347 | + @ResponseBody | |
| 348 | + @RequestMapping(value = "/syncPatientsLastCheckEmployeeId", method = RequestMethod.GET) | |
| 349 | + public String syncPatientsLastCheckEmployeeId(@RequestParam String hospitalId, | |
| 350 | + @RequestParam(required = false) String size) { | |
| 351 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 352 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 353 | + // 医院id | |
| 354 | + patientsQuery.setHospitalId(hospitalId); | |
| 355 | + List<Integer> typeList = new ArrayList<>(); | |
| 356 | + // 孕妇 | |
| 357 | + typeList.add(1); | |
| 358 | + // 产妇 | |
| 359 | + typeList.add(3); | |
| 360 | + patientsQuery.setTypeList(typeList); | |
| 361 | + // 查询 | |
| 362 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
| 363 | + System.out.println("本次读取了【" + patientsList.size() + "】条数据"); | |
| 364 | + int batchSize = StringUtils.isEmpty(size) ? 1000 : Integer.valueOf(size); | |
| 365 | + int end = 0; | |
| 366 | + for (int i = 0; i < patientsList.size(); i += batchSize) { | |
| 367 | + end = (end + batchSize); | |
| 368 | + if (end > patientsList.size()) { | |
| 369 | + end = patientsList.size(); | |
| 370 | + } | |
| 371 | + final List<Patients> tempList = patientsList.subList(i, end); | |
| 372 | + new Thread(new Runnable() { | |
| 373 | + @Override | |
| 374 | + public void run() { | |
| 375 | + if (CollectionUtils.isNotEmpty(tempList)) { | |
| 376 | + for (Patients patients : tempList) { | |
| 377 | + String id = patients.getId(); | |
| 378 | + String hospitalId = patients.getHospitalId(); | |
| 379 | + String lastCheckEmployeeId = null; | |
| 380 | + String flag; | |
| 381 | + // 查询复诊,如果没有再查询初诊 | |
| 382 | + AntExQuery antExQuery = new AntExQuery(); | |
| 383 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 384 | + antExQuery.setParentId(id); | |
| 385 | + antExQuery.setHospitalId(hospitalId); | |
| 386 | + List<AntenatalExaminationModel> antenatalExaminationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
| 387 | + if (CollectionUtils.isNotEmpty(antenatalExaminationModelList)) { | |
| 388 | + lastCheckEmployeeId = antenatalExaminationModelList.get(0).getCheckDoctor(); | |
| 389 | + flag = "复诊"; | |
| 390 | + } else { | |
| 391 | + // 查询初诊 | |
| 392 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 393 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 394 | + antExChuQuery.setParentId(id); | |
| 395 | + antExChuQuery.setHospitalId(hospitalId); | |
| 396 | + List<AntExChuModel> antExChuModelList = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 397 | + if (antExChuModelList.size() == 1) { | |
| 398 | + lastCheckEmployeeId = antExChuModelList.get(0).getProdDoctor(); | |
| 399 | + } | |
| 400 | + flag = "初诊"; | |
| 401 | + } | |
| 402 | + if (!StringUtils.isEmpty(lastCheckEmployeeId)) { | |
| 403 | + patientsService.updatePatientLastCheckEmployeeIdOne(id, lastCheckEmployeeId); | |
| 404 | + System.out.println("更新lyms_patient:id=" + id + ",lastCheckEmployeeId=" + lastCheckEmployeeId + ",来自" + flag); | |
| 405 | + } | |
| 406 | + } | |
| 407 | + } | |
| 408 | + } | |
| 409 | + }).start(); | |
| 410 | + } | |
| 411 | + return "syncPatientsLastCheckEmployeeId start......"; | |
| 348 | 412 | } |
| 349 | 413 | |
| 350 | 414 | @RequestMapping(value = "/initCardNo", method = RequestMethod.GET) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AutoMatchFacade.java
View file @
843b670
| ... | ... | @@ -60,15 +60,15 @@ |
| 60 | 60 | |
| 61 | 61 | /**/ //用户角色 |
| 62 | 62 | if (UserTypeEnum.NORMAL_USER.getId().equals(list.get(0).getType())||UserTypeEnum.PLATFORM_ADMIN.getId().equals(list.get(0).getType())) { |
| 63 | - List<Organization> list2 = accessPermissionFacade.getOrganization(accessPermissionFacade.findAccessPerminssionByUserId(list.get(0).getId())); | |
| 63 | + /* List<Organization> list2 = accessPermissionFacade.getOrganization(accessPermissionFacade.findAccessPerminssionByUserId(list.get(0).getId())); | |
| 64 | 64 | if(CollectionUtils.isNotEmpty(list2)){ |
| 65 | 65 | for(Organization organization:list2){ |
| 66 | 66 | data.add(organization.getId()); |
| 67 | 67 | } |
| 68 | - } | |
| 69 | - if (!data.contains(list.get(0).getOrgId())) { | |
| 68 | + }*/ | |
| 69 | +// if (!data.contains(list.get(0).getOrgId())) { | |
| 70 | 70 | data.add(list.get(0).getOrgId()); |
| 71 | - } | |
| 71 | +// } | |
| 72 | 72 | } else if(UserTypeEnum.SUPPER_ADMIN.getId().equals(list.get(0).getType())) { |
| 73 | 73 | return null; |
| 74 | 74 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
843b670
| ... | ... | @@ -96,6 +96,8 @@ |
| 96 | 96 | |
| 97 | 97 | @Autowired |
| 98 | 98 | private DataPermissionService dataPermissionService; |
| 99 | + @Autowired | |
| 100 | + private AutoMatchFacade autoMatchFacade; | |
| 99 | 101 | |
| 100 | 102 | |
| 101 | 103 | public BaseResponse getBabyBase(String babyId) { |
| ... | ... | @@ -1473,6 +1475,10 @@ |
| 1473 | 1475 | // for (Organization organization : organizationList) { |
| 1474 | 1476 | // hospitalIdList.add(String.valueOf(organization.getId())); |
| 1475 | 1477 | // } |
| 1478 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 1479 | + if(null!=hospital){ | |
| 1480 | + hospitalIdList.add(hospital); | |
| 1481 | + } | |
| 1476 | 1482 | DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); |
| 1477 | 1483 | dataPermissionsModelQuery.setUserId(userId); |
| 1478 | 1484 | List<DataPermissionsModel> dataPermissionsModelList = dataPermissionService.queryPermission(dataPermissionsModelQuery); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
843b670
| ... | ... | @@ -333,6 +333,10 @@ |
| 333 | 333 | if (isRegion) { |
| 334 | 334 | //王平说的 必须要给区域医院权限,不然他就是蠢逼 201611124 16:41 |
| 335 | 335 | hospitalList = new ArrayList<>(); |
| 336 | + String hospital = autoMatchFacade.getHospitalId(userId); | |
| 337 | + if(null!=hospital){ | |
| 338 | + hospitalList.add(hospital); | |
| 339 | + } | |
| 336 | 340 | DataPermissionsModelQuery dataPermissionsModelQuery = new DataPermissionsModelQuery(); |
| 337 | 341 | dataPermissionsModelQuery.setUserId(userId); |
| 338 | 342 | List<DataPermissionsModel> permissionsModels = dataPermissionService.queryPermission(dataPermissionsModelQuery); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
View file @
843b670
| ... | ... | @@ -25,6 +25,8 @@ |
| 25 | 25 | import com.lyms.platform.pojo.ResidentsArchiveModel; |
| 26 | 26 | import com.lyms.platform.query.PremaritalCheckupQuery; |
| 27 | 27 | import com.lyms.platform.query.ResidentsArchiveQuery; |
| 28 | +import com.mongodb.util.JSON; | |
| 29 | +import net.sf.json.JSONObject; | |
| 28 | 30 | import org.apache.commons.collections.CollectionUtils; |
| 29 | 31 | import org.apache.commons.lang.StringUtils; |
| 30 | 32 | import org.springframework.beans.factory.annotation.Autowired; |
| 31 | 33 | |
| ... | ... | @@ -327,13 +329,13 @@ |
| 327 | 329 | |
| 328 | 330 | ResidentsArchiveResult result = new ResidentsArchiveResult(); |
| 329 | 331 | |
| 332 | + | |
| 330 | 333 | ResidentsArchiveQuery query = new ResidentsArchiveQuery(); |
| 331 | 334 | query.setYn(YnEnums.YES.getId()); |
| 332 | 335 | query.setId(id); |
| 333 | 336 | List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(query); |
| 334 | 337 | if (CollectionUtils.isNotEmpty(modelList)){ |
| 335 | 338 | ResidentsArchiveModel model = modelList.get(0); |
| 336 | - | |
| 337 | 339 | result = getResult(model); |
| 338 | 340 | } |
| 339 | 341 | |
| ... | ... | @@ -349,7 +351,7 @@ |
| 349 | 351 | result.setId(model.getId()); |
| 350 | 352 | result.setUsername(model.getUsername()); |
| 351 | 353 | result.setSex(model.getSex()); |
| 352 | - result.setBrithDay(model.getBuildDay()); | |
| 354 | + result.setBirthDay(model.getBuildDay()); | |
| 353 | 355 | result.setCountryId(model.getCountryId()); |
| 354 | 356 | result.setNationId(model.getNationId()); |
| 355 | 357 | result.setMarriageId(model.getMarriageId()); |
| ... | ... | @@ -375,7 +377,7 @@ |
| 375 | 377 | result.setStreetRegisterId(model.getStreetRegisterId()); |
| 376 | 378 | result.setAddressRegister(model.getAddressRegister()); |
| 377 | 379 | |
| 378 | - result.setPastHistory(JsonUtil.str2Obj(model.getPastHistory(),Map.class)); | |
| 380 | + result.setPastHistory(JsonUtil.str2Obj(model.getPastHistory(), Map.class)); | |
| 379 | 381 | result.setFamilyHistory(JsonUtil.str2Obj(model.getFamilyHistory(),Map.class)); |
| 380 | 382 | result.setPersonalHistory(JsonUtil.str2Obj(model.getPresentHistory(),Map.class)); |
| 381 | 383 | result.setYwgmHistory(JsonUtil.str2Obj(model.getYwgmHistory(),Map.class)); |
| ... | ... | @@ -392,6 +394,22 @@ |
| 392 | 394 | result.setPublishName(model.getPublishName()); |
| 393 | 395 | |
| 394 | 396 | return result; |
| 397 | + } | |
| 398 | + | |
| 399 | + /** | |
| 400 | + * 把json对象串转换成map对象 | |
| 401 | + * @param jsonObjStr e.g. {'name':'get','int':1,'double',1.1,'null':null} | |
| 402 | + * @return Map | |
| 403 | + */ | |
| 404 | + public static Map getMapFromJsonObjStr(String jsonObjStr) { | |
| 405 | + JSONObject jsonObject = JSONObject.fromObject(jsonObjStr); | |
| 406 | + | |
| 407 | + Map map = new HashMap(); | |
| 408 | + for (Iterator iter = jsonObject.keys(); iter.hasNext();) { | |
| 409 | + String key = (String) iter.next(); | |
| 410 | + map.put(key, jsonObject.get(key)); | |
| 411 | + } | |
| 412 | + return map; | |
| 395 | 413 | } |
| 396 | 414 | |
| 397 | 415 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ResidentsArchiveAddRequest.java
View file @
843b670
| ... | ... | @@ -121,24 +121,24 @@ |
| 121 | 121 | model.setAddress(address); |
| 122 | 122 | model.setProvinceRegisterId(provinceRegisterId); |
| 123 | 123 | model.setCityRegisterId(cityRegisterId); |
| 124 | - model.setAddressRegister(areaRegisterId); | |
| 124 | + model.setAreaRegisterId(areaRegisterId); | |
| 125 | 125 | model.setStreetRegisterId(streetRegisterId); |
| 126 | 126 | model.setAddressRegister(addressRegister); |
| 127 | 127 | |
| 128 | 128 | if (pastHistory!=null){ |
| 129 | - model.setPastHistory(JsonUtil.array2JsonString(pastHistory)); | |
| 129 | + model.setPastHistory(JsonUtil.obj2JsonString(pastHistory)); | |
| 130 | 130 | } |
| 131 | 131 | if (familyHistory!=null){ |
| 132 | - model.setFamilyHistory(JsonUtil.array2JsonString(familyHistory)); | |
| 132 | + model.setFamilyHistory(JsonUtil.obj2JsonString(familyHistory)); | |
| 133 | 133 | } |
| 134 | 134 | if (personalHistory!=null){ |
| 135 | - model.setPersonalHistory(JsonUtil.array2JsonString(personalHistory)); | |
| 135 | + model.setPersonalHistory(JsonUtil.obj2JsonString(personalHistory)); | |
| 136 | 136 | } |
| 137 | 137 | if (ywgmHistory!=null){ |
| 138 | - model.setYwgmHistory(JsonUtil.array2JsonString(ywgmHistory)); | |
| 138 | + model.setYwgmHistory(JsonUtil.obj2JsonString(ywgmHistory)); | |
| 139 | 139 | } |
| 140 | 140 | if (presentHistory!=null){ |
| 141 | - model.setPresentHistory(JsonUtil.array2JsonString(presentHistory)); | |
| 141 | + model.setPresentHistory(JsonUtil.obj2JsonString(presentHistory)); | |
| 142 | 142 | } |
| 143 | 143 | model.setVcCardNo(vcCardNo); |
| 144 | 144 | model.setBuildDoctor(buildDoctor); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ResidentsArchiveResult.java
View file @
843b670
| ... | ... | @@ -17,7 +17,7 @@ |
| 17 | 17 | //性别 |
| 18 | 18 | private String sex; |
| 19 | 19 | //出生日期 |
| 20 | - private String brithDay; | |
| 20 | + private String birthDay; | |
| 21 | 21 | //国籍 |
| 22 | 22 | private String countryId; |
| 23 | 23 | //民族Id |
| 24 | 24 | |
| ... | ... | @@ -115,12 +115,12 @@ |
| 115 | 115 | this.sex = sex; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public String getBrithDay() { | |
| 119 | - return brithDay; | |
| 118 | + public String getBirthDay() { | |
| 119 | + return birthDay; | |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public void setBrithDay(String brithDay) { | |
| 123 | - this.brithDay = brithDay; | |
| 122 | + public void setBirthDay(String birthDay) { | |
| 123 | + this.birthDay = birthDay; | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | public String getCountryId() { |