Commit 0e04f5a7030890de0bbfa05ad6396ef621e325e9

Authored by gengxiaokai
1 parent 39809acec7

威海产后观察记录

Showing 7 changed files with 471 additions and 2 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PostpartumRecordsService.java View file @ 0e04f5a
1 1 package com.lyms.platform.biz.service;
2 2  
3 3 import com.lyms.platform.biz.dal.IPostpartumRecordsDao;
  4 +import com.lyms.platform.common.dao.operator.MongoQuery;
  5 +import com.lyms.platform.pojo.PostpartumRecords;
  6 +import com.lyms.platform.query.PostpartumRecordsQuery;
  7 +import org.apache.commons.lang.StringUtils;
4 8 import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.data.domain.Sort;
5 10 import org.springframework.stereotype.Service;
6 11  
  12 +import java.util.List;
  13 +
7 14 /**
8 15 * Created by Administrator on 2019/1/9.
9 16 */
... ... @@ -13,7 +20,14 @@
13 20 @Autowired
14 21 private IPostpartumRecordsDao postpartumRecordsDao;
15 22  
16   -
  23 + public List<PostpartumRecords> getBabySieveQuery(PostpartumRecordsQuery postpartumRecordsQuery){
  24 + MongoQuery query = postpartumRecordsQuery.convertToQuery();
  25 + if (StringUtils.isNotEmpty(postpartumRecordsQuery.getNeed())) {
  26 + postpartumRecordsQuery.mysqlBuild(postpartumRecordsDao.queryPostpartumRecordsCount(query));
  27 + query.start(postpartumRecordsQuery.getOffset()).end(postpartumRecordsQuery.getLimit());
  28 + }
  29 + return postpartumRecordsDao.queryPostpartumRecords(query.addOrder(Sort.Direction.DESC, "created"));
  30 + }
17 31  
18 32 }
platform-dal/src/main/java/com/lyms/platform/pojo/PostpartumRecords.java View file @ 0e04f5a
... ... @@ -21,6 +21,8 @@
21 21 private String created;//创建时间
22 22 private String modified;//修改时间
23 23 private List<Records> records;//记录列表
  24 + private String hospitalId;//医院ID
  25 + private String doctor;//操作医生
24 26  
25 27 public static class Records implements Serializable {
26 28 private static final long serialVersionUID = SerialIdEnum.Records.getCid();
... ... @@ -194,6 +196,22 @@
194 196  
195 197 public void setRecords(List<Records> records) {
196 198 this.records = records;
  199 + }
  200 +
  201 + public String getHospitalId() {
  202 + return hospitalId;
  203 + }
  204 +
  205 + public void setHospitalId(String hospitalId) {
  206 + this.hospitalId = hospitalId;
  207 + }
  208 +
  209 + public String getDoctor() {
  210 + return doctor;
  211 + }
  212 +
  213 + public void setDoctor(String doctor) {
  214 + this.doctor = doctor;
197 215 }
198 216 }
platform-dal/src/main/java/com/lyms/platform/query/PostpartumRecordsQuery.java View file @ 0e04f5a
... ... @@ -13,13 +13,33 @@
13 13 public class PostpartumRecordsQuery extends BaseQuery implements IConvertToNativeQuery {
14 14  
15 15 private String parentId;//孕妇ID
  16 + private String hospitalId;//医院ID
16 17  
17 18 public MongoQuery convertToQuery() {
18 19 MongoCondition condition = MongoCondition.newInstance();
19 20 if(null != parentId){
20 21 condition = condition.and("parentId", parentId, MongoOper.IS);
21 22 }
  23 + if(null !=hospitalId){
  24 + condition = condition.and("hospitalId", hospitalId, MongoOper.IS);
  25 + }
22 26 return condition.toMongoQuery();
  27 + }
  28 +
  29 + public String getParentId() {
  30 + return parentId;
  31 + }
  32 +
  33 + public void setParentId(String parentId) {
  34 + this.parentId = parentId;
  35 + }
  36 +
  37 + public String getHospitalId() {
  38 + return hospitalId;
  39 + }
  40 +
  41 + public void setHospitalId(String hospitalId) {
  42 + this.hospitalId = hospitalId;
23 43 }
24 44 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PostpartumRecordsController.java View file @ 0e04f5a
1 1 package com.lyms.platform.operate.web.controller;
2 2  
  3 +import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.BaseController;
  5 +import com.lyms.platform.common.base.LoginContext;
  6 +import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.operate.web.facade.PostpartumRecordsFacade;
  8 +import com.lyms.platform.operate.web.request.PostpartumRecordsQueryRequest;
  9 +import org.springframework.beans.factory.annotation.Autowired;
3 10 import org.springframework.stereotype.Controller;
  11 +import org.springframework.web.bind.annotation.RequestMapping;
  12 +import org.springframework.web.bind.annotation.RequestMethod;
  13 +import org.springframework.web.bind.annotation.ResponseBody;
4 14  
  15 +import javax.servlet.http.HttpServletRequest;
  16 +import javax.validation.Valid;
  17 +
5 18 /**
6 19 * Created by Administrator on 2019/1/9.
7 20 * 产后观察记录
8 21 */
9 22 @Controller
10   -public class PostpartumRecordsController {
  23 +public class PostpartumRecordsController extends BaseController {
  24 +
  25 + @Autowired
  26 + private PostpartumRecordsFacade postpartumRecordsFacade;
  27 +
  28 +
  29 + @RequestMapping(value = "/postpartumRecords",method = RequestMethod.GET)
  30 + @ResponseBody
  31 + @TokenRequired
  32 + public BaseResponse getPostpartumRecords(@Valid PostpartumRecordsQueryRequest PostpartumRecordsQueryRequest,
  33 + HttpServletRequest request){
  34 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  35 + return postpartumRecordsFacade.queryPostpartumRecords(PostpartumRecordsQueryRequest,loginState.getId());
  36 + }
  37 +
11 38 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PostpartumRecordsFacade.java View file @ 0e04f5a
1 1 package com.lyms.platform.operate.web.facade;
2 2  
  3 +import com.lyms.platform.biz.service.MatDeliverService;
3 4 import com.lyms.platform.biz.service.PatientsService;
4 5 import com.lyms.platform.biz.service.PostpartumRecordsService;
  6 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  7 +import com.lyms.platform.common.enums.YnEnums;
  8 +import com.lyms.platform.common.result.BaseObjectResponse;
  9 +import com.lyms.platform.common.result.BaseResponse;
  10 +import com.lyms.platform.operate.web.request.PostpartumRecordsQueryRequest;
  11 +import com.lyms.platform.operate.web.result.PostpartumRecordsResult;
  12 +import com.lyms.platform.pojo.MaternalDeliverModel;
  13 +import com.lyms.platform.pojo.Patients;
  14 +import com.lyms.platform.pojo.PostpartumRecords;
  15 +import com.lyms.platform.query.MatDeliverQuery;
  16 +import com.lyms.platform.query.PatientsQuery;
  17 +import com.lyms.platform.query.PostpartumRecordsQuery;
  18 +import org.apache.commons.collections.CollectionUtils;
  19 +import org.apache.commons.lang.StringUtils;
5 20 import org.springframework.beans.factory.annotation.Autowired;
6 21 import org.springframework.beans.factory.annotation.Qualifier;
7 22 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
8 23 import org.springframework.stereotype.Component;
9 24  
  25 +import java.util.ArrayList;
  26 +import java.util.List;
  27 +
10 28 /**
11 29 * Created by Administrator on 2019/1/9.
12 30 * 产后观察
13 31  
... ... @@ -20,7 +38,82 @@
20 38 private PatientsService patientsService;
21 39 @Autowired
22 40 private PostpartumRecordsService postpartumRecordsService;
  41 + @Autowired
  42 + private AutoMatchFacade autoMatchFacade;
  43 + @Autowired
  44 + private MatDeliverService matDeliverService;
23 45  
  46 +
  47 + /**
  48 + * 产后观察申请查询接口
  49 + * @param prQueryRequest
  50 + * @param userId
  51 + * @return
  52 + */
  53 + public BaseResponse queryPostpartumRecords(PostpartumRecordsQueryRequest prQueryRequest,Integer userId){
  54 + PostpartumRecordsResult postpartumRecordsResult = new PostpartumRecordsResult();
  55 + String hospital = autoMatchFacade.getHospitalId(userId);
  56 + PostpartumRecordsQuery prQuery = new PostpartumRecordsQuery();
  57 + PatientsQuery patientsQuery = new PatientsQuery();
  58 + if(StringUtils.isNotEmpty(prQueryRequest.getCardNo()) || StringUtils.isNotEmpty(prQueryRequest.getVcCardNo())){
  59 + String parentId = null;
  60 + String maternalDeliverId = null;
  61 + if(prQueryRequest.getCardNo() !=null){
  62 + patientsQuery.setCardNo(prQueryRequest.getCardNo());
  63 + }
  64 + else if(prQueryRequest.getVcCardNo() != null){
  65 + patientsQuery.setVcCardNo(prQueryRequest.getVcCardNo());
  66 + }
  67 + //patientsQuery.setHospitalId(hospital);
  68 + //查询孕妇
  69 + List<Patients> list = patientsService.queryPatient(patientsQuery);
  70 + if(CollectionUtils.isNotEmpty(list)){
  71 + parentId = list.get(0).getId();
  72 +
  73 + MatDeliverQuery matDeliverQuery = new MatDeliverQuery();
  74 + matDeliverQuery.setPid(list.get(0).getPid());
  75 + matDeliverQuery.setYn(YnEnums.YES.getId());
  76 + //查询分娩
  77 + List<MaternalDeliverModel> mdList = matDeliverService.query(matDeliverQuery);
  78 + if(CollectionUtils.isNotEmpty(mdList)){
  79 + prQuery.setParentId(parentId);
  80 + prQuery.setHospitalId(hospital);
  81 + List<PostpartumRecords> prList = postpartumRecordsService.getBabySieveQuery(prQuery);
  82 + if(CollectionUtils.isNotEmpty(prList)){
  83 + postpartumRecordsResult.convertToResult(prList.get(0));
  84 + postpartumRecordsResult.setName(list.get(0).getUsername());
  85 + postpartumRecordsResult.setBhnum(mdList.get(0).getBhNum());
  86 + postpartumRecordsResult.setOneCxl(mdList.get(0).getTotalOneCxl());
  87 + postpartumRecordsResult.setTwoCxl(mdList.get(0).getTotalTwoCxl());
  88 + List<PostpartumRecords.Records> records = prList.get(0).getRecords();
  89 + List recordsList = new ArrayList();
  90 + if(CollectionUtils.isNotEmpty(records)){
  91 + for(PostpartumRecords.Records r : records){
  92 + recordsList.add(postpartumRecordsResult.new Records(r));
  93 + }
  94 + postpartumRecordsResult.setRecords(recordsList);
  95 + }
  96 + }else{
  97 + postpartumRecordsResult.setName(list.get(0).getUsername());
  98 + postpartumRecordsResult.setBhnum(mdList.get(0).getBhNum());
  99 + postpartumRecordsResult.setOneCxl(mdList.get(0).getTotalOneCxl());
  100 + postpartumRecordsResult.setTwoCxl(mdList.get(0).getTotalTwoCxl());
  101 + }
  102 + }else{
  103 + return new BaseObjectResponse().setErrormsg("孕妇未填写分娩记录,不能进行产后观察!").setErrorcode(ErrorCodeConstants.NO_DATA);
  104 + }
  105 +
  106 + }else{
  107 + return new BaseObjectResponse().setErrormsg("孕妇未在本机构建档,不能进行产后观察!").setErrorcode(ErrorCodeConstants.NO_DATA);
  108 + }
  109 +
  110 + }else{
  111 + return new BaseObjectResponse().setErrormsg("请输入查询条件!").setErrorcode(ErrorCodeConstants.PARAMETER_ERROR);
  112 + }
  113 +
  114 +
  115 + return new BaseObjectResponse().setErrormsg("成功!").setErrorcode(ErrorCodeConstants.SUCCESS).setData(postpartumRecordsResult);
  116 + }
24 117  
25 118 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PostpartumRecordsQueryRequest.java View file @ 0e04f5a
  1 +package com.lyms.platform.operate.web.request;
  2 +
  3 +/**
  4 + * 产后观察记录查询模型
  5 + * Created by Administrator on 2019/1/10.
  6 + */
  7 +public class PostpartumRecordsQueryRequest {
  8 +
  9 + private String cardNo;//身份证号
  10 + private String vcCardNo;//就诊卡号
  11 +
  12 + public String getCardNo() {
  13 + return cardNo;
  14 + }
  15 +
  16 + public void setCardNo(String cardNo) {
  17 + this.cardNo = cardNo;
  18 + }
  19 +
  20 + public String getVcCardNo() {
  21 + return vcCardNo;
  22 + }
  23 +
  24 + public void setVcCardNo(String vcCardNo) {
  25 + this.vcCardNo = vcCardNo;
  26 + }
  27 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PostpartumRecordsResult.java View file @ 0e04f5a
  1 +package com.lyms.platform.operate.web.result;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.pojo.PostpartumRecords;
  5 +
  6 +import java.io.Serializable;
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * Created by Administrator on 2019/1/10.
  11 + * 产后观察记录返回模型
  12 + */
  13 +public class PostpartumRecordsResult {
  14 +
  15 + private String id;
  16 + private String parentId;//孕妇ID
  17 + private String maternalDeliverId;//分娩ID
  18 + private String created;//创建时间
  19 + private String modified;//修改时间
  20 + private List<Records> records;//记录列表
  21 + private String hospitalId;//医院ID
  22 + private String doctor;//操作医生
  23 + private String name;//孕妇姓名
  24 + private String bhnum;//住院号
  25 + private String oneCxl;//一小时出血量
  26 + private String twoCxl;//两小时出血量
  27 +
  28 + public class Records implements Serializable {
  29 + private String id;
  30 + private String date;//时间
  31 + private String tw;//体温
  32 + private String xy;//血压
  33 + private String mb;//脉搏
  34 + private String xybhd;//血氧饱和度
  35 + private String gd;//宫底
  36 + private String cxl;//出血量
  37 + private String pgjc;//膀胱检查
  38 + private String hyqk;//会阴情况
  39 + private String nz;//内诊
  40 + private String fz;//附注
  41 + private String qm;//签名
  42 +
  43 + public Records(){
  44 +
  45 + }
  46 +
  47 + public Records(PostpartumRecords.Records record){
  48 + setId(record.getId());
  49 + setDate(record.getDate());
  50 + setTw(record.getTw());
  51 + setXy(record.getXy());
  52 + setMb(record.getMb());
  53 + setXybhd(record.getXybhd());
  54 + setGd(record.getGd());
  55 + setCxl(record.getCxl());
  56 + setPgjc(record.getPgjc());
  57 + setHyqk(record.getHyqk());
  58 + setNz(record.getNz());
  59 + setFz(record.getFz());
  60 + setQm(record.getQm());
  61 + }
  62 +
  63 + public String getId() {
  64 + return id;
  65 + }
  66 +
  67 + public void setId(String id) {
  68 + this.id = id;
  69 + }
  70 +
  71 + public String getDate() {
  72 + return date;
  73 + }
  74 +
  75 + public void setDate(String date) {
  76 + this.date = date;
  77 + }
  78 +
  79 + public String getTw() {
  80 + return tw;
  81 + }
  82 +
  83 + public void setTw(String tw) {
  84 + this.tw = tw;
  85 + }
  86 +
  87 + public String getXy() {
  88 + return xy;
  89 + }
  90 +
  91 + public void setXy(String xy) {
  92 + this.xy = xy;
  93 + }
  94 +
  95 + public String getMb() {
  96 + return mb;
  97 + }
  98 +
  99 + public void setMb(String mb) {
  100 + this.mb = mb;
  101 + }
  102 +
  103 + public String getXybhd() {
  104 + return xybhd;
  105 + }
  106 +
  107 + public void setXybhd(String xybhd) {
  108 + this.xybhd = xybhd;
  109 + }
  110 +
  111 + public String getGd() {
  112 + return gd;
  113 + }
  114 +
  115 + public void setGd(String gd) {
  116 + this.gd = gd;
  117 + }
  118 +
  119 + public String getCxl() {
  120 + return cxl;
  121 + }
  122 +
  123 + public void setCxl(String cxl) {
  124 + this.cxl = cxl;
  125 + }
  126 +
  127 + public String getPgjc() {
  128 + return pgjc;
  129 + }
  130 +
  131 + public void setPgjc(String pgjc) {
  132 + this.pgjc = pgjc;
  133 + }
  134 +
  135 + public String getHyqk() {
  136 + return hyqk;
  137 + }
  138 +
  139 + public void setHyqk(String hyqk) {
  140 + this.hyqk = hyqk;
  141 + }
  142 +
  143 + public String getNz() {
  144 + return nz;
  145 + }
  146 +
  147 + public void setNz(String nz) {
  148 + this.nz = nz;
  149 + }
  150 +
  151 + public String getFz() {
  152 + return fz;
  153 + }
  154 +
  155 + public void setFz(String fz) {
  156 + this.fz = fz;
  157 + }
  158 +
  159 + public String getQm() {
  160 + return qm;
  161 + }
  162 +
  163 + public void setQm(String qm) {
  164 + this.qm = qm;
  165 + }
  166 + }
  167 +
  168 + public String getId() {
  169 + return id;
  170 + }
  171 +
  172 + public void setId(String id) {
  173 + this.id = id;
  174 + }
  175 +
  176 + public String getParentId() {
  177 + return parentId;
  178 + }
  179 +
  180 + public void setParentId(String parentId) {
  181 + this.parentId = parentId;
  182 + }
  183 +
  184 + public String getMaternalDeliverId() {
  185 + return maternalDeliverId;
  186 + }
  187 +
  188 + public void setMaternalDeliverId(String maternalDeliverId) {
  189 + this.maternalDeliverId = maternalDeliverId;
  190 + }
  191 +
  192 + public String getCreated() {
  193 + return created;
  194 + }
  195 +
  196 + public void setCreated(String created) {
  197 + this.created = created;
  198 + }
  199 +
  200 + public String getModified() {
  201 + return modified;
  202 + }
  203 +
  204 + public void setModified(String modified) {
  205 + this.modified = modified;
  206 + }
  207 +
  208 + public List<Records> getRecords() {
  209 + return records;
  210 + }
  211 +
  212 + public void setRecords(List<Records> records) {
  213 + this.records = records;
  214 + }
  215 +
  216 + public String getHospitalId() {
  217 + return hospitalId;
  218 + }
  219 +
  220 + public void setHospitalId(String hospitalId) {
  221 + this.hospitalId = hospitalId;
  222 + }
  223 +
  224 + public String getDoctor() {
  225 + return doctor;
  226 + }
  227 +
  228 + public void setDoctor(String doctor) {
  229 + this.doctor = doctor;
  230 + }
  231 +
  232 + public String getName() {
  233 + return name;
  234 + }
  235 +
  236 + public void setName(String name) {
  237 + this.name = name;
  238 + }
  239 +
  240 + public String getBhnum() {
  241 + return bhnum;
  242 + }
  243 +
  244 + public void setBhnum(String bhnum) {
  245 + this.bhnum = bhnum;
  246 + }
  247 +
  248 + public String getOneCxl() {
  249 + return oneCxl;
  250 + }
  251 +
  252 + public void setOneCxl(String oneCxl) {
  253 + this.oneCxl = oneCxl;
  254 + }
  255 +
  256 + public String getTwoCxl() {
  257 + return twoCxl;
  258 + }
  259 +
  260 + public void setTwoCxl(String twoCxl) {
  261 + this.twoCxl = twoCxl;
  262 + }
  263 +
  264 + public PostpartumRecordsResult convertToResult(PostpartumRecords postpartumRecords){
  265 + setId(postpartumRecords.getId());
  266 + setHospitalId(postpartumRecords.getHospitalId());
  267 + setCreated(postpartumRecords.getCreated());
  268 + return this;
  269 + }
  270 +}