|  | @ -3063,7 +3063,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         return rs.size();
 |  |         return rs.size();
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public Map<String, Object> findDoctorInfo(String doctor, String withWork) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public Map<String, Object> findDoctorInfo(String doctor, String withWork,String patient) {
 | 
												
													
														
															|  |         BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 |  |         BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         Map<String, Object> rs = new HashedMap();
 |  |         Map<String, Object> rs = new HashedMap();
 | 
												
											
												
													
														
															|  | @ -3157,7 +3157,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  | //            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
 |  | //            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
 | 
												
													
														
															|  | //            rs.put("coordinationCout",coordinationCout);
 |  | //            rs.put("coordinationCout",coordinationCout);
 | 
												
													
														
															|  |             //医生关注
 |  |             //医生关注
 | 
												
													
														
															|  |             List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctor(doctor);
 |  | 
 | 
												
													
														
															|  | 
 |  |             List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctor,patient);
 | 
												
													
														
															|  |             if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) {
 |  |             if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) {
 | 
												
													
														
															|  |                 rs.put("attention", "1");
 |  |                 rs.put("attention", "1");
 | 
												
													
														
															|  |             } else {
 |  |             } else {
 | 
												
											
												
													
														
															|  | @ -4172,7 +4172,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 jsonObject.put("dept_code", "");
 |  |                 jsonObject.put("dept_code", "");
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             jsonObject.put("visit_status", 1);
 |  |             jsonObject.put("visit_status", 1);
 | 
												
													
														
															|  |             jsonObject.put("waiting_count", 0);
 |  | 
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("visit_count", 0);
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("offline_count",0);
 | 
												
													
														
															|  | 
 |  |             jsonObject.put("ending_count",0);
 | 
												
													
														
															|  |             jsonObject.put("patient_name", "");
 |  |             jsonObject.put("patient_name", "");
 | 
												
													
														
															|  |             jsonObject.put("time_cost", 0);
 |  |             jsonObject.put("time_cost", 0);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -4211,12 +4213,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 if (StringUtils.isNoneBlank(doctor)) {
 |  |                 if (StringUtils.isNoneBlank(doctor)) {
 | 
												
													
														
															|  |                     Long waitCount = Long.parseLong(waitObj.get("waitCount").toString());
 |  |                     Long waitCount = Long.parseLong(waitObj.get("waitCount").toString());
 | 
												
													
														
															|  |                     if (result.keySet().contains(doctor)) {
 |  |                     if (result.keySet().contains(doctor)) {
 | 
												
													
														
															|  |                         result.get(doctor).put("waiting_count", waitCount);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         result.get(doctor).put("visit_count", waitCount);
 | 
												
													
														
															|  |                     } else {
 |  |                     } else {
 | 
												
													
														
															|  |                         JSONObject jsonObject = new JSONObject();
 |  |                         JSONObject jsonObject = new JSONObject();
 | 
												
													
														
															|  |                         jsonObject.put("id", doctor);
 |  |                         jsonObject.put("id", doctor);
 | 
												
													
														
															|  |                         jsonObject.put("visit_status", 1);
 |  |                         jsonObject.put("visit_status", 1);
 | 
												
													
														
															|  |                         jsonObject.put("waiting_count", waitCount);
 |  | 
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("visit_count", waitCount);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("offline_count", 0);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("ending_count", 0);
 | 
												
													
														
															|  |                         if (StringUtils.isNoneBlank((String) waitObj.get("doctorName"))) {
 |  |                         if (StringUtils.isNoneBlank((String) waitObj.get("doctorName"))) {
 | 
												
													
														
															|  |                             jsonObject.put("doctor_name", (String) waitObj.get("doctorName"));
 |  |                             jsonObject.put("doctor_name", (String) waitObj.get("doctorName"));
 | 
												
													
														
															|  |                         } else {
 |  |                         } else {
 | 
												
											
												
													
														
															|  | @ -4230,6 +4234,115 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //已结束
 | 
												
													
														
															|  | 
 |  |         String endSql = "SELECT count(op.id) AS \"endCount\"," +
 | 
												
													
														
															|  | 
 |  |                 "room.doctor AS \"doctor\", " +
 | 
												
													
														
															|  | 
 |  |                 "room.doctor_name AS \"doctorName\" " +
 | 
												
													
														
															|  | 
 |  |                 "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
 | 
												
													
														
															|  | 
 |  |                 "WHERE op.status=3 AND room.outpatient_id=op.id AND room.consult_type=2 " +
 | 
												
													
														
															|  | 
 |  |                 "AND room.doctor IS NOT NULL ";
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNoneBlank(dept)) {
 | 
												
													
														
															|  | 
 |  |             endSql = endSql + " and op.dept = '" + dept + "' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (flag){
 | 
												
													
														
															|  | 
 |  |                 endSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 endSql += " AND room.reservation_time <= str_to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 endSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 endSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             endSql = endSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> endlist = jdbcTemplate.queryForList(endSql);
 | 
												
													
														
															|  | 
 |  |         if (endlist != null && endlist.size() > 0) {
 | 
												
													
														
															|  | 
 |  |             //根据身份证计算年龄
 | 
												
													
														
															|  | 
 |  |             for (Map<String, Object> endObj : endlist) {
 | 
												
													
														
															|  | 
 |  |                 String doctor = (String) endObj.get("doctor");
 | 
												
													
														
															|  | 
 |  |                 if (StringUtils.isNoneBlank(doctor)) {
 | 
												
													
														
															|  | 
 |  |                     Long endCount = Long.parseLong(endObj.get("endCount").toString());
 | 
												
													
														
															|  | 
 |  |                     if (result.keySet().contains(doctor)) {
 | 
												
													
														
															|  | 
 |  |                         result.get(doctor).put("ending_count", endCount);
 | 
												
													
														
															|  | 
 |  |                     } else {
 | 
												
													
														
															|  | 
 |  |                         JSONObject jsonObject = new JSONObject();
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("id", doctor);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("visit_status", 1);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("visit_count",0);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("offline_count", 0);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("ending_count", endCount);
 | 
												
													
														
															|  | 
 |  |                         if (StringUtils.isNoneBlank((String) endObj.get("doctorName"))) {
 | 
												
													
														
															|  | 
 |  |                             jsonObject.put("doctor_name", (String) endObj.get("doctorName"));
 | 
												
													
														
															|  | 
 |  |                         } else {
 | 
												
													
														
															|  | 
 |  |                             jsonObject.put("doctor_name", "");
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("patient_name", "");
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("time_cost", 0);
 | 
												
													
														
															|  | 
 |  |                         result.put(doctor, jsonObject);
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //离线
 | 
												
													
														
															|  | 
 |  |         String disconnectSql = "SELECT count(op.id) AS \"disconnectCount\"," +
 | 
												
													
														
															|  | 
 |  |                 "room.doctor AS \"doctor\", " +
 | 
												
													
														
															|  | 
 |  |                 "room.doctor_name AS \"doctorName\" " +
 | 
												
													
														
															|  | 
 |  |                 "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room ," +
 | 
												
													
														
															|  | 
 |  |                 "base_patient p " +
 | 
												
													
														
															|  | 
 |  |                 "WHERE  room.outpatient_id=op.id AND room.consult_type=2  AND p.id = op.patient" +
 | 
												
													
														
															|  | 
 |  |                 " AND room.doctor IS NOT NULL and (p.online=0 OR P.online IS NULL) ";
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNoneBlank(dept)) {
 | 
												
													
														
															|  | 
 |  |             disconnectSql = disconnectSql + " and op.dept = '" + dept + "' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
												
													
														
															|  | 
 |  |             if (flag){
 | 
												
													
														
															|  | 
 |  |                 disconnectSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 disconnectSql += " AND room.reservation_time <= str_to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
 | 
												
													
														
															|  | 
 |  |             }else {
 | 
												
													
														
															|  | 
 |  |                 disconnectSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
												
													
														
															|  | 
 |  |                 disconnectSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             disconnectSql = disconnectSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         List<Map<String, Object>> disconnectlist = jdbcTemplate.queryForList(disconnectSql);
 | 
												
													
														
															|  | 
 |  |         if (disconnectlist != null && disconnectlist.size() > 0) {
 | 
												
													
														
															|  | 
 |  |             //根据身份证计算年龄
 | 
												
													
														
															|  | 
 |  |             for (Map<String, Object> endObj : endlist) {
 | 
												
													
														
															|  | 
 |  |                 String doctor = (String) endObj.get("doctor");
 | 
												
													
														
															|  | 
 |  |                 if (StringUtils.isNoneBlank(doctor)) {
 | 
												
													
														
															|  | 
 |  |                     Long disconnectCount = Long.parseLong(endObj.get("disconnectCount").toString());
 | 
												
													
														
															|  | 
 |  |                     if (result.keySet().contains(doctor)) {
 | 
												
													
														
															|  | 
 |  |                         result.get(doctor).put("offline_count", disconnectCount);
 | 
												
													
														
															|  | 
 |  |                     } else {
 | 
												
													
														
															|  | 
 |  |                         JSONObject jsonObject = new JSONObject();
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("id", doctor);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("visit_status", 1);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("ending_count",0);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("visit_count",0);
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("offline_count", disconnectCount);
 | 
												
													
														
															|  | 
 |  |                         if (StringUtils.isNoneBlank((String) endObj.get("doctorName"))) {
 | 
												
													
														
															|  | 
 |  |                             jsonObject.put("doctor_name", (String) endObj.get("doctorName"));
 | 
												
													
														
															|  | 
 |  |                         } else {
 | 
												
													
														
															|  | 
 |  |                             jsonObject.put("doctor_name", "");
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("patient_name", "");
 | 
												
													
														
															|  | 
 |  |                         jsonObject.put("time_cost", 0);
 | 
												
													
														
															|  | 
 |  |                         result.put(doctor, jsonObject);
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //获取进行中的居民
 |  |         //获取进行中的居民
 | 
												
													
														
															|  |         String onlineSql = "SELECT " +
 |  |         String onlineSql = "SELECT " +
 | 
												
													
														
															|  |                 "room.outpatient_id AS \"id\"," +
 |  |                 "room.outpatient_id AS \"id\"," +
 |