|  | @ -1032,10 +1032,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         String rsCode = res.getString("@RESULT");
 | 
	
		
			
				|  |  |         if("0".equals(rsCode)){
 | 
	
		
			
				|  |  |             //存储挂号号
 | 
	
		
			
				|  |  |             String serialNo = (String)rs.get("serial_no");
 | 
	
		
			
				|  |  |             // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}}
 | 
	
		
			
				|  |  |             String serialNo = (String)res.get("@serial_no");
 | 
	
		
			
				|  |  |             outpatientDO.setRegisterNo(serialNo);
 | 
	
		
			
				|  |  |             String conNo = (String)rs.get("@times");
 | 
	
		
			
				|  |  |             String conNo = (String)res.get("@times");
 | 
	
		
			
				|  |  |             outpatientDO.setConNo(conNo);
 | 
	
		
			
				|  |  |             logger.info("挂号流水 @serial_no: " +serialNo+" @times: "+conNo);
 | 
	
		
			
				|  |  |             outpatientDao.save(outpatientDO);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |             //保存日志
 | 
	
	
		
			
				|  | @ -2321,7 +2323,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Boolean saveDoctorWorkTimeJson(String type,String codes,String workTimeJson)throws Exception{
 | 
	
		
			
				|  |  |     public Boolean saveDoctorWorkTimeJson(String type,String codes,String workTimeJson,String date)throws Exception{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         com.alibaba.fastjson.JSONArray works = JSON.parseArray(workTimeJson);
 | 
	
		
			
				|  |  |         List<WlyyDoctorWorkTimeDO> wlyyDoctorWorkTimeDOs = new ArrayList<>();
 | 
	
	
		
			
				|  | @ -2348,7 +2350,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     " h.org_code ='"+codes+"'";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             List<WlyyDoctorWorkTimeDO> workTimeDOs =makeDoctorWorkTimeDOList(doctors,wlyyDoctorWorkTimeDOs);
 | 
	
		
			
				|  |  |             saveDoctorWorkTime(workTimeDOs);
 | 
	
		
			
				|  |  |             saveDoctorWorkTime(workTimeDOs,date,doctors);
 | 
	
		
			
				|  |  |             //科室
 | 
	
		
			
				|  |  |         }else if("2".equals(type)){
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -2367,7 +2369,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     " h.dept_code in ("+sqlCode(codes)+")";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             List<WlyyDoctorWorkTimeDO> workTimeDOs =makeDoctorWorkTimeDOList(doctors,wlyyDoctorWorkTimeDOs);
 | 
	
		
			
				|  |  |             saveDoctorWorkTime(workTimeDOs);
 | 
	
		
			
				|  |  |             saveDoctorWorkTime(workTimeDOs,date,doctors);
 | 
	
		
			
				|  |  |             //医生批量
 | 
	
		
			
				|  |  |         }else if("3".equals(type)){
 | 
	
		
			
				|  |  |             String sql ="SELECT " +
 | 
	
	
		
			
				|  | @ -2385,7 +2387,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |                     " d.id in ("+sqlCode(codes)+")";
 | 
	
		
			
				|  |  |             List<Map<String,Object>> doctors = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             List<WlyyDoctorWorkTimeDO> workTimeDOs =makeDoctorWorkTimeDOList(doctors,wlyyDoctorWorkTimeDOs);
 | 
	
		
			
				|  |  |             saveDoctorWorkTime(workTimeDOs);
 | 
	
		
			
				|  |  |             saveDoctorWorkTime(workTimeDOs,date,doctors);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return true;
 | 
	
	
		
			
				|  | @ -2407,15 +2409,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |             //构建医生排班
 | 
	
		
			
				|  |  |             for(Map<String,Object> doctor:doctors){
 | 
	
		
			
				|  |  |                 for(WlyyDoctorWorkTimeDO time:wlyyDoctorWorkTimeDOs){
 | 
	
		
			
				|  |  |                     time.setDoctor((String)doctor.get("id"));
 | 
	
		
			
				|  |  |                     time.setDoctorName((String)doctor.get("name"));
 | 
	
		
			
				|  |  |                     time.setDept((String)doctor.get("dept_code"));
 | 
	
		
			
				|  |  |                     time.setDeptName((String)doctor.get("dept_name"));
 | 
	
		
			
				|  |  |                     time.setHospital((String)doctor.get("org_code"));
 | 
	
		
			
				|  |  |                     time.setHospitalName((String)doctor.get("org_name"));
 | 
	
		
			
				|  |  |                     time.setCreateTime(new Date());
 | 
	
		
			
				|  |  |                     rs.add(time);
 | 
	
		
			
				|  |  |                     WlyyDoctorWorkTimeDO t = new WlyyDoctorWorkTimeDO();
 | 
	
		
			
				|  |  |                     t.setDoctor((String)doctor.get("id"));
 | 
	
		
			
				|  |  |                     t.setDoctorName((String)doctor.get("name"));
 | 
	
		
			
				|  |  |                     t.setDept((String)doctor.get("dept_code"));
 | 
	
		
			
				|  |  |                     t.setDeptName((String)doctor.get("dept_name"));
 | 
	
		
			
				|  |  |                     t.setHospital((String)doctor.get("org_code"));
 | 
	
		
			
				|  |  |                     t.setHospitalName((String)doctor.get("org_name"));
 | 
	
		
			
				|  |  |                     t.setCreateTime(new Date());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     t.setType(time.getType());
 | 
	
		
			
				|  |  |                     t.setTimeType(time.getTimeType());
 | 
	
		
			
				|  |  |                     t.setStartTime(time.getStartTime());
 | 
	
		
			
				|  |  |                     t.setEndTime(time.getEndTime());
 | 
	
		
			
				|  |  |                     t.setDate(time.getDate());
 | 
	
		
			
				|  |  |                     t.setTimeInterval(time.getTimeInterval());
 | 
	
		
			
				|  |  |                     rs.add(t);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 logger.info(rs.size()+"");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return rs;
 | 
	
	
		
			
				|  | @ -2426,7 +2437,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @param workTimeDOs
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public Boolean saveDoctorWorkTime(List<WlyyDoctorWorkTimeDO> workTimeDOs){
 | 
	
		
			
				|  |  |     public Boolean saveDoctorWorkTime(List<WlyyDoctorWorkTimeDO> workTimeDOs,String date,List<Map<String,Object>> doctors){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(workTimeDOs!=null&&workTimeDOs.size()>0){
 | 
	
		
			
				|  |  |             //按月按医生分组标记排班数据
 | 
	
	
		
			
				|  | @ -2434,15 +2445,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             for(WlyyDoctorWorkTimeDO time : workTimeDOs){
 | 
	
		
			
				|  |  |                 //医生工作月份
 | 
	
		
			
				|  |  |                 String workMonth = time.getDoctor()+","+time.getDate().substring(0,6);
 | 
	
		
			
				|  |  |                 String workMonth = time.getDoctor()+","+time.getDate().substring(0,7);
 | 
	
		
			
				|  |  |                 //判断是否是首次插入医生月份数据,如果是首次,则删除该医生当前月份排班数据数据
 | 
	
		
			
				|  |  |                 if(!workMonths.contains(workMonth)){
 | 
	
		
			
				|  |  |                     workMonths.add(workMonth);
 | 
	
		
			
				|  |  |                     List<WlyyDoctorWorkTimeDO> oldTimes = doctorWorkTimeDao.findDoctorWorkTimeByMonth(time.getDoctor(),"%"+time.getDate().substring(0,6)+"%");
 | 
	
		
			
				|  |  |                     List<WlyyDoctorWorkTimeDO> oldTimes = doctorWorkTimeDao.findDoctorWorkTimeByMonth(time.getDoctor(),"%"+time.getDate().substring(0,7)+"%");
 | 
	
		
			
				|  |  |                     doctorWorkTimeDao.delete(oldTimes);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             doctorWorkTimeDao.save(workTimeDOs);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             //如果排班数据为空,删除医生月份下排班数据
 | 
	
		
			
				|  |  |             if(StringUtils.isNotBlank(date)){
 | 
	
		
			
				|  |  |                 String d[] = date.split(",");
 | 
	
		
			
				|  |  |                 for(String dt:d){
 | 
	
		
			
				|  |  |                     for(Map<String,Object> doc:doctors){
 | 
	
		
			
				|  |  |                         List<WlyyDoctorWorkTimeDO> oldTimes = doctorWorkTimeDao.findDoctorWorkTimeByMonth((String)doc.get("id"),"%"+dt+"%");
 | 
	
		
			
				|  |  |                         doctorWorkTimeDao.delete(oldTimes);
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return true;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -2693,15 +2715,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      * @param doctor
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void pickVideoPrescripitonWaitingPeople(String outpatientCode, String doctor) throws Exception{
 | 
	
		
			
				|  |  |         BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
 | 
	
		
			
				|  |  |         List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outpatientCode);
 | 
	
		
			
				|  |  |         if(roomDOs!=null&&roomDOs.size()>0){
 | 
	
		
			
				|  |  |             for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){
 | 
	
		
			
				|  |  |                     BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
 | 
	
		
			
				|  |  |                     roomDO.setDoctor(doctor);
 | 
	
		
			
				|  |  |                     roomDO.setDoctorName(baseDoctorDO.getName());
 | 
	
		
			
				|  |  |                     hospitalWaitingRoomDao.save(roomDO);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
 | 
	
		
			
				|  |  |         wlyyOutpatientDO.setDoctor(doctor);
 | 
	
		
			
				|  |  |         wlyyOutpatientDO.setDoctorName(baseDoctorDO.getName());
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |         
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  |     
 | 
	
		
			
				|  |  |     /**
 |