| 
					
				 | 
			
			
				@ -15,6 +15,7 @@ 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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -26,6 +27,7 @@ import com.yihu.jw.hospital.dict.WlyyChargeDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.service.DoctorMappingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.service.PatientMappingService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -40,6 +42,7 @@ 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.iot.common.UploadVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -130,6 +133,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorHospitalDao baseDoctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PrescriptionExpressageService sfexpressService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyDoctorOnlineTimeDao wlyyDoctorOnlineTimeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -180,6 +185,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String admNo,boolean demoFlag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" admNo:"+admNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS16017(registerSn,null,patNo,admNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -528,6 +534,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setIdcard(patientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setOutpatientType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -559,6 +566,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return outpatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -573,11 +581,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setHospital(outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setHospitalName(outpatientDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //是否是有协同门诊医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientId(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientName(outpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationTime(outpatientDO.getRegisterDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setVisitStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置复诊类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType())?Integer.parseInt(outpatientDO.getOutpatientType()):1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setSort(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2761,4 +2777,83 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return waitVideoCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 保存在线排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param onlineWorkJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop saveDoctorOnlineWork(String onlineWorkJson)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyDoctorOnlineTimeDO timeDO = objectMapper.readValue(onlineWorkJson,WlyyDoctorOnlineTimeDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyDoctorOnlineTimeDO> list = wlyyDoctorOnlineTimeDao.findWorkExistList(timeDO.getDoctor(),timeDO.getStartTime(),timeDO.getEndTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return Envelop.getError("排班已存在",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        timeDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return Envelop.getSuccess("保存成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 删除在线排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Envelop delDoctorOnlineWork(String id)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyDoctorOnlineTimeDao.delete(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return Envelop.getSuccess("删除成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询医生在线排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorOnlineTimeDO> findDoctorOnlineWorkList(String doctor,String startDate,String endDate){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return wlyyDoctorOnlineTimeDao.findWorkList(doctor,DateUtil.stringToDate(startDate+" 00:00:00","yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate+" 23:59:59","yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 发起图文和视频复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientDO cooperativeOutpatient(String outpatientJson,String registerJson)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.保存就诊实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setMjz("mz"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setIdcard(patientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setOutpatientType("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPatientRegisterTimeDO registerTimeDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果是视频预约咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(registerJson)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO = objectMapper.readValue(registerJson,WlyyPatientRegisterTimeDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientRegisterTimeDao.save(registerTimeDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("号源已经被预约,请选择其他号源"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //3.创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return outpatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |