| 
					
				 | 
			
			
				@ -38,7 +38,6 @@ import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.base.BaseRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1756,7 +1755,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 医生可接单列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 医生可接单列表(图文) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2143,4 +2142,120 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        res = httpClientUtil.post("http://www.xmtyw.cn/wlyy/iHealth/userInfo", params, "UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取正在进行中的视频复诊/协同门诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> getVideoPrescriptionByDoctor(String doctor) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "room.reservation_type AS reservation_type," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "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 outpatient.status = 1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.doctor='"+doctor+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.consult_type= 2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "date_format(room.reservation_time ,'%Y-%m-%d' ) AS group_date," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "room.reservation_type AS reservation_type," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "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 outpatient.status = 0 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.doctor='"+doctor+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.reservation_time is not null " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "AND room.consult_type= 2 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Set<String> datelist = new HashSet<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HashMap<String,List<Map<String,Object>>> waitinglist = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //根据身份证计算年龄 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Map<String,Object> outpatient :list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String idcard = (String)outpatient.get("idcard"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatient.put("age",DateUtil.getAgeForIdcard(idcard)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String group_date = (String)outpatient.get("group_date"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(waitinglist.keySet().contains(group_date)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    waitinglist.get(group_date).add(outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<Map<String,Object>> _cu = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    _cu.add(outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    waitinglist.put(group_date,_cu); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Collection<String> keyset= waitinglist.keySet(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<String> _list = new ArrayList<String>(keyset); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //对key键值按字典升序排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Collections.sort(_list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONArray result = new com.alibaba.fastjson.JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; i < _list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            System.out.println(_list.get(i)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("day",_list.get(i)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            object.put("data",waitinglist.get(_list.get(i))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.add(object); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |