Commit 3c18de5adf30e052e866e2a932473320765837f1

Authored by yangfei
1 parent c570a07277

住院统计

Showing 9 changed files with 516 additions and 37 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/PatientMarkHospitalMapper.java View file @ 3c18de5
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.permission.model.PatientMarkHospital;
4 4 import com.lyms.platform.permission.model.PatientMarkHospitalQuery;
  5 +import com.lyms.platform.permission.model.ReportFailureHosptail;
5 6 import com.lyms.platform.permission.model.ReportMakeHosptail;
6 7  
7 8 import java.util.List;
... ... @@ -21,5 +22,12 @@
21 22  
22 23 public List<ReportMakeHosptail> reportPatMarkHospByMakeDoctor(PatientMarkHospitalQuery query);
23 24  
  25 + List<ReportMakeHosptail> reportPatMarkHospByBackDoctor(PatientMarkHospitalQuery query);
  26 +
  27 + List<ReportMakeHosptail> reportPatMarkHospByInDoctor(PatientMarkHospitalQuery query);
  28 +
  29 + List<ReportMakeHosptail> reportRealityByInDoctor(PatientMarkHospitalQuery patientMarkHospQuery);
  30 +
  31 + List<ReportFailureHosptail> reportFailure(PatientMarkHospitalQuery patientMarkHospQuery);
24 32 }
platform-biz-service/src/main/java/com/lyms/platform/permission/model/PatientMarkHospitalQuery.java View file @ 3c18de5
... ... @@ -135,6 +135,18 @@
135 135 * 住院类型(1-分娩住院、2-其他住院)
136 136 */
137 137 private Integer hospitType;
  138 + /**
  139 + * sql
  140 + */
  141 + private String sql;
  142 +
  143 + public String getSql() {
  144 + return sql;
  145 + }
  146 +
  147 + public void setSql(String sql) {
  148 + this.sql = sql;
  149 + }
138 150  
139 151 public Date getBackStartDate() {
140 152 return backStartDate;
platform-biz-service/src/main/java/com/lyms/platform/permission/model/ReportFailureHosptail.java View file @ 3c18de5
  1 +package com.lyms.platform.permission.model;
  2 +
  3 +/**
  4 + * @auther yangfei
  5 + * @createTime 2017年09月27日 10时13分
  6 + * @discription
  7 + */
  8 +public class ReportFailureHosptail {
  9 + /**
  10 + * 类型
  11 + */
  12 + private String type;
  13 + /**
  14 + * 提醒总数
  15 + */
  16 + private int num;
  17 + /**
  18 + * 电话无人接听数量
  19 + */
  20 + private int noPhoneNum;
  21 + /**
  22 + * 暂时未确定
  23 + */
  24 + private int indeterNum;
  25 + /**
  26 + * 她院已办理住院
  27 + */
  28 + private int otherHospNum;
  29 + /**
  30 + * 其他
  31 + */
  32 + private int otherNum;
  33 +
  34 + public String getType() {
  35 + return type;
  36 + }
  37 +
  38 + public void setType(String type) {
  39 + this.type = type;
  40 + }
  41 +
  42 + public int getNum() {
  43 + return num;
  44 + }
  45 +
  46 + public void setNum(int num) {
  47 + this.num = num;
  48 + }
  49 +
  50 + public int getNoPhoneNum() {
  51 + return noPhoneNum;
  52 + }
  53 +
  54 + public void setNoPhoneNum(int noPhoneNum) {
  55 + this.noPhoneNum = noPhoneNum;
  56 + }
  57 +
  58 + public int getIndeterNum() {
  59 + return indeterNum;
  60 + }
  61 +
  62 + public void setIndeterNum(int indeterNum) {
  63 + this.indeterNum = indeterNum;
  64 + }
  65 +
  66 + public int getOtherHospNum() {
  67 + return otherHospNum;
  68 + }
  69 +
  70 + public void setOtherHospNum(int otherHospNum) {
  71 + this.otherHospNum = otherHospNum;
  72 + }
  73 +
  74 + public int getOtherNum() {
  75 + return otherNum;
  76 + }
  77 +
  78 + public void setOtherNum(int otherNum) {
  79 + this.otherNum = otherNum;
  80 + }
  81 +}
platform-biz-service/src/main/java/com/lyms/platform/permission/model/ReportMakeHosptail.java View file @ 3c18de5
... ... @@ -6,14 +6,44 @@
6 6 * @discription 住院预约统计
7 7 */
8 8 public class ReportMakeHosptail {
9   - //住院预约
  9 + //住院预约
10 10 private int num;
  11 + //预约成功数
  12 + private int succNum;
  13 + //预约失败
  14 + private int errNum;
11 15 //医生Id
12 16 private String doctorId;
13 17 //医生名称
14 18 private String doctorName;
15 19 //预约占比
16 20 private int occupCompar;
  21 + //预约成功占比
  22 + private int succOccupCompar;
  23 +
  24 + public int getSuccOccupCompar() {
  25 + return succOccupCompar;
  26 + }
  27 +
  28 + public void setSuccOccupCompar(int succOccupCompar) {
  29 + this.succOccupCompar = succOccupCompar;
  30 + }
  31 +
  32 + public int getSuccNum() {
  33 + return succNum;
  34 + }
  35 +
  36 + public void setSuccNum(int succNum) {
  37 + this.succNum = succNum;
  38 + }
  39 +
  40 + public int getErrNum() {
  41 + return errNum;
  42 + }
  43 +
  44 + public void setErrNum(int errNum) {
  45 + this.errNum = errNum;
  46 + }
17 47  
18 48 public String getDoctorName() {
19 49 return doctorName;
platform-biz-service/src/main/java/com/lyms/platform/permission/service/PatientMarkHospitalService.java View file @ 3c18de5
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.permission.model.PatientMarkHospital;
4 4 import com.lyms.platform.permission.model.PatientMarkHospitalQuery;
  5 +import com.lyms.platform.permission.model.ReportFailureHosptail;
5 6 import com.lyms.platform.permission.model.ReportMakeHosptail;
6 7  
7 8 import java.util.List;
... ... @@ -21,5 +22,12 @@
21 22  
22 23 public List<ReportMakeHosptail> reportPatMarkHospByMakeDoctor(PatientMarkHospitalQuery query);
23 24  
  25 + List<ReportMakeHosptail> reportPatMarkHospByBackDoctor(PatientMarkHospitalQuery query);
  26 +
  27 + List<ReportMakeHosptail> reportPatMarkHospByInDoctor(PatientMarkHospitalQuery patientMarkHospQuery);
  28 +
  29 + List<ReportMakeHosptail> reportRealityByInDoctor(PatientMarkHospitalQuery patientMarkHospQuery);
  30 +
  31 + List<ReportFailureHosptail> reportFailure(PatientMarkHospitalQuery patientMarkHospQuery);
24 32 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/PatientMarkHospitalServiceImpl.java View file @ 3c18de5
... ... @@ -3,6 +3,7 @@
3 3 import com.lyms.platform.permission.dao.master.PatientMarkHospitalMapper;
4 4 import com.lyms.platform.permission.model.PatientMarkHospital;
5 5 import com.lyms.platform.permission.model.PatientMarkHospitalQuery;
  6 +import com.lyms.platform.permission.model.ReportFailureHosptail;
6 7 import com.lyms.platform.permission.model.ReportMakeHosptail;
7 8 import com.lyms.platform.permission.service.PatientMarkHospitalService;
8 9 import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -52,6 +53,26 @@
52 53 @Override
53 54 public List<ReportMakeHosptail> reportPatMarkHospByMakeDoctor(PatientMarkHospitalQuery query) {
54 55 return patientMarkHospitalMapper.reportPatMarkHospByMakeDoctor(query);
  56 + }
  57 +
  58 + @Override
  59 + public List<ReportMakeHosptail> reportPatMarkHospByBackDoctor(PatientMarkHospitalQuery query) {
  60 + return patientMarkHospitalMapper.reportPatMarkHospByBackDoctor(query);
  61 + }
  62 +
  63 + @Override
  64 + public List<ReportMakeHosptail> reportPatMarkHospByInDoctor(PatientMarkHospitalQuery patientMarkHospQuery) {
  65 + return patientMarkHospitalMapper.reportPatMarkHospByInDoctor(patientMarkHospQuery);
  66 + }
  67 +
  68 + @Override
  69 + public List<ReportMakeHosptail> reportRealityByInDoctor(PatientMarkHospitalQuery patientMarkHospQuery) {
  70 + return patientMarkHospitalMapper.reportRealityByInDoctor(patientMarkHospQuery);
  71 + }
  72 +
  73 + @Override
  74 + public List<ReportFailureHosptail> reportFailure(PatientMarkHospitalQuery patientMarkHospQuery) {
  75 + return patientMarkHospitalMapper.reportFailure(patientMarkHospQuery);
55 76 }
56 77  
57 78 }
platform-biz-service/src/main/resources/mainOrm/master/PatientMarkHospital.xml View file @ 3c18de5
... ... @@ -258,6 +258,9 @@
258 258 <if test="hospitType != null">
259 259 and hospit_type = #{hospitType,jdbcType=INTEGER}
260 260 </if>
  261 + <if test="sql != null">
  262 + ${sql}
  263 + </if>
261 264 </where>
262 265 </sql>
263 266  
... ... @@ -266,6 +269,193 @@
266 269 select count(*) num,make_doctor as doctorId from patient_mark_hospital
267 270 <include refid="PatientMarkHospitalCondition"/>
268 271 GROUP BY make_doctor;
  272 + </select>
  273 +
  274 + <select id="reportPatMarkHospByBackDoctor" resultType="com.lyms.platform.permission.model.ReportMakeHosptail"
  275 + parameterType="com.lyms.platform.permission.model.PatientMarkHospitalQuery">
  276 + SELECT
  277 + back_doctor as doctorId,
  278 + count(*) AS num,
  279 + sum(
  280 + CASE back_result
  281 + WHEN 1 THEN
  282 + 1
  283 + ELSE
  284 + 0
  285 + END
  286 + ) AS succNum,
  287 + sum(
  288 + CASE back_result
  289 + WHEN 2 THEN
  290 + 1
  291 + ELSE
  292 + 0
  293 + END
  294 + ) AS errNum
  295 + FROM
  296 + patient_mark_hospital
  297 + <include refid="PatientMarkHospitalCondition"/>
  298 + and back_doctor is not null
  299 + GROUP BY back_doctor;
  300 + </select>
  301 +
  302 + <select id="reportPatMarkHospByInDoctor" resultType="com.lyms.platform.permission.model.ReportMakeHosptail"
  303 + parameterType="com.lyms.platform.permission.model.PatientMarkHospitalQuery">
  304 + SELECT
  305 + in_hospit_doctor as doctorId,
  306 + count(*) AS num,
  307 + sum(
  308 + CASE in_hospit_result
  309 + WHEN 1 THEN
  310 + 1
  311 + ELSE
  312 + 0
  313 + END
  314 + ) AS succNum,
  315 + sum(
  316 + CASE in_hospit_result
  317 + WHEN 2 THEN
  318 + 1
  319 + ELSE
  320 + 0
  321 + END
  322 + ) AS errNum from
  323 + patient_mark_hospital
  324 + <include refid="PatientMarkHospitalCondition"/>
  325 + and in_hospit_doctor is not null
  326 + GROUP BY in_hospit_doctor;
  327 + </select>
  328 + <select id="reportPatMarkHospByInDoctor" resultType="com.lyms.platform.permission.model.ReportMakeHosptail"
  329 + parameterType="com.lyms.platform.permission.model.PatientMarkHospitalQuery">
  330 + SELECT
  331 + in_hospit_doctor as doctorId,
  332 + count(*) AS num,
  333 + sum(
  334 + CASE in_hospit_result
  335 + WHEN 1 THEN
  336 + 1
  337 + ELSE
  338 + 0
  339 + END
  340 + ) AS succNum,
  341 + sum(
  342 + CASE in_hospit_result
  343 + WHEN 2 THEN
  344 + 1
  345 + ELSE
  346 + 0
  347 + END
  348 + ) AS errNum from
  349 + patient_mark_hospital
  350 + <include refid="PatientMarkHospitalCondition"/>
  351 + and in_hospit_doctor is not null
  352 + GROUP BY in_hospit_doctor;
  353 + </select>
  354 +
  355 + <select id="reportRealityByInDoctor" resultType="com.lyms.platform.permission.model.ReportMakeHosptail"
  356 + parameterType="com.lyms.platform.permission.model.PatientMarkHospitalQuery">
  357 + SELECT
  358 + in_hospit_doctor AS doctorId,
  359 + count(*) num,
  360 + sum(
  361 + CASE hospit_status
  362 + WHEN 2 THEN
  363 + 1
  364 + ELSE
  365 + 0
  366 + END
  367 + ) AS succNum
  368 + FROM
  369 + patient_mark_hospital
  370 + <include refid="PatientMarkHospitalCondition"/>
  371 + and in_hospit_status = 2
  372 + GROUP BY
  373 + in_hospit_doctor;
  374 + </select>
  375 +
  376 + <select id="reportFailure" resultType="com.lyms.platform.permission.model.ReportFailureHosptail"
  377 + parameterType="com.lyms.platform.permission.model.PatientMarkHospitalQuery">
  378 + SELECT
  379 + '回院提醒' as type,
  380 + count(*) num,
  381 + sum(
  382 + CASE back_failure
  383 + WHEN 1 THEN
  384 + 1
  385 + ELSE
  386 + 0
  387 + END
  388 + ) AS noPhoneNum,
  389 + sum(
  390 + CASE back_failure
  391 + WHEN 2 THEN
  392 + 1
  393 + ELSE
  394 + 0
  395 + END
  396 + ) AS otherHospNum,
  397 + sum(
  398 + CASE back_failure
  399 + WHEN 3 THEN
  400 + 1
  401 + ELSE
  402 + 0
  403 + END
  404 + ) AS indeterNum,
  405 + sum(
  406 + CASE back_failure
  407 + WHEN 4 THEN
  408 + 1
  409 + ELSE
  410 + 0
  411 + END
  412 + ) AS otherNum
  413 + FROM
  414 + patient_mark_hospital
  415 + <include refid="PatientMarkHospitalCondition"/>
  416 + and
  417 + in_hospit_status = 2
  418 + UNION
  419 + SELECT
  420 + '住院提醒' as type,
  421 + count(*) num,
  422 + sum(
  423 + CASE in_hospit_failure
  424 + WHEN 1 THEN
  425 + 1
  426 + ELSE
  427 + 0
  428 + END
  429 + ) AS 电话无人接听,
  430 + sum(
  431 + CASE in_hospit_failure
  432 + WHEN 2 THEN
  433 + 1
  434 + ELSE
  435 + 0
  436 + END
  437 + ) AS 他院已办理住院,
  438 + sum(
  439 + CASE in_hospit_failure
  440 + WHEN 3 THEN
  441 + 1
  442 + ELSE
  443 + 0
  444 + END
  445 + ) AS 暂时未确定,
  446 + sum(
  447 + CASE in_hospit_failure
  448 + WHEN 4 THEN
  449 + 1
  450 + ELSE
  451 + 0
  452 + END
  453 + ) AS 其他
  454 + FROM
  455 + patient_mark_hospital
  456 + <include refid="PatientMarkHospitalCondition"/>
  457 + and
  458 + in_hospit_status = 2
269 459 </select>
270 460  
271 461  
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientMarkHospServiceFacade.java View file @ 3c18de5
... ... @@ -57,19 +57,7 @@
57 57 PatientMarkHospitalQuery patientMarkHospQuery = new PatientMarkHospitalQuery();
58 58 patientMarkHospQuery.setHospitalId(hospitalId);
59 59 PatientsQuery patientsQuery = new PatientsQuery();
60   - List<Patients> patientses = null;
61   - //根据查询号、当前孕周进行查询
62   - if (null != patientMarkRequest.getcDueWeekStart() || null != patientMarkRequest.getcDueWeekEnd()) {
63   - if (null != patientMarkRequest.getcDueWeekStart()) {
64   - patientsQuery.setLastMensesEnd(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientMarkRequest.getcDueWeekStart() * 7)));
65   - }
66   - if (null != patientMarkRequest.getcDueWeekEnd()) {
67   - patientsQuery.setLastMensesStart(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientMarkRequest.getcDueWeekEnd() * 7) - 6));
68   - }
69   - patientsQuery.setHospitalId(hospitalId);
70   - patientses = patientsService.queryPatient1(patientsQuery, "modpatientsQueryified");
71   - }
72   -
  60 + List<Patients> patientses = setPatientIds(patientMarkRequest,patientsQuery,hospitalId);
73 61 if (CollectionUtils.isNotEmpty(patientses)) {
74 62 List<String> parentIds = new LinkedList<>();
75 63 for (Patients pa : patientses) {
76 64  
77 65  
... ... @@ -96,11 +84,174 @@
96 84 return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(reportMakeHosptails);
97 85 }
98 86  
  87 + /**
  88 + * 回院预约统计
  89 + * @param patientMarkRequest
  90 + * @param id
  91 + * @return
  92 + */
  93 + public BaseListResponse reportBackHospit(PatientMarkRequest patientMarkRequest, Integer id){
  94 + //根据用户id获取医院ID
  95 + String hospitalId = autoMatchFacade.getHospitalId(id);
  96 + PatientMarkHospitalQuery patientMarkHospQuery = new PatientMarkHospitalQuery();
  97 + patientMarkHospQuery.setHospitalId(hospitalId);
  98 + PatientsQuery patientsQuery = new PatientsQuery();
  99 + List<Patients> patientses = setPatientIds(patientMarkRequest,patientsQuery,hospitalId);
  100 + if (CollectionUtils.isNotEmpty(patientses)) {
  101 + List<String> parentIds = new LinkedList<>();
  102 + for (Patients pa : patientses) {
  103 + parentIds.add(pa.getId());
  104 + }
  105 + patientMarkHospQuery.setPatientIds((String[]) parentIds.toArray(new String[parentIds.size()]));
  106 + } else if (null != patientMarkRequest.getcDueWeekStart() || null != patientMarkRequest.getcDueWeekEnd()) {
  107 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  108 + }
99 109  
  110 + //统计数据
  111 + List<ReportMakeHosptail> reportMakeHosptails = patientMarkHospitalService.reportPatMarkHospByBackDoctor(patientMarkHospQuery);
  112 + //住院预约总数
  113 + int count = patientMarkHospitalService.queryPatientMarkHospitalCount(patientMarkHospQuery);
  114 + patientMarkHospQuery.setBackStatus(1);
  115 + //回院待提醒数
  116 + int waitCount = patientMarkHospitalService.queryPatientMarkHospitalCount(patientMarkHospQuery);
  117 + for(ReportMakeHosptail rm:reportMakeHosptails){
  118 + Users users = usersService.getUsers(Integer.parseInt(rm.getDoctorId()));
  119 + if (users != null) {
  120 + rm.setDoctorName(users.getName());
  121 + } else {
  122 + rm.setDoctorName("产检医生");
  123 + }
  124 + rm.setSuccOccupCompar(rm.getNum()/rm.getSuccNum());
  125 + }
  126 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(reportMakeHosptails);
  127 + }
100 128  
101 129  
102 130  
103 131 /**
  132 + * 住院提醒统计
  133 + * @param patientMarkRequest
  134 + * @param id
  135 + * @return
  136 + */
  137 + public BaseListResponse reportInHospit(PatientMarkRequest patientMarkRequest, Integer id){
  138 + //根据用户id获取医院ID
  139 + String hospitalId = autoMatchFacade.getHospitalId(id);
  140 + PatientMarkHospitalQuery patientMarkHospQuery = new PatientMarkHospitalQuery();
  141 + patientMarkHospQuery.setHospitalId(hospitalId);
  142 + PatientsQuery patientsQuery = new PatientsQuery();
  143 + List<Patients> patientses = setPatientIds(patientMarkRequest,patientsQuery,hospitalId);
  144 + if (CollectionUtils.isNotEmpty(patientses)) {
  145 + List<String> parentIds = new LinkedList<>();
  146 + for (Patients pa : patientses) {
  147 + parentIds.add(pa.getId());
  148 + }
  149 + patientMarkHospQuery.setPatientIds((String[]) parentIds.toArray(new String[parentIds.size()]));
  150 + } else if (null != patientMarkRequest.getcDueWeekStart() || null != patientMarkRequest.getcDueWeekEnd()) {
  151 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  152 + }
  153 +
  154 + //统计数据
  155 + List<ReportMakeHosptail> reportMakeHosptails = patientMarkHospitalService.reportPatMarkHospByInDoctor(patientMarkHospQuery);
  156 + patientMarkHospQuery.setBackResult(1);
  157 + //回院预约成功总数
  158 + int count = patientMarkHospitalService.queryPatientMarkHospitalCount(patientMarkHospQuery);
  159 + patientMarkHospQuery.setInHospitStatus(1);
  160 + //待住院提醒总数
  161 + int waitCount = patientMarkHospitalService.queryPatientMarkHospitalCount(patientMarkHospQuery);
  162 + for(ReportMakeHosptail rm:reportMakeHosptails){
  163 + Users users = usersService.getUsers(Integer.parseInt(rm.getDoctorId()));
  164 + if (users != null) {
  165 + rm.setDoctorName(users.getName());
  166 + } else {
  167 + rm.setDoctorName("产检医生");
  168 + }
  169 + }
  170 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(reportMakeHosptails);
  171 + }
  172 +
  173 + /**
  174 + * 实际住院统计
  175 + * @param patientMarkRequest
  176 + * @param id
  177 + * @return
  178 + */
  179 + public BaseListResponse reportRealityHospit(PatientMarkRequest patientMarkRequest, Integer id){
  180 + //根据用户id获取医院ID
  181 + String hospitalId = autoMatchFacade.getHospitalId(id);
  182 + PatientMarkHospitalQuery patientMarkHospQuery = new PatientMarkHospitalQuery();
  183 + patientMarkHospQuery.setHospitalId(hospitalId);
  184 + PatientsQuery patientsQuery = new PatientsQuery();
  185 + List<Patients> patientses = setPatientIds(patientMarkRequest,patientsQuery,hospitalId);
  186 + if (CollectionUtils.isNotEmpty(patientses)) {
  187 + List<String> parentIds = new LinkedList<>();
  188 + for (Patients pa : patientses) {
  189 + parentIds.add(pa.getId());
  190 + }
  191 + patientMarkHospQuery.setPatientIds((String[]) parentIds.toArray(new String[parentIds.size()]));
  192 + } else if (null != patientMarkRequest.getcDueWeekStart() || null != patientMarkRequest.getcDueWeekEnd()) {
  193 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  194 + }
  195 +
  196 + //实际住院统计数据
  197 + List<ReportMakeHosptail> reportMakeHosptails = patientMarkHospitalService.reportRealityByInDoctor(patientMarkHospQuery);
  198 + for(ReportMakeHosptail rm:reportMakeHosptails){
  199 + Users users = usersService.getUsers(Integer.parseInt(rm.getDoctorId()));
  200 + if (users != null) {
  201 + rm.setDoctorName(users.getName());
  202 + } else {
  203 + rm.setDoctorName("产检医生");
  204 + }
  205 + }
  206 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(reportMakeHosptails);
  207 + }
  208 + /**
  209 + * 预约失败统计
  210 + * @param patientMarkRequest
  211 + * @param id
  212 + * @return
  213 + */
  214 + public BaseListResponse reportFailureHospit(PatientMarkRequest patientMarkRequest, Integer id){
  215 + //根据用户id获取医院ID
  216 + String hospitalId = autoMatchFacade.getHospitalId(id);
  217 + PatientMarkHospitalQuery patientMarkHospQuery = new PatientMarkHospitalQuery();
  218 + patientMarkHospQuery.setHospitalId(hospitalId);
  219 + PatientsQuery patientsQuery = new PatientsQuery();
  220 + List<Patients> patientses = setPatientIds(patientMarkRequest,patientsQuery,hospitalId);
  221 + if (CollectionUtils.isNotEmpty(patientses)) {
  222 + List<String> parentIds = new LinkedList<>();
  223 + for (Patients pa : patientses) {
  224 + parentIds.add(pa.getId());
  225 + }
  226 + patientMarkHospQuery.setPatientIds((String[]) parentIds.toArray(new String[parentIds.size()]));
  227 + } else if (null != patientMarkRequest.getcDueWeekStart() || null != patientMarkRequest.getcDueWeekEnd()) {
  228 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功");
  229 + }
  230 +
  231 + //提醒失败统计数据
  232 + List<ReportFailureHosptail> reportMakeHosptails = patientMarkHospitalService.reportFailure(patientMarkHospQuery);
  233 + return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(reportMakeHosptails);
  234 + }
  235 +
  236 + public List<Patients> setPatientIds(PatientMarkRequest patientMarkRequest,PatientsQuery patientsQuery,String hospitalId){
  237 + //根据查询号、当前孕周进行查询
  238 + if (null != patientMarkRequest.getcDueWeekStart() || null != patientMarkRequest.getcDueWeekEnd()) {
  239 + if (null != patientMarkRequest.getcDueWeekStart()) {
  240 + patientsQuery.setLastMensesEnd(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientMarkRequest.getcDueWeekStart() * 7)));
  241 + }
  242 + if (null != patientMarkRequest.getcDueWeekEnd()) {
  243 + patientsQuery.setLastMensesStart(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientMarkRequest.getcDueWeekEnd() * 7) - 6));
  244 + }
  245 + patientsQuery.setHospitalId(hospitalId);
  246 + return patientsService.queryPatient1(patientsQuery, "modpatientsQueryified");
  247 + }else{
  248 + return null;
  249 + }
  250 + }
  251 +
  252 +
  253 +
  254 + /**
104 255 * 初始化接口
105 256 *
106 257 * @return
... ... @@ -355,19 +506,7 @@
355 506 PatientMarkHospitalQuery patientMarkHospQuery = new PatientMarkHospitalQuery();
356 507 patientMarkHospQuery.setHospitalId(hospitalId);
357 508 PatientsQuery patientsQuery = new PatientsQuery();
358   - List<Patients> patientses = null;
359   - //根据查询号、当前孕周进行查询
360   - if (null != patientMarkRequest.getcDueWeekStart() || null != patientMarkRequest.getcDueWeekEnd()) {
361   - if (null != patientMarkRequest.getcDueWeekStart()) {
362   - patientsQuery.setLastMensesEnd(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientMarkRequest.getcDueWeekStart() * 7)));
363   - }
364   - if (null != patientMarkRequest.getcDueWeekEnd()) {
365   - patientsQuery.setLastMensesStart(DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(patientMarkRequest.getcDueWeekEnd() * 7) - 6));
366   - }
367   - patientsQuery.setHospitalId(hospitalId);
368   - patientses = patientsService.queryPatient1(patientsQuery, "modpatientsQueryified");
369   - }
370   -
  509 + List<Patients> patientses = setPatientIds(patientMarkRequest,patientsQuery,hospitalId);
371 510 if (CollectionUtils.isNotEmpty(patientses)) {
372 511 List<String> parentIds = new LinkedList<>();
373 512 for (Patients pa : patientses) {
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java View file @ 3c18de5
... ... @@ -130,16 +130,6 @@
130 130 List<PatientService> patientServices = patientServiceService.queryPatientService(patientQuery);
131 131 if (CollectionUtils.isNotEmpty(patientServices)) {
132 132 continue;
133   - // BaseResponse baseResponse = new BaseResponse();
134   - // baseResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST);
135   - // String serType = PatientSerEnums.SerTypeEnums.getTitle(ps.getSerType());
136   - // String serDoct = "产检医生";
137   - // Users users = usersService.getUsers(Integer.parseInt(ps.getSerDoct()));
138   - // if (users != null) {
139   - // serDoct = users.getName();
140   - // }
141   - // baseResponse.setErrormsg("该孕妇已开通" + serDoct + "医生的" + serType + "服务,请勿重复开通");
142   - // return baseResponse;
143 133 }
144 134  
145 135 Patients patients = patientsService.findOnePatientById(ps.getParentid());