| 
					
				 | 
			
			
				@ -8,13 +8,19 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.PatientMedicareCardDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.WlyyDoctorWorkTimeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.mapping.service.DoctorMappingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.mapping.service.PatientMappingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.dao.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -24,21 +30,18 @@ import com.yihu.jw.patient.dao.BasePatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.patient.dao.BasePatientMedicareCardDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.base.org.BaseOrgVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import jxl.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import jxl.write.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.time.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.poi.ss.usermodel.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.BeanPropertyRowMapper; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -49,10 +52,7 @@ import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.OutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.lang.Boolean; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by Trick on 2019/5/17. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -82,7 +82,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorClinicRoomConsultDao doctorClinicRoomConsultDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HospitalWaitingRoomDao HospitalWaitingRoomDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HospitalWaitingRoomDao hospitalWaitingRoomDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DictHospitalDeptDao dictHospitalDeptDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -97,6 +97,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private OutpatientDao outpatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ObjectMapper objectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyChargeDictDao wlyyChargeDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyHospitalSysDictDao sysDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorWorkTimeDao doctorWorkTimeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientRegisterTimeDao patientRegisterTimeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${demo.flag}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private boolean demoFlag; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -193,6 +201,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_adm_no AS originAdmNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.register_no AS registerNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_register_no AS originRegisterNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_con_no AS originConNo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.con_no AS conNo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.hospital," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.hospital_name AS hospitalName," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.win_no AS winNo," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -256,6 +266,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("address",basePatientDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mobile",basePatientDO.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("birthday",DateUtil.dateToStr(basePatientDO.getBirthday(),"yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取处方信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDO> prescriptionDOs = null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -461,10 +473,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean appointmentRevisit(String outpatientJson,String expressageJson)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientDO appointmentRevisit(String outpatientJson,String expressageJson,String registerJson)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.保存就诊实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -476,6 +487,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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("号源已经被预约,请选择其他号源"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson,WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setDel(1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -484,78 +509,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //3.创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient,registerTimeDO==null?null:registerTimeDO.getStartTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return outpatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @param json 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public String paymentCallback(JSONObject json)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //创建续方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        createPrescription(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        //创建诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        createRoom(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    public Boolean createPrescription(JSONObject json) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String patient = json.getString("patient"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String doctor = json.getString("doctor"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String originRealOrder = json.getString("originRealOrder"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String originAdmNo = json.getString("originAdmNo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String serialNo = json.getString("serialNo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        BasePatientDO basePatientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),patient,"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        String patNo  = patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        WlyyPrescriptionVO originPrescriptionVO = findOriginPrescription(serialNo,patNo,originAdmNo,originRealOrder,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        WlyyPrescriptionDO prescription = new WlyyPrescriptionDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setOriginAdmNo(originAdmNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setOriginRealOrder(originRealOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setOriginSerialNo(serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setPatientCode(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setPatientName(basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setSsc(cardDO.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescription.setDoctorName(baseDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<WlyyPrescriptionInfoVO> originInfoVOs = originPrescriptionVO.getInfoVOs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<WlyyPrescriptionInfoDO> infoDOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<WlyyPrescriptionDiagnosisVO> diagnosisVOs = originPrescriptionVO.getDiagnosisVOs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescriptionInfoDao.save(convertToModels(originInfoVOs,infoDOs,WlyyPrescriptionInfoDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescriptionDiagnosisDao.save(convertToModels(diagnosisVOs,diagnosisDOs,WlyyPrescriptionDiagnosisDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        prescriptionDao.save(prescription); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(WlyyOutpatientDO outpatientDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(WlyyOutpatientDO outpatientDO,Date reservationTime){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setConsultType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientId(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientName(outpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationTime(outpatientDO.getAdmDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationTime(reservationTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setVisitStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setSort(0); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -566,7 +536,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setOutpatientId(outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HospitalWaitingRoomDao.save(waitingRoom); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        hospitalWaitingRoomDao.save(waitingRoom); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -616,10 +586,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject checkOutpatient(String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject checkOutpatient(String patient)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //-1卡余额不足,,-2 存在未结束的诊断热 1成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject rs = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.判断钱是否够 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.余额判断改到前端判断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.判断是否有未结束的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -648,10 +619,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode,String dept){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<DictHospitalDeptDO> list =  dictHospitalDeptDao.findByOrgCodeIn(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<DictHospitalDeptVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return convertToModels(list,rs,DictHospitalDeptVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        convertToModels(list,rs,DictHospitalDeptVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0&&StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<rs.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = rs.get(i).getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(dept.equals(id)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Collections.swap(rs,0,i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -660,23 +641,106 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept,String chargeType,String doctorCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.doctor_duty_code, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.doctor_duty_name " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.expertise," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.introduce," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.job_title_code AS jobTitleCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.job_title_name AS jobTitleName," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.charge_type AS chargeType" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.dept_code = '"+dept+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND h.org_code = '"+orgCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0&&StringUtils.isNotBlank(doctorCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String)list.get(i).get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(doctorCode.equals(id)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Collections.swap(list,0,i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取医生列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findDoctorWithWork(String orgCode,String dept,String chargeType,String doctorCode,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.dept_code = '"+dept+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND h.org_code = '"+orgCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rstotal != null && rstotal.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.expertise," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.introduce," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.job_title_code AS jobTitleCode, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.job_title_name AS jobTitleName," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.charge_type AS chargeType" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.dept_code = '"+dept+"' " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND h.org_code = '"+orgCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //获取排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(Map<String,Object> doctor :list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String)doctor.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctor.put("workTime",times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(doctorCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(int i=0;i<list.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String id = (String)list.get(i).get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(doctorCode.equals(id)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Collections.swap(list,0,i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 挂号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -695,6 +759,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //存储挂号号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String serialNo = (String)rs.get("serial_no"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setRegisterNo(serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String conNo = (String)rs.get("@times"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setCardNo(conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -757,6 +823,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO = prescriptionDOs.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO = new WlyyPrescriptionDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO.setOutpatientId(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDO.setStatus(10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDO.setPatientCode(outpatientDO.getPatient()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -768,7 +835,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //下诊断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //删除之前诊断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDiagnosisDao.delete(ds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(ds!=null&&ds.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDiagnosisDao.delete(ds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = (List<WlyyPrescriptionDiagnosisDO>) com.alibaba.fastjson.JSONArray.parseArray(diagnosisJson, WlyyPrescriptionDiagnosisDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String Icd10 = ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1059,4 +1128,295 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ws.addCell(label); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyChargeDictVO> findByDeptTypeCode(String deptTypeCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyChargeDictDO> dictDOs = wlyyChargeDictDao.findByDeptTypeCode(deptTypeCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyChargeDictVO> dictVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return convertToModels(dictDOs,dictVOs,WlyyChargeDictVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取医生排班规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalSysDictDO> list = sysDictDao.findByDictName("Scheduling"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar ncTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ncTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar scTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        scTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar ecTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ecTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置几天号源,及最后天号源的开放时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int days =Integer.parseInt(findHospitalSysDictValue(list,"OpenDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String closeTime = findHospitalSysDictValue(list,"CloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //比较当前时间是否超过开放时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM_SS).after(DateUtil.strToDate(closeTime,DateUtil.HH_MM))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //当前时间超过开放时间,可以预约最后一天全部号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ecTime.add(Calendar.DAY_OF_MONTH,days); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ecTime.set(ecTime.get(Calendar.YEAR),ecTime.get(Calendar.MONTH),ecTime.get(Calendar.DATE),23,59,59); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //当前时间没超过开放时间,可以预约最后一天前一天全部号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ecTime.add(Calendar.DAY_OF_MONTH,days>1?days-1:0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ecTime.set(ecTime.get(Calendar.YEAR),ecTime.get(Calendar.MONTH),ecTime.get(Calendar.DATE),23,59,59); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyDoctorWorkTimeDO> times =  doctorWorkTimeDao.findDoctorWorkTime(doctor,scTime.getTime(),ecTime.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        workTimeFilter(list,times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        convertToModels(times,timeVOs,WlyyDoctorWorkTimeVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(timeVOs!=null&&timeVOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyDoctorWorkTimeVO timeVO : timeVOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                timeVO.setCount(findWorkTimeCount(timeVO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return timeVOs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeDO> workTimeFilter(List<WlyyHospitalSysDictDO> sys,List<WlyyDoctorWorkTimeDO> times){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(times!=null&×.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //上午号源开放的最早天数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int AMCloseDays =Integer.parseInt(findHospitalSysDictValue(sys,"AMCloseDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //每一天上午的最早预约的过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String AMCloseTime = findHospitalSysDictValue(sys,"AMCloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //下午号源开放的最早天数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int PMCloseDays =Integer.parseInt(findHospitalSysDictValue(sys,"PMCloseDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //每一天下午的最早预约的过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String PMCloseTime = findHospitalSysDictValue(sys,"PMCloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Iterator it = times.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            while (it.hasNext()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //设置上午过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Calendar scAMTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scAMTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scAMTime.add(Calendar.DAY_OF_MONTH,AMCloseDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //设置下午午过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Calendar scPMTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scPMTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scPMTime.add(Calendar.DAY_OF_MONTH,PMCloseDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyDoctorWorkTimeDO time = (WlyyDoctorWorkTimeDO)it.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Boolean filter = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //1.【上午的排班中】 且 【排班结束时间】如果在【开放时间】前,则移除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(filter&&"1".equals(time.getTimeType())&&time.getEndTime().before(scAMTime.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    filter=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //2.【下午午的排班中】 且 【排班结束时间】如果在【开放时间】前,则移除该排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(filter&&"2".equals(time.getTimeType())&&time.getEndTime().before(scPMTime.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    filter=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //3.如果【当前时间】过了【上午放号时间】,则移除所有上午的排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(filter&&"1".equals(time.getTimeType())&& 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM_SS).after(DateUtil.strToDate(AMCloseTime,DateUtil.HH_MM))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    scAMTime.set(scAMTime.get(Calendar.YEAR),scAMTime.get(Calendar.MONTH),scAMTime.get(Calendar.DATE),12,00,00); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(time.getEndTime().before(scAMTime.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        filter=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //4.如果【当前时间】过了【下午午放号时间】,则移除所有下午的排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(filter&&"2".equals(time.getTimeType())&& 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM_SS).after(DateUtil.strToDate(PMCloseTime,DateUtil.HH_MM))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    scPMTime.set(scAMTime.get(Calendar.YEAR),scAMTime.get(Calendar.MONTH),scAMTime.get(Calendar.DATE),12,00,00); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(time.getEndTime().before(scPMTime.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return times; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findHospitalSysDictValue(List<WlyyHospitalSysDictDO> list,String dictCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyHospitalSysDictDO sysDictDO : list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(dictCode.equals(sysDictDO.getDictCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return sysDictDO.getDictValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取卡信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param cardNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param demoFlag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public net.sf.json.JSONObject getCardInfo(String cardNo, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.qutpatientBalance(cardNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findWorkTimeInfo(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyDoctorWorkTimeDO timeDO = doctorWorkTimeDao.findOne(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar sc = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sc.setTime(timeDO.getStartTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.根据当前时间,去取已过时间的号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        while (sc.getTime().before(timeDO.getEndTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(new Date().before(sc.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //加上时间间隔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sc.add(Calendar.MINUTE,timeDO.getTimeInterval()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctorAndWorkId(timeDO.getDoctor(),id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.根据时间间隔拆分号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        while (sc.getTime().before(timeDO.getEndTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> t = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            t.put("startTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //加上时间间隔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sc.add(Calendar.MINUTE,timeDO.getTimeInterval()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果结束时间大于排班时间则不再拆分号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(sc.getTime().after(timeDO.getEndTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            t.put("endTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果号源被预约了,标记为true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Boolean registered = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(registerTimeDOs!=null&®isterTimeDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(WlyyPatientRegisterTimeDO registerTimeDO : registerTimeDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(t.get("startTime").equals(DateUtil.dateToStr(registerTimeDO.getStartTime(),"yyyy-MM-dd HH:mm:ss"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        registered = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            t.put("registered",registered); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.add(t); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Integer findWorkTimeCount(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyDoctorWorkTimeDO timeDO = doctorWorkTimeDao.findOne(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar sc = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sc.setTime(timeDO.getStartTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.根据当前时间,去取已过时间的号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        while (sc.getTime().before(timeDO.getEndTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(new Date().before(sc.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //加上时间间隔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sc.add(Calendar.MINUTE,timeDO.getTimeInterval()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctorAndWorkId(timeDO.getDoctor(),id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.根据时间间隔拆分号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        while (sc.getTime().before(timeDO.getEndTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,Object> t = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            t.put("startTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //加上时间间隔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sc.add(Calendar.MINUTE,timeDO.getTimeInterval()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(sc.getTime().after(timeDO.getEndTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            t.put("endTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(registerTimeDOs!=null&®isterTimeDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Boolean registered = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(WlyyPatientRegisterTimeDO registerTimeDO : registerTimeDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(t.get("startTime").equals(DateUtil.dateToStr(registerTimeDO.getStartTime(),"yyyy-MM-dd HH:mm:ss"))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        registered = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(!registered){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    rs.add(t); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.add(t); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> findDoctorInfo(String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO doctorDO = baseDoctorDao.findOne(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(doctorDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("doctor",doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("doctor",doctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("job",doctorDO.getJobTitleCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("jobName",doctorDO.getJobTitleName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("chargeType",doctorDO.getChargeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("photo",doctorDO.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> cancelOutPatient(String outPatientId,String cancelType,String cancelValue,String cancelRemark){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //判断医生是否接诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(roomDOs!=null&&roomDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(roomDO.getVisitStatus()==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    rs.put("code",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    rs.put("mes","医生已经接诊,无法取消"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    roomDO.setVisitStatus(-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    hospitalWaitingRoomDao.save(roomDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //更改门诊状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyOutpatientDO.setStatus("-1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyOutpatientDO.setPatientCancelRemark(cancelRemark); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyOutpatientDO.setPatientCancelType(cancelType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyOutpatientDO.setPatientCancelValue(cancelValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDao.save(wlyyOutpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //删除门诊号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patientRegisterTimeDao.delete(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("code",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mes","取消成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyHospitalSysDictDO> findCancelReasonList(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return sysDictDao.findByDictName("PatientCancel"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |