| 
					
				 | 
			
			
				@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.hospital.prescription.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.fasterxml.jackson.databind.ObjectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.dict.dao.DictHospitalDeptDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.dict.DictHospitalDeptDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9,10 +10,7 @@ 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.WlyyHospitalWaitingRoomDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.service.PatientMappingService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -21,12 +19,16 @@ import com.yihu.jw.hospital.prescription.service.entrance.EntranceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.org.dao.BaseOrgDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.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 net.sf.json.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -79,6 +81,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientMappingService patientMappingService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private OutpatientDao outpatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ObjectMapper objectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${demo.flag}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private boolean demoFlag; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -97,6 +101,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS30025(patNo,null,null,startTime,endTime,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询单条门诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param registerSn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param admNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientVO findOutpatientInfo(String patient,String registerSn,String admNo)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,admNo,registerSn,null,null,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 原处方记录列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param registerSn 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -130,7 +151,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取复诊记录列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param page 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -143,8 +164,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_outpatient o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = '"+patient+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.status = "+status; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = '"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql +=  " AND o.status = "+status; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -169,6 +192,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.doctor AS doctor, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.doctor_name AS doctorName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.idcard AS idcard, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.card_no AS cardNo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.mjz AS mjz, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.icd10 AS icd10, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.icd10_name AS icd10Name, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -181,13 +205,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_outpatient o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = '"+patient+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.status = "+status; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = '"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=  " AND o.status = "+status; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -195,6 +221,57 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取单条复诊记录信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //复诊信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("outpatient",convertToModel(outpatientDO,WlyyOutpatientVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName",basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientId",basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("idCard",basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("sex", basePatientDO.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),outpatientDO.getPatient(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc",cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取处方信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            convertToModels(prescriptionDOs,prescriptionVOs,WlyyPrescriptionVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyPrescriptionVO vo:prescriptionVOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //疾病信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setDiagnosisVOs(findDiagnosisById(vo.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescriptions",prescriptionVOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(expressageDOs!=null&&expressageDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询历史 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -329,14 +406,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc",cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByPrescriptionId(wlyyPrescriptionDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(expressageDOs!=null&&expressageDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //诊断信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -354,119 +423,112 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 预约 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param json 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean appointmentRevisit(JSONObject json)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.创建支付 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.支付回调 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        paymentCallback(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param json 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 发起图文和视频复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param expressageJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String paymentCallback(JSONObject json)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //创建续方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createPrescription(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //创建诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createPrescription(JSONObject json) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean appointmentRevisit(String outpatientJson,String expressageJson)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patient = json.getString("patient"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctor = json.getString("doctor"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.保存就诊实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setStatus("0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String originRealOrder = json.getString("originRealOrder"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String originAdmNo = json.getString("originAdmNo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String serialNo = json.getString("serialNo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(outpatient.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson,WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //3.创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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 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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(JSONObject json){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patient = json.getString("patient"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String doctor = json.getString("doctor"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String dept = json.getString("dept"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String hospital = json.getString("hospital"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String reservationTime = json.getString("reservationTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer consultType = json.getInt("consultType"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyDoctorClinicRoomDO> list = doctorClinicRoomConsultDao.findByDoctorAndStatus(doctor,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //已经有诊室不做操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //未有诊室则新增 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyDoctorClinicRoomDO room = new WlyyDoctorClinicRoomDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setDoctorName(baseDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setClinicName(baseDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DictHospitalDeptDO deptDO = dictHospitalDeptDao.findByCode(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setDept(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setDept(deptDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseOrgDO baseOrgDO = baseOrgDao.findByCode(hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setDept(hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setDept(baseOrgDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setClinicStatus(-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            room.setStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doctorClinicRoomConsultDao.save(room); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(WlyyOutpatientDO outpatientDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setConsultType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientId(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientName(basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationTime(DateUtil.strToDate(reservationTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientId(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setPatientName(outpatientDO.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationTime(outpatientDO.getAdmDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setVisitStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setSort(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setConsultType(consultType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setDoctor(outpatientDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setDoctor(outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setOutpatientId(outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HospitalWaitingRoomDao.save(waitingRoom); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -492,5 +554,76 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取卡记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findPatientCard(String patient)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS15018(null,patient,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject checkOutpatient(String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //-1卡余额不足,,-2 存在未结束的诊断热 1成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject rs = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.判断钱是否够 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.判断是否有未结束的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("code",-2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("mes","存在未结束的诊断"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("code",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mes","验证通过"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取所有医院列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<BaseOrgVO> findAllHospital(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseOrgDO> list = baseOrgDao.findByDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<BaseOrgVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return convertToModels(list,rs,BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取机构下部门信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<DictHospitalDeptDO> list =  dictHospitalDeptDao.findByOrgCodeIn(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<DictHospitalDeptVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return convertToModels(list,rs,DictHospitalDeptVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取医生列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.doctor_duty_code, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.doctor_duty_name " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 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+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |