Commit fb87c941cb4f6c29fa23dbf2468cdd7351608218

Authored by hujiaqi
1 parent 4b3bed9ddb

分娩管理基础查询

Showing 10 changed files with 449 additions and 3 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IMatDeliverDao.java View file @ fb87c94
... ... @@ -59,5 +59,8 @@
59 59 */
60 60 MaternalDeliverModel getById(String id);
61 61  
  62 + int count(MongoQuery mongoQuery);
  63 +
  64 + List<MaternalDeliverModel> pageQuery(MongoQuery mongoQuery);
62 65 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/MatDeliverDaoImpl.java View file @ fb87c94
... ... @@ -60,5 +60,15 @@
60 60 public MaternalDeliverModel getById(String id) {
61 61 return findById(id);
62 62 }
  63 +
  64 + @Override
  65 + public int count(MongoQuery mongoQuery) {
  66 + return (int) super.count(mongoQuery.convertToMongoQuery());
  67 + }
  68 +
  69 + @Override
  70 + public List<MaternalDeliverModel> pageQuery(MongoQuery mongoQuery) {
  71 + return super.find(mongoQuery.convertToMongoQuery());
  72 + }
63 73 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MatDeliverService.java View file @ fb87c94
1 1 package com.lyms.platform.biz.service;
2 2  
3 3 import com.lyms.platform.biz.dal.IMatDeliverDao;
  4 +import com.lyms.platform.common.dao.operator.MongoQuery;
4 5 import com.lyms.platform.common.enums.YnEnums;
5 6 import com.lyms.platform.pojo.MaternalDeliverModel;
6 7 import com.lyms.platform.query.MatDeliverQuery;
... ... @@ -52,6 +53,13 @@
52 53 }
53 54 public MaternalDeliverModel getOneMatDeliver(String id){
54 55 return iMatDeliverDao.getById(id);
  56 + }
  57 +
  58 + public List<MaternalDeliverModel> pageQuery(MatDeliverQuery matDeliverQuery) {
  59 + MongoQuery mongoQuery = matDeliverQuery.convertToQuery();
  60 + matDeliverQuery.mysqlBuild(iMatDeliverDao.count(matDeliverQuery.convertToQuery()));
  61 + mongoQuery.start(matDeliverQuery.getOffset()).end(matDeliverQuery.getLimit());
  62 + return iMatDeliverDao.pageQuery(mongoQuery.addOrder(Sort.Direction.DESC, "dueDate1"));
55 63 }
56 64 }
platform-dal/src/main/java/com/lyms/platform/query/MatDeliverQuery.java View file @ fb87c94
... ... @@ -8,6 +8,7 @@
8 8 import org.springframework.data.mongodb.core.query.Criteria;
9 9  
10 10 import java.util.Date;
  11 +import java.util.List;
11 12  
12 13 /**
13 14 * 产妇分娩记录查询
... ... @@ -17,6 +18,8 @@
17 18 public class MatDeliverQuery extends BaseQuery implements IConvertToNativeQuery {
18 19 private String id;
19 20 private String parentId;
  21 + private List<String> parentIdList;
  22 + private String deliveryMode;
20 23 private String vcCardNo;
21 24 private String cardNo;
22 25 private String pid;
... ... @@ -115,6 +118,12 @@
115 118 if (null != parentId) {
116 119 condition = condition.and("parentId", parentId, MongoOper.IS);
117 120 }
  121 + if (null != parentIdList) {
  122 + condition = condition.and("parentId", parentIdList, MongoOper.IN);
  123 + }
  124 + if(null != deliveryMode){
  125 + condition = condition.and("deliveryMode", deliveryMode, MongoOper.IS);
  126 + }
118 127 if (null != hospitalId) {
119 128 condition = condition.and("hospitalId", hospitalId, MongoOper.IS);
120 129 }
... ... @@ -190,6 +199,22 @@
190 199  
191 200 public void setYn(Integer yn) {
192 201 this.yn = yn;
  202 + }
  203 +
  204 + public List<String> getParentIdList() {
  205 + return parentIdList;
  206 + }
  207 +
  208 + public void setParentIdList(List<String> parentIdList) {
  209 + this.parentIdList = parentIdList;
  210 + }
  211 +
  212 + public String getDeliveryMode() {
  213 + return deliveryMode;
  214 + }
  215 +
  216 + public void setDeliveryMode(String deliveryMode) {
  217 + this.deliveryMode = deliveryMode;
193 218 }
194 219 }
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ fb87c94
... ... @@ -23,6 +23,8 @@
23 23  
24 24 private String id;
25 25  
  26 + private String husbandPhone;
  27 +
26 28 /**
27 29 * 关键字
28 30 */
... ... @@ -1110,6 +1112,14 @@
1110 1112  
1111 1113 public void setVcCardNo(String vcCardNo) {
1112 1114 this.vcCardNo = vcCardNo;
  1115 + }
  1116 +
  1117 + public String getHusbandPhone() {
  1118 + return husbandPhone;
  1119 + }
  1120 +
  1121 + public void setHusbandPhone(String husbandPhone) {
  1122 + this.husbandPhone = husbandPhone;
1113 1123 }
1114 1124 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java View file @ fb87c94
... ... @@ -4,10 +4,14 @@
4 4 import com.lyms.platform.common.base.BaseController;
5 5 import com.lyms.platform.common.base.LoginContext;
6 6 import com.lyms.platform.common.constants.ErrorCodeConstants;
  7 +import com.lyms.platform.common.result.BaseListResponse;
7 8 import com.lyms.platform.common.result.BaseResponse;
  9 +import com.lyms.platform.common.utils.ExceptionUtils;
8 10 import com.lyms.platform.operate.web.facade.MatDeliverFacade;
  11 +import com.lyms.platform.operate.web.request.ChildbirthManagerRequest;
9 12 import com.lyms.platform.operate.web.request.MatDeliverAddRequest;
10 13 import com.lyms.platform.operate.web.request.MatDeliverQueryRequest;
  14 +import com.lyms.platform.operate.web.result.ChildbirthManagerResult;
11 15 import org.apache.commons.lang.StringUtils;
12 16 import org.springframework.beans.factory.annotation.Autowired;
13 17 import org.springframework.stereotype.Controller;
... ... @@ -96,5 +100,31 @@
96 100 public BaseResponse getEnums(){
97 101 return matDeliverFacade.getEnums();
98 102 }
  103 +
  104 + /**
  105 + * @auther HuJiaqi
  106 + * @createTime 2016年12月07日 14时22分
  107 + * @discription 分娩管理
  108 + */
  109 + @TokenRequired
  110 + @ResponseBody
  111 + @RequestMapping(value = "childbirthManager", method = RequestMethod.POST)
  112 + public BaseListResponse childbirthManager(HttpServletRequest httpServletRequest, @RequestBody ChildbirthManagerRequest childbirthManagerRequest) {
  113 + BaseListResponse baseListResponse;
  114 + try {
  115 + childbirthManagerRequest.setOperatorId(((LoginContext) httpServletRequest.getAttribute("loginContext")).getId());
  116 + ChildbirthManagerResult childbirthManagerResult = matDeliverFacade.childbirthManager(childbirthManagerRequest);
  117 + if (childbirthManagerResult.getErrorcode() != ErrorCodeConstants.SUCCESS) {
  118 + baseListResponse = new BaseListResponse().setErrorcode(childbirthManagerResult.getErrorcode()).setErrormsg(childbirthManagerResult.getErrormsg());
  119 + return baseListResponse;
  120 + }
  121 + baseListResponse = new BaseListResponse().setErrorcode(childbirthManagerResult.getErrorcode()).setErrormsg(childbirthManagerResult.getErrormsg()).setData(childbirthManagerResult.getData()).setPageInfo(childbirthManagerResult.getPageInfo());
  122 + } catch (Exception e) {
  123 + baseListResponse = new BaseListResponse().setErrorcode(ErrorCodeConstants.SYSTEM_ERROR).setErrormsg(ErrorCodeConstants.SYSTEM_ERROR_DESCRIPTION);
  124 + ExceptionUtils.catchException(e, "childbirthManager异常");
  125 + }
  126 + return baseListResponse;
  127 + }
  128 +
99 129 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java View file @ fb87c94
... ... @@ -5,13 +5,13 @@
5 5 import com.lyms.platform.common.enums.*;
6 6 import com.lyms.platform.common.result.BaseObjectResponse;
7 7 import com.lyms.platform.common.result.BaseResponse;
  8 +import com.lyms.platform.common.utils.BeanUtils;
8 9 import com.lyms.platform.common.utils.DateUtil;
9 10 import com.lyms.platform.common.utils.ExceptionUtils;
  11 +import com.lyms.platform.operate.web.request.ChildbirthManagerRequest;
10 12 import com.lyms.platform.operate.web.request.MatDeliverAddRequest;
11 13 import com.lyms.platform.operate.web.request.MatDeliverQueryRequest;
12   -import com.lyms.platform.operate.web.result.HighScoreResult;
13   -import com.lyms.platform.operate.web.result.MatDeliverListResult;
14   -import com.lyms.platform.operate.web.result.MaternalDeliverResult;
  14 +import com.lyms.platform.operate.web.result.*;
15 15 import com.lyms.platform.permission.model.Organization;
16 16 import com.lyms.platform.permission.model.Users;
17 17 import com.lyms.platform.permission.service.OrganizationService;
... ... @@ -914,6 +914,73 @@
914 914 list.add(resultMap);
915 915 }
916 916 return list;
  917 + }
  918 +
  919 + public ChildbirthManagerResult childbirthManager(ChildbirthManagerRequest childbirthManagerRequest) {
  920 + ChildbirthManagerResult childbirthManagerResult = new ChildbirthManagerResult();
  921 +
  922 + PatientsQuery patientsQuery = new PatientsQuery();
  923 +
  924 + patientsQuery.setFmDateStart(DateUtil.parseYMD(childbirthManagerRequest.getStartDate()));
  925 + patientsQuery.setFmDateEnd(DateUtil.parseYMD(childbirthManagerRequest.getEndDate()));
  926 + patientsQuery.setName(childbirthManagerRequest.getUserName());
  927 + patientsQuery.setYn(YnEnums.YES.getId());
  928 + patientsQuery.setType(3);
  929 + // patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(childbirthManagerRequest.getOperatorId()));
  930 + patientsQuery.setCardNo(childbirthManagerRequest.getCardNo());
  931 + patientsQuery.setPhone(childbirthManagerRequest.getPhone());
  932 + patientsQuery.setHusbandPhone(childbirthManagerRequest.getHusbandPhone());
  933 + // 分娩方式去另外一张表查
  934 + List<Patients> patientsList = patientsService.queryPatient(patientsQuery);
  935 + List<String> parentIdList = new ArrayList<>();
  936 + if (patientsList == null || patientsList.size() == 0) {
  937 + // 没有查到,直接抛出
  938 + childbirthManagerResult.setErrorcode(ErrorCodeConstants.SUCCESS);
  939 + childbirthManagerResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION);
  940 + return childbirthManagerResult;
  941 + }
  942 + for (Patients patients : patientsList) {
  943 + parentIdList.add(patients.getId());
  944 + }
  945 +
  946 + MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
  947 + matDeliverQuery.setDeliveryMode(childbirthManagerRequest.getDeliveryMode());
  948 + matDeliverQuery.setParentIdList(parentIdList);
  949 + matDeliverQuery.setPage(childbirthManagerRequest.getPage());
  950 + matDeliverQuery.setLimit(childbirthManagerRequest.getLimit());
  951 + List<MaternalDeliverModel> maternalDeliverModelList = matDeliverService.pageQuery(matDeliverQuery);
  952 + if (maternalDeliverModelList == null || maternalDeliverModelList.size() == 0) {
  953 + // 没有查到,直接抛出
  954 + childbirthManagerResult.setErrorcode(ErrorCodeConstants.SUCCESS);
  955 + childbirthManagerResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION);
  956 + return childbirthManagerResult;
  957 + }
  958 +
  959 + List<ChildbirthManagerQueryModel> childbirthManagerQueryModelList = new ArrayList<>();
  960 + for (MaternalDeliverModel maternalDeliverModel : maternalDeliverModelList) {
  961 + for (Patients patients : patientsList) {
  962 + if (maternalDeliverModel.getParentId().equals(patients.getId())) {
  963 + // 这里分好了组,开始往结果集里面加数据
  964 + ChildbirthManagerQueryModel childbirthManagerQueryModel = new ChildbirthManagerQueryModel();
  965 + BeanUtils.copy(patients, childbirthManagerQueryModel);
  966 + BeanUtils.copy(maternalDeliverModel, childbirthManagerQueryModel);
  967 + try {
  968 + childbirthManagerQueryModel.setDeliverDoctor(usersService.getUsers(Integer.valueOf(maternalDeliverModel.getDeliverDoctor())).getName());
  969 + } catch (Exception e) {
  970 + // 什么都不干
  971 + }
  972 + childbirthManagerQueryModel.setAge(DateUtil.getAge(patients.getBirth()));
  973 + childbirthManagerQueryModelList.add(childbirthManagerQueryModel);
  974 + }
  975 + }
  976 + }
  977 +
  978 + childbirthManagerResult.setData(childbirthManagerQueryModelList);
  979 + childbirthManagerResult.setPageInfo(matDeliverQuery.getPageInfo());
  980 + childbirthManagerResult.setErrorcode(ErrorCodeConstants.SUCCESS);
  981 + childbirthManagerResult.setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION);
  982 + return childbirthManagerResult;
  983 +
917 984 }
918 985 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ChildbirthManagerRequest.java View file @ fb87c94
  1 +package com.lyms.platform.operate.web.request;
  2 +
  3 +/**
  4 + * @auther HuJiaqi
  5 + * @createTime 2016年12月07日 14时07分
  6 + * @discription
  7 + */
  8 +public class ChildbirthManagerRequest extends BasePageQueryRequest {
  9 +
  10 + /**
  11 + * @auther HuJiaqi
  12 + * @createTime 2016年12月07日 14时13分
  13 + * @discription 产妇姓名
  14 + */
  15 + private String userName;
  16 +
  17 + /**
  18 + * @auther HuJiaqi
  19 + * @createTime 2016年12月07日 14时13分
  20 + * @discription 证件号
  21 + */
  22 + private String cardNo;
  23 +
  24 + /**
  25 + * @auther HuJiaqi
  26 + * @createTime 2016年12月07日 14时13分
  27 + * @discription 联系方式
  28 + */
  29 + private String phone;
  30 +
  31 + private String startDate;
  32 +
  33 + private String endDate;
  34 +
  35 + /**
  36 + * @auther HuJiaqi
  37 + * @createTime 2016年12月07日 14时14分
  38 + * @discription 分娩方式
  39 + */
  40 + private String DeliveryMode;
  41 +
  42 + /**
  43 + * @auther HuJiaqi
  44 + * @createTime 2016年12月07日 15时54分
  45 + * @discription 丈夫联系方式
  46 + */
  47 + private String husbandPhone;
  48 +
  49 + // TODO 高帆说条码号暂时先不管
  50 +
  51 + private Integer operatorId;
  52 +
  53 + public String getUserName() {
  54 + return userName;
  55 + }
  56 +
  57 + public void setUserName(String userName) {
  58 + this.userName = userName;
  59 + }
  60 +
  61 + public String getCardNo() {
  62 + return cardNo;
  63 + }
  64 +
  65 + public void setCardNo(String cardNo) {
  66 + this.cardNo = cardNo;
  67 + }
  68 +
  69 + public String getPhone() {
  70 + return phone;
  71 + }
  72 +
  73 + public void setPhone(String phone) {
  74 + this.phone = phone;
  75 + }
  76 +
  77 + public String getStartDate() {
  78 + return startDate;
  79 + }
  80 +
  81 + public void setStartDate(String startDate) {
  82 + this.startDate = startDate;
  83 + }
  84 +
  85 + public String getEndDate() {
  86 + return endDate;
  87 + }
  88 +
  89 + public void setEndDate(String endDate) {
  90 + this.endDate = endDate;
  91 + }
  92 +
  93 + public String getDeliveryMode() {
  94 + return DeliveryMode;
  95 + }
  96 +
  97 + public void setDeliveryMode(String deliveryMode) {
  98 + DeliveryMode = deliveryMode;
  99 + }
  100 +
  101 + public Integer getOperatorId() {
  102 + return operatorId;
  103 + }
  104 +
  105 + public void setOperatorId(Integer operatorId) {
  106 + this.operatorId = operatorId;
  107 + }
  108 +
  109 + public String getHusbandPhone() {
  110 + return husbandPhone;
  111 + }
  112 +
  113 + public void setHusbandPhone(String husbandPhone) {
  114 + this.husbandPhone = husbandPhone;
  115 + }
  116 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ChildbirthManagerQueryModel.java View file @ fb87c94
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +/**
  4 + * @auther HuJiaqi
  5 + * @createTime 2016年12月07日 15时51分
  6 + * @discription
  7 + */
  8 +public class ChildbirthManagerQueryModel {
  9 +
  10 + /**
  11 + * @auther HuJiaqi
  12 + * @createTime 2016年12月07日 16时36分
  13 + * @discription 分娩日期
  14 + */
  15 + private String dueDate;
  16 +
  17 + /**
  18 + * @auther HuJiaqi
  19 + * @createTime 2016年12月07日 16时36分
  20 + * @discription 姓名
  21 + */
  22 + private String username;
  23 +
  24 + /**
  25 + * @auther HuJiaqi
  26 + * @createTime 2016年12月07日 16时36分
  27 + * @discription 年龄
  28 + */
  29 + private Integer age;
  30 +
  31 + /**
  32 + * @auther HuJiaqi
  33 + * @createTime 2016年12月07日 16时37分
  34 + * @discription 证件号
  35 + */
  36 + private String cardNo;
  37 +
  38 + /**
  39 + * @auther HuJiaqi
  40 + * @createTime 2016年12月07日 16时37分
  41 + * @discription 分娩孕周
  42 + */
  43 + private String dueWeek;
  44 +
  45 + /**
  46 + * @auther HuJiaqi
  47 + * @createTime 2016年12月07日 16时38分
  48 + * @discription 分娩方式
  49 + */
  50 + private String deliveryMode;
  51 +
  52 + /**
  53 + * @auther HuJiaqi
  54 + * @createTime 2016年12月07日 16时38分
  55 + * @discription 产妇情况
  56 + */
  57 + private String maternalInfo;
  58 +
  59 + /**
  60 + * @auther HuJiaqi
  61 + * @createTime 2016年12月07日 16时38分
  62 + * @discription 胎数
  63 + */
  64 + private Integer tireNumber;
  65 +
  66 + /**
  67 + * @auther HuJiaqi
  68 + * @createTime 2016年12月07日 16时39分
  69 + * @discription 活产数
  70 + */
  71 + // TODO 暂未确定
  72 +
  73 + /**
  74 + * @auther HuJiaqi
  75 + * @createTime 2016年12月07日 16时40分
  76 + * @discription 接生医生
  77 + */
  78 + private String deliverDoctor;
  79 +
  80 + /**
  81 + * @auther HuJiaqi
  82 + * @createTime 2016年12月07日 16时41分
  83 + * @discription 联系方式
  84 + */
  85 + private String phone;
  86 +
  87 + public String getDueDate() {
  88 + return dueDate;
  89 + }
  90 +
  91 + public void setDueDate(String dueDate) {
  92 + this.dueDate = dueDate;
  93 + }
  94 +
  95 + public String getUsername() {
  96 + return username;
  97 + }
  98 +
  99 + public void setUsername(String username) {
  100 + this.username = username;
  101 + }
  102 +
  103 + public Integer getAge() {
  104 + return age;
  105 + }
  106 +
  107 + public void setAge(Integer age) {
  108 + this.age = age;
  109 + }
  110 +
  111 + public String getCardNo() {
  112 + return cardNo;
  113 + }
  114 +
  115 + public void setCardNo(String cardNo) {
  116 + this.cardNo = cardNo;
  117 + }
  118 +
  119 + public String getDueWeek() {
  120 + return dueWeek;
  121 + }
  122 +
  123 + public void setDueWeek(String dueWeek) {
  124 + this.dueWeek = dueWeek;
  125 + }
  126 +
  127 + public String getDeliveryMode() {
  128 + return deliveryMode;
  129 + }
  130 +
  131 + public void setDeliveryMode(String deliveryMode) {
  132 + this.deliveryMode = deliveryMode;
  133 + }
  134 +
  135 + public String getMaternalInfo() {
  136 + return maternalInfo;
  137 + }
  138 +
  139 + public void setMaternalInfo(String maternalInfo) {
  140 + this.maternalInfo = maternalInfo;
  141 + }
  142 +
  143 + public Integer getTireNumber() {
  144 + return tireNumber;
  145 + }
  146 +
  147 + public void setTireNumber(Integer tireNumber) {
  148 + this.tireNumber = tireNumber;
  149 + }
  150 +
  151 + public String getDeliverDoctor() {
  152 + return deliverDoctor;
  153 + }
  154 +
  155 + public void setDeliverDoctor(String deliverDoctor) {
  156 + this.deliverDoctor = deliverDoctor;
  157 + }
  158 +
  159 + public String getPhone() {
  160 + return phone;
  161 + }
  162 +
  163 + public void setPhone(String phone) {
  164 + this.phone = phone;
  165 + }
  166 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/ChildbirthManagerResult.java View file @ fb87c94
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +import com.lyms.platform.common.result.BaseListResponse;
  4 +
  5 +/**
  6 + * @auther HuJiaqi
  7 + * @createTime 2016年12月07日 14时08分
  8 + * @discription
  9 + */
  10 +public class ChildbirthManagerResult extends BaseListResponse {
  11 +}