Commit 6089f63692f3687611303867489e621389f296b9

Authored by jiangjiazhi
1 parent 687844cd60

1

Showing 5 changed files with 78 additions and 10 deletions

platform-dal/src/main/java/com/lyms/platform/pojo/ReferralApplyOrderModel.java View file @ 6089f63
... ... @@ -34,6 +34,9 @@
34 34 private Integer score;
35 35 //转入医院
36 36 private String transferredHospital;
  37 + //转出医院id
  38 + private String outHospitalId;
  39 +
37 40 //转入科室
38 41 private String transferredDepartment;
39 42 //病情描述
... ... @@ -53,6 +56,13 @@
53 56 //申请单状态 0 已接收 1 已转出 2 建议转诊
54 57 private Integer status;
55 58  
  59 + public String getOutHospitalId() {
  60 + return outHospitalId;
  61 + }
  62 +
  63 + public void setOutHospitalId(String outHospitalId) {
  64 + this.outHospitalId = outHospitalId;
  65 + }
56 66  
57 67 public Integer getAge() {
58 68 return age;
platform-dal/src/main/java/com/lyms/platform/query/ReferralApplyOrderQuery.java View file @ 6089f63
... ... @@ -34,8 +34,26 @@
34 34 private String rLevel;
35 35 private Integer score;
36 36 private String riskFactor;
  37 + //转入医院
  38 + private String transferredHospital;
  39 + private String outHospitalId;
37 40  
  41 + public String getOutHospitalId() {
  42 + return outHospitalId;
  43 + }
38 44  
  45 + public void setOutHospitalId(String outHospitalId) {
  46 + this.outHospitalId = outHospitalId;
  47 + }
  48 +
  49 + public String getTransferredHospital() {
  50 + return transferredHospital;
  51 + }
  52 +
  53 + public void setTransferredHospital(String transferredHospital) {
  54 + this.transferredHospital = transferredHospital;
  55 + }
  56 +
39 57 @Override
40 58 public MongoQuery convertToQuery() {
41 59 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -50,6 +68,12 @@
50 68 }
51 69 if(null!=age){
52 70 condition=condition.and("age",age, MongoOper.IS);
  71 + }
  72 + if(null!=transferredHospital){
  73 + condition=condition.and("transferredHospital",transferredHospital, MongoOper.IS);
  74 + }
  75 + if(null!=outHospitalId){
  76 + condition=condition.and("outHospitalId",outHospitalId, MongoOper.IS);
53 77 }
54 78 if(null!=dueWeek){
55 79 condition=condition.and("dueWeek",dueWeek, MongoOper.IS);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ApplyOrderController.java View file @ 6089f63
1 1 package com.lyms.platform.operate.web.controller;
2 2  
  3 +import com.lyms.platform.common.annotation.TokenRequired;
3 4 import com.lyms.platform.common.base.BaseController;
  5 +import com.lyms.platform.common.base.LoginContext;
4 6 import com.lyms.platform.common.constants.ErrorCodeConstants;
5 7 import com.lyms.platform.common.result.BaseListResponse;
6 8 import com.lyms.platform.common.result.BaseResponse;
... ... @@ -13,6 +15,7 @@
13 15 import org.springframework.stereotype.Controller;
14 16 import org.springframework.web.bind.annotation.*;
15 17  
  18 +import javax.servlet.http.HttpServletRequest;
16 19 import javax.validation.Valid;
17 20  
18 21 /**
... ... @@ -42,8 +45,10 @@
42 45 //增加转诊申请单
43 46 @RequestMapping(method = RequestMethod.POST,value = "/referralapply")
44 47 @ResponseBody
45   - public BaseResponse addReferralApplyOrder(@Valid @RequestBody ReferralApplyOrderAddRequest applyOrderAddRequest) {
46   - return applyOrderFacade.addOneReferralApplyOrder(applyOrderAddRequest);
  48 + @TokenRequired
  49 + public BaseResponse addReferralApplyOrder(@Valid @RequestBody ReferralApplyOrderAddRequest applyOrderAddRequest,HttpServletRequest request) {
  50 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  51 + return applyOrderFacade.addOneReferralApplyOrder(applyOrderAddRequest,loginState.getId());
47 52 }
48 53  
49 54 @RequestMapping(method = RequestMethod.POST,value = "/sieveapply")
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ApplyOrderFacade.java View file @ 6089f63
... ... @@ -10,6 +10,8 @@
10 10 import com.lyms.platform.operate.web.request.ReferralApplyOrderAddRequest;
11 11 import com.lyms.platform.operate.web.request.SieveApplyOrderAddRequest;
12 12 import com.lyms.platform.operate.web.result.ApplyOrderOutResult;
  13 +import com.lyms.platform.permission.model.Organization;
  14 +import com.lyms.platform.permission.service.OrganizationService;
13 15 import com.lyms.platform.pojo.Patients;
14 16 import com.lyms.platform.pojo.ReferralApplyOrderModel;
15 17 import com.lyms.platform.pojo.SieveApplyOrderModel;
... ... @@ -33,6 +35,8 @@
33 35 private ApplyOrderService applyOrderService;
34 36 @Autowired
35 37 private PatientsService patientsService;
  38 + @Autowired
  39 + private AutoMatchFacade autoMatchFacade;
36 40  
37 41 /**
38 42 * 增加转诊申请
39 43  
40 44  
41 45  
... ... @@ -40,23 +44,28 @@
40 44 * @param referralApplyOrderAddRequest
41 45 * @return
42 46 */
43   - public BaseResponse addOneReferralApplyOrder(ReferralApplyOrderAddRequest referralApplyOrderAddRequest) {
  47 + public BaseResponse addOneReferralApplyOrder(ReferralApplyOrderAddRequest referralApplyOrderAddRequest,Integer userId) {
44 48 ReferralApplyOrderModel referralApplyOrderModel = referralApplyOrderAddRequest.convertToDataModel();
45 49 referralApplyOrderModel.setCreated(new Date());
46 50 referralApplyOrderModel.setStatus(0);
47 51 PatientsQuery patientsQuery=new PatientsQuery();
48 52 patientsQuery.setId(referralApplyOrderModel.getParentId());
49 53 //查询产妇信息
50   - List<Patients> patientses= patientsService.queryPatient(patientsQuery);
  54 + List<Patients> patientses = patientsService.queryPatient(patientsQuery);
51 55 Patients patients=null;
52 56 if(CollectionUtils.isNotEmpty(patientses)){
53 57 patients= patientses.get(0);
54 58 }
55   - referralApplyOrderModel.setCardNo(patients.getCardNo());
56   - referralApplyOrderModel.setAge(patients.getAge());
57   - referralApplyOrderModel.setDueDate(patients.getDueDate());
58   - referralApplyOrderModel.setName(patients.getUsername());
59 59  
  60 + if(null!=patients){
  61 + referralApplyOrderModel.setCardNo(patients.getCardNo());
  62 + referralApplyOrderModel.setAge(patients.getAge());
  63 + referralApplyOrderModel.setDueDate(patients.getDueDate());
  64 + referralApplyOrderModel.setName(patients.getUsername());
  65 + }
  66 +
  67 + List<Integer> areaId = autoMatchFacade.matchOrgId(userId);
  68 + referralApplyOrderModel.setOutHospitalId(areaId.get(0)+"");
60 69 applyOrderService.addOneReferralApplyOrder(referralApplyOrderModel);
61 70 return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
62 71 }
... ... @@ -106,7 +115,7 @@
106 115 * @param applyOrderQueryRequest
107 116 * @return
108 117 */
109   - public BaseListResponse queryApplyOrder(ApplyOrderQueryRequest applyOrderQueryRequest){
  118 + public BaseListResponse queryApplyOrder(ApplyOrderQueryRequest applyOrderQueryRequest,Integer userId){
110 119 ReferralApplyOrderQuery referralApplyOrderQuery=new ReferralApplyOrderQuery();
111 120 referralApplyOrderQuery.setName(applyOrderQueryRequest.getName());
112 121 referralApplyOrderQuery.setAge(applyOrderQueryRequest.getAge());
... ... @@ -117,7 +126,14 @@
117 126 referralApplyOrderQuery.setCardNo(applyOrderQueryRequest.getCardNo());
118 127 referralApplyOrderQuery.setPage(applyOrderQueryRequest.getPage());
119 128 referralApplyOrderQuery.setLimit(applyOrderQueryRequest.getLimit());
120   -
  129 + //1 转入 0转出
  130 + if("1".equals(applyOrderQueryRequest.getType())){
  131 + List data = autoMatchFacade.matchOrgId(userId);
  132 + referralApplyOrderQuery.setTransferredHospital(data.get(0)+"");
  133 + }else if("0".equals(applyOrderQueryRequest.getType())){
  134 + List data = autoMatchFacade.matchOrgId(userId);
  135 + referralApplyOrderQuery.setOutHospitalId(data.get(0)+"");
  136 + }
121 137 List<ReferralApplyOrderModel> orderModels = applyOrderService.queryReferralApplyOrderWithQuery(referralApplyOrderQuery);
122 138  
123 139 List data = new ArrayList();
... ... @@ -130,5 +146,6 @@
130 146 }
131 147 return new BaseListResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
132 148 }
  149 +
133 150 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/ApplyOrderQueryRequest.java View file @ 6089f63
... ... @@ -33,6 +33,18 @@
33 33 private String rLevel;
34 34 private Integer score;
35 35 private String riskFactor;
  36 + /**
  37 + * 1 转入 0 转出
  38 + */
  39 + private String type;
  40 +
  41 + public String getType() {
  42 + return type;
  43 + }
  44 +
  45 + public void setType(String type) {
  46 + this.type = type;
  47 + }
36 48  
37 49 public String getAge() {
38 50 return age;