Commit d26eb99a758244e78ad6211b5dd5a80f4b49a434

Authored by liquanyu
1 parent 93f8f9ad92

update code

Showing 3 changed files with 67 additions and 2 deletions

platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml View file @ d26eb99
... ... @@ -163,6 +163,9 @@
163 163 <if test="lisId != null and lisId != ''">
164 164 AND LIS_ID = #{lisId}
165 165 </if>
  166 + <if test="title != null and title != ''">
  167 + AND TITLE = #{title}
  168 + </if>
166 169 <if test="hospitalId != null and hospitalId != ''">
167 170 AND HOSPITAL_ID = #{hospitalId}
168 171 </if>
... ... @@ -229,8 +232,6 @@
229 232 LR.VCCARDNO=#{vcCardNo}
230 233 AND
231 234 LR.HOSPITAL_ID=#{hospitalId}
232   - AND
233   - LI.HOSPITAL_ID=#{hospitalId}
234 235 </select>
235 236  
236 237  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/LisController.java View file @ d26eb99
... ... @@ -15,6 +15,8 @@
15 15 import com.lyms.platform.permission.model.LisReportModel;
16 16 import com.lyms.platform.permission.service.LisService;
17 17 import org.apache.commons.collections.CollectionUtils;
  18 +import org.slf4j.Logger;
  19 +import org.slf4j.LoggerFactory;
18 20 import org.springframework.beans.factory.annotation.Autowired;
19 21 import org.springframework.stereotype.Controller;
20 22 import org.springframework.web.bind.annotation.*;
... ... @@ -30,6 +32,9 @@
30 32 @Controller
31 33 public class LisController extends BaseController {
32 34  
  35 + //日志调测器
  36 + private static final Logger logger = LoggerFactory.getLogger("lis-sync-log");
  37 +
33 38 @Autowired
34 39 private LisService lisService;
35 40 @Autowired
... ... @@ -87,6 +92,7 @@
87 92 list.add(model);
88 93 }catch (Exception e)
89 94 {
  95 + logger.error("lis id == "+lisRequest.getLisId());
90 96 continue;
91 97 }
92 98  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java View file @ d26eb99
... ... @@ -237,8 +237,59 @@
237 237 }
238 238 }
239 239  
  240 +
240 241 /**
  242 + * 同步南充中心医院的数据到线上
241 243 * 定时任务配置applicationContext.xml
  244 + */
  245 + public void nczxyySyncDataSSL() {
  246 +
  247 + try{
  248 + String json = HttpClientUtil.doPost("https://area-nc-api.healthbaby.com.cn:12356/findSyncData", new HashMap<String, String>(), "utf-8");
  249 + if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(json))
  250 + {
  251 + List<SyncDataModel> list = JsonUtil.toList(json, SyncDataModel.class);
  252 + System.out.println("nczxyy syncdata size = "+ list.size());
  253 + int batchSize = 200;
  254 + int end = 0;
  255 + for (int i = 0; i < list.size(); i += batchSize) {
  256 + end = (end + batchSize);
  257 + if (end > list.size()) {
  258 + end = list.size();
  259 + }
  260 + System.out.println("nczxyy start:" + i + ",end:" + end);
  261 + final List<SyncDataModel> tempList = list.subList(i, end);
  262 + new Thread(new Runnable() {
  263 + @Override
  264 + public void run() {
  265 + if (CollectionUtils.isNotEmpty(tempList))
  266 + {
  267 + StringBuffer ids = new StringBuffer();
  268 + for (SyncDataModel model : tempList) {
  269 + boolean boo = mongoSyncService.syncData(model.getAction(), model.getDataId(), model.getClassName(), model.getJsonData());
  270 + if (boo) {
  271 + ids.append(model.getId());
  272 + ids.append(",");
  273 + }
  274 + }
  275 + if (ids.length() > 0) {
  276 + Map<String,String> params = new HashMap<String, String>();
  277 + params.put("ids", ids.toString());
  278 + String result = HttpClientUtil.doPost("https://area-nc-api.healthbaby.com.cn:12356/updateSyncData", params, "utf-8");
  279 + System.out.println("exc result = "+ result);
  280 + }
  281 + }
  282 + }
  283 + }).start();
  284 + }
  285 + }
  286 + }catch(Exception ex){
  287 + ExceptionUtils.catchException(ex, "nczxyySyncDataSSL Error.");
  288 + }
  289 + }
  290 +
  291 + /**
  292 + * 定时任务配置applicationContext.xml
242 293 *
243 294 */
244 295 public void syncDataSSL()
... ... @@ -257,6 +308,13 @@
257 308 dzfySyncDataSSL();
258 309 }
259 310 },"dzfy-thread").start();
  311 +
  312 + new Thread(new Runnable() {
  313 + @Override
  314 + public void run() {
  315 + nczxyySyncDataSSL();
  316 + }
  317 + },"nczxyy-thread").start();
260 318  
261 319 }
262 320