|  | @ -480,7 +480,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         rs.put("patientCancelType", outpatientDO.getPatientCancelType());
 | 
	
		
			
				|  |  |         rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
 | 
	
		
			
				|  |  |         rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
 | 
	
		
			
				|  |  |         rs.put("operator", userAgent.getUID());
 | 
	
		
			
				|  |  |         rs.put("operator",outpatientDO.getOperator());
 | 
	
		
			
				|  |  |         //居民详情
 | 
	
		
			
				|  |  |         BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
 | 
	
		
			
				|  |  |         rs.put("patientName", basePatientDO.getName());
 | 
	
	
		
			
				|  | @ -594,7 +594,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(startTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 totalSql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     totalSql += " and create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     totalSql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 totalSql += " AND create_time >='" + startTime + " 00:00:00'";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -602,7 +607,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(endTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 totalSql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     totalSql += " and create_time <= str_to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     totalSql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 totalSql += " AND create_time <='" + endTime + " 23:59:59'";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -669,14 +678,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(startTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " and create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql += " and create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql += " AND create_time >='" + startTime + " 00:00:00'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(endTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " and create_time <= str_to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql += " and create_time <= to_date('" + startTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql += " AND create_time <='" + endTime + " 23:59:59'";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -2491,7 +2508,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(startTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 totalSql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     totalSql += " and e.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     totalSql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 totalSql += " AND e.create_time >='" + startTime + " 00:00:00'";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -2499,7 +2520,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(endTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 totalSql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     totalSql += " and e.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     totalSql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 totalSql += " AND e.create_time <='" + endTime + " 23:59:59'";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -2513,7 +2538,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String sql = "SELECT  ";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 sql = sql + "date_format(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql = sql + "to_char(e.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -2541,7 +2571,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(startTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " and e.create_time >= str_to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql += " and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql += " AND e.create_time >='" + startTime + " 00:00:00'";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -2549,7 +2583,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(endTime)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " and e.create_time <= str_to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql += " and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql += " AND e.create_time <='" + endTime + " 23:59:59'";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -3334,6 +3373,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         //更改门诊状态
 | 
	
		
			
				|  |  |         WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
 | 
	
		
			
				|  |  |         wlyyOutpatientDO.setStatus("-1");
 | 
	
		
			
				|  |  |         //报错拒诊操作人
 | 
	
		
			
				|  |  |         wlyyOutpatientDO.setOperator(userAgent.getUID());
 | 
	
		
			
				|  |  |         String description = null;
 | 
	
		
			
				|  |  |         if (1 == operator) {
 | 
	
		
			
				|  |  |             //居民取消
 | 
	
	
		
			
				|  | @ -3856,7 +3897,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 "patient.birthday AS \"birthday\"," +
 | 
	
		
			
				|  |  |                 "room.consult_type AS \"consult_type\",";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wechatId)) {
 | 
	
		
			
				|  |  |             sql += "to_char(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
 | 
	
		
			
				|  |  |             if(flag){
 | 
	
		
			
				|  |  |                 sql += "date_format(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql += "to_char(room.reservation_time ,'yyyy-MM-dd hh24:mi:ss' ) AS \"timedate_format\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format,";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -3899,7 +3945,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             sql += " AND outpatient.dept='" + dept + "' ";
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         logger.info("接口名称:findWaitingRoomOutpatientByDoctor-->sql="+sql);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |         if (list != null && list.size() > 0) {
 | 
	
		
			
				|  |  |             //根据身份证计算年龄
 | 
	
	
		
			
				|  | @ -3944,8 +3990,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String totalSql = "SELECT count(id) AS \"total\" FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             totalSql += " and reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             totalSql += " and reservation_time <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 totalSql += " and reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 totalSql += " and reservation_time <= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 totalSql += " and reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 totalSql += " and reservation_time <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             totalSql += " AND reservation_time >='" + DateUtil.dateToStrShort(new Date()) + " 00:00:00'";
 | 
	
		
			
				|  |  |             totalSql += " AND reservation_time <='" + DateUtil.dateToStrShort(new Date()) + " 23:59:59'";
 | 
	
	
		
			
				|  | @ -4016,8 +4068,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             waitingSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             waitingSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 waitingSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 waitingSql += " 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 {
 | 
	
		
			
				|  |  |                 waitingSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 waitingSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             waitingSql = waitingSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -4060,7 +4118,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 "patient.birthday AS \"birthday\"," +
 | 
	
		
			
				|  |  |                 "room.consult_type AS \"consult_type\",";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             onlineSql = onlineSql + "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",ceil((sysdate-to_date(to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'))* 24 * 60) AS \"time_cost\",";
 | 
	
		
			
				|  |  |             if(flag){
 | 
	
		
			
				|  |  |                 onlineSql = onlineSql + "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",ceil((sysdate-to_date(date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'))* 24 * 60) AS \"time_cost\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 onlineSql = onlineSql + "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",ceil((sysdate-to_date(to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'))* 24 * 60) AS \"time_cost\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             onlineSql = onlineSql + "date_format(room.reservation_time,'%Y-%m-%d %H:%i:%S' )  AS \"time\",TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS \"time_cost\",";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -4085,8 +4148,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         onlineSql = onlineSql+ "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor";
 | 
	
		
			
				|  |  | */
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
 | 
	
		
			
				|  |  |             onlineSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             onlineSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 onlineSql += " AND room.reservation_time >= str_to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 onlineSql += " AND room.reservation_time <= str_to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 onlineSql += " AND room.reservation_time >= to_date('" + date + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 onlineSql += " AND room.reservation_time <= to_date('" + date + " 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             onlineSql = onlineSql + "AND room.reservation_time>='" + date + " 00:00:00' AND room.reservation_time<='" + date + " 23:59:59' ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -4684,7 +4753,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 if (one.getEndTime().before(workTimeDO.getStartTime()) || one.getStartTime().after(workTimeDO.getEndTime())) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     throw new Exception("您选择的时间与“开始时间-结束时间”的医院排班/自己排班冲突,请重新选择!");
 | 
	
		
			
				|  |  |                     throw new Exception("您选择的时间与“开始时间:"+one.getStartTime()+"-结束时间:"+one.getEndTime()+"”的医院排班/自己排班冲突,请重新选择!");
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -4885,7 +4954,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     public List<Map<String, Object>> getVideoPrescriptionByDoctor(String doctor, String general_doctor, String wxId) {
 | 
	
		
			
				|  |  |         String condition = "";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -4951,8 +5025,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     public String generalDoctorWaitingNumber(String doctor, String wxId, String outpatientId) {
 | 
	
		
			
				|  |  |         String condition = "";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |                 condition += "date_format(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |                 condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
 | 
	
		
			
				|  |  |             condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
 | 
	
	
		
			
				|  | @ -4989,7 +5069,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | //                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             if(flag){
 | 
	
		
			
				|  |  |                 sql += " AND room.reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_time >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -5009,8 +5094,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |     public com.alibaba.fastjson.JSONArray getWaitingForVisitVideoPrescriptionByDoctor(String doctor, String wxId) {
 | 
	
		
			
				|  |  |         String condition = "";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
 | 
	
		
			
				|  |  |             if(flag){
 | 
	
		
			
				|  |  |                 condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |                 condition += "date_format(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |                 condition += "to_char(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
 | 
	
		
			
				|  |  |             condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
 | 
	
	
		
			
				|  | @ -5047,7 +5138,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | //                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";*/
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             if(flag){
 | 
	
		
			
				|  |  |                 sql += " AND room.reservation_time >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql += " AND room.reservation_time >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql += " AND room.reservation_time >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -5403,7 +5499,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             sql = sql + " AND outpatient.type= '" + type + "' ";
 | 
	
		
			
				|  |  |             if ("2".equals(type)) {//视频复诊才需要判断时间,
 | 
	
		
			
				|  |  |                 if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                     sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                     if (flag){
 | 
	
		
			
				|  |  |                         sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 } else {
 | 
	
		
			
				|  |  |                     sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
 | 
	
		
			
				|  |  |                 }
 | 
	
	
		
			
				|  | @ -5411,11 +5511,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         } else if ("2".equals(outpatient_type)) {
 | 
	
		
			
				|  |  |             //协同门诊也需要判断时间
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         logger.info("接口名称:doctorReviewConsultCount-->sql="+sql);
 | 
	
		
			
				|  |  |         List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Long waitVideoCount = 0l;
 | 
	
	
		
			
				|  | @ -5833,7 +5939,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(startDate)) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sqlTotal += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sqlTotal += " and o.register_date >= str_to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sqlTotal += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sqlTotal += " AND o.register_date >='" + startDate + " 00:00:00' ";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -5841,7 +5952,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(endDate)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sqlTotal += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sqlTotal += " and o.register_date <= str_to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sqlTotal += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sqlTotal += " AND o.register_date <='" + endDate + " 23:59:59' ";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -5900,14 +6016,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 " o.general_doctor = '" + generalDoctor + "'";
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(startDate)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sql += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " and o.register_date >= str_to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql += " and o.register_date >= to_date('" + startDate + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql += " AND o.register_date >='" + startDate + " 00:00:00' ";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotBlank(endDate)) {
 | 
	
		
			
				|  |  |             if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |                 sql += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 if (flag){
 | 
	
		
			
				|  |  |                     sql += " and o.register_date <= str_to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }else {
 | 
	
		
			
				|  |  |                     sql += " and o.register_date <= to_date('" + endDate + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 sql += " AND o.register_date <='" + endDate + " 23:59:59' ";
 | 
	
		
			
				|  |  |             }
 | 
	
	
		
			
				|  | @ -6140,7 +6266,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String condition = "";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             condition = "to_char(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 condition = "date_format(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 condition = "to_char(p.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             condition = "date_format(p.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"time\",";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -6148,9 +6279,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         String sql = "SELECT " + condition + "d.NAME as \"doctorName\",d.job_title_name as \"job_title_name\",d.photo AS \"photo\",p.id as \"outpatientid\" FROM wlyy_outpatient p,base_doctor d " +
 | 
	
		
			
				|  |  |                 "WHERE p.patient='" + patient + "' AND p.doctor=d.id AND p.status=0 ";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 sql += " AND p.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 sql += " AND p.register_date <= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql += " AND p.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |                 sql += " AND p.register_date <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             sql += " AND p.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |             sql += " AND p.register_date <= to_date('" + DateUtil.dateToStrShort(new Date()) + " 23:59:59','YYYY-MM-DD HH24:MI:SS')";
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql += " BETWEEN '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' AND '" + DateUtil.dateToStrShort(new Date()) + " 23:59:59' ";
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -6474,7 +6610,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                 "\tp.idcard as \"idcard\",\n" +
 | 
	
		
			
				|  |  |                 "\tp.ssc as \"ssc\",\n";
 | 
	
		
			
				|  |  |         if ("xm_ykyy_wx".equals(wxId)) {
 | 
	
		
			
				|  |  |             sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             if (flag){
 | 
	
		
			
				|  |  |                 sql = sql + "date_format(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\",";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
 | 
	
		
			
				|  |  |         }
 |