Commit b93f47d2779b9d397a1203a45ae832268928ce99

Authored by baohanddd
1 parent d4f28fba60

add data import :机构、部门、用户(医生)

Showing 6 changed files with 74 additions and 11 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/ReferConfigDao.java View file @ b93f47d
... ... @@ -9,6 +9,9 @@
9 9 * Created by Zhang.Rui on 2016/3/17.
10 10 */
11 11 public interface ReferConfigDao {
  12 +
  13 + public ReferValue getReferValueById(String id);
  14 +
12 15 void addRefer(ReferValue referValue);
13 16  
14 17 void updateRefer(MongoQuery query, ReferValue referValue);
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/ReferConfigDaoImpl.java View file @ b93f47d
... ... @@ -15,6 +15,10 @@
15 15 @Repository("referConfigDao")
16 16 public class ReferConfigDaoImpl extends BaseMongoDAOImpl<ReferValue> implements ReferConfigDao {
17 17  
  18 + @Override
  19 + public ReferValue getReferValueById(String id) {
  20 + return this.findById(id);
  21 + }
18 22  
19 23 @Override
20 24 public void addRefer(ReferValue referValue) {
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/ReferConfigService.java View file @ b93f47d
... ... @@ -24,6 +24,10 @@
24 24 @Autowired
25 25 private ReferConfigDao referConfigDao;
26 26  
  27 + public ReferValue getReferValueById(String id) {
  28 + return referConfigDao.getReferValueById(id);
  29 + }
  30 +
27 31 public List<ReferValue> queryRefer(ReferConfigQuery referConfigQuery) {
28 32 MongoQuery mongoQuery = referConfigQuery.convertToQuery();
29 33 referConfigQuery.setNeed("true");
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/DataImportTaskServiceImpl.java View file @ b93f47d
1 1 package com.lyms.platform.data.service.impl;
2 2  
3 3 import com.lyms.platform.biz.param.CommunityQuery;
4   -import com.lyms.platform.biz.service.BabyService;
5   -import com.lyms.platform.biz.service.BasicConfigService;
6   -import com.lyms.platform.biz.service.CommunityConfigService;
7   -import com.lyms.platform.biz.service.PatientsService;
  4 +import com.lyms.platform.biz.service.*;
8 5 import com.lyms.platform.common.enums.PermissionTypeEnums;
9 6 import com.lyms.platform.common.enums.UserTypeEnum;
10 7 import com.lyms.platform.common.enums.VisitStatusEnums;
... ... @@ -14,10 +11,7 @@
14 11 import com.lyms.platform.data.service.DataImportTaskService;
15 12 import com.lyms.platform.permission.model.*;
16 13 import com.lyms.platform.permission.service.*;
17   -import com.lyms.platform.pojo.BabyModel;
18   -import com.lyms.platform.pojo.BasicConfig;
19   -import com.lyms.platform.pojo.CommunityConfig;
20   -import com.lyms.platform.pojo.Patients;
  14 +import com.lyms.platform.pojo.*;
21 15 import com.lyms.platform.query.BabyModelQuery;
22 16 import com.lyms.platform.query.PatientsQuery;
23 17 import com.lymsh.mommybaby.earlydata.dao.PlatMapper;
... ... @@ -25,6 +19,7 @@
25 19 import com.lymsh.mommybaby.earlydata.model.PlatDataType;
26 20 import org.apache.commons.collections.CollectionUtils;
27 21 import org.apache.commons.lang.StringUtils;
  22 +import org.apache.commons.lang.math.NumberUtils;
28 23 import org.joda.time.DateTime;
29 24 import org.springframework.beans.factory.annotation.Autowired;
30 25 import org.springframework.beans.factory.annotation.Value;
31 26  
... ... @@ -68,7 +63,13 @@
68 63 @Autowired
69 64 private CommunityConfigService communityConfigService;
70 65  
  66 + @Autowired
  67 + private AssayConfigService assayConfigService;
71 68  
  69 + @Autowired
  70 + private ReferConfigService referConfigService;
  71 +
  72 +
72 73 @Value("#{configProperties['login.token']}")
73 74 private String token;
74 75 @Value("#{configProperties['login.typeId']}")
... ... @@ -98,7 +99,11 @@
98 99 continue;
99 100 }
100 101 BasicConfig config = new BasicConfig();
101   - config.setId(type.getDtId());
  102 + if (NumberUtils.isNumber(type.getDtId())) {
  103 + config.setId("ora-type-"+type.getDtId());
  104 + } else {
  105 + config.setId(type.getDtId());
  106 + }
102 107 config.setCode(type.getDtName());
103 108 config.setName(type.getDtName());
104 109 config.setParentId("0");
... ... @@ -124,7 +129,11 @@
124 129 continue;
125 130 }
126 131 BasicConfig config = new BasicConfig();
127   - config.setId(data.getDcId());
  132 + if (NumberUtils.isNumber(data.getDcId())) {
  133 + config.setId("ora-data-"+data.getDcId());
  134 + } else {
  135 + config.setId(data.getDcId());
  136 + }
128 137 config.setCode(data.getDcNo());
129 138 config.setName(data.getDcName());
130 139 if ("0".equals(data.getDcParentid())) {
131 140  
132 141  
... ... @@ -159,12 +168,46 @@
159 168  
160 169 @Override
161 170 public void fullUpdateAssay() {
162   -
  171 + OrganizationQuery query = new OrganizationQuery();
  172 + query.setYn(YnEnums.YES.getId());
  173 + List<Organization> list = organizationService.queryOrganization(query);
  174 + for (Organization organization : list) {
  175 + if (StringUtils.isNotBlank(organization.getForeignId())) {
  176 + updateAssayByHospital(organization.getForeignId(), organization.getId(), null);
  177 + }
  178 + }
163 179 }
164 180  
165 181 @Override
166 182 public void updateAssayByHospital(String hospitalForeignId, Integer hospitalId, Date startTime) {
  183 + try {
  184 + List<Map> list = platMapper.selectMommyRefer(hospitalForeignId);
  185 + for (Map map:list) {
  186 + String id = map.get("ID").toString();
  187 + if (StringUtils.isBlank(id)) {
  188 + continue;
  189 + }
  190 + ReferValue referValue = new ReferValue();
  191 + referValue.setId(id);
  192 + referValue.setName(map.get("MR_CTRLNAME").toString());
  193 + referValue.setYn(YnEnums.YES.getId());
  194 + referValue.setPublishId("worker");
  195 +// referValue.setAgeDepartment();
  196 + referValue.setAssayConfigId(map.get("MR_CTRLID").toString());
  197 +// referValue.setBeginAge();
  198 +// referValue.setCharRefer();
  199 + referValue.setCode(map.get("MR_CODE").toString());
  200 +// referValue.setDepartment();
  201 + referValue.setHospitalId(hospitalId);
  202 + referValue.setStandardCode(referValue.getCode());
  203 + referValue.setUnit(map.get("MR_UNIT").toString());
  204 + ReferValue dbReferValue = referConfigService.getReferValueById(id);
167 205  
  206 + }
  207 + } catch (Exception e) {
  208 + e.printStackTrace();
  209 + LogUtil.taskError(e.getMessage(), e);
  210 + }
168 211 }
169 212  
170 213 /**
platform-mommyData/src/main/java/com/lymsh/mommybaby/earlydata/dao/PlatMapper.java View file @ b93f47d
... ... @@ -36,5 +36,7 @@
36 36  
37 37 public List<Map> selectAllPuerperaByHospitalId(@Param("hospitalId") String hospitalId, @Param("startTime") Date startTime);
38 38  
  39 + public List<Map> selectMommyRefer(@Param("hospitalId") String hospitalId);
  40 +
39 41 }
platform-mommyData/src/main/resources/earlyOrm/Plat.xml View file @ b93f47d
... ... @@ -229,6 +229,13 @@
229 229 order by mp.p_hospitalid,ppt.p_id,mp.p_no
230 230 </select>
231 231  
  232 + <select id="selectMommyRefer" resultType="hashmap" parameterType="map">
  233 + select *
  234 + from MOMMY_REFERENCE
  235 + where MR_HOSPITAL = #{hospitalId} and MR_UNIT is not null and MR_MAXVALUE is not null and MR_MINVALUE is not null and MR_CTRLNAME is not null and MR_CTRLID is null and MR_CODE is not null
  236 + order by MR_CTRLID
  237 + </select>
  238 +
232 239  
233 240 </mapper>