Commit 8c151c7f08d21093ae980ab4a53839b1e61e6e08

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 8 changed files

platform-common/src/main/java/com/lyms/platform/common/constants/ErrorCodeConstants.java View file @ 8c151c7
... ... @@ -62,5 +62,8 @@
62 62 public static final int NO_POWER = 4021;
63 63 //区域模式运行
64 64 public static final String RUN_MODE="1";
  65 +
  66 + //数据已过期
  67 + public static final int DATA_EXPIRE = 4108;
65 68 }
platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java View file @ 8c151c7
... ... @@ -70,9 +70,12 @@
70 70 private Integer yn;
71 71  
72 72 private String hospitalId;
  73 + private List<String> hospitalIds;
73 74  
74 75 private Date courseEndTime;
75 76  
  77 + private String keyword;
  78 +
76 79 @Override
77 80 public MongoQuery convertToQuery() {
78 81 MongoCondition condition = MongoCondition.newInstance();
... ... @@ -112,6 +115,10 @@
112 115 condition = condition.and("status", status, MongoOper.IS);
113 116 }
114 117  
  118 + if (null != hospitalIds && hospitalIds.size() > 0) {
  119 + condition = condition.and("hospitalId", hospitalIds, MongoOper.IN);
  120 + }
  121 +
115 122 Criteria c1 = null;
116 123  
117 124 if (null != courseTimeStart) {
... ... @@ -157,6 +164,24 @@
157 164 condition = condition.andCondition(new MongoCondition(c1));
158 165 }
159 166 return condition.toMongoQuery();
  167 + }
  168 +
  169 + @Override
  170 + public String getKeyword() {
  171 + return keyword;
  172 + }
  173 +
  174 + @Override
  175 + public void setKeyword(String keyword) {
  176 + this.keyword = keyword;
  177 + }
  178 +
  179 + public List<String> getHospitalIds() {
  180 + return hospitalIds;
  181 + }
  182 +
  183 + public void setHospitalIds(List<String> hospitalIds) {
  184 + this.hospitalIds = hospitalIds;
160 185 }
161 186  
162 187 public Date getCourseEndTime() {
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ 8c151c7
... ... @@ -130,6 +130,9 @@
130 130 //查询号
131 131 private String queryNo;
132 132  
  133 + //查询手机就诊卡证件号
  134 + private String pvc;
  135 +
133 136 private String phoneOrCert;
134 137 private String[] pc;
135 138 private String[] pv;
... ... @@ -137,6 +140,14 @@
137 140 private Integer buildDaysStart;
138 141 private Integer buildDaysEnd;
139 142  
  143 + public String getPvc() {
  144 + return pvc;
  145 + }
  146 +
  147 + public void setPvc(String pvc) {
  148 + this.pvc = pvc;
  149 + }
  150 +
140 151 public String getNotoRiskFactor() {
141 152 return notoRiskFactor;
142 153 }
143 154  
... ... @@ -450,7 +461,10 @@
450 461  
451 462 private boolean norFactor;
452 463  
  464 + //国家高危因数为空集合
  465 + private boolean isNullrFactor;
453 466  
  467 +
454 468 /**
455 469 * 是否有效
456 470 */
... ... @@ -521,6 +535,14 @@
521 535 //孕妇证件类型
522 536 private String pcerteTypeId;
523 537  
  538 + public boolean isNullrFactor() {
  539 + return isNullrFactor;
  540 + }
  541 +
  542 + public void setNullrFactor(boolean nullrFactor) {
  543 + isNullrFactor = nullrFactor;
  544 + }
  545 +
524 546 public String getPcerteTypeId() {
525 547 return pcerteTypeId;
526 548 }
... ... @@ -1200,6 +1222,19 @@
1200 1222 c1 = c.orCondition(new MongoCondition[]{con1, con2, con3, con4, con5}).getCriteria();
1201 1223 }
1202 1224 }
  1225 +
  1226 + if (null != pvc) {
  1227 + MongoCondition c = MongoCondition.newInstance();
  1228 + MongoCondition con1 = MongoCondition.newInstance("phone", pvc, MongoOper.IS);
  1229 + MongoCondition con3 = MongoCondition.newInstance("cardNo", pvc, MongoOper.IS);
  1230 + MongoCondition con5 = MongoCondition.newInstance("vcCardNo", pvc, MongoOper.IS);
  1231 + if (c1 != null) {
  1232 + c1 = c1.andOperator(c.orCondition(new MongoCondition[]{con1, con3, con5}).getCriteria());
  1233 + } else {
  1234 + c1 = c.orCondition(new MongoCondition[]{con1, con3, con5}).getCriteria();
  1235 + }
  1236 + }
  1237 +
1203 1238 if (null != phoneOrCert) {
1204 1239 MongoCondition c = MongoCondition.newInstance();
1205 1240 MongoCondition con1 = MongoCondition.newInstance("phone", phoneOrCert, MongoOper.IS);
... ... @@ -1320,6 +1355,11 @@
1320 1355 } else if (null != rFactorList && !rFactorList.isEmpty()) {
1321 1356 condition = condition.and("riskFactorId", rFactorList, MongoOper.IN);
1322 1357 }
  1358 +
  1359 + if(isNullrFactor){
  1360 + condition = condition.and("riskFactorId", new ArrayList<String>(), MongoOper.IS);
  1361 + }
  1362 +
1323 1363 if (-1 != yn) {
1324 1364 condition = condition.and("yn", yn, MongoOper.IS);
1325 1365 }
platform-operate-api/src/main/java/com/lyms/hospitalapi/qhdfy/ConnTools.java View file @ 8c151c7
... ... @@ -36,16 +36,16 @@
36 36 private static String fmPassword = "LYMS";
37 37  
38 38  
39   - private static String clDirverClassName = "oracle.jdbc.driver.OracleDriver";
40   - private static String clUrl = "jdbc:oracle:thin:@168.254.0.80:1521:jhemr";
41   - private static String clUser = "lyms";
42   - private static String clPassword = "lyms";
  39 +// private static String clDirverClassName = "oracle.jdbc.driver.OracleDriver";
  40 +// private static String clUrl = "jdbc:oracle:thin:@168.254.0.80:1521:jhemr";
  41 +// private static String clUser = "lyms";
  42 +// private static String clPassword = "lyms";
43 43  
44 44  
45   -// private static String clDirverClassName = "com.mysql.jdbc.Driver";
46   -// private static String clUrl = "jdbc:mysql://119.90.57.26:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
47   -// private static String clUser = "platform";
48   -// private static String clPassword = "platform123";
  45 + private static String clDirverClassName = "com.mysql.jdbc.Driver";
  46 + private static String clUrl = "jdbc:mysql://119.90.57.26:3306/platform?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8";
  47 + private static String clUser = "platform";
  48 + private static String clPassword = "platform123";
49 49  
50 50  
51 51 public static Connection makeHisConnection() {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientCourseController.java View file @ 8c151c7
... ... @@ -13,7 +13,7 @@
13 13  
14 14  
15 15 /**
16   - * 孕妇预约和签到
  16 + * 孕妇预约和签到课程
17 17 */
18 18 @Controller
19 19 public class PatientCourseController extends BaseController {
20 20  
... ... @@ -69,9 +69,89 @@
69 69 @TokenRequired
70 70 public BaseResponse queryOrderPatient(
71 71 @RequestParam(required = true) String queryNo,
  72 + @RequestParam(required = true) String courseId,
72 73 HttpServletRequest request) {
73 74  
74   - return patientCourseFacade.queryOrderPatient(queryNo, getUserId(request));
  75 + return patientCourseFacade.queryOrderPatient(queryNo, courseId, getUserId(request));
  76 + }
  77 +
  78 +
  79 + /**
  80 + * 搜索签到详情
  81 + * @param queryNo
  82 + * @param request
  83 + * @return
  84 + */
  85 + @RequestMapping(method = RequestMethod.GET, value = "/querySignPatient")
  86 + @ResponseBody
  87 + @TokenRequired
  88 + public BaseResponse querySignPatient(
  89 + @RequestParam(required = true) String queryNo,
  90 + @RequestParam(required = true) String courseId,
  91 + HttpServletRequest request) {
  92 +
  93 + return patientCourseFacade.querySignPatient(queryNo, courseId, getUserId(request));
  94 + }
  95 +
  96 +
  97 + /**
  98 + * 孕妇预约课程
  99 + * @param courseId
  100 + * @param patientId
  101 + * @param hospitalId
  102 + * @param orderType //预约类型 1 院内 2 小程序
  103 + * @param request
  104 + * @return
  105 + */
  106 + @RequestMapping(method = RequestMethod.GET, value = "/orderCourse")
  107 + @ResponseBody
  108 + public BaseResponse orderCourse(
  109 + @RequestParam(required = true) String courseId,
  110 + @RequestParam(required = true) String patientId,
  111 + @RequestParam(required = true) String hospitalId,
  112 + @RequestParam(required = true) Integer orderType,
  113 + HttpServletRequest request) {
  114 +
  115 + return patientCourseFacade.orderCourse(courseId, patientId, hospitalId, orderType, getUserId(request));
  116 + }
  117 +
  118 +
  119 + /**
  120 + * 孕妇签到
  121 + * @param patientCourseId
  122 + * @param request
  123 + * @return
  124 + */
  125 + @RequestMapping(method = RequestMethod.GET, value = "/signCourse")
  126 + @ResponseBody
  127 + public BaseResponse signCourse(
  128 + @RequestParam(required = true) String patientCourseId,
  129 + @RequestParam(required = true) String courseId,
  130 + HttpServletRequest request) {
  131 +
  132 + return patientCourseFacade.signCourse(patientCourseId, courseId, getUserId(request));
  133 + }
  134 +
  135 +
  136 + /**
  137 + * 获取小程序的孕妇学校列表
  138 + * @param hospitalIds 相关医院id
  139 + * @param patientId 患者id
  140 + * @param request
  141 + * @return
  142 + */
  143 + @RequestMapping(method = RequestMethod.GET, value = "/getAppPatientCourseList")
  144 + @ResponseBody
  145 + public BaseResponse getAppPatientCourseList(
  146 + @RequestParam(required = true) String hospitalIds,
  147 + @RequestParam(required = true) String patientId,
  148 + @RequestParam(required = false) String keyword,
  149 + @RequestParam(required = true) Integer status,
  150 + @RequestParam("page") Integer page,
  151 + @RequestParam("limit") Integer limit,
  152 + HttpServletRequest request) {
  153 +
  154 + return patientCourseFacade.getAppPatientCourseList(status,hospitalIds, patientId,keyword,page,limit);
75 155 }
76 156 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCourseFacade.java View file @ 8c151c7
1 1 package com.lyms.platform.operate.web.facade;
2 2  
3 3  
  4 +import com.lyms.platform.biz.service.CourseService;
4 5 import com.lyms.platform.biz.service.CourseTypeService;
5 6 import com.lyms.platform.biz.service.PatientCourseService;
6 7 import com.lyms.platform.biz.service.PatientsService;
7 8 import com.lyms.platform.common.constants.ErrorCodeConstants;
8 9 import com.lyms.platform.common.enums.YnEnums;
9 10 import com.lyms.platform.common.result.BaseListResponse;
  11 +import com.lyms.platform.common.result.BaseObjectResponse;
10 12 import com.lyms.platform.common.result.BaseResponse;
11 13 import com.lyms.platform.common.utils.DateUtil;
  14 +import com.lyms.platform.operate.web.result.CourseTypeResult;
12 15 import com.lyms.platform.operate.web.result.PatientCourseResult;
  16 +import com.lyms.platform.permission.model.Organization;
  17 +import com.lyms.platform.permission.service.OrganizationService;
13 18 import com.lyms.platform.permission.service.UsersService;
14 19 import com.lyms.platform.pojo.CourseModel;
  20 +import com.lyms.platform.pojo.CourseTypeModel;
15 21 import com.lyms.platform.pojo.PatientCourseModel;
16 22 import com.lyms.platform.pojo.Patients;
17 23 import com.lyms.platform.query.CourseQuery;
  24 +import com.lyms.platform.query.CourseTypeQuery;
18 25 import com.lyms.platform.query.PatientCourseQuery;
  26 +import com.lyms.platform.query.PatientsQuery;
19 27 import org.apache.commons.collections.CollectionUtils;
20 28 import org.apache.commons.lang.StringUtils;
21 29 import org.springframework.beans.factory.annotation.Autowired;
22 30 import org.springframework.stereotype.Component;
23 31  
24   -import java.util.ArrayList;
25   -import java.util.Date;
26   -import java.util.List;
  32 +import java.util.*;
27 33  
28 34  
29 35 /**
30 36  
... ... @@ -48,7 +54,13 @@
48 54 @Autowired
49 55 private PatientsService patientsService;
50 56  
  57 + @Autowired
  58 + private CourseService courseService;
51 59  
  60 + @Autowired
  61 + private OrganizationService organizationService;
  62 +
  63 +
52 64 public BaseResponse getPatientCourseList(Integer status,String courseId, Integer page,
53 65 Integer limit, Integer userId) {
54 66  
55 67  
56 68  
57 69  
58 70  
59 71  
... ... @@ -64,16 +76,38 @@
64 76 //状态 1预约,2签到
65 77 patientCourseQuery.setStatus(status);
66 78  
67   - List<PatientCourseResult> results = new ArrayList<>();
  79 + List<PatientCourseResult> results = getPatientCourse(patientCourseQuery);
68 80  
  81 + BaseListResponse objectResponse = new BaseListResponse();
  82 + objectResponse.setData(results);
  83 + objectResponse.setPageInfo(patientCourseQuery.getPageInfo());
  84 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  85 + objectResponse.setErrormsg("成功");
  86 + return objectResponse;
  87 + }
69 88  
70   - List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery);
71   - if (CollectionUtils.isNotEmpty(patientCourseModels))
  89 + public BaseResponse queryOrderPatient(String queryNo,String courseId, Integer userId) {
  90 + String hospitalId = autoMatchFacade.getHospitalId(userId);
  91 +
  92 + PatientCourseQuery patientCourseQuery = new PatientCourseQuery();
  93 + patientCourseQuery.setYn(YnEnums.YES.getId());
  94 + patientCourseQuery.setCourseId(courseId);
  95 + patientCourseQuery.setHospitalId(hospitalId);
  96 + patientCourseQuery.setQueryNo(queryNo);
  97 + //状态 1预约,2签到
  98 + patientCourseQuery.setStatus(1);
  99 +
  100 + List<PatientCourseResult> results = getPatientCourse(patientCourseQuery);
  101 + if (CollectionUtils.isEmpty(results))
72 102 {
73   - for (PatientCourseModel model : patientCourseModels)
  103 + PatientsQuery patientsQuery = new PatientsQuery();
  104 + patientsQuery.setYn(YnEnums.YES.getId());
  105 + patientsQuery.setPvc(queryNo);
  106 + List<Patients> patientses = patientsService.queryPatient(patientsQuery);
  107 + if (CollectionUtils.isNotEmpty(patientses))
74 108 {
  109 + Patients patients = patientses.get(0);
75 110 PatientCourseResult result = new PatientCourseResult();
76   - Patients patients = patientsService.findOnePatientById(model.getPatientId());
77 111 if (patients != null)
78 112 {
79 113 result.setAge(DateUtil.getAge(patients.getBirth(),new Date()));
80 114  
... ... @@ -81,7 +115,46 @@
81 115 result.setUserName(patients.getUsername());
82 116 result.setPhone(patients.getPhone());
83 117 result.setVcCardNo(patients.getVcCardNo());
  118 + result.setPatientId(patients.getId());
84 119 }
  120 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  121 + objectResponse.setData(result);
  122 + objectResponse.setErrorcode(ErrorCodeConstants.NAME_EXIST);
  123 + objectResponse.setErrormsg("该孕妇未预约此课程,是否现在预约?");
  124 + return objectResponse;
  125 + }
  126 + else
  127 + {
  128 + BaseResponse objectResponse = new BaseResponse();
  129 + objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA);
  130 + objectResponse.setErrormsg("数据不存在");
  131 + return objectResponse;
  132 + }
  133 + }
  134 +
  135 + BaseListResponse objectResponse = new BaseListResponse();
  136 + objectResponse.setData(results);
  137 + objectResponse.setPageInfo(patientCourseQuery.getPageInfo());
  138 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  139 + objectResponse.setErrormsg("成功");
  140 + return objectResponse;
  141 + }
  142 +
  143 +
  144 + private List<PatientCourseResult> getPatientCourse(PatientCourseQuery patientCourseQuery)
  145 + {
  146 + List<PatientCourseResult> results = new ArrayList<>();
  147 + List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery);
  148 + if (CollectionUtils.isNotEmpty(patientCourseModels))
  149 + {
  150 + for (PatientCourseModel model : patientCourseModels)
  151 + {
  152 + PatientCourseResult result = new PatientCourseResult();
  153 + result.setAge(DateUtil.getAge(model.getBirthday(),new Date()));
  154 + result.setCardNo(model.getCardNo());
  155 + result.setUserName(model.getUserName());
  156 + result.setPhone(model.getPhone());
  157 + result.setVcCardNo(model.getVcCardNo());
85 158 result.setOrderTime(model.getOrderTime() == null ? "" : DateUtil.gety_m_dhm(model.getOrderTime()));
86 159 result.setSignTime(model.getSignTime() == null ? "" : DateUtil.gety_m_dhm(model.getSignTime()));
87 160 //预约类型 1 院内 2 小程序
88 161  
89 162  
90 163  
91 164  
92 165  
93 166  
94 167  
... ... @@ -90,31 +163,215 @@
90 163 results.add(result);
91 164 }
92 165 }
  166 + return results;
  167 + }
93 168  
94   - BaseListResponse objectResponse = new BaseListResponse();
95   - objectResponse.setData(results);
96   - objectResponse.setPageInfo(patientCourseQuery.getPageInfo());
  169 + public BaseResponse orderCourse(String courseId, String patientId,String hospitalId,Integer orderType, Integer userId) {
  170 +
  171 + BaseResponse objectResponse = new BaseResponse();
  172 + CourseQuery query = new CourseQuery();
  173 + query.setYn(YnEnums.YES.getId());
  174 + query.setId(courseId);
  175 + List<CourseModel> courseModels = courseService.queryCourseList(query);
  176 + if (CollectionUtils.isNotEmpty(courseModels))
  177 + {
  178 + CourseModel model = courseModels.get(0);
  179 + if (model != null && model.getCourseEndTime().getTime() < new Date().getTime())
  180 + {
  181 + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXPIRE);
  182 + objectResponse.setErrormsg("该课程预约时间已截止,请刷新后重试");
  183 + return objectResponse;
  184 + }
  185 +
  186 + if (model != null && model.getLimitNum() != null && model.getLimitNum() < (model.getEnrolmentNum() == null? 1 : model.getEnrolmentNum()+1))
  187 + {
  188 + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXPIRE);
  189 + objectResponse.setErrormsg("该课程预约人数已达上限,不能预约该课程了!");
  190 + return objectResponse;
  191 + }
  192 + }
  193 +
  194 + Patients patients = patientsService.findOnePatientById(patientId);
  195 + if (patients == null)
  196 + {
  197 + PatientCourseModel model = new PatientCourseModel();
  198 + model.setBirthday(patients.getBirth());
  199 + model.setCardNo(patients.getCardNo());
  200 + model.setUserName(patients.getUsername());
  201 + model.setPhone(patients.getPhone());
  202 + model.setVcCardNo(patients.getVcCardNo());
  203 + model.setOrderTime(new Date());
  204 + model.setOrderType(orderType);
  205 + model.setOperUserId(String.valueOf(userId));
  206 + model.setHospitalId(hospitalId);
  207 + model.setCourseId(courseId);
  208 + model.setCreated(new Date());
  209 + model.setModified(new Date());
  210 + model.setYn(YnEnums.YES.getId());
  211 + patientCourseService.addPatientCourse(model);
  212 + }
  213 +
97 214 objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
98 215 objectResponse.setErrormsg("成功");
99 216 return objectResponse;
100 217 }
101 218  
102   - public BaseResponse queryOrderPatient(String queryNo, Integer userId) {
  219 +
  220 + public BaseResponse querySignPatient(String queryNo,String courseId, Integer userId) {
103 221 String hospitalId = autoMatchFacade.getHospitalId(userId);
104 222  
105 223 PatientCourseQuery patientCourseQuery = new PatientCourseQuery();
  224 + patientCourseQuery.setCourseId(courseId);
106 225 patientCourseQuery.setYn(YnEnums.YES.getId());
107 226  
108 227 patientCourseQuery.setHospitalId(hospitalId);
109 228 patientCourseQuery.setQueryNo(queryNo);
110 229 //状态 1预约,2签到
111   - patientCourseQuery.setStatus(1);
  230 + patientCourseQuery.setStatus(2);
112 231  
113   - List<PatientCourseResult> results = new ArrayList<>();
  232 + List<PatientCourseResult> results = getPatientCourse(patientCourseQuery);
  233 + if (CollectionUtils.isEmpty(results))
  234 + {
114 235  
  236 + //状态 1预约,2签到
  237 + patientCourseQuery.setStatus(1);
  238 + List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery);
  239 + if (CollectionUtils.isNotEmpty(patientCourseModels))
  240 + {
  241 + BaseResponse objectResponse = new BaseResponse();
  242 + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST);
  243 + objectResponse.setErrormsg("孕妇已经预约,确认是否签到?");
  244 + return objectResponse;
  245 + }
  246 + else
  247 + {
  248 + BaseResponse objectResponse = new BaseResponse();
  249 + objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA);
  250 + objectResponse.setErrormsg("数据不存在");
  251 + return objectResponse;
  252 + }
  253 + }
115 254  
116   - List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery);
117   - return null;
  255 + BaseListResponse objectResponse = new BaseListResponse();
  256 + objectResponse.setData(results);
  257 + objectResponse.setPageInfo(patientCourseQuery.getPageInfo());
  258 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  259 + objectResponse.setErrormsg("成功");
  260 + return objectResponse;
  261 + }
  262 +
  263 + public BaseResponse signCourse(String patientCourseId,String courseId, Integer userId) {
  264 +
  265 + BaseResponse objectResponse = new BaseResponse();
  266 + CourseQuery query = new CourseQuery();
  267 + query.setYn(YnEnums.YES.getId());
  268 + query.setId(courseId);
  269 + List<CourseModel> courseModels = courseService.queryCourseList(query);
  270 + if (CollectionUtils.isNotEmpty(courseModels))
  271 + {
  272 + CourseModel model = courseModels.get(0);
  273 + if (model != null && model.getCourseEndTime().getTime() < new Date().getTime())
  274 + {
  275 + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXPIRE);
  276 + objectResponse.setErrormsg("该课程签到时间已截止,请刷新后重试");
  277 + return objectResponse;
  278 + }
  279 + }
  280 +
  281 + if (patientCourseId != null)
  282 + {
  283 + PatientCourseModel model = new PatientCourseModel();
  284 + model.setId(patientCourseId);
  285 + model.setModified(new Date());
  286 + model.setYn(YnEnums.YES.getId());
  287 + model.setStatus(2);
  288 + patientCourseService.updatePatientCourse(model);
  289 + }
  290 +
  291 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  292 + objectResponse.setErrormsg("成功");
  293 + return objectResponse;
  294 + }
  295 +
  296 + public BaseResponse getAppPatientCourseList(Integer status,String hospitalIds, String patientId,
  297 + String keyword, Integer page, Integer limit) {
  298 +
  299 + List<String> hospitalIdList = new ArrayList<>();
  300 +
  301 + if (StringUtils.isNotEmpty(hospitalIds))
  302 + {
  303 + hospitalIdList = Arrays.asList(hospitalIds.split(","));
  304 + }
  305 +
  306 + CourseQuery query = new CourseQuery();
  307 + query.setStatus(status);
  308 + query.setYn(YnEnums.YES.getId());
  309 + query.setPage(page);
  310 + query.setLimit(limit);
  311 + query.setNeed("true");
  312 + query.setHospitalIds(hospitalIdList);
  313 + List<CourseModel> courseModels = courseService.queryCourseList(query);
  314 +
  315 + List<Map> results = new ArrayList<>();
  316 + CourseTypeQuery courseTypeQuery = new CourseTypeQuery();
  317 + query.setYn(YnEnums.YES.getId());
  318 +
  319 + if (CollectionUtils.isNotEmpty(courseModels))
  320 + {
  321 + for (CourseModel model : courseModels)
  322 + {
  323 + Map<String,String> result = new HashMap<>();
  324 + //课程名称
  325 + result.put("courseName",model.getCourseName());
  326 + //课程描述
  327 + result.put("courseDesc",model.getCourseDesc() == null ? "" : model.getCourseDesc());
  328 + //课程时间
  329 + result.put("courseTime",DateUtil.gety_m_dhm(model.getCourseTime()));
  330 + //课程地址
  331 + result.put("courseAddress", model.getCourseAddress() == null ? "" : model.getCourseAddress());
  332 + //主讲
  333 + result.put("courseSpeaker",model.getCourseSpeaker() == null ? "" : model.getCourseSpeaker());
  334 +
  335 + String hospitalName = "";
  336 + if (org.apache.commons.lang.StringUtils.isNotEmpty(model.getHospitalId())) {
  337 + Organization organization = organizationService.getOrganization(Integer.parseInt(model.getHospitalId()));
  338 + if (organization != null && organization.getYn() == YnEnums.YES.getId()) {
  339 + hospitalName = organization.getName();
  340 + }
  341 + }
  342 +
  343 + result.put("hospitalName",hospitalName);
  344 + //报名人数
  345 + result.put("enrolmentNum", model.getEnrolmentNum() == null ? "0" : String.valueOf(model.getEnrolmentNum()));
  346 +
  347 + courseTypeQuery.setId(model.getCourseTypeId());
  348 +
  349 + //课程类型名称
  350 + String courseType = "";
  351 + List<CourseTypeModel> typeModels = courseTypeService.queryCourseTypeList(courseTypeQuery);
  352 + if (CollectionUtils.isNotEmpty(typeModels))
  353 + {
  354 + courseType = typeModels.get(0).getCourseTypeName();
  355 + }
  356 + result.put("courseType",courseType);
  357 +
  358 +
  359 + //课程上限人数
  360 + result.put("limitNum",model.getLimitNum() == null ? "0" : String.valueOf(model.getLimitNum()));
  361 +
  362 + //孕妇与课程的状态
  363 + result.put("status","");
  364 +
  365 + results.add(result);
  366 + }
  367 + }
  368 +
  369 + BaseListResponse objectResponse = new BaseListResponse();
  370 + objectResponse.setData(results);
  371 + objectResponse.setPageInfo(query.getPageInfo());
  372 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  373 + objectResponse.setErrormsg("成功");
  374 + return objectResponse;
118 375 }
119 376 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/RiskReportFacade.java View file @ 8c151c7
... ... @@ -154,14 +154,18 @@
154 154 query.setBookbuildingDateEnd(patientsQuery.getBookbuildingDateEnd());
155 155 query.setNotoRiskFactor("");
156 156 query.setoRiskFactor("true");
  157 + query.setNullrFactor(true);
157 158 query.setType(patientsQuery.getType());
158 159  
159   - //单个高危因素孕产妇条
  160 + //不包含国家高危的自定义高危人
160 161 int riskPatientCount = patientsService.queryPatientCount(query);
  162 + query.setNullrFactor(false);
  163 + //包含国家高危的自定义高危人数
  164 + int otherPatientCount = patientsService.queryPatientCount(query);
161 165  
162   - //总的孕妇条数
  166 + //总的孕妇条数(国家标准高危)
163 167 int allPatientCount = patientsService.queryPatientCount(patientsQuery);
164   - allPatientCount += riskPatientCount;
  168 + // allPatientCount += riskPatientCount;
165 169  
166 170 List<RiskReportResult> results = new ArrayList<>();
167 171  
... ... @@ -216,7 +220,7 @@
216 220 }
217 221 }
218 222  
219   - results.addAll(getOtherRiskCount(riskPatientCount, allPatientCount));
  223 + results.addAll(getOtherRiskCount(otherPatientCount, allPatientCount+riskPatientCount));
220 224 // Collections.sort(results, new RiskReportResult());
221 225 Map<String, List<RiskReportResult>> slaveBasicConfigMap = new HashMap<>();
222 226 for (RiskReportResult bc : results) {
... ... @@ -278,7 +282,7 @@
278 282  
279 283 DecimalFormat df = new DecimalFormat("0.00");
280 284 //肖进:其他高危发病率=其他高危+国家高危人数/其他高危人数
281   - String percent =riskPatientCount>0? df.format((double) riskPatientCount / (allPatientCount+riskPatientCount) * 100) + "%":"0%";
  285 + String percent =riskPatientCount>0? df.format((double) riskPatientCount / (allPatientCount) * 100) + "%":"0%";
282 286 risk.setPercent(percent);
283 287  
284 288 List level = new ArrayList();
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/PatientCourseResult.java View file @ 8c151c7
... ... @@ -34,6 +34,16 @@
34 34 //签到时间
35 35 private String signTime;
36 36  
  37 + private String patientId;
  38 +
  39 + public String getPatientId() {
  40 + return patientId;
  41 + }
  42 +
  43 + public void setPatientId(String patientId) {
  44 + this.patientId = patientId;
  45 + }
  46 +
37 47 public String getSignTime() {
38 48 return signTime;
39 49 }