Commit 828afbc8052878ecdd8cc386ccb88aaa7bc0ee4b
1 parent
27fe28ed3b
Exists in
master
and in
6 other branches
his lis开发
Showing 10 changed files with 574 additions and 20 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterLisMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/LisService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/InitDataController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MongoSyncController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SyncDataController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/MasterLisMapper.java
View file @
828afbc
platform-biz-service/src/main/java/com/lyms/platform/permission/service/LisService.java
View file @
828afbc
... | ... | @@ -2,9 +2,17 @@ |
2 | 2 | |
3 | 3 | |
4 | 4 | import com.lyms.platform.common.result.BaseResponse; |
5 | +import com.lyms.platform.permission.model.LisReportItemModel; | |
6 | +import com.lyms.platform.permission.model.LisReportModel; | |
5 | 7 | |
8 | +import java.util.List; | |
9 | + | |
6 | 10 | public interface LisService { |
7 | 11 | |
8 | 12 | BaseResponse saveLisData(String lisData); |
13 | + | |
14 | + List<LisReportModel> queryLisDataByModel(LisReportModel model); | |
15 | + | |
16 | + List<LisReportItemModel> queryLisItemByModel(LisReportItemModel query); | |
9 | 17 | } |
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/LisServiceImpl.java
View file @
828afbc
... | ... | @@ -47,5 +47,16 @@ |
47 | 47 | } |
48 | 48 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
49 | 49 | } |
50 | + | |
51 | + @Override | |
52 | + public List<LisReportModel> queryLisDataByModel(LisReportModel model) { | |
53 | + return masterLisMapper.queryLisDataByModel(model); | |
54 | + } | |
55 | + | |
56 | + @Override | |
57 | + public List<LisReportItemModel> queryLisItemByModel(LisReportItemModel query) { | |
58 | + | |
59 | + return masterLisMapper.queryLisItemByModel(query); | |
60 | + } | |
50 | 61 | } |
platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml
View file @
828afbc
... | ... | @@ -103,8 +103,39 @@ |
103 | 103 | HOSPITAL_ID AS hospitalId, |
104 | 104 | PHONE AS phone |
105 | 105 | FROM LIS_REPORT_TBL |
106 | - WHERE LIS_ID = #{lisId} | |
107 | - AND HOSPITAL_ID = #{hospitalId} | |
106 | + WHERE 1 = 1 | |
107 | + <if test="lisId != null and lisId != ''"> | |
108 | + AND LIS_ID = #{lisId} | |
109 | + </if> | |
110 | + <if test="hospitalId != null and hospitalId != ''"> | |
111 | + AND HOSPITAL_ID = #{hospitalId} | |
112 | + </if> | |
113 | + <if test="vcCardNo != null and vcCardNo != ''"> | |
114 | + AND VCCARDNO = #{vcCardNo} | |
115 | + </if> | |
116 | + </select> | |
117 | + | |
118 | + <select id="queryLisItemByModel" parameterType="com.lyms.platform.permission.model.LisReportItemModel" | |
119 | + resultType="com.lyms.platform.permission.model.LisReportItemModel"> | |
120 | + SELECT | |
121 | + LIS_ID, | |
122 | + CODE, | |
123 | + NAME, | |
124 | + RESULT, | |
125 | + RESULT_FLAG, | |
126 | + REF, | |
127 | + RESULT_TYPE, | |
128 | + UNIT, | |
129 | + PRINT_ORDER, | |
130 | + HOSPITAL_ID | |
131 | + FROM LIS_REPORT_ITEM_TBL | |
132 | + WHERE 1 = 1 | |
133 | + <if test="lisId != null and lisId != ''"> | |
134 | + AND LIS_ID = #{lisId} | |
135 | + </if> | |
136 | + <if test="hospitalId != null and hospitalId != ''"> | |
137 | + AND HOSPITAL_ID = #{hospitalId} | |
138 | + </if> | |
108 | 139 | </select> |
109 | 140 | </mapper> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/InitDataController.java
View file @
828afbc
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Created by riecard on 2016/12/4. |
28 | + * 全量把区域数据同步到指定环境(如线上环境) | |
28 | 29 | */ |
29 | 30 | @Controller |
30 | 31 | @RequestMapping("/initdata") |
31 | 32 | |
... | ... | @@ -35,12 +36,18 @@ |
35 | 36 | @Autowired |
36 | 37 | protected MongoTemplate mongoTemplate; |
37 | 38 | |
39 | + /** | |
40 | + * 该方法是同步要同步的所有的表到指定的环境 | |
41 | + * @param hospitalId | |
42 | + * @return | |
43 | + */ | |
38 | 44 | @ResponseBody |
39 | 45 | @RequestMapping(value = "/resyncdata", method = RequestMethod.POST) |
40 | 46 | public String resyncdata(String hospitalId) { |
41 | 47 | if (org.apache.commons.lang.StringUtils.isBlank(hospitalId)) { |
42 | 48 | return "hospitalId is null"; |
43 | 49 | } |
50 | + //要同步的所有表的model对象 | |
44 | 51 | StringBuffer sb = new StringBuffer(); |
45 | 52 | List<Class> classList = new ArrayList<>(); |
46 | 53 | classList.add(AntenatalExaminationModel.class); |
... | ... | @@ -126,6 +133,12 @@ |
126 | 133 | } |
127 | 134 | } |
128 | 135 | |
136 | + /** | |
137 | + * 接收所有同步上来的数据,然后保存到表中 | |
138 | + * @param className | |
139 | + * @param json | |
140 | + * @return | |
141 | + */ | |
129 | 142 | @ResponseBody |
130 | 143 | @RequestMapping(value = "/reser", method = RequestMethod.POST) |
131 | 144 | public String reser(String className, String json) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisController.java
View file @
828afbc
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | +import com.lyms.platform.common.annotation.TokenRequired; | |
3 | 4 | import com.lyms.platform.common.base.BaseController; |
5 | +import com.lyms.platform.common.base.LoginContext; | |
4 | 6 | import com.lyms.platform.common.result.BaseResponse; |
7 | +import com.lyms.platform.operate.web.facade.LisFacade; | |
5 | 8 | import com.lyms.platform.permission.service.LisService; |
6 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
7 | 10 | import org.springframework.stereotype.Controller; |
8 | 11 | |
9 | 12 | |
... | ... | @@ -20,13 +23,40 @@ |
20 | 23 | |
21 | 24 | @Autowired |
22 | 25 | private LisService lisService; |
26 | + @Autowired | |
27 | + private LisFacade lisFacade; | |
23 | 28 | |
29 | + /** | |
30 | + * 保存各个医院上传上来的lis数据,该数据保存在mysql数据库 | |
31 | + * 每条lis数据中保存了属于那个医院的id | |
32 | + * 每个医院id是配置在相应单独部署的his项目中 | |
33 | + * @param lisData | |
34 | + * @param httpServletRequest | |
35 | + * @return | |
36 | + */ | |
24 | 37 | @RequestMapping(method = RequestMethod.POST, value = "/saveLisData") |
25 | 38 | @ResponseBody |
26 | 39 | public BaseResponse saveLisData(@RequestParam("lisData") String lisData, |
27 | 40 | HttpServletRequest httpServletRequest) { |
28 | 41 | System.out.println("LisController==="+lisData); |
29 | 42 | return lisService.saveLisData(lisData); |
43 | + } | |
44 | + | |
45 | + | |
46 | + /** | |
47 | + * 获取lis和ris报告的接口 | |
48 | + * @param vcCardNo 就诊卡号 | |
49 | + * @param sortType 排序类型(1,根据日期分类;2,根据检查项目分类) | |
50 | + * @return | |
51 | + */ | |
52 | + @RequestMapping(method = RequestMethod.GET, value = "/getLisAndRisData") | |
53 | + @ResponseBody | |
54 | + @TokenRequired | |
55 | + public BaseResponse getLisAndRisData(@RequestParam("vcCardNo") String vcCardNo, | |
56 | + @RequestParam("sortType") Integer sortType, | |
57 | + HttpServletRequest request) { | |
58 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
59 | + return lisFacade.getLisAndRisData(vcCardNo,sortType,loginState.getId()); | |
30 | 60 | } |
31 | 61 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MongoSyncController.java
View file @
828afbc
... | ... | @@ -21,6 +21,15 @@ |
21 | 21 | @Autowired |
22 | 22 | private MongoSyncService mongoSyncService; |
23 | 23 | |
24 | + /** | |
25 | + * 接收来自区域或者单体医院往线上同步数据的接口 | |
26 | + * @param action | |
27 | + * @param token | |
28 | + * @param className | |
29 | + * @param jsonData | |
30 | + * @param id | |
31 | + * @return | |
32 | + */ | |
24 | 33 | @ResponseBody |
25 | 34 | @RequestMapping(method = RequestMethod.POST,value = "/syncmongo") |
26 | 35 | public String syncmongo(String action, String token, String className, String jsonData, String id){ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SyncDataController.java
View file @
828afbc
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java
View file @
828afbc
1 | +package com.lyms.platform.operate.web.facade; | |
2 | + | |
3 | +import com.lyms.hospitalapi.pojo.CheckByDate; | |
4 | +import com.lyms.hospitalapi.pojo.CheckItemResponse; | |
5 | +import com.lyms.hospitalapi.pojo.CheckResponse; | |
6 | +import com.lyms.hospitalapi.pojo.CheckType; | |
7 | +import com.lyms.platform.biz.service.*; | |
8 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
9 | +import com.lyms.platform.common.enums.*; | |
10 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
11 | +import com.lyms.platform.common.result.BaseResponse; | |
12 | +import com.lyms.platform.common.utils.Assert; | |
13 | +import com.lyms.platform.common.utils.DateUtil; | |
14 | +import com.lyms.platform.common.utils.JsonUtil; | |
15 | +import com.lyms.platform.common.utils.SystemConfig; | |
16 | +import com.lyms.platform.operate.web.request.*; | |
17 | +import com.lyms.platform.operate.web.result.*; | |
18 | +import com.lyms.platform.permission.model.*; | |
19 | +import com.lyms.platform.permission.service.LisService; | |
20 | +import com.lyms.platform.permission.service.OrganizationService; | |
21 | +import com.lyms.platform.permission.service.UsersService; | |
22 | +import com.lyms.platform.pojo.*; | |
23 | +import com.lyms.platform.query.*; | |
24 | +import org.apache.commons.collections.CollectionUtils; | |
25 | +import org.apache.commons.lang.StringUtils; | |
26 | +import org.apache.commons.lang.math.NumberUtils; | |
27 | +import org.springframework.beans.factory.annotation.Autowired; | |
28 | +import org.springframework.data.domain.Sort; | |
29 | +import org.springframework.stereotype.Component; | |
30 | + | |
31 | +import java.util.*; | |
32 | + | |
33 | +/** | |
34 | + * | |
35 | + */ | |
36 | +@Component | |
37 | +public class LisFacade { | |
38 | + @Autowired | |
39 | + private AntenatalExaminationService antenatalExaminationService; | |
40 | + @Autowired | |
41 | + private PatientsService patientsService; | |
42 | + @Autowired | |
43 | + private BasicConfigFacade basicConfigFacade; | |
44 | + @Autowired | |
45 | + private BasicConfigService basicConfigService; | |
46 | + @Autowired | |
47 | + private ApplyOrderService applyOrderService; | |
48 | + @Autowired | |
49 | + private OrganizationService organizationService; | |
50 | + @Autowired | |
51 | + private MatDeliverService matDeliverService; | |
52 | + @Autowired | |
53 | + private PostReviewService postReviewService; | |
54 | + @Autowired | |
55 | + private AutoMatchFacade autoMatchFacade; | |
56 | + @Autowired | |
57 | + private StopPregnancyService stopPregnancyService; | |
58 | + @Autowired | |
59 | + private UsersService usersService; | |
60 | + @Autowired | |
61 | + private DeleteProcessHandler deleteProcessHandler; | |
62 | + @Autowired | |
63 | + private AntExRecordService recordService; | |
64 | + | |
65 | + @Autowired | |
66 | + private OrganizationGroupsFacade groupsFacade; | |
67 | + | |
68 | + @Autowired | |
69 | + private LisService lisService; | |
70 | + | |
71 | + /** | |
72 | + * 获取lis和ris检验报告 | |
73 | + * @param vcCardNo 就诊卡号 | |
74 | + * @param sortType 排序类型(1,根据日期分类;2,根据检查项目分类) | |
75 | + * @return | |
76 | + */ | |
77 | + public BaseResponse getLisAndRisData(String vcCardNo,Integer sortType,Integer userId) { | |
78 | + List<CheckByDate> checkByDate=new ArrayList<CheckByDate>(); | |
79 | + if(1 == sortType){ | |
80 | + List<CheckResponse> result = new ArrayList<>(); | |
81 | + //获取lis数据 | |
82 | + result.addAll(queryLisCheckList(vcCardNo,userId)); | |
83 | + //result.addAll(queryPacsCheckList(cardNo)); | |
84 | + List<String> keyList = new ArrayList<>(); | |
85 | + // 去重 | |
86 | + List<CheckResponse> list = new ArrayList<>(); | |
87 | + Date tempDate = null; | |
88 | + for (CheckResponse check:result) { | |
89 | + if (check.getModified() != null && check.getModified().equals(tempDate)) { | |
90 | + continue; | |
91 | + } | |
92 | + list.add(check); | |
93 | + tempDate = check.getModified(); | |
94 | + } | |
95 | + // 排序 | |
96 | + Collections.sort(list, new Comparator() { | |
97 | + public int compare(Object a, Object b) { | |
98 | + if (((CheckResponse)a).getApplyDate() == null) { | |
99 | + return -1; | |
100 | + } | |
101 | + if (((CheckResponse)b).getApplyDate() == null) { | |
102 | + return -1; | |
103 | + } | |
104 | + if (((CheckResponse)a).getApplyDate().before(((CheckResponse)a).getApplyDate())) { | |
105 | + return 1; | |
106 | + } | |
107 | + return -1; | |
108 | + } | |
109 | + }); | |
110 | + | |
111 | + for (CheckResponse check:list) { | |
112 | + String ymd = DateUtil.getyyyy_MM_dd(check.getModified()); | |
113 | + if (!keyList.contains(ymd)) { | |
114 | + keyList.add(ymd); | |
115 | + } | |
116 | + | |
117 | + } | |
118 | + | |
119 | + for(String time:keyList){ | |
120 | + List<CheckType> CheckType=new ArrayList<CheckType>(); | |
121 | + List<CheckResponse> result2=new ArrayList<>();//存放所有检验报告(type=1) | |
122 | + List<CheckResponse> result3=new ArrayList<>();//存放所有影像报告(type=2) | |
123 | + List<CheckResponse> result4=new ArrayList<>();//存放所有其他报告 | |
124 | + CheckType jianyan=new CheckType(); | |
125 | + jianyan.setType("检验报告"); | |
126 | + CheckType yingxiang=new CheckType(); | |
127 | + yingxiang.setType("影像报告"); | |
128 | + CheckType other=new CheckType(); | |
129 | + other.setType("其它报告"); | |
130 | + for(CheckResponse chre:result){ | |
131 | + if(time.equals(DateUtil.getyyyy_MM_dd(chre.getApplyDate()))){ | |
132 | + if(chre.getType() == 1){ | |
133 | + result2.add(chre); | |
134 | + //jianyan.setTypeName(result2); | |
135 | + //CheckType.add(jianyan); | |
136 | + }else if(chre.getType() == 2){ | |
137 | + result3.add(chre); | |
138 | + //yingxiang.setTypeName(result3); | |
139 | + //CheckType.add(yingxiang); | |
140 | + }else{ | |
141 | + result4.add(chre); | |
142 | + //other.setTypeName(result4); | |
143 | + //CheckType.add(other); | |
144 | + } | |
145 | + | |
146 | + } | |
147 | + } | |
148 | + jianyan.setTypeName(result2); | |
149 | + CheckType.add(jianyan); | |
150 | + | |
151 | + yingxiang.setTypeName(result3); | |
152 | + CheckType.add(yingxiang); | |
153 | + | |
154 | + other.setTypeName(result4); | |
155 | + CheckType.add(other); | |
156 | + | |
157 | + CheckByDate CheckByDate1=new CheckByDate(); | |
158 | + CheckByDate1.setTime(time); | |
159 | + CheckByDate1.setTypes(CheckType); | |
160 | + checkByDate.add(CheckByDate1); | |
161 | + } | |
162 | + }else{ | |
163 | + List<CheckResponse> result = new ArrayList<CheckResponse>(); | |
164 | + result.addAll(queryLisCheckList(vcCardNo,userId)); | |
165 | + //result.addAll(queryPacsCheckList(cardNo)); | |
166 | + List<String> keyList = new ArrayList<>(); | |
167 | + List<String> listtype=new ArrayList<>(); | |
168 | + List<CheckResponse> listt = new ArrayList<>(); | |
169 | + // 去重 | |
170 | + List<CheckResponse> list = new ArrayList<>(); | |
171 | + Integer num=0; | |
172 | + for(CheckResponse check:result){ | |
173 | + if(check.getType()!=null && check.getType()==num){ | |
174 | + continue; | |
175 | + } | |
176 | + list.add(check); | |
177 | + num=check.getType(); | |
178 | + } | |
179 | + String t=null; | |
180 | + for(CheckResponse check:result){ | |
181 | + if(check.getTitle()!=null && check.getTitle().equals(t)){ | |
182 | + continue; | |
183 | + } | |
184 | + listt.add(check); | |
185 | + t=check.getTitle(); | |
186 | + } | |
187 | + | |
188 | + | |
189 | + // 排序 | |
190 | + Collections.sort(list, new Comparator() { | |
191 | + public int compare(Object a, Object b) { | |
192 | + if (((CheckResponse)a).getApplyDate() == null) { | |
193 | + return -1; | |
194 | + } | |
195 | + if (((CheckResponse)b).getApplyDate() == null) { | |
196 | + return -1; | |
197 | + } | |
198 | + if (((CheckResponse)a).getApplyDate().before(((CheckResponse)a).getApplyDate())) { | |
199 | + return 1; | |
200 | + } | |
201 | + return -1; | |
202 | + } | |
203 | + }); | |
204 | + | |
205 | + for (CheckResponse check:list) { | |
206 | + Integer ymd = check.getType(); | |
207 | + if (!keyList.contains(ymd.toString())) { | |
208 | + keyList.add(ymd.toString()); | |
209 | + } | |
210 | + | |
211 | + } | |
212 | + for(CheckResponse check:listt){ | |
213 | + String ty=check.getTitle(); | |
214 | + if(!listtype.contains(ty)){ | |
215 | + listtype.add(ty); | |
216 | + } | |
217 | + } | |
218 | + | |
219 | + for(String type:keyList){ | |
220 | + | |
221 | + List<CheckType> CheckType=new ArrayList<CheckType>(); | |
222 | + | |
223 | + for(String typ:listtype){ | |
224 | + List<CheckResponse> result2=new ArrayList<>(); | |
225 | + CheckType CheckType1=new CheckType(); | |
226 | + //CheckType1.setType(typ); | |
227 | + for(CheckResponse chre:result){ | |
228 | + if(type.equals(chre.getType().toString()) && typ.equals(chre.getTitle())){ | |
229 | + chre.setTitle(DateUtil.getyyyy_MM_dd(chre.getApplyDate())+" "+chre.getTitle()); | |
230 | + result2.add(chre); | |
231 | + } | |
232 | + | |
233 | + } | |
234 | + if(result2.size()>0){ | |
235 | + CheckType1.setType(typ); | |
236 | + CheckType1.setTypeName(result2); | |
237 | + CheckType.add(CheckType1); | |
238 | + } | |
239 | + } | |
240 | + | |
241 | + CheckByDate CheckByDate1=new CheckByDate(); | |
242 | + if("1".equals(type)){ | |
243 | + CheckByDate1.setTime("检验报告"); | |
244 | + CheckByDate1.setTypes(CheckType); | |
245 | + checkByDate.add(CheckByDate1); | |
246 | + }else if("2".equals(type)){ | |
247 | + CheckByDate1.setTime("影像报告"); | |
248 | + CheckByDate1.setTypes(CheckType); | |
249 | + checkByDate.add(CheckByDate1); | |
250 | + }else{ | |
251 | + CheckByDate1.setTime("其它报告"); | |
252 | + CheckByDate1.setTypes(CheckType); | |
253 | + checkByDate.add(CheckByDate1); | |
254 | + } | |
255 | + | |
256 | + } | |
257 | + } | |
258 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION).setData(checkByDate); | |
259 | + } | |
260 | + | |
261 | + | |
262 | + /** | |
263 | + * 1、首先根据就诊卡号和医院id查询到这个孕妇的pid | |
264 | + * 2、再根据pid查询到这个孕妇在区域所有的建档记录 | |
265 | + * 3、分别取每个建档中的医院id和就诊卡号在lis记录表中查询数据 | |
266 | + * 4、封装lis数据 | |
267 | + * @param vcCardNo | |
268 | + * @param userId 用户ID | |
269 | + * @return | |
270 | + */ | |
271 | + public List<CheckResponse> queryLisCheckList(String vcCardNo,Integer userId) { | |
272 | + | |
273 | + //保存这个人在所有医院的lis记录 | |
274 | + List<CheckResponse> result = new ArrayList<>(); | |
275 | + | |
276 | + //缓存查询到的医院 | |
277 | + Map<String,String> hIdNames = new HashMap<>(); | |
278 | + | |
279 | + //根据用户id获取医院ID | |
280 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
281 | + | |
282 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
283 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
284 | + | |
285 | + PatientsQuery patientsQuery=new PatientsQuery(); | |
286 | + patientsQuery.setVcCardNo(vcCardNo); | |
287 | + patientsQuery.setHospitalId(hospitalId); | |
288 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
289 | + //通过医院id和就诊卡号查询到孕妇信息 | |
290 | + List<Patients> list= patientsService.queryPatient(patientsQuery); | |
291 | + if(CollectionUtils.isNotEmpty(list)){ | |
292 | + | |
293 | + Patients patients = list.get(0); | |
294 | + patientsQuery.setPid(patients.getPid()); | |
295 | + patientsQuery.setVcCardNo(null); | |
296 | + patientsQuery.setHospitalId(null); | |
297 | + | |
298 | + //通过上面就诊号查询到的人的所有建档记录 包括其他医院的建档记录 | |
299 | + list= patientsService.queryPatient(patientsQuery); | |
300 | + if(CollectionUtils.isNotEmpty(list)){ | |
301 | + for(Patients pat : list) | |
302 | + { | |
303 | + if (pat != null && StringUtils.isNotEmpty(pat.getVcCardNo()) && StringUtils.isNotEmpty(pat.getHospitalId())) | |
304 | + { | |
305 | + | |
306 | + //获取lis记录中医院的名称 | |
307 | + String hospitalName = hIdNames.get(pat.getHospitalId()); | |
308 | + if (!StringUtils.isNotEmpty(hospitalName)) | |
309 | + { | |
310 | + organizationQuery.setId(Integer.parseInt(pat.getHospitalId())); | |
311 | + List<Organization> hospitals = organizationService.queryOrganization(organizationQuery); | |
312 | + if (CollectionUtils.isNotEmpty(hospitals)) | |
313 | + { | |
314 | + hospitalName = hospitals.get(0).getName(); | |
315 | + hIdNames.put(hospitals.get(0).getId()+"",hospitalName); | |
316 | + } | |
317 | + } | |
318 | + | |
319 | + LisReportModel model = new LisReportModel(); | |
320 | + model.setVcCardNo(pat.getVcCardNo()); | |
321 | + model.setHospitalId(pat.getHospitalId()); | |
322 | + //通过就诊卡号和医院id查询到医院下面的lis记录 | |
323 | + List<LisReportModel> lises = lisService.queryLisDataByModel(model); | |
324 | + if (CollectionUtils.isNotEmpty(lises)) | |
325 | + { | |
326 | + for (LisReportModel lis : lises) | |
327 | + { | |
328 | + CheckResponse check = new CheckResponse(); | |
329 | + check.setModified(lis.getModified()); | |
330 | + check.setType(1); /* 1:检验报告,2:影像报告 */ | |
331 | + check.setName(lis.getName()); | |
332 | + check.setTitle(lis.getTitle()); | |
333 | + check.setHospitalName(hospitalName); | |
334 | + if (lis.getAge() != null) { | |
335 | + check.setAge(lis.getAge().toString()); | |
336 | + } | |
337 | + check.setApplyDate(lis.getPublishTime()); | |
338 | + check.setApplyDateStr(DateUtil.getyyyy_MM_dd(lis.getPublishTime())); | |
339 | + check.setCheckDept(lis.getApplyDept()); | |
340 | + check.setDoctor(lis.getApplyDoctor()); | |
341 | + check.setSex(check.getSex()); | |
342 | + | |
343 | + | |
344 | + List<CheckItemResponse> itemList = new ArrayList<>(); | |
345 | + | |
346 | + LisReportItemModel query = new LisReportItemModel(); | |
347 | + query.setLisId(lis.getLisId()); | |
348 | + query.setHospitalId(lis.getHospitalId()); | |
349 | + //查询lis每项详情 | |
350 | + List<LisReportItemModel> items = lisService.queryLisItemByModel(query); | |
351 | + if (CollectionUtils.isNotEmpty(items)) | |
352 | + { | |
353 | + for (LisReportItemModel checkItem : items) | |
354 | + { | |
355 | + CheckItemResponse item = new CheckItemResponse(); | |
356 | + item.setName(checkItem.getName()); | |
357 | + item.setCode(checkItem.getCode()); | |
358 | + item.setRefer(checkItem.getRef()); | |
359 | + if (StringUtils.isNotBlank(checkItem.getNumberResult())) { | |
360 | + item.setResult(checkItem.getNumberResult()); | |
361 | + } else if (StringUtils.isNotBlank(checkItem.getCharResult())) { | |
362 | + item.setResult(checkItem.getCharResult()); | |
363 | + } else { | |
364 | + item.setResult(checkItem.getResult()); | |
365 | + } | |
366 | + item.setUnit(checkItem.getUnit()); | |
367 | + item.setSpecial(checkItem.getResultFlag()); | |
368 | + itemList.add(item); | |
369 | + } | |
370 | + check.setItemList(itemList); | |
371 | + } | |
372 | + result.add(check); | |
373 | + } | |
374 | + | |
375 | + } | |
376 | + } | |
377 | + } | |
378 | + } | |
379 | + } | |
380 | + return result; | |
381 | + } | |
382 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
View file @
828afbc
... | ... | @@ -75,6 +75,10 @@ |
75 | 75 | @Autowired |
76 | 76 | private AntenatalExaminationService antenatalExaminationService; |
77 | 77 | |
78 | + /** | |
79 | + * 该方法是区域或者单体医院部署的把数据定时往某个环境上传 | |
80 | + * (如往线上环境上传,mongo_sync_url就配置相应的线上的接收地址) | |
81 | + */ | |
78 | 82 | public void syncData() { |
79 | 83 | SyncDataQuery query = new SyncDataQuery(); |
80 | 84 | query.setStatus(1); |
81 | 85 | |
82 | 86 | |
... | ... | @@ -130,18 +134,18 @@ |
130 | 134 | } |
131 | 135 | |
132 | 136 | /** |
133 | - * 同步秦皇岛的数据到线上 | |
137 | + * 该方法是定时去取秦皇岛要同步的数据 | |
138 | + * 定时任务配置applicationContext.xml | |
134 | 139 | */ |
135 | 140 | public void qhdfySyncDataSSL() { |
136 | 141 | |
137 | 142 | try{ |
138 | - | |
139 | 143 | |
140 | 144 | String json = HttpClientUtil.doPost("https://area-qhd-api.healthbaby.com.cn:18019/findSyncData", new HashMap<String, String>(), "utf-8"); |
141 | 145 | if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(json)) |
142 | 146 | { |
143 | 147 | List<SyncDataModel> list = JsonUtil.toList(json, SyncDataModel.class); |
144 | - System.out.println("syncdata size = "+ list.size()); | |
148 | + System.out.println("qdhfy syncdata size = "+ list.size()); | |
145 | 149 | |
146 | 150 | |
147 | 151 | int batchSize = 200; |
... | ... | @@ -151,7 +155,7 @@ |
151 | 155 | if (end > list.size()) { |
152 | 156 | end = list.size(); |
153 | 157 | } |
154 | - System.out.println("start:" + i + ",end:" + end); | |
158 | + System.out.println("qhdfy start:" + i + ",end:" + end); | |
155 | 159 | final List<SyncDataModel> tempList = list.subList(i, end); |
156 | 160 | new Thread(new Runnable() { |
157 | 161 | @Override |
158 | 162 | |
... | ... | @@ -176,25 +180,86 @@ |
176 | 180 | } |
177 | 181 | }).start(); |
178 | 182 | } |
179 | - | |
180 | -// for (SyncDataModel model : list) { | |
181 | -// boolean boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData()); | |
182 | -// if (boo) { | |
183 | -// ids.append(model.getId()); | |
184 | -// ids.append(","); | |
185 | -// } | |
186 | -// } | |
187 | -// if (ids.length() > 0) { | |
188 | -// Map<String,String> params = new HashMap<String, String>(); | |
189 | -// params.put("ids", ids.toString()); | |
190 | -// String result = HttpClientUtil.doPost("https://area-qhd-api.healthbaby.com.cn:18019/updateSyncData", params, "utf-8"); | |
191 | -// System.out.println("exc result = "+ result); | |
192 | -// } | |
193 | 183 | } |
194 | 184 | }catch(Exception ex){ |
195 | 185 | ExceptionUtils.catchException(ex, "qhdfySyncDataSSL Error."); |
196 | 186 | } |
197 | 187 | } |
188 | + | |
189 | + | |
190 | + /** | |
191 | + * 同步德州妇幼的数据到线上 | |
192 | + * 定时任务配置applicationContext.xml | |
193 | + */ | |
194 | + public void dzfySyncDataSSL() { | |
195 | + | |
196 | + try{ | |
197 | + String json = HttpClientUtil.doPost("https://area-dz-api.healthbaby.com.cn:12356/findSyncData", new HashMap<String, String>(), "utf-8"); | |
198 | + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(json)) | |
199 | + { | |
200 | + List<SyncDataModel> list = JsonUtil.toList(json, SyncDataModel.class); | |
201 | + System.out.println("dzfy syncdata size = "+ list.size()); | |
202 | + int batchSize = 200; | |
203 | + int end = 0; | |
204 | + for (int i = 0; i < list.size(); i += batchSize) { | |
205 | + end = (end + batchSize); | |
206 | + if (end > list.size()) { | |
207 | + end = list.size(); | |
208 | + } | |
209 | + System.out.println("dzfy start:" + i + ",end:" + end); | |
210 | + final List<SyncDataModel> tempList = list.subList(i, end); | |
211 | + new Thread(new Runnable() { | |
212 | + @Override | |
213 | + public void run() { | |
214 | + if (CollectionUtils.isNotEmpty(tempList)) | |
215 | + { | |
216 | + StringBuffer ids = new StringBuffer(); | |
217 | + for (SyncDataModel model : tempList) { | |
218 | + boolean boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData()); | |
219 | + if (boo) { | |
220 | + ids.append(model.getId()); | |
221 | + ids.append(","); | |
222 | + } | |
223 | + } | |
224 | + if (ids.length() > 0) { | |
225 | + Map<String,String> params = new HashMap<String, String>(); | |
226 | + params.put("ids", ids.toString()); | |
227 | + String result = HttpClientUtil.doPost("https://area-qhd-api.healthbaby.com.cn:18019/updateSyncData", params, "utf-8"); | |
228 | + System.out.println("exc result = "+ result); | |
229 | + } | |
230 | + } | |
231 | + } | |
232 | + }).start(); | |
233 | + } | |
234 | + } | |
235 | + }catch(Exception ex){ | |
236 | + ExceptionUtils.catchException(ex, "dzfySyncDataSSL Error."); | |
237 | + } | |
238 | + } | |
239 | + | |
240 | + /** | |
241 | + * 定时任务配置applicationContext.xml | |
242 | + * | |
243 | + */ | |
244 | + public void syncDataSSL() | |
245 | + { | |
246 | + new Thread(new Runnable() { | |
247 | + @Override | |
248 | + public void run() { | |
249 | + qhdfySyncDataSSL(); | |
250 | + } | |
251 | + },"qhdfy-thread").start(); | |
252 | + | |
253 | + | |
254 | + new Thread(new Runnable() { | |
255 | + @Override | |
256 | + public void run() { | |
257 | + dzfySyncDataSSL(); | |
258 | + } | |
259 | + },"qhdfy-thread").start(); | |
260 | + | |
261 | + } | |
262 | + | |
198 | 263 | |
199 | 264 | private String buildFX(String charResult) { |
200 | 265 | if (StringUtils.isNotBlank(charResult)) { |