Commit 67aefcf4457112c1c766b5b16f429377befa6026
1 parent
c0218fd65f
Exists in
master
and in
8 other branches
增加自动分配社区
Showing 3 changed files with 54 additions and 6 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/param/CommunityQuery.java
View file @
67aefcf
| ... | ... | @@ -10,6 +10,19 @@ |
| 10 | 10 | private String id; |
| 11 | 11 | private String orgAreaId; |
| 12 | 12 | |
| 13 | + public String getGxxq() { | |
| 14 | + return gxxq; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setGxxq(String gxxq) { | |
| 18 | + this.gxxq = gxxq; | |
| 19 | + } | |
| 20 | + | |
| 21 | + //管辖区域名字 | |
| 22 | + private String gxxq; | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 13 | 26 | public String getOrgAreaId() { |
| 14 | 27 | return orgAreaId; |
| 15 | 28 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/CommunityConfigService.java
View file @
67aefcf
| ... | ... | @@ -46,6 +46,9 @@ |
| 46 | 46 | //查询社区 |
| 47 | 47 | public List<CommunityConfig> queryCommunity(CommunityQuery communityQuery) { |
| 48 | 48 | MongoCondition mongoCondition = MongoCondition.newInstance(); |
| 49 | + if(null!=communityQuery.getGxxq()){ | |
| 50 | + mongoCondition = new MongoCondition("gxxq", communityQuery.getGxxq(), MongoOper.LIKE); | |
| 51 | + } | |
| 49 | 52 | if(null != communityQuery.getKeyword()) { |
| 50 | 53 | mongoCondition = mongoCondition.orCondition(new MongoCondition[]{new MongoCondition("name", communityQuery.getKeyword(), MongoOper.LIKE), new MongoCondition("gxxq", communityQuery.getKeyword(), MongoOper.LIKE)}); |
| 51 | 54 | } |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/DataImportTaskServiceImpl.java
View file @
67aefcf
| 1 | 1 | package com.lyms.platform.data.service.impl; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.param.CommunityQuery; | |
| 3 | 4 | import com.lyms.platform.biz.service.BabyService; |
| 4 | 5 | import com.lyms.platform.biz.service.BasicConfigService; |
| 6 | +import com.lyms.platform.biz.service.CommunityConfigService; | |
| 5 | 7 | import com.lyms.platform.biz.service.PatientsService; |
| 6 | 8 | import com.lyms.platform.common.enums.PermissionTypeEnums; |
| 7 | 9 | import com.lyms.platform.common.enums.UserTypeEnum; |
| 8 | 10 | import com.lyms.platform.common.enums.VisitStatusEnums; |
| 9 | 11 | import com.lyms.platform.common.enums.YnEnums; |
| 10 | -import com.lyms.platform.common.utils.JsonUtil; | |
| 12 | +import com.lyms.platform.common.utils.Assert; | |
| 11 | 13 | import com.lyms.platform.common.utils.LogUtil; |
| 12 | 14 | import com.lyms.platform.common.utils.LoginUtil; |
| 13 | 15 | import com.lyms.platform.data.service.DataImportTaskService; |
| 14 | 16 | import com.lyms.platform.permission.model.*; |
| 15 | 17 | import com.lyms.platform.permission.service.*; |
| 16 | -import com.lyms.platform.pojo.BabyModel; | |
| 17 | 18 | import com.lyms.platform.pojo.BasicConfig; |
| 19 | +import com.lyms.platform.pojo.CommunityConfig; | |
| 18 | 20 | import com.lyms.platform.pojo.Patients; |
| 19 | -import com.lyms.platform.pojo.PuerperaModel; | |
| 20 | 21 | import com.lymsh.mommybaby.earlydata.dao.PlatMapper; |
| 21 | 22 | import com.lymsh.mommybaby.earlydata.model.PlatDataContent; |
| 22 | 23 | import com.lymsh.mommybaby.earlydata.model.PlatDataType; |
| 24 | +import org.apache.commons.collections.CollectionUtils; | |
| 23 | 25 | import org.apache.commons.lang.StringUtils; |
| 24 | 26 | import org.joda.time.DateTime; |
| 25 | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -61,6 +63,8 @@ |
| 61 | 63 | |
| 62 | 64 | @Autowired |
| 63 | 65 | private PlatMapper platMapper; |
| 66 | + @Autowired | |
| 67 | + private CommunityConfigService communityConfigService; | |
| 64 | 68 | |
| 65 | 69 | |
| 66 | 70 | @Value("#{configProperties['login.token']}") |
| ... | ... | @@ -86,7 +90,7 @@ |
| 86 | 90 | public void updateBasicConfig() { |
| 87 | 91 | try { |
| 88 | 92 | List<PlatDataType> typeList = platMapper.selectPlatDataType(); |
| 89 | - for (PlatDataType type:typeList) { | |
| 93 | + for (PlatDataType type : typeList) { | |
| 90 | 94 | try { |
| 91 | 95 | if (StringUtils.isBlank(type.getDtId())) { |
| 92 | 96 | continue; |
| ... | ... | @@ -177,6 +181,7 @@ |
| 177 | 181 | } |
| 178 | 182 | } |
| 179 | 183 | |
| 184 | + | |
| 180 | 185 | /** |
| 181 | 186 | * 每天晚上9点25同步一次 |
| 182 | 187 | */ |
| ... | ... | @@ -376,7 +381,6 @@ |
| 376 | 381 | } |
| 377 | 382 | |
| 378 | 383 | |
| 379 | - | |
| 380 | 384 | /** |
| 381 | 385 | * 每5分钟同步一次(早六点到晚九点) |
| 382 | 386 | */ |
| ... | ... | @@ -442,7 +446,8 @@ |
| 442 | 446 | patients.setAreaRegisterId(map.get("P_HUSBANDMOBILEPHONE") == null ? null : map.get("P_HUSBANDMOBILEPHONE").toString()); |
| 443 | 447 | patients.setVcCardNo(map.get("VC_CARDNO") == null ? null : map.get("VC_CARDNO").toString()); |
| 444 | 448 | patients.setDeliverOrg(map.get("P_HOSPITALID") == null ? null : map.get("P_HOSPITALID").toString()); |
| 445 | - | |
| 449 | + //分配社区 | |
| 450 | + updateCommunity(patients); | |
| 446 | 451 | if (patientsService.queryPatientCount(patients.getId()) == 0) { |
| 447 | 452 | patients.setCreated(patients.getModified()); |
| 448 | 453 | patients.setIsVisit(VisitStatusEnums.UNVISIT.getId()); |
| ... | ... | @@ -462,6 +467,33 @@ |
| 462 | 467 | } catch (Exception e) { |
| 463 | 468 | e.printStackTrace(); |
| 464 | 469 | LogUtil.taskError(e.getMessage(), e); |
| 470 | + } | |
| 471 | + } | |
| 472 | + | |
| 473 | + private void updateCommunity(Patients patients) { | |
| 474 | + Assert.notNull(patients, "patient must not null."); | |
| 475 | + //产后修养地 | |
| 476 | + patients.getAddressPostRest(); | |
| 477 | + patients.getProvincePostRestId(); | |
| 478 | + patients.getCityPostRestId(); | |
| 479 | + patients.getAreaPostRestId(); | |
| 480 | + CommunityQuery communityQuery = null; | |
| 481 | + CommunityConfig communityConfig = null; | |
| 482 | + if (StringUtils.isNotEmpty(patients.getAreaPostRestId()) && StringUtils.isNotEmpty(patients.getAddressPostRest())) { | |
| 483 | + communityQuery = new CommunityQuery(); | |
| 484 | + communityQuery.setOrgAreaId(patients.getAreaPostRestId()); | |
| 485 | + communityQuery.setGxxq(patients.getAddressPostRest()); | |
| 486 | + } else if (StringUtils.isNotEmpty(patients.getAddress()) && StringUtils.isNotEmpty(patients.getAreaId())) { | |
| 487 | + communityQuery = new CommunityQuery(); | |
| 488 | + communityQuery.setOrgAreaId(patients.getAreaId()); | |
| 489 | + communityQuery.setGxxq(patients.getAddress()); | |
| 490 | + } | |
| 491 | + if (null != communityQuery) { | |
| 492 | + List<CommunityConfig> list = communityConfigService.queryCommunity(communityQuery); | |
| 493 | + if (CollectionUtils.isNotEmpty(list)) { | |
| 494 | + communityConfig = list.get(0); | |
| 495 | + patients.setCommunityId(communityConfig.getId()); | |
| 496 | + } | |
| 465 | 497 | } |
| 466 | 498 | } |
| 467 | 499 |