diff --git a/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManage.java b/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManage.java index b767067..73364bf 100644 --- a/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManage.java +++ b/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManage.java @@ -11,10 +11,19 @@ public class CheckItemManage { private String affiliateId; private String checkItemInfoName; private Integer enable; + private Integer type; private Date modified; private Date created; + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + public Date getCreated() { return created; } diff --git a/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManageQuery.java b/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManageQuery.java index 5186b92..0297d50 100644 --- a/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManageQuery.java +++ b/platform-biz-service/src/main/java/com/lyms/platform/permission/model/CheckItemManageQuery.java @@ -5,6 +5,15 @@ import com.lyms.platform.common.dao.BaseQuery; public class CheckItemManageQuery extends BaseQuery { private Integer id; private String affiliateId; + private Integer type; + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } public Integer getId() { return id; diff --git a/platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItemManage.xml b/platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItemManage.xml index 8274b8f..45fc151 100644 --- a/platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItemManage.xml +++ b/platform-biz-service/src/main/resources/mainOrm/master/MasterCheckItemManage.xml @@ -8,22 +8,23 @@ + SELECT LAST_INSERT_ID() - INSERT INTO lyms_checkitem(startweek,endweek,checkItemInfoId,affiliate,modified,created) - VALUES(#{startWeek},#{endWeek},#{checkItemInfoId},#{affiliateId},#{modified},#{created}) + INSERT INTO lyms_checkitem(startweek,endweek,checkItemInfoId,affiliate,modified,created,type) + VALUES(#{startWeek},#{endWeek},#{checkItemInfoId},#{affiliateId},#{modified},#{created},#{type}) @@ -46,6 +47,9 @@ affiliate=#{affiliateId,jdbcType=VARCHAR}, + + type=#{type,jdbcType=INTEGER}, + modified=#{modified}, @@ -65,11 +69,14 @@ diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemOrder.java b/platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemOrder.java index 6e83e2b..c89ad0b 100644 --- a/platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemOrder.java +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/CheckItemOrder.java @@ -21,6 +21,15 @@ public class CheckItemOrder extends BaseModel { private Date nextCheckTime; private String hospitalId; private Date created; + private String checkId; + + public String getCheckId() { + return checkId; + } + + public void setCheckId(String checkId) { + this.checkId = checkId; + } public String getHospitalId() { return hospitalId; diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CheckItemManageController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CheckItemManageController.java index 86a4b9e..6d97378 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CheckItemManageController.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CheckItemManageController.java @@ -35,15 +35,18 @@ public class CheckItemManageController extends BaseController { /** * 查询展示项 + * type 类型 1孕妇 2儿童 */ @RequestMapping(value = "/getCheckItemManageList", method = RequestMethod.GET) @ResponseBody public FrontEndResult getCheckItemManageList(@RequestParam(value = "affiliateId") String affiliateId, @RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "type", required = false) Integer type, @RequestParam(value = "limit", required = false) Integer limit) { CheckItemManageQuery checkItemManageQuery = new CheckItemManageQuery(); checkItemManageQuery.setNeed("true"); checkItemManageQuery.setSort("startweek asc"); + checkItemManageQuery.setType(type); checkItemManageQuery.setPage(page); checkItemManageQuery.setLimit(limit); checkItemManageQuery.setAffiliateId(affiliateId); @@ -109,6 +112,7 @@ public class CheckItemManageController extends BaseController { @RequestParam(value = "startweek") Integer startweek, @RequestParam(value = "endweek") Integer endweek, @RequestParam(value = "checkItemInfoId") String checkItemInfoId, + @RequestParam(value = "type") Integer type, @RequestParam(value = "affiliateId") String affiliateId) { if (null == startweek || null == endweek || StringUtils.isEmpty(checkItemInfoId) || StringUtils.isEmpty(affiliateId)) { ResultUtils.buildParameterErrorResultAndWrite(response, "请填写必须项!"); @@ -139,6 +143,7 @@ public class CheckItemManageController extends BaseController { } if (end && start) { CheckItemManage checkItemManage = new CheckItemManage(); + checkItemManage.setType(type); checkItemManage.setStartWeek(startweek); checkItemManage.setEndWeek(endweek); checkItemManage.setCheckItemInfoId(checkItemInfoId); diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java index 52983c9..1193b43 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntExRecordFacade.java @@ -18,9 +18,11 @@ import com.lyms.platform.operate.web.utils.ResolveUtils; import com.lyms.platform.operate.web.utils.UnitConstants; import com.lyms.platform.operate.web.utils.UnitUtils; import com.lyms.platform.operate.web.worker.AntExRecordWorker; +import com.lyms.platform.permission.model.CheckItem; import com.lyms.platform.permission.model.Organization; import com.lyms.platform.permission.model.OrganizationQuery; import com.lyms.platform.permission.model.Users; +import com.lyms.platform.permission.service.CheckItemService; import com.lyms.platform.permission.service.OrganizationService; import com.lyms.platform.permission.service.UsersService; import com.lyms.platform.permission.service.impl.MeasureDataInfoServiceImpl; @@ -102,7 +104,8 @@ public class AntExRecordFacade { private DzfyHisService dzfyHisService; @Autowired - private MeasureDataInfoServiceImpl measureDataInfoService; + private CheckItemService checkItemService; + /** * 组合查询请求 @@ -1957,13 +1960,21 @@ public class AntExRecordFacade { long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemOrder.class); data.put("allCount", String.valueOf(count)); - List itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(hospitalId)), CheckItemConfig.class); - if (CollectionUtils.isNotEmpty(itemConfigs)) { + Map param = new HashMap(); + param.put("type",null); + param.put("hospitalId",hospitalId); + List checkItems = checkItemService.getCheckItemList(param); + if (CollectionUtils.isNotEmpty(checkItems)) { List list = new ArrayList<>(); - for (CheckItemConfig item : itemConfigs) { - 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); + for (CheckItem item : checkItems) { + 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); + if (itemCount == 0) + { + continue; + } Map map = new HashMap<>(); - map.put("itemName", item.getName()); + map.put("itemName", item.getProject()); map.put("itemCount", String.valueOf(itemCount)); list.add(map); } @@ -1981,21 +1992,27 @@ public class AntExRecordFacade { String[] arrs = checkTime.split(" - "); Date start = DateUtil.parseYMD(arrs[0]); Date end = DateUtil.parseYMD(arrs[1]); - long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("checkTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemActual.class); + long count = mongoTemplate.count(Query.query(Criteria.where("hospitalId").is(hospitalId).and("nextCheckTime").gte(DateUtil.getDayFirstSecond(start)).lte(DateUtil.getDayLastSecond(end))), CheckItemOrder.class); data.put("allCount", String.valueOf(count)); - List itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(hospitalId)), CheckItemConfig.class); - if (CollectionUtils.isNotEmpty(itemConfigs)) { + Map param = new HashMap(); + param.put("type",null); + param.put("hospitalId",hospitalId); + List checkItems = checkItemService.getCheckItemList(param); + if (CollectionUtils.isNotEmpty(checkItems)) { List list = new ArrayList<>(); - for (CheckItemConfig item : itemConfigs) { - 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); + for (CheckItem item : checkItems) { + 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); + if (itemCount == 0) + { + continue; + } Map map = new HashMap<>(); - map.put("itemName", item.getName()); + map.put("itemName", item.getProject()); map.put("itemCount", String.valueOf(itemCount)); - 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); + map.put("actualCount", "0"); list.add(map); - - map.put("actualCount", String.valueOf(actualCount)); } data.put("itemList", list); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java index f0e3710..5bf9a57 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java @@ -313,12 +313,12 @@ public class AntenatalExaminationFacade { String hospitalId = autoMatchFacade.getHospitalId(userId); //秦皇岛市山海关人民医院 零时处理 - if (StringUtils.isNotEmpty(antExAddRequest.getCheckDate()) && "1000000004".equals(hospitalId)) { - if (!antExAddRequest.getCheckDate().equals(DateUtil.getyyyy_MM_dd(new Date()))) - { - return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); - } - } +// if (StringUtils.isNotEmpty(antExAddRequest.getCheckDate()) && "1000000004".equals(hospitalId)) { +// if (!antExAddRequest.getCheckDate().equals(DateUtil.getyyyy_MM_dd(new Date()))) +// { +// return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); +// } +// } AntenatalExaminationModel model = antExAddRequest.convertToDataModel(); //表示区域的 @@ -527,26 +527,19 @@ public class AntenatalExaminationFacade { // zcPrenatalService.saveAntexFu(antExamModel); // } -// try { -// //处方计划 -// if (antExamModel.getNextCheckTime() != null) { -// saveCheckItem(antExamModel.getNextCheckTime(), patients); -// } -// } catch (Exception e) { -// e.printStackTrace(); -// } -// try { -// //处方计划 -// if (antExamModel.getCheckDate() != null) { -// saveCheckActual(antExamModel.getCheckDate(), patients); -// } -// } catch (Exception e) { -// e.printStackTrace(); -// } - try { //处方计划 if (antExamModel.getNextCheckTime() != null) { + saveCheckItem(antExamModel.getNextCheckTime(), patients,antExAddRequest.getConfigItemId(),antExamModel.getId(),hospitalId); + } + } catch (Exception e) { + e.printStackTrace(); + } + + + try { + //追访统计 + if (antExamModel.getNextCheckTime() != null) { patients = patientsService.findOnePatientById(antExamModel.getParentId()); updateTrackCount(antExamModel.getCheckDate(), antExamModel.getNextCheckTime(), patients); } @@ -633,14 +626,14 @@ public class AntenatalExaminationFacade { final String hospitalId = autoMatchFacade.getHospitalId(userId); - //秦皇岛市山海关人民医院 零时处理 - if (StringUtils.isNotEmpty(excAddRequest.getCheckTime()) && "1000000004".equals(hospitalId)) { - if (!excAddRequest.getCheckTime().equals(DateUtil.getyyyy_MM_dd(new Date()))) - { - return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); - } - - } +// //秦皇岛市山海关人民医院 零时处理 +// if (StringUtils.isNotEmpty(excAddRequest.getCheckTime()) && "1000000004".equals(hospitalId)) { +// if (!excAddRequest.getCheckTime().equals(DateUtil.getyyyy_MM_dd(new Date()))) +// { +// return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); +// } +// +// } /** 验证产检券是否可用 可用就改为已使用状态 */ @@ -1198,20 +1191,13 @@ public class AntenatalExaminationFacade { // } -// try { -// //处方计划 -// if (excAddRequest.getNextCheckTime() != null) { -// saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()), patients); -// } -// } catch (Exception e) { -// } -// try { -// //处方计划 -// if (excAddRequest.getCheckTime() != null) { -// saveCheckActual(DateUtil.parseYMD(excAddRequest.getCheckTime()), patients); -// } -// } catch (Exception e) { -// } + try { + //处方计划 + if (excAddRequest.getNextCheckTime() != null) { + saveCheckItem(DateUtil.parseYMD(excAddRequest.getNextCheckTime()), patients,excAddRequest.getConfigItemId(),antExChuModel.getId(),hospitalId); + } + } catch (Exception e) { + } try { if (excAddRequest.getNextCheckTime() != null) { @@ -1421,24 +1407,23 @@ public class AntenatalExaminationFacade { return null; } -// public void saveCheckItem(Date nextCheckTime, Patients patients) { -// List itemConfigs = mongoTemplate.find(Query.query(Criteria.where("hospitalId").is(patients.getHospitalId())), CheckItemConfig.class); -// if (CollectionUtils.isNotEmpty(itemConfigs)) { -// for (CheckItemConfig checkItemConfig : itemConfigs) { -// //末次月经加一天的原因是 列表中展示的孕周是不包含末次月经那天,计算周数所以也要不包含末次月经当天 -// int currentWeek = DateUtil.getWeek(DateUtil.addDay(patients.getLastMenses(), 1), nextCheckTime); -// if (checkItemConfig.getStartWeek() <= currentWeek && checkItemConfig.getEndWeek() >= currentWeek) { -// CheckItemOrder order = new CheckItemOrder(); -// order.setCreated(new Date()); -// order.setHospitalId(patients.getHospitalId()); -// order.setNextCheckTime(nextCheckTime); -// order.setItemId(checkItemConfig.getId()); -// order.setPatientId(patients.getId()); -// mongoTemplate.save(order); -// } -// } -// } -// } + public void saveCheckItem(Date nextCheckTime, Patients patients,String checkItems,String checkId,String hospitalId) { + if (StringUtils.isNotEmpty(checkItems)) { + String[] arrs = checkItems.split(","); + for (String id : arrs) + { + CheckItemOrder order = new CheckItemOrder(); + order.setCreated(new Date()); + order.setHospitalId(hospitalId); + order.setNextCheckTime(nextCheckTime); + order.setItemId(id); + order.setCheckId(checkId); + order.setPatientId(patients.getId()); + mongoTemplate.save(order); + } + + } + } // // // public void saveCheckActual(Date checkTime, Patients patients) {