Commit 91764300275817c220cdbf45b11903987f41636a

Authored by liquanyu
1 parent 2c8d07d8f7

update

Showing 2 changed files with 77 additions and 122 deletions

platform-biz-service/src/main/resources/mainOrm/master/MasterLis.xml View file @ 9176430
... ... @@ -2,7 +2,7 @@
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3 3 <mapper namespace="com.lyms.platform.permission.dao.master.MasterLisMapper">
4 4  
5   - <insert id="saveLisData" parameterType="com.lyms.platform.permission.model.LisReportQuery">
  5 + <insert id="saveLisData" parameterType="com.lyms.platform.permission.model.LisReportModel">
6 6 INSERT INTO LIS_REPORT_TBL(
7 7 LIS_ID,
8 8 TITLE,
... ... @@ -83,7 +83,7 @@
83 83 DELETE FROM LIS_REPORT_TBL WHERE LIS_ID = #{lisId} AND HOSPITAL_ID = #{hospitalId}
84 84 </delete>
85 85  
86   - <select id="queryLisDataByModel" parameterType="com.lyms.platform.permission.model.LisReportModel"
  86 + <select id="queryLisDataByModel" parameterType="com.lyms.platform.permission.model.LisReportQuery"
87 87 resultType="com.lyms.platform.permission.model.LisReportModel">
88 88 SELECT
89 89 ID AS id,
90 90  
91 91  
... ... @@ -111,62 +111,12 @@
111 111 <if test="lisId != null and lisId != ''">
112 112 AND LIS_ID = #{lisId}
113 113 </if>
114   - <if test="vcCardNo != null">
  114 + <if test="vcCardNo != null and vcCardNo != ''">
115 115 AND VCCARDNO = #{vcCardNo}
116 116 </if>
117   - <if test="vcCardNo == null">
118   - AND VCCARDNO = ''
119   - </if>
120   - <if test="hospitalId != null and hospitalId != ''">
121   - AND HOSPITAL_ID = #{hospitalId}
122   - </if>
123   -
124   - <if test="checkTime != null">
125   - AND date_format(CHECK_TIME,'%Y-%m-%d') = date_format(#{checkTime},'%Y-%m-%d')
126   - </if>
127   -
128   - <if test="titles.size() !=0 ">
129   - AND TITLE IN
130   - <foreach collection="titles" item="title"
131   - index="index" open="(" close=")" separator=",">
132   - #{title}
133   - </foreach>
134   - </if>
135   -
136   -
137   - UNION
138   - SELECT
139   - ID AS id,
140   - LIS_ID AS lisId,
141   - TITLE AS title,
142   - TYPE AS type,
143   - VCCARDNO AS vcCardNo,
144   - NAME AS name,
145   - BHNUM AS bhnum,
146   - AGE AS age,
147   - SEX AS sex,
148   - APPLY_TIME AS applyTime,
149   - CHECK_TIME AS checkTime,
150   - PUBLISH_TIME AS publishTime,
151   - APPLY_DOCTOR AS applyDoctor,
152   - APPLY_DEPT AS applyDept,
153   - CHECKER AS checker,
154   - MODIFIED AS modified,
155   - CREATED AS created,
156   - HOSPITAL_ID AS hospitalId,
157   - PHONE AS phone,
158   - ITEM_JSON AS itemJson
159   - FROM LIS_REPORT_TBL
160   - WHERE 1 = 1
161   - <if test="lisId != null and lisId != ''">
162   - AND LIS_ID = #{lisId}
163   - </if>
164   - <if test="phone != null">
  117 + <if test="phone != null and phone != ''">
165 118 AND PHONE = #{phone}
166 119 </if>
167   - <if test="phone == null">
168   - AND PHONE = ''
169   - </if>
170 120 <if test="hospitalId != null and hospitalId != ''">
171 121 AND HOSPITAL_ID = #{hospitalId}
172 122 </if>
... ... @@ -182,7 +132,6 @@
182 132 #{title}
183 133 </foreach>
184 134 </if>
185   -
186 135 </select>
187 136  
188 137  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/LisFacade.java View file @ 9176430
... ... @@ -312,13 +312,10 @@
312 312 hIdNames.put(hospitals.get(0).getId()+"",hospitalName);
313 313 }
314 314 }
315   -
316 315 LisReportQuery model = new LisReportQuery();
317   - model.setVcCardNo(pat.getVcCardNo());
318   - model.setHospitalId(pat.getHospitalId());
319   - model.setPhone(pat.getPhone());
  316 + model.setHospitalId(hospitalId);
320 317 //通过就诊卡号和医院id查询到医院下面的lis记录
321   - List<LisReportModel> lises = lisService.queryLisDataByModel(model);
  318 + List<LisReportModel> lises = queryLisData(pat.getVcCardNo(), pat.getPhone(), model);
322 319 if (CollectionUtils.isNotEmpty(lises))
323 320 {
324 321 for (LisReportModel lis : lises)
... ... @@ -384,6 +381,59 @@
384 381 return result;
385 382 }
386 383  
  384 + private List<LisReportModel> queryLisData(String vcCardNo, String phone,LisReportQuery model) {
  385 +
  386 +
  387 + List<LisReportModel> reportModelList = new ArrayList<>();
  388 + //通过就诊卡号和医院id查询到医院下面的lis记录
  389 + if (StringUtils.isNotEmpty(vcCardNo))
  390 + {
  391 + model.setVcCardNo(vcCardNo);
  392 + List<LisReportModel> lises = lisService.queryLisDataByModel(model);
  393 + reportModelList.addAll(lises);
  394 + }
  395 + if (StringUtils.isNotEmpty(phone))
  396 + {
  397 + model.setVcCardNo(null);
  398 + model.setPhone(phone);
  399 + List<LisReportModel> lises = lisService.queryLisDataByModel(model);
  400 + if (CollectionUtils.isNotEmpty(lises))
  401 + {
  402 + List<LisReportModel> noExists = new ArrayList<>();
  403 + for(LisReportModel lis : lises)
  404 + {
  405 + boolean isExist = false;
  406 + if (CollectionUtils.isNotEmpty(reportModelList))
  407 + {
  408 + for(LisReportModel reportModel : reportModelList)
  409 + {
  410 + if (lis != null && reportModel != null)
  411 + {
  412 + if (StringUtils.isNotEmpty(lis.getLisId()) && lis.getLisId().equals(reportModel.getLisId()))
  413 + {
  414 + isExist = true;
  415 + break;
  416 + }
  417 + }
  418 + }
  419 + if (isExist)
  420 + {
  421 + noExists.add(lis);
  422 + }
  423 + }
  424 + else
  425 + {
  426 + noExists.add(lis);
  427 + }
  428 +
  429 + }
  430 + reportModelList.addAll(noExists);
  431 + }
  432 + }
  433 + return reportModelList;
  434 +
  435 + }
  436 +
387 437 /**
388 438 * 返回小程序查询个人的lis报告
389 439 * 该接口由app服务器端调用
... ... @@ -395,7 +445,7 @@
395 445 List<String> ids = new ArrayList<>();
396 446 if (StringUtils.isNotEmpty(patientIds))
397 447 {
398   - CollectionUtils.addAll(ids,patientIds.split(","));
  448 + CollectionUtils.addAll(ids, patientIds.split(","));
399 449 }
400 450  
401 451 PatientsQuery patientsQuery=new PatientsQuery();
... ... @@ -453,11 +503,6 @@
453 503 }
454 504 }
455 505 }
456   -// BaseObjectResponse objectResponse = new BaseObjectResponse();
457   -// objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
458   -// objectResponse.setData(lises);
459   -// objectResponse.setErrormsg("成功");
460   -// return objectResponse;
461 506 return lises;
462 507 }
463 508  
... ... @@ -519,11 +564,6 @@
519 564 }
520 565 }
521 566 }
522   -// BaseObjectResponse objectResponse = new BaseObjectResponse();
523   -// objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
524   -// objectResponse.setData(lises);
525   -// objectResponse.setErrormsg("成功");
526   -// return objectResponse;
527 567 return lises;
528 568 }
529 569  
... ... @@ -611,44 +651,6 @@
611 651 }
612 652 }
613 653 }
614   -
615   -// for(LisReportModel lisReportModel : lises)
616   -// {
617   -// Map<String,String> map = new HashMap<>();
618   -// if (StringUtils.isNotEmpty(lisReportModel.getHospitalId()))
619   -// {
620   -// Organization organization = organizationService.getOrganization(Integer.parseInt(lisReportModel.getHospitalId()));
621   -// if (organization != null)
622   -// {
623   -// map.put("hospitalName",organization.getName());
624   -// }
625   -// }
626   -//
627   -// PatientsQuery patientsQuery=new PatientsQuery();
628   -// String[] strs = new String[]{lisReportModel.getPhone(), lisReportModel.getVcCardNo()};
629   -// patientsQuery.setPv(strs);
630   -// patientsQuery.setYn(YnEnums.YES.getId());
631   -// List<Patients> list= patientsService.queryPatient(patientsQuery);
632   -// if (CollectionUtils.isNotEmpty(list))
633   -// {
634   -// Patients pat = list.get(0);
635   -// String patientId = pat.getId();
636   -// if (!patientIds.contains(patientId))
637   -// {
638   -// patientIds.add(patientId);
639   -// map.put("vcCardNo", pat.getVcCardNo());
640   -// map.put("name",pat.getUsername());
641   -// map.put("phone",pat.getPhone());
642   -// map.put("checkTime",lisReportModel.getCheckTime() == null ? DateUtil.getyyyy_MM_dd_hms(lisReportModel.getPublishTime())
643   -// : DateUtil.getyyyy_MM_dd_hms(lisReportModel.getCheckTime()));
644   -// map.put("patientId",patientId);
645   -// map.put("hospitalId",lisReportModel.getHospitalId());
646   -// map.put("title",lisReportModel.getTitle());
647   -// map.put("id",lisReportModel.getId()+"");
648   -// lists.add(map);
649   -// }
650   -// }
651   -// }
652 654 }
653 655 patientIds.clear();
654 656  
655 657  
... ... @@ -665,12 +667,9 @@
665 667 titles.add("[丙]血常规(24项)");
666 668 titles.add("血常规(24项)");
667 669 query.setTitles(titles);
668   - query.setPhone(phone);
669   - query.setPhone(phone);
670   - query.setVcCardNo(vcCardNo);
671 670 query.setHospitalId(hospitalId);
672 671 query.setCheckTime(DateUtil.parseYMD(checkTime));
673   - List<LisReportModel> lises = lisService.queryLisDataByModel(query);
  672 + List<LisReportModel> lises = queryLisData(vcCardNo,phone,query);
674 673 Map<String,Map<String,String>> map = new HashMap<>();
675 674 if (CollectionUtils.isNotEmpty(lises))
676 675 {
... ... @@ -679,6 +678,10 @@
679 678 if ("尿常规".equals(model.getTitle()))
680 679 {
681 680 Map<String,String> map1 = new HashMap<>();
  681 + map1.put("ndb",""); //尿蛋白
  682 + map1.put("nt",""); //尿糖
  683 + map1.put("ntt",""); //尿酮体
  684 + map1.put("nqx",""); //尿潜血
682 685 String itemJson = model.getItemJson();
683 686 List<LisReportItemModel> items = JsonUtil.toList(itemJson,LisReportItemModel.class);
684 687 if (CollectionUtils.isNotEmpty(items))
685 688  
686 689  
687 690  
688 691  
689 692  
... ... @@ -689,26 +692,29 @@
689 692 {
690 693 map1.put("ndb",item.getCharResult() == null ? item.getNumberResult() : item.getCharResult());
691 694 }
692   - else if ("尿糖".equals(item.getName()))
  695 + else if ("尿糖".equals(item.getName()) || "尿葡萄糖".equals(item.getName()))
693 696 {
694   - map1.put("tn",item.getCharResult() == null ? item.getNumberResult() : item.getCharResult());
  697 + map1.put("nt",item.getCharResult() == null ? item.getNumberResult() : item.getCharResult());
695 698 }
696 699 else if ("尿酮体".equals(item.getName()))
697 700 {
698 701 map1.put("ntt",item.getCharResult() == null ? item.getNumberResult() : item.getCharResult());
699 702 }
700   - else if ("尿潜血".equals(item.getName()))
  703 + else if ("尿潜血".equals(item.getName()) || "尿隐血".equals(item.getName()))
701 704 {
702   - map1.put("ntx",item.getCharResult() == null ? item.getNumberResult() : item.getCharResult());
  705 + map1.put("nqx",item.getCharResult() == null ? item.getNumberResult() : item.getCharResult());
703 706 }
704 707 }
705 708 }
706 709  
707 710 map.put("ncg",map1);
708 711 }
709   - else if ("[丙]血常规(24项)".equals(model.getTitle()) || "血常规(24项".equals(model.getTitle()))
  712 + else if ("[丙]血常规(24项)".equals(model.getTitle()) || "血常规(24项)".equals(model.getTitle()))
710 713 {
711 714 Map<String,String> map1 = new HashMap<>();
  715 + map1.put("xhdb",""); //血红蛋白
  716 + map1.put("bxbjs","");//白细胞计数
  717 + map1.put("xxbjs",""); //血小板计数
712 718 String itemJson = model.getItemJson();
713 719 List<LisReportItemModel> items = JsonUtil.toList(itemJson,LisReportItemModel.class);
714 720 if (CollectionUtils.isNotEmpty(items))
715 721  
716 722  
717 723  
... ... @@ -717,15 +723,15 @@
717 723 {
718 724 if ("血红蛋白".equals(item.getName()))
719 725 {
720   - map1.put("xhdb",item.getResult());
  726 + map1.put("xhdb",item.getNumberResult());
721 727 }
722 728 else if ("白细胞计数".equals(item.getName()))
723 729 {
724   - map1.put("xxbjs",item.getResult());
  730 + map1.put("bxbjs",item.getNumberResult());
725 731 }
726   - else if ("血小板计数".equals(item.getName()))
  732 + else if ("血小板计数".equals(item.getName()) || "血小板".equals(item.getName()))
727 733 {
728   - map1.put("xxbjs",item.getResult());
  734 + map1.put("xxbjs",item.getNumberResult());
729 735 }
730 736 }
731 737 }