Commit 46386e1d89fce32f5ccccc1ebe90c8bd3ad4a947

Authored by liquanyu
1 parent 8ece787c97

处方报表

Showing 7 changed files with 124 additions and 83 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManage.java View file @ 46386e1
... ... @@ -11,9 +11,18 @@
11 11 private String affiliateId;
12 12 private String checkItemInfoName;
13 13 private Integer enable;
  14 + private Integer type;
14 15  
15 16 private Date modified;
16 17 private Date created;
  18 +
  19 + public Integer getType() {
  20 + return type;
  21 + }
  22 +
  23 + public void setType(Integer type) {
  24 + this.type = type;
  25 + }
17 26  
18 27 public Date getCreated() {
19 28 return created;
platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManageQuery.java View file @ 46386e1
... ... @@ -5,6 +5,15 @@
5 5 public class CheckItemManageQuery extends BaseQuery {
6 6 private Integer id;
7 7 private String affiliateId;
  8 + private Integer type;
  9 +
  10 + public Integer getType() {
  11 + return type;
  12 + }
  13 +
  14 + public void setType(Integer type) {
  15 + this.type = type;
  16 + }
8 17  
9 18 public Integer getId() {
10 19 return id;
platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItemManage.xml View file @ 46386e1
... ... @@ -8,22 +8,23 @@
8 8 <result column="endweek" property="endWeek" jdbcType="INTEGER"/>
9 9 <result column="checkItemInfoId" property="checkItemInfoId" jdbcType="VARCHAR"/>
10 10 <result column="affiliate" property="affiliateId" jdbcType="VARCHAR"/>
  11 + <result column="type" property="type" jdbcType="INTEGER"/>
11 12 </resultMap>
12 13 <select id="getCheckItemManageList" resultMap="CheckItemManageMap">
13   - SELECT id,startweek,endweek,checkItemInfoId,affiliate from lyms_checkitem
  14 + SELECT id,startweek,endweek,checkItemInfoId,affiliate,type from lyms_checkitem
14 15 </select>
15 16  
16 17 <insert id="addCheckItem" parameterType="com.lyms.platform.permission.model.CheckItemManage">
17 18 <selectKey order="AFTER" keyProperty="id" resultType="java.lang.Integer">
18 19 SELECT LAST_INSERT_ID()
19 20 </selectKey>
20   - INSERT INTO lyms_checkitem(startweek,endweek,checkItemInfoId,affiliate,modified,created)
21   - VALUES(#{startWeek},#{endWeek},#{checkItemInfoId},#{affiliateId},#{modified},#{created})
  21 + INSERT INTO lyms_checkitem(startweek,endweek,checkItemInfoId,affiliate,modified,created,type)
  22 + VALUES(#{startWeek},#{endWeek},#{checkItemInfoId},#{affiliateId},#{modified},#{created},#{type})
22 23 </insert>
23 24  
24 25  
25 26 <select id="getCheckItemManage" resultMap="CheckItemManageMap">
26   - SELECT id,startweek,endweek,checkItemInfoId,affiliate from lyms_checkitem where
  27 + SELECT id,startweek,endweek,checkItemInfoId,affiliate,type from lyms_checkitem where
27 28 affiliate=#{affiliateId}
28 29 </select>
29 30  
... ... @@ -46,6 +47,9 @@
46 47 <if test="affiliateId!=null and affiliateId!=''">
47 48 affiliate=#{affiliateId,jdbcType=VARCHAR},
48 49 </if>
  50 + <if test="type != null">
  51 + type=#{type,jdbcType=INTEGER},
  52 + </if>
49 53 <if test="modified!=null">
50 54 modified=#{modified},
51 55 </if>
52 56  
... ... @@ -65,10 +69,13 @@
65 69  
66 70 <select id="queryCheckItemManage" resultMap="CheckItemManageMap"
67 71 parameterType="com.lyms.platform.permission.model.CheckItemManageQuery">
68   - SELECT id,startweek,endweek,checkItemInfoId,affiliate from lyms_checkitem
  72 + SELECT id,startweek,endweek,checkItemInfoId,affiliate,type from lyms_checkitem
69 73 <if test="affiliateId!=null and affiliateId!=''">
70 74 where
71 75 affiliate=#{affiliateId,jdbcType=VARCHAR}
  76 + </if>
  77 + <if test="type !=null">
  78 + and type=#{type,jdbcType=INTEGER}
72 79 </if>
73 80 <include refid="orderAndLimit"/>
74 81 </select>
platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemOrder.java View file @ 46386e1
... ... @@ -21,6 +21,15 @@
21 21 private Date nextCheckTime;
22 22 private String hospitalId;
23 23 private Date created;
  24 + private String checkId;
  25 +
  26 + public String getCheckId() {
  27 + return checkId;
  28 + }
  29 +
  30 + public void setCheckId(String checkId) {
  31 + this.checkId = checkId;
  32 + }
24 33  
25 34 public String getHospitalId() {
26 35 return hospitalId;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CheckItemManageController.java View file @ 46386e1
... ... @@ -35,15 +35,18 @@
35 35  
36 36 /**
37 37 * 查询展示项
  38 + * type 类型 1孕妇 2儿童
38 39 */
39 40 @RequestMapping(value = "/getCheckItemManageList", method = RequestMethod.GET)
40 41 @ResponseBody
41 42 public FrontEndResult getCheckItemManageList(@RequestParam(value = "affiliateId") String affiliateId,
42 43 @RequestParam(value = "page", required = false) Integer page,
  44 + @RequestParam(value = "type", required = false) Integer type,
43 45 @RequestParam(value = "limit", required = false) Integer limit) {
44 46 CheckItemManageQuery checkItemManageQuery = new CheckItemManageQuery();
45 47 checkItemManageQuery.setNeed("true");
46 48 checkItemManageQuery.setSort("startweek asc");
  49 + checkItemManageQuery.setType(type);
47 50 checkItemManageQuery.setPage(page);
48 51 checkItemManageQuery.setLimit(limit);
49 52 checkItemManageQuery.setAffiliateId(affiliateId);
... ... @@ -109,6 +112,7 @@
109 112 @RequestParam(value = "startweek") Integer startweek,
110 113 @RequestParam(value = "endweek") Integer endweek,
111 114 @RequestParam(value = "checkItemInfoId") String checkItemInfoId,
  115 + @RequestParam(value = "type") Integer type,
112 116 @RequestParam(value = "affiliateId") String affiliateId) {
113 117 if (null == startweek || null == endweek || StringUtils.isEmpty(checkItemInfoId) || StringUtils.isEmpty(affiliateId)) {
114 118 ResultUtils.buildParameterErrorResultAndWrite(response, "请填写必须项!");
... ... @@ -139,6 +143,7 @@
139 143 }
140 144 if (end && start) {
141 145 CheckItemManage checkItemManage = new CheckItemManage();
  146 + checkItemManage.setType(type);
142 147 checkItemManage.setStartWeek(startweek);
143 148 checkItemManage.setEndWeek(endweek);
144 149 checkItemManage.setCheckItemInfoId(checkItemInfoId);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java View file @ 46386e1
... ... @@ -18,9 +18,11 @@
18 18 import com.lyms.platform.operate.web.utils.UnitConstants;
19 19 import com.lyms.platform.operate.web.utils.UnitUtils;
20 20 import com.lyms.platform.operate.web.worker.AntExRecordWorker;
  21 +import com.lyms.platform.permission.model.CheckItem;
21 22 import com.lyms.platform.permission.model.Organization;
22 23 import com.lyms.platform.permission.model.OrganizationQuery;
23 24 import com.lyms.platform.permission.model.Users;
  25 +import com.lyms.platform.permission.service.CheckItemService;
24 26 import com.lyms.platform.permission.service.OrganizationService;
25 27 import com.lyms.platform.permission.service.UsersService;
26 28 import com.lyms.platform.permission.service.impl.MeasureDataInfoServiceImpl;
27 29  
... ... @@ -102,8 +104,9 @@
102 104 private DzfyHisService dzfyHisService;
103 105  
104 106 @Autowired
105   - private MeasureDataInfoServiceImpl measureDataInfoService;
  107 + private CheckItemService checkItemService;
106 108  
  109 +
107 110 /**
108 111 * 组合查询请求
109 112 *
110 113  
111 114  
... ... @@ -1957,13 +1960,21 @@
1957 1960 long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemOrder.class);
1958 1961 data.put("allCount", String.valueOf(count));
1959 1962  
1960   - List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(hospitalId)), CheckItemConfig.class);
1961   - if (CollectionUtils.isNotEmpty(itemConfigs)) {
  1963 + Map param = new HashMap();
  1964 + param.put("type",null);
  1965 + param.put("hospitalId",hospitalId);
  1966 + List<CheckItem> checkItems = checkItemService.getCheckItemList(param);
  1967 + if (CollectionUtils.isNotEmpty(checkItems)) {
1962 1968 List<Map> list = new ArrayList<>();
1963   - for (CheckItemConfig item : itemConfigs) {
1964   - long itemCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId())), CheckItemOrder.class);
  1969 + for (CheckItem item : checkItems) {
  1970 + long itemCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime")
  1971 + .gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId())), CheckItemOrder.class);
  1972 + if (itemCount == 0)
  1973 + {
  1974 + continue;
  1975 + }
1965 1976 Map<String, String> map = new HashMap<>();
1966   - map.put("itemName", item.getName());
  1977 + map.put("itemName", item.getProject());
1967 1978 map.put("itemCount", String.valueOf(itemCount));
1968 1979 list.add(map);
1969 1980 }
1970 1981  
1971 1982  
1972 1983  
1973 1984  
1974 1985  
... ... @@ -1981,21 +1992,27 @@
1981 1992 String[] arrs = checkTime.split(" - ");
1982 1993 Date start = DateUtil.parseYMD(arrs[0]);
1983 1994 Date end = DateUtil.parseYMD(arrs[1]);
1984   - long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("checkTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemActual.class);
  1995 + long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemOrder.class);
1985 1996 data.put("allCount", String.valueOf(count));
1986 1997  
1987   - List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(hospitalId)), CheckItemConfig.class);
1988   - if (CollectionUtils.isNotEmpty(itemConfigs)) {
  1998 + Map param = new HashMap();
  1999 + param.put("type",null);
  2000 + param.put("hospitalId",hospitalId);
  2001 + List<CheckItem> checkItems = checkItemService.getCheckItemList(param);
  2002 + if (CollectionUtils.isNotEmpty(checkItems)) {
1989 2003 List<Map> list = new ArrayList<>();
1990   - for (CheckItemConfig item : itemConfigs) {
1991   - long itemCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("checkTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId())), CheckItemActual.class);
  2004 + for (CheckItem item : checkItems) {
  2005 + long itemCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime")
  2006 + .gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId())), CheckItemOrder.class);
  2007 + if (itemCount == 0)
  2008 + {
  2009 + continue;
  2010 + }
1992 2011 Map<String, String> map = new HashMap<>();
1993   - map.put("itemName", item.getName());
  2012 + map.put("itemName", item.getProject());
1994 2013 map.put("itemCount", String.valueOf(itemCount));
1995   - long actualCount = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("checkTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end)).and("itemId").is(item.getId()).and("status").is(1)), CheckItemActual.class);
  2014 + map.put("actualCount", "0");
1996 2015 list.add(map);
1997   -
1998   - map.put("actualCount", String.valueOf(actualCount));
1999 2016 }
2000 2017 data.put("itemList", list);
2001 2018 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java View file @ 46386e1
... ... @@ -313,12 +313,12 @@
313 313 String hospitalId = autoMatchFacade.getHospitalId(userId);
314 314  
315 315 //秦皇岛市山海关人民医院 零时处理
316   - if (StringUtils.isNotEmpty(antExAddRequest.getCheckDate()) && "1000000004".equals(hospitalId)) {
317   - if (!antExAddRequest.getCheckDate().equals(DateUtil.getyyyy_MM_dd(new Date())))
318   - {
319   - return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST);
320   - }
321   - }
  316 +// if (StringUtils.isNotEmpty(antExAddRequest.getCheckDate()) && "1000000004".equals(hospitalId)) {
  317 +// if (!antExAddRequest.getCheckDate().equals(DateUtil.getyyyy_MM_dd(new Date())))
  318 +// {
  319 +// return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST);
  320 +// }
  321 +// }
322 322  
323 323 AntenatalExaminationModel model = antExAddRequest.convertToDataModel();
324 324 //表示区域的
325 325  
... ... @@ -527,26 +527,19 @@
527 527 // zcPrenatalService.saveAntexFu(antExamModel);
528 528 // }
529 529  
530   -// try {
531   -// //处方计划
532   -// if (antExamModel.getNextCheckTime() != null) {
533   -// saveCheckItem(antExamModel.getNextCheckTime(), patients);
534   -// }
535   -// } catch (Exception e) {
536   -// e.printStackTrace();
537   -// }
538   -// try {
539   -// //处方计划
540   -// if (antExamModel.getCheckDate() != null) {
541   -// saveCheckActual(antExamModel.getCheckDate(), patients);
542   -// }
543   -// } catch (Exception e) {
544   -// e.printStackTrace();
545   -// }
546   -
547 530 try {
548 531 //处方计划
549 532 if (antExamModel.getNextCheckTime() != null) {
  533 + saveCheckItem(antExamModel.getNextCheckTime(), patients,antExAddRequest.getConfigItemId(),antExamModel.getId(),hospitalId);
  534 + }
  535 + } catch (Exception e) {
  536 + e.printStackTrace();
  537 + }
  538 +
  539 +
  540 + try {
  541 + //追访统计
  542 + if (antExamModel.getNextCheckTime() != null) {
550 543 patients = patientsService.findOnePatientById(antExamModel.getParentId());
551 544 updateTrackCount(antExamModel.getCheckDate(), antExamModel.getNextCheckTime(), patients);
552 545 }
553 546  
554 547  
... ... @@ -633,16 +626,16 @@
633 626 final String hospitalId = autoMatchFacade.getHospitalId(userId);
634 627  
635 628  
636   - //秦皇岛市山海关人民医院 零时处理
637   - if (StringUtils.isNotEmpty(excAddRequest.getCheckTime()) && "1000000004".equals(hospitalId)) {
638   - if (!excAddRequest.getCheckTime().equals(DateUtil.getyyyy_MM_dd(new Date())))
639   - {
640   - return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST);
641   - }
  629 +// //秦皇岛市山海关人民医院 零时处理
  630 +// if (StringUtils.isNotEmpty(excAddRequest.getCheckTime()) && "1000000004".equals(hospitalId)) {
  631 +// if (!excAddRequest.getCheckTime().equals(DateUtil.getyyyy_MM_dd(new Date())))
  632 +// {
  633 +// return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST);
  634 +// }
  635 +//
  636 +// }
642 637  
643   - }
644 638  
645   -
646 639 /** 验证产检券是否可用 可用就改为已使用状态 */
647 640 if (StringUtils.isNotBlank(excAddRequest.getCouponCode()) && excAddRequest.getCouponType() != null) {
648 641 stopWatch.start("couponService.validate");
... ... @@ -1198,20 +1191,13 @@
1198 1191 // }
1199 1192  
1200 1193  
1201   -// try {
1202   -// //处方计划
1203   -// if (excAddRequest.getNextCheckTime() != null) {
1204   -// saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()), patients);
1205   -// }
1206   -// } catch (Exception e) {
1207   -// }
1208   -// try {
1209   -// //处方计划
1210   -// if (excAddRequest.getCheckTime() != null) {
1211   -// saveCheckActual(DateUtil.parseYMD(excAddRequest.getCheckTime()), patients);
1212   -// }
1213   -// } catch (Exception e) {
1214   -// }
  1194 + try {
  1195 + //处方计划
  1196 + if (excAddRequest.getNextCheckTime() != null) {
  1197 + saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()), patients,excAddRequest.getConfigItemId(),antExChuModel.getId(),hospitalId);
  1198 + }
  1199 + } catch (Exception e) {
  1200 + }
1215 1201  
1216 1202 try {
1217 1203 if (excAddRequest.getNextCheckTime() != null) {
... ... @@ -1421,24 +1407,23 @@
1421 1407 return null;
1422 1408 }
1423 1409  
1424   -// public void saveCheckItem(Date nextCheckTime, Patients patients) {
1425   -// List<CheckItemConfig> itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(patients.getHospitalId())), CheckItemConfig.class);
1426   -// if (CollectionUtils.isNotEmpty(itemConfigs)) {
1427   -// for (CheckItemConfig checkItemConfig : itemConfigs) {
1428   -// //末次月经加一天的原因是 列表中展示的孕周是不包含末次月经那天,计算周数所以也要不包含末次月经当天
1429   -// int currentWeek = DateUtil.getWeek(DateUtil.addDay(patients.getLastMenses(), 1), nextCheckTime);
1430   -// if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek) {
1431   -// CheckItemOrder order = new CheckItemOrder();
1432   -// order.setCreated(new Date());
1433   -// order.setHospitalId(patients.getHospitalId());
1434   -// order.setNextCheckTime(nextCheckTime);
1435   -// order.setItemId(checkItemConfig.getId());
1436   -// order.setPatientId(patients.getId());
1437   -// mongoTemplate.save(order);
1438   -// }
1439   -// }
1440   -// }
1441   -// }
  1410 + public void saveCheckItem(Date nextCheckTime, Patients patients,String checkItems,String checkId,String hospitalId) {
  1411 + if (StringUtils.isNotEmpty(checkItems)) {
  1412 + String[] arrs = checkItems.split(",");
  1413 + for (String id : arrs)
  1414 + {
  1415 + CheckItemOrder order = new CheckItemOrder();
  1416 + order.setCreated(new Date());
  1417 + order.setHospitalId(hospitalId);
  1418 + order.setNextCheckTime(nextCheckTime);
  1419 + order.setItemId(id);
  1420 + order.setCheckId(checkId);
  1421 + order.setPatientId(patients.getId());
  1422 + mongoTemplate.save(order);
  1423 + }
  1424 +
  1425 + }
  1426 + }
1442 1427 //
1443 1428 //
1444 1429 // public void saveCheckActual(Date checkTime, Patients patients) {