|  | @ -8,6 +8,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.org.BaseOrgDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
 | 
	
	
		
			
				|  | @ -16,7 +17,6 @@ import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.hospital.prescription.*;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
 | 
	
	
		
			
				|  | @ -107,6 +107,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     private PatientRegisterTimeDao patientRegisterTimeDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyHttpLogDao wlyyHttpLogDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Value("${demo.flag}")
 | 
	
		
			
				|  |  |     private boolean demoFlag;
 | 
	
	
		
			
				|  | @ -1524,6 +1526,118 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return times;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生可接单列表
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type) {
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 "room.outpatient_id AS id," +
 | 
	
		
			
				|  |  |                 "room.patient_id AS patient_id," +
 | 
	
		
			
				|  |  |                 "room.patient_name AS name," +
 | 
	
		
			
				|  |  |                 "patient.sex AS sex," +
 | 
	
		
			
				|  |  |                 "patient.idcard AS idcard," +
 | 
	
		
			
				|  |  |                 "patient.photo AS photo," +
 | 
	
		
			
				|  |  |                 "patient.birthday AS birthday," +
 | 
	
		
			
				|  |  |                 "room.consult_type AS consult_type," +
 | 
	
		
			
				|  |  |                 "room.reservation_time AS time," +
 | 
	
		
			
				|  |  |                 "outpatient.disease_img AS disease_img," +
 | 
	
		
			
				|  |  |                 "outpatient.description AS description," +
 | 
	
		
			
				|  |  |                 "outpatient.origin_con_no AS origin_con_no " +
 | 
	
		
			
				|  |  |                 "FROM " +
 | 
	
		
			
				|  |  |                 "wlyy_hospital_waiting_room room," +
 | 
	
		
			
				|  |  |                 "base_patient patient," +
 | 
	
		
			
				|  |  |                 "wlyy_outpatient outpatient " +
 | 
	
		
			
				|  |  |                 "WHERE " +
 | 
	
		
			
				|  |  |                 "room.patient_id=patient.id " +
 | 
	
		
			
				|  |  |                 "AND room.outpatient_id=outpatient.id " +
 | 
	
		
			
				|  |  |                 "AND room.doctor IS NULL " +
 | 
	
		
			
				|  |  |                 "AND room.consult_type="+type;
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             //根据身份证计算年龄
 | 
	
		
			
				|  |  |             for(Map<String,Object> outpatient :list){
 | 
	
		
			
				|  |  |                 String idcard = (String)outpatient.get("idcard");
 | 
	
		
			
				|  |  |                 outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findWaitingRoomPatient(String dept, Integer type) {
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 "patient.id AS id," +
 | 
	
		
			
				|  |  |                 "patient.name AS name," +
 | 
	
		
			
				|  |  |                 "patient.sex AS sex," +
 | 
	
		
			
				|  |  |                 "patient.idcard AS idcard," +
 | 
	
		
			
				|  |  |                 "patient.photo AS photo," +
 | 
	
		
			
				|  |  |                 "waitingroom.reservation_type AS type," +
 | 
	
		
			
				|  |  |                 "waitingroom.consult_type AS consult_type," +
 | 
	
		
			
				|  |  |                 "waitingroom.reservation_time AS reservation_time " +
 | 
	
		
			
				|  |  |                 "FROM " +
 | 
	
		
			
				|  |  |                 "wlyy_hospital_waiting_room waitingroom," +
 | 
	
		
			
				|  |  |                 "base_patient patient " +
 | 
	
		
			
				|  |  |                 "WHERE waitingroom.consult_type=2 AND doctor IS NOT NULL ";
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             //根据身份证计算年龄
 | 
	
		
			
				|  |  |             for(Map<String,Object> roompatient :list){
 | 
	
		
			
				|  |  |                 String idcard = (String)roompatient.get("idcard");
 | 
	
		
			
				|  |  |                 roompatient.put("age",DateUtil.getAgeForIdcard(idcard));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     public JSONObject findWaitingRoomStatusCount(String dept) {
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         String totalSql = "SELECT count(id) AS total FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
 | 
	
		
			
				|  |  |         totalSql += " AND reservation_time >='"+DateUtil.dateToStrShort(new Date())+" 00:00:00'";
 | 
	
		
			
				|  |  |         totalSql += " AND reservation_time <='"+DateUtil.dateToStrShort(new Date())+" 23:59:59'";
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
 | 
	
		
			
				|  |  |         Long count = 0L;
 | 
	
		
			
				|  |  |         if (rstotal != null && rstotal.size() > 0) {
 | 
	
		
			
				|  |  |             count = (Long) rstotal.get(0).get("total");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         result.put("waiting_count",count);
 | 
	
		
			
				|  |  |         result.put("outpatient_count",count);
 | 
	
		
			
				|  |  |         result.put("waiting_count_difference",count);
 | 
	
		
			
				|  |  |         result.put("outpatient_count_difference",count);
 | 
	
		
			
				|  |  |         result.put("yesterday_waiting_count",count);
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return result;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findClinicRoomList(String dept) {
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 "id," +
 | 
	
		
			
				|  |  |                 "doctor_name," +
 | 
	
		
			
				|  |  |                 "clinic_status AS visit_status," +
 | 
	
		
			
				|  |  |                 "patient_name AS patient_name," +
 | 
	
		
			
				|  |  |                 "waiting_count AS waiting_count," +
 | 
	
		
			
				|  |  |                 "room_name AS room_name " +
 | 
	
		
			
				|  |  |                 "FROM wlyy_doctor_clinic_room ";
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     public WlyyDoctorClinicRoomDO findClinicRoomStatus(String id) {
 | 
	
		
			
				|  |  |         return wlyyDoctorClinicRoomDao.findOne(id);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取快速咨询时间分段
 | 
	
	
		
			
				|  | @ -1608,46 +1722,4 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         return  list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 医生可接单列表
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type) {
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         String sql ="SELECT " +
 | 
	
		
			
				|  |  |                 "room.outpatient_id AS id," +
 | 
	
		
			
				|  |  |                 "room.patient_id AS patient_id," +
 | 
	
		
			
				|  |  |                 "room.patient_name AS name," +
 | 
	
		
			
				|  |  |                 "patient.sex AS sex," +
 | 
	
		
			
				|  |  |                 "patient.idcard AS idcard," +
 | 
	
		
			
				|  |  |                 "patient.photo AS photo," +
 | 
	
		
			
				|  |  |                 "patient.birthday AS birthday," +
 | 
	
		
			
				|  |  |                 "room.consult_type AS consult_type," +
 | 
	
		
			
				|  |  |                 "room.reservation_time AS time," +
 | 
	
		
			
				|  |  |                 "outpatient.disease_img AS disease_img," +
 | 
	
		
			
				|  |  |                 "outpatient.description AS description," +
 | 
	
		
			
				|  |  |                 "outpatient.origin_con_no AS origin_con_no " +
 | 
	
		
			
				|  |  |                 "FROM " +
 | 
	
		
			
				|  |  |                 "wlyy_hospital_waiting_room room," +
 | 
	
		
			
				|  |  |                 "base_patient patient," +
 | 
	
		
			
				|  |  |                 "wlyy_outpatient outpatient " +
 | 
	
		
			
				|  |  |                 "WHERE " +
 | 
	
		
			
				|  |  |                 "room.patient_id=patient.id " +
 | 
	
		
			
				|  |  |                 "AND room.outpatient_id=outpatient.id " +
 | 
	
		
			
				|  |  |                 "AND room.doctor IS NULL " +
 | 
	
		
			
				|  |  |                 "AND room.consult_type="+type;
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if(list!=null&&list.size()>0){
 | 
	
		
			
				|  |  |             //根据身份证计算年龄
 | 
	
		
			
				|  |  |             for(Map<String,Object> outpatient :list){
 | 
	
		
			
				|  |  |                 String idcard = (String)outpatient.get("idcard");
 | 
	
		
			
				|  |  |                 outpatient.put("age",DateUtil.getAgeForIdcard(idcard));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         return list;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |