|  | @ -3899,7 +3899,7 @@ public class ImService {
 | 
	
		
			
				|  |  | 		return mapList;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	/**
 | 
	
		
			
				|  |  | 	/**TnyyEntranceService
 | 
	
		
			
				|  |  | 	 * 修改视频会话邀请状态
 | 
	
		
			
				|  |  | 	 * @param session_id session_id
 | 
	
		
			
				|  |  | 	 * @param status 1发起,0挂断
 | 
	
	
		
			
				|  | @ -4263,4 +4263,205 @@ public class ImService {
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return count;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 	public List<Map<String,Object>> doctorUpcomingList2(String doctorCode, String type) {
 | 
	
		
			
				|  |  | 		String sql = "";
 | 
	
		
			
				|  |  | 		if("1,15,17".equals(type)) {
 | 
	
		
			
				|  |  | 			/*sql = "SELECT " +
 | 
	
		
			
				|  |  | 					"a.id AS \"id\"," +
 | 
	
		
			
				|  |  | 					"a.type AS \"type\"," +
 | 
	
		
			
				|  |  | 					"a.title AS \"title\"," +
 | 
	
		
			
				|  |  | 					"a.symptoms AS \"symptoms\",";
 | 
	
		
			
				|  |  | 			if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 				if (flag){
 | 
	
		
			
				|  |  | 					sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
 | 
	
		
			
				|  |  | 				}else{
 | 
	
		
			
				|  |  | 					sql = sql + "to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else{
 | 
	
		
			
				|  |  | 				sql = sql + "date_format(a.czrq,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql = sql +"b.status AS \"status\"," +
 | 
	
		
			
				|  |  | 					"b.evaluate AS \"evaluate\"," +
 | 
	
		
			
				|  |  | 					"b.doctor AS \"doctorCode\"," +
 | 
	
		
			
				|  |  | 					"b.actual_sender AS \"generalDoctor\"," +
 | 
	
		
			
				|  |  | 					"d.name AS \"patientName\"," +
 | 
	
		
			
				|  |  | 					"d.id as \"patientId\"," +
 | 
	
		
			
				|  |  | 					"d.idcard as \"patientIdcard\"," +
 | 
	
		
			
				|  |  | 					"d.sex as \"patientsex\"," +
 | 
	
		
			
				|  |  | 					"d.photo AS \"patientphoto\" " +
 | 
	
		
			
				|  |  | 					"FROM wlyy_consult a," +
 | 
	
		
			
				|  |  | 					"wlyy_consult_team b," +
 | 
	
		
			
				|  |  | 					"base_patient d  " +
 | 
	
		
			
				|  |  | 					"WHERE a.id=b.consult " +
 | 
	
		
			
				|  |  | 					"AND b.patient=d.id AND b.doctor='" + doctorCode + "' AND b.type in (" + type + ") and b.status = 0 and a.pay_status=1 " +
 | 
	
		
			
				|  |  | 					"ORDER BY a.czrq desc ";*/
 | 
	
		
			
				|  |  | 			sql = "SELECT " +
 | 
	
		
			
				|  |  | 					" DISTINCT op.id AS \"outpatientId\"," +
 | 
	
		
			
				|  |  | 					"op.description AS \"title\"," +
 | 
	
		
			
				|  |  | 					"op.description AS \"symptoms\","+
 | 
	
		
			
				|  |  | 					//添加排序的列
 | 
	
		
			
				|  |  | 					"op.create_time AS \"createTime\",";
 | 
	
		
			
				|  |  | 			if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 				if (flag){
 | 
	
		
			
				|  |  | 					sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else{
 | 
	
		
			
				|  |  | 				sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql =sql +"op.status AS \"status\"," +
 | 
	
		
			
				|  |  | 					"op.evaluate_status AS \"evaluate\"," +
 | 
	
		
			
				|  |  | 					"op.doctor AS \"doctorCode\"," +
 | 
	
		
			
				|  |  | 					"case op.type when '1' then '1'  when '3' then '15' else  '17' end \"type\"," +
 | 
	
		
			
				|  |  | 					"op.general_doctor AS \"generalDoctor\"," +
 | 
	
		
			
				|  |  | 					"patient.NAME AS \"patientName\"," +
 | 
	
		
			
				|  |  | 					"patient.id AS \"patientId\"," +
 | 
	
		
			
				|  |  | 					"op.consumer AS \"consumer\"," +
 | 
	
		
			
				|  |  | 					"patient.idcard AS \"patientIdcard\"," +
 | 
	
		
			
				|  |  | 					"patient.sex AS \"patientsex\"," +
 | 
	
		
			
				|  |  | 					"patient.photo AS \"patientphoto\",";
 | 
	
		
			
				|  |  | 			if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 				if (flag){
 | 
	
		
			
				|  |  | 					sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql = sql + "to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\",";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else{
 | 
	
		
			
				|  |  | 				sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql = sql +		"op.status AS \"outpatientstatus\" "+
 | 
	
		
			
				|  |  | 					"FROM base_patient patient," +
 | 
	
		
			
				|  |  | 					"wlyy_outpatient op " +
 | 
	
		
			
				|  |  | 					"WHERE op.patient=patient.id " +
 | 
	
		
			
				|  |  | 					"AND op.doctor='"+doctorCode+"' " +
 | 
	
		
			
				|  |  | 					"AND op.status in ('0','1','2') and  op.pay_status=1 ";
 | 
	
		
			
				|  |  | 			/*if("9".equals(type)){
 | 
	
		
			
				|  |  | 				//图文复诊
 | 
	
		
			
				|  |  | 				sql =sql +"AND op.type=1 AND op.outpatient_type=1 ";
 | 
	
		
			
				|  |  | 			}else if("16".equals(type)){
 | 
	
		
			
				|  |  | 				//视频复诊
 | 
	
		
			
				|  |  | 				sql =sql +"AND op.type=2 AND op.outpatient_type=1 ";
 | 
	
		
			
				|  |  | 				if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 					if (flag){
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}else {
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else if("12".equals(type)){
 | 
	
		
			
				|  |  | 				//视频复诊
 | 
	
		
			
				|  |  | 				sql =sql +"AND op.outpatient_type=2";
 | 
	
		
			
				|  |  | 				if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 					if (flag){
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}else  {
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else{}*/
 | 
	
		
			
				|  |  | 			if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 				if (flag){
 | 
	
		
			
				|  |  | 					sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			}else {
 | 
	
		
			
				|  |  | 				sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql =sql +" AND op.type in ('1','2') AND op.outpatient_type = 3 ";
 | 
	
		
			
				|  |  | 			sql =sql +" ORDER BY op.create_time DESC";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
 | 
	
		
			
				|  |  | 			sql = "SELECT " +
 | 
	
		
			
				|  |  | 					" DISTINCT op.id AS \"outpatientId\"," +
 | 
	
		
			
				|  |  | 					"op.description AS \"title\"," +
 | 
	
		
			
				|  |  | 					"op.description AS \"symptoms\","+
 | 
	
		
			
				|  |  | 					//添加排序的列
 | 
	
		
			
				|  |  | 					"op.create_time AS \"createTime\",";
 | 
	
		
			
				|  |  | 			if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 				if (flag){
 | 
	
		
			
				|  |  | 					sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else{
 | 
	
		
			
				|  |  | 				sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql =sql +"op.status AS \"status\"," +
 | 
	
		
			
				|  |  | 					"op.evaluate_status AS \"evaluate\"," +
 | 
	
		
			
				|  |  | 					"op.doctor AS \"doctorCode\"," +
 | 
	
		
			
				|  |  | 					"op.general_doctor AS \"generalDoctor\"," +
 | 
	
		
			
				|  |  | 					"op.consumer AS \"consumer\"," +
 | 
	
		
			
				|  |  | 					"patient.NAME AS \"patientName\"," +
 | 
	
		
			
				|  |  | 					"patient.id AS \"patientId\"," +
 | 
	
		
			
				|  |  | 					"patient.idcard AS \"patientIdcard\"," +
 | 
	
		
			
				|  |  | 					"patient.sex AS \"patientsex\"," +
 | 
	
		
			
				|  |  | 					"patient.photo AS \"patientphoto\",";
 | 
	
		
			
				|  |  | 			if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 				if (flag){
 | 
	
		
			
				|  |  | 					sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql = sql + "to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\",";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else{
 | 
	
		
			
				|  |  | 				sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 			sql = sql +		"op.status AS \"outpatientstatus\" " +
 | 
	
		
			
				|  |  | 					"FROM base_patient patient," +
 | 
	
		
			
				|  |  | 					"wlyy_outpatient op " +
 | 
	
		
			
				|  |  | 					"WHERE op.patient=patient.id " +
 | 
	
		
			
				|  |  | 					"AND op.doctor='"+doctorCode+"' " +
 | 
	
		
			
				|  |  | 					"AND op.status in ('0','1','2') and  op.pay_status=1 ";
 | 
	
		
			
				|  |  | 			if("9".equals(type)){
 | 
	
		
			
				|  |  | 				//图文复诊
 | 
	
		
			
				|  |  | 				sql =sql +"AND op.type=1 AND op.outpatient_type=1 ";
 | 
	
		
			
				|  |  | 			}else if("16".equals(type)){
 | 
	
		
			
				|  |  | 				//视频复诊
 | 
	
		
			
				|  |  | 				sql =sql +"AND op.type=2 AND op.outpatient_type=1 ";
 | 
	
		
			
				|  |  | 				if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 					if (flag){
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}else {
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else if("12".equals(type)){
 | 
	
		
			
				|  |  | 				//视频复诊
 | 
	
		
			
				|  |  | 				sql =sql +"AND op.outpatient_type=2";
 | 
	
		
			
				|  |  | 				if("xm_ykyy_wx".equals(wxId)){
 | 
	
		
			
				|  |  | 					if (flag){
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}else  {
 | 
	
		
			
				|  |  | 						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  | 					}
 | 
	
		
			
				|  |  | 				}else {
 | 
	
		
			
				|  |  | 					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
 | 
	
		
			
				|  |  | 				}
 | 
	
		
			
				|  |  | 			}else{}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 			sql =sql +" ORDER BY op.create_time DESC";
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 		List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
 | 
	
		
			
				|  |  | 		for (Map<String,Object> map:mapList){
 | 
	
		
			
				|  |  | 			if (map.get("patientIdcard")!=null){
 | 
	
		
			
				|  |  | 				String idcard = map.get("patientIdcard").toString();
 | 
	
		
			
				|  |  | 				Integer age =IdCardUtil.getAgeForIdcard(idcard);
 | 
	
		
			
				|  |  | 				map.put("patientAge",age);
 | 
	
		
			
				|  |  | 			}
 | 
	
		
			
				|  |  | 		}
 | 
	
		
			
				|  |  | 		return mapList;
 | 
	
		
			
				|  |  | 	}
 | 
	
		
			
				|  |  | }
 |