| 
					
				 | 
			
			
				@ -162,6 +162,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HibenateUtils hibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorPatientFollowDao baseOrgPatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyHospitalWorkRuleDao wlyyHospitalWorkRuleDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${demo.flag}") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -169,6 +171,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取居民就诊记录接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param endTime 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -176,35 +179,36 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:"+patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:" + patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo "+patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS30025(patNo,null,startTime,endTime,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo " + patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询单条门诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param conNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientVO findOutpatientInfo(String patient,String conNo)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:"+patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientVO findOutpatientInfo(String patient, String conNo) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:" + patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo:"+patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,conNo,null,null,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patNo:" + patNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyOutpatientVO outpatientVO = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setSex(patientDO.getSex()+""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setSex(patientDO.getSex() + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setBirthday(patientDO.getBirthday()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return outpatientVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -214,18 +218,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn,String patient,String realOrder,String admNo,boolean demoFlag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn, String patient, String realOrder, String admNo, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS16017(registerSn,realOrder,patNo,admNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOriginPrescriptionList: registerSn:" + registerSn + " patient" + patient + " patNo:" + patNo + " realOrder:" + realOrder + " admNo:" + admNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取单条处方记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param registerSn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param admNo 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -234,13 +239,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyPrescriptionVO findOriginPrescription(String registerSn, String patient, String admNo, String realOrder, boolean demoFlag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo =patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isBlank(patNo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyPrescriptionVO findOriginPrescription(String registerSn, String patient, String admNo, String realOrder, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> rs = entranceService.BS16017(registerSn,realOrder,patNo,admNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> rs = entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null && rs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return rs.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -248,13 +253,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取复诊记录列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findReOutpatientList(String patient,Integer status,String startTime,String endTime,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findReOutpatientList(String patient, Integer status, String startTime, String endTime, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -263,24 +269,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = ? AND o.outpatient_type != '2' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Object> totalParams = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        totalParams.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql +=  " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(startTime+" 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(startTime + " 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(endTime+" 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(endTime + " 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql,totalParams.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql, totalParams.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rstotal != null && rstotal.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.adm_no AS admNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_adm_no AS originAdmNo, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -317,101 +323,102 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Object> params = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=  " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time >= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(startTime+" 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(startTime + " 00:00:00"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time <= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(endTime+" 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(endTime + " 23:59:59"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC LIMIT " + (page - 1) * size + "," + size + " "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class),params.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class), params.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取单条复诊记录信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId,String prescriptionId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId, String prescriptionId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //复诊信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("outpatient",convertToModel(outpatientDO,WlyyOutpatientVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("outpatient", convertToModel(outpatientDO, WlyyOutpatientVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName",basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("photo",basePatientDO.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientId",basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("idCard",basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName", basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("photo", basePatientDO.getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("address",basePatientDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mobile",basePatientDO.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("birthday",DateUtil.dateToStr(basePatientDO.getBirthday(),"yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(), outpatientDO.getPatient(), "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc", cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(prescriptionId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(prescriptionId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDOs = prescriptionDao.findById(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            convertToModels(prescriptionDOs,prescriptionVOs,WlyyPrescriptionVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyPrescriptionVO vo:prescriptionVOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()), infoVOs, WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //检查检验信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyInspectionVO> inspectionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId()),inspectionVOs,WlyyInspectionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId()), inspectionVOs, WlyyInspectionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescriptions",prescriptionVOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (expressageDOs != null && expressageDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage", convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //物流配送新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(expressageLogDOs!=null&&expressageLogDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs",convertToModels(expressageLogDOs,expressageLogVOs, WlyyPrescriptionExpressageLogVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (expressageLogDOs != null && expressageLogDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressageLogs", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //预约记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(timeDOs!=null&&timeDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register",timeDOs.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (timeDOs != null && timeDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register", timeDOs.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("register", null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -420,6 +427,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询历史 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param startTime 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -428,24 +436,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findPrescriptionList(String patient, String status,String startTime, String endTime, Integer page, Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findPrescriptionList(String patient, String status, String startTime, String endTime, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_prescription p "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        totalSql += " WHERE 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND p.patient_code ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND p.patient_code ='" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND p.status IN ("+status+")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND p.status IN (" + status + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -454,7 +462,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.real_order AS realOrder," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " p.origin_real_order AS originRealOrder," + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -500,70 +508,70 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_prescription p " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(patient)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND p.patient_code ='"+patient+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND p.patient_code ='" + patient + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND p.status IN ("+status+")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND p.status IN (" + status + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyPrescriptionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置病种,药品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyPrescriptionVO vo:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (WlyyPrescriptionVO vo : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setDiagnosisVOs(findDiagnosisById(vo.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()), infoVOs, WlyyPrescriptionInfoVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionDiagnosisVO> findDiagnosisById(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionDiagnosisVO> findDiagnosisById(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> list = prescriptionDiagnosisDao.findByPrescriptionId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return convertToModels(list,rs,WlyyPrescriptionDiagnosisVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return convertToModels(list, rs, WlyyPrescriptionDiagnosisVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> findPrescriptionInfo(String prescriptionId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> findPrescriptionInfo(String prescriptionId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //续方信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescription",convertToModel(wlyyPrescriptionDO,WlyyPrescriptionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("prescription", convertToModel(wlyyPrescriptionDO, WlyyPrescriptionVO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //居民详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDO.getPatientCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientName",basePatientDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("patientId",basePatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("idCard",basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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(),wlyyPrescriptionDO.getPatientCode(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc",cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(), wlyyPrescriptionDO.getPatientCode(), "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("ssc", cardDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("age", IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //诊断信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("diagnosis", findDiagnosisById(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("infos",prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("infos", prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean checkPrescription(String patient){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean checkPrescription(String patient) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDO> list = prescriptionDao.findByPatientCode(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -572,15 +580,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 发起图文和视频复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param expressageJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientDO appointmentRevisit(String outpatientJson,String expressageJson,String registerJson,String chargeType)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.保存就诊实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setMjz("mz"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -590,7 +599,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setOutpatientType("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(outpatientDO.getRegisterDate()==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (outpatientDO.getRegisterDate() == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setRegisterDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -600,25 +609,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果是视频预约咨询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(registerJson)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO = objectMapper.readValue(registerJson,WlyyPatientRegisterTimeDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(registerJson)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registerTimeDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientRegisterTimeDao.save(registerTimeDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("号源已经被预约,请选择其他号源"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.物流信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson,WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setOutpatientId(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //3.创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient,chargeType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        createRoom(outpatient, chargeType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return outpatient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -626,10 +635,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 创建候诊室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(WlyyOutpatientDO outpatientDO,String chargeType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean createRoom(WlyyOutpatientDO outpatientDO, String chargeType) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -639,7 +649,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setHospitalName(outpatientDO.getHospitalName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //是否是有协同门诊医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -649,18 +659,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationTime(outpatientDO.getRegisterDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setVisitStatus(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置复诊类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType())?Integer.parseInt(outpatientDO.getOutpatientType()):1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType()) ? Integer.parseInt(outpatientDO.getOutpatientType()) : 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setSort(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientDO.getDoctor())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setDoctor(outpatientDO.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setDoctorName(outpatientDO.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setOutpatientId(outpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        waitingRoom.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            waitingRoom.setChargeType(chargeType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -670,7 +680,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean cancelPrescription(String prescriptionId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean cancelPrescription(String prescriptionId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDO.setStatus(-2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -678,18 +688,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *@param admNo 门诊唯一号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param admNo     门诊唯一号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param realOrder 处方号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  @param status 处方状态 1审方失败,2审核完成,3结算完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status    处方状态 1审方失败,2审核完成,3结算完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> updatePrescriptionByHisStatu(String admNo,String realOrder,String status)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> updatePrescriptionByHisStatu(String admNo, String realOrder, String status) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //status 处方流程状态 ,13  开方失败/调整中,20 诊断完成/开方成功/待支付,已完成:100 已完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //pay_status`:处方结算状态,0为未结算,1为结算成功,默认为0', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String outPatientSql=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String outPatientSql = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "UPDATE base.wlyy_prescription p SET p.`status`='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -699,7 +709,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //开方成功时候,先用处方号获取本地处方状态是否为开方失败,如果是则需要更新本地的处方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = "UPDATE base.wlyy_prescription p SET p.`status`='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //变更门诊状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outPatientSql="UPDATE base.wlyy_outpatient p SET p.`status`='2' WHERE p.adm_no='" + admNo + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outPatientSql = "UPDATE base.wlyy_outpatient p SET p.`status`='2' WHERE p.adm_no='" + admNo + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jdbcTemplate.execute(outPatientSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jdbcTemplate.execute(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -713,7 +723,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyPrescriptionDO.setPayStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyPrescriptionDO.setStatus(100); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),100,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(), 100, 2, outpatientDO.getDoctor(), outpatientDO.getDoctorName(), "", new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionDao.save(wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -721,30 +731,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyPrescriptionDO.setPayStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyPrescriptionDO.setStatus(32); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WlyyPrescriptionVO vo = findOriginPrescription(outpatientDO.getRegisterNo(),outpatientDO.getPatient(),admNo,realOrder,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    WlyyPrescriptionVO vo = findOriginPrescription(outpatientDO.getRegisterNo(), outpatientDO.getPatient(), admNo, realOrder, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyPrescriptionDO.setDispUser(vo.getDispUser()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyPrescriptionDO.setDispUserName(vo.getDispUserName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    wlyyPrescriptionDO.setDispDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),32,2,vo.getDispUser(),vo.getDispUserName(),"",new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.error("获取处方信息异常"+e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(), 32, 2, vo.getDispUser(), vo.getDispUserName(), "", new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    logger.error("获取处方信息异常" + e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionDao.save(wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //发送取药系统消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SystemMessageDO systemMessageDO = sendPatientGetDrugMes(outpatientDO,wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SystemMessageDO systemMessageDO = sendPatientGetDrugMes(outpatientDO, wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("mes",systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("mes", systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("flag",true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("flag", true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public SystemMessageDO sendPatientGetDrugMes(WlyyOutpatientDO outpatient,WlyyPrescriptionDO prescriptionDO){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public SystemMessageDO sendPatientGetDrugMes(WlyyOutpatientDO outpatient, WlyyPrescriptionDO prescriptionDO) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SystemMessageDO systemMessageDO = new SystemMessageDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setTitle("患者取药"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setType("7"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -756,37 +766,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setRelationCode(outpatient.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject data = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("name",outpatient.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("recipeType",prescriptionDO.getDispensaryType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("message","患者已完成取药"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("name", outpatient.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("age", IdCardUtil.getAgeForIdcard(outpatient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("gender", IdCardUtil.getSexForIdcard_new(outpatient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("recipeType", prescriptionDO.getDispensaryType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            data.put("message", "患者已完成取药"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageDO.setData(data.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            systemMessageService.saveMessage(systemMessageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("sendPatientGetDrugMes :"+e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("sendPatientGetDrugMes :" + e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return systemMessageDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取卡记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findPatientCard(String patient)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findPatientCard(String patient) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray res = entranceService.BS15018(patientDO.getIdcard(),null,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray res = entranceService.BS15018(patientDO.getIdcard(), null, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray rs = new JSONArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(res !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i =0;i<res.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (res != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < res.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject card = res.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String cardStat = card.getString("CARD_STAT"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if("激活".equals(cardStat)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("激活".equals(cardStat)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    rs.add(card); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -795,53 +806,54 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> checkOutpatient(String patient)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> checkOutpatient(String patient) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //-1卡余额不足,,-2 存在未结束的诊断热 1成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> rs = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //1.余额判断改到前端判断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //net.sf.json.JSONObject json = entranceService.qutpatientBalance(cardNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //2.判断是否有未结束的 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("outpatient",list.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("code",-2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("mes","存在未结束的诊断"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("outpatient", list.get(0)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("code", -2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("mes", "存在未结束的诊断"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("code",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mes","验证通过"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("code", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mes", "验证通过"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return rs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取所有医院列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<BaseOrgVO> findAllHospital(Integer level,String keyWord){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<BaseOrgVO> findAllHospital(Integer level, String keyWord) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneEmpty(keyWord)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            keyWord = "%" + keyWord + "%"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(level!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgDO> list = baseOrgDao.findByLevelAndName(level,"1",keyWord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (level != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgDO> list = baseOrgDao.findByLevelAndName(level, "1", keyWord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list,rs,BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgDO> list = baseOrgDao.findByDelAndName("1",keyWord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list, rs, BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgDO> list = baseOrgDao.findByDelAndName("1", keyWord); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list,rs,BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list, rs, BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(level!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgDO> list = baseOrgDao.findByLevelAndDel(level,"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (level != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgDO> list = baseOrgDao.findByLevelAndDel(level, "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list,rs,BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list, rs, BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgDO> list = baseOrgDao.findByDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<BaseOrgVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list,rs,BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return convertToModels(list, rs, BaseOrgVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -849,24 +861,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取机构下部门信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode,String dept,String consultDeptFlag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode, String dept, String consultDeptFlag) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<DictHospitalDeptDO> list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(consultDeptFlag)&&"1".equals(consultDeptFlag)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = dictHospitalDeptDao.findByOrgCodeAndConsultDeptFlag(orgCode,consultDeptFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list =  dictHospitalDeptDao.findByOrgCodeIn(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(consultDeptFlag) && "1".equals(consultDeptFlag)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = dictHospitalDeptDao.findByOrgCodeAndConsultDeptFlag(orgCode, consultDeptFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = dictHospitalDeptDao.findByOrgCodeIn(orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<DictHospitalDeptVO> rs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        convertToModels(list,rs,DictHospitalDeptVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0&&StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        convertToModels(list, rs, DictHospitalDeptVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null && rs.size() > 0 && StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //排序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<rs.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < rs.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = rs.get(i).getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(dept.equals(id)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Collections.swap(rs,0,i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (dept.equals(id)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Collections.swap(rs, 0, i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -875,12 +888,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取医生列表. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept,String chargeType,String doctorCode,String outpatientType,String startDate,String endDate,String key,String consultStatus){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> findDoctorByHospitalAndDept(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -896,59 +910,59 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND h.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND h.dept_code = '" + dept + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(orgCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND h.org_code = '"+orgCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(orgCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND h.org_code = '" + orgCode + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("all".equals(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("all".equals(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //查询全部号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+=" AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " AND d.charge_type ='" + chargeType + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("all".equals(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("all".equals(outpatientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //查询全部权限 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+=" AND d.outpatient_type like'%"+outpatientType+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " AND d.outpatient_type like'%" + outpatientType + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.outpatient_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.outpatient_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(key)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND (h.dept_name like '%"+key+"%' OR d.name like '%"+key+"%' OR d.expertise like '%"+key+"%') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(key)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND (h.dept_name like '%" + key + "%' OR d.name like '%" + key + "%' OR d.expertise like '%" + key + "%') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(consultStatus)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.consult_status = '"+consultStatus+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(consultStatus)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.consult_status = '" + consultStatus + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)&&StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND EXISTS ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND EXISTS ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  wlyy_doctor_work_time t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  t.doctor = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time >='" +startDate+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time <='"+endDate+"'"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time >='" + startDate + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time <='" + endDate + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findDoctorByHospitalAndDept sql:"+sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findDoctorByHospitalAndDept sql:" + sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0&&StringUtils.isNotBlank(doctorCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -958,64 +972,65 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取医生列表带排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findDoctorWithWork(String orgCode,String dept,String chargeType,String doctorCode,String outpatientType,String startDate,String endDate,String key,String consultStatus,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findDoctorWithWork(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+= " AND h.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND h.dept_code = '" + dept + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(orgCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+= " AND h.org_code = '"+orgCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(orgCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND h.org_code = '" + orgCode + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+= " AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+= " AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND d.charge_type ='" + chargeType + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(outpatientType.contains("or")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (outpatientType.contains("or")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] outpatientTypeArray = outpatientType.split("or"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql+= " AND ( "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += " AND ( "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (int i = 0; i < outpatientTypeArray.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    totalSql +=" d.outpatient_type like'%"+outpatientTypeArray[i]+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(i != outpatientTypeArray.length -1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    totalSql += " d.outpatient_type like'%" + outpatientTypeArray[i] + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (i != outpatientTypeArray.length - 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        totalSql += " or "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql+= "  ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql+= " AND d.outpatient_type like'%"+outpatientType+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += "  ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += " AND d.outpatient_type like'%" + outpatientType + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND d.outpatient_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND d.outpatient_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(key)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND (h.dept_name like '%"+key+"%' OR d.name like '%"+key+"%' OR d.expertise like '%"+key+"%') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(key)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND (h.dept_name like '%" + key + "%' OR d.name like '%" + key + "%' OR d.expertise like '%" + key + "%') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(consultStatus)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND d.consult_status = '"+consultStatus+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(consultStatus)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND d.consult_status = '" + consultStatus + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)&&StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND EXISTS ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND EXISTS ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  wlyy_doctor_work_time t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  t.doctor = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time >='" +startDate+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time <='"+endDate+"'"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time >='" + startDate + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time <='" + endDate + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1025,7 +1040,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1042,72 +1057,72 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 1=1" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND h.dept_code = '"+dept+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND h.dept_code = '" + dept + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(orgCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND h.org_code = '"+orgCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(orgCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND h.org_code = '" + orgCode + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND d.charge_type is not null"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.charge_type ='" + chargeType + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.charge_type is not null"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(outpatientType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(outpatientType.contains("or")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(outpatientType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (outpatientType.contains("or")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] outpatientTypeArray = outpatientType.split("or"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+= " AND ( "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " AND ( "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (int i = 0; i < outpatientTypeArray.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql +=" d.outpatient_type like'%"+outpatientTypeArray[i]+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(i != outpatientTypeArray.length -1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql += " d.outpatient_type like'%" + outpatientTypeArray[i] + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (i != outpatientTypeArray.length - 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sql += " or "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+= " ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+= " AND d.outpatient_type like'%"+outpatientType+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " ) "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " AND d.outpatient_type like'%" + outpatientType + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.outpatient_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.outpatient_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(key)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND (h.dept_name like '%"+key+"%' OR d.name like '%"+key+"%' OR d.expertise like '%"+key+"%') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(key)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND (h.dept_name like '%" + key + "%' OR d.name like '%" + key + "%' OR d.expertise like '%" + key + "%') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(consultStatus)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.consult_status = '"+consultStatus+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(consultStatus)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.consult_status = '" + consultStatus + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endDate)&&StringUtils.isNotBlank(startDate)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND EXISTS ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endDate) && StringUtils.isNotBlank(startDate)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND EXISTS ( " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  1 " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  wlyy_doctor_work_time t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "  t.doctor = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time >='" +startDate+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time <='"+endDate+"'"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time >='" + startDate + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " AND t.start_time <='" + endDate + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " )"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " AND d.del='1' AND d.outpatient_type is not null LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> doctor : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String) doctor.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctor.put("workTime", times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(doctorCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1115,8 +1130,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor, String hospital) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalWorkRuleDO> list = wlyyHospitalWorkRuleDao.findByHospital(hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyHospitalWorkRuleDO rule = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date openTime = DateUtil.strToDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd") + " " + rule.getMaxDayOpenTime() + ":00", "yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer openDay = rule.getMaxDay(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (openTime.before(new Date())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                openDay = openDay - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date endDate = DateUtil.stringToDate(DateUtil.dateToStr(DateUtil.getPreDays(new Date(), openDay), "yyyy-MM-dd") + "23:59:59", "yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyDoctorWorkTimeDO> timeDOs = doctorWorkTimeDao.findDoctorWorkTime(doctor, new Date(), endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            convertToModels(timeDOs, timeVOs, WlyyDoctorWorkTimeVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return timeVOs; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询医生列表带月份排班状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orgCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param chargeType 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1125,33 +1161,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findDoctorWithMouthWork(String orgCode,String dept,String chargeType,String date,String nameKey,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findDoctorWithMouthWork(String orgCode, String dept, String chargeType, String date, String nameKey, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " base_doctor d " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_role r ON r.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_code = '"+orgCode+"'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_code = '" + orgCode + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND r.role_code ='specialist'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("all".equals(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("all".equals(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //不过滤号别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql+=" AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += " AND d.charge_type ='" + chargeType + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //不传号别过滤不为为空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+= " AND h.dept_code = '"+dept+"' " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND h.dept_code = '" + dept + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(nameKey)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+= " AND d.name like '%"+nameKey+"%' " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(nameKey)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND d.name like '%" + nameKey + "%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1160,7 +1196,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.photo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " d.`name`, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1176,72 +1212,72 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN base_doctor_role r ON r.doctor_code = d.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE  " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_code = '"+orgCode+"'"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " h.org_code = '" + orgCode + "'" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " AND r.role_code ='specialist'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("all".equals(chargeType)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("all".equals(chargeType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //不过滤号别 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+=" AND d.charge_type ='"+chargeType+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql += " AND d.charge_type ='" + chargeType + "'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //不传号别过滤不为为空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.charge_type is not null "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND h.dept_code = '"+dept+"' " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND h.dept_code = '" + dept + "' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(nameKey)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+= " AND d.name like '%"+nameKey+"%' " ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(nameKey)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND d.name like '%" + nameKey + "%' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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<WlyyDoctorWorkTimeDO> workTimeDOs = doctorWorkTimeDao.findDoctorWorkTimeByMonth(id,"%"+date+"%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(workTimeDOs!=null&&workTimeDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    doctor.put("isScheduling",true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    doctor.put("isScheduling",false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> doctor : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String) doctor.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyDoctorWorkTimeDO> workTimeDOs = doctorWorkTimeDao.findDoctorWorkTimeByMonth(id, "%" + date + "%"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (workTimeDOs != null && workTimeDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    doctor.put("isScheduling", true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    doctor.put("isScheduling", false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findDoctorWithMouthWork :"+sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findDoctorWithMouthWork :" + sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 挂号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public net.sf.json.JSONObject registerOutPatient(String outPatientId,String doctor)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public net.sf.json.JSONObject registerOutPatient(String outPatientId, String doctor) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctor,outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(doctorMappingDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(doctor, outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doctorMappingDO == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new RuntimeException("未找到医生映射信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //查找居民当天挂号记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String date = DateUtil.dateToStr(new Date(),"yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterDO>  patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctor(outpatientDO.getPatient(),date,doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(patientRegisterDOs!=null&&patientRegisterDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctor(outpatientDO.getPatient(), date, doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //判断是否已经挂号,如果已经挂号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(registerDO.getConNo())&&StringUtils.isNotBlank(registerDO.getRegisterNo())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(registerDO.getConNo()) && StringUtils.isNotBlank(registerDO.getRegisterNo())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                net.sf.json.JSONObject res = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("@RESULT","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("已经挂号 res: " +res.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                res.put("@RESULT", "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("已经挂号 res: " + res.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //更新挂号流水号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatientDO.setConNo(registerDO.getConNo()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1249,27 +1285,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatientDO.setAdmDate(registerDO.getCreateTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //调用电子病历注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                manageType =2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registDianziBingli(outpatientDO,basePatientDO,manageType,registerDO.getRegisterNo(),registerDO.getConNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                manageType = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                registDianziBingli(outpatientDO, basePatientDO, manageType, registerDO.getRegisterNo(), registerDO.getConNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject rs = entranceService.BS10111(outpatientDO.getCardNo(),doctorMappingDO.getMappingCode(),outpatientDO.getDept(),null,outpatientDO.getWinNo(),demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject rs = entranceService.BS10111(outpatientDO.getCardNo(), doctorMappingDO.getMappingCode(), outpatientDO.getDept(), null, outpatientDO.getWinNo(), demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject res = rs.getJSONObject("resquest"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("挂号结果 res: " +res.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("挂号结果 res: " + res.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String rsCode = res.getString("@RESULT"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("0".equals(rsCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("0".equals(rsCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //存储挂号号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // {"resquest":{"@RESULT":"0","@MSG":"完成","@serial_no":"47770476","@times":"28"}} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String serialNo = (String)res.get("@serial_no"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String serialNo = (String) res.get("@serial_no"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setRegisterNo(serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String conNo = (String)res.get("@times"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String conNo = (String) res.get("@times"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setConNo(conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setAdmDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("挂号流水 @serial_no: " +serialNo+" @times: "+conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //存储就诊记录 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1286,21 +1322,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setRegisterNo(serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setConNo(conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientRegisterDao.save(registerDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //调用电子病历注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registDianziBingli(outpatientDO,basePatientDO,manageType,registerDO.getRegisterNo(),registerDO.getConNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if("-2".equals(rsCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registDianziBingli(outpatientDO, basePatientDO, manageType, registerDO.getRegisterNo(), registerDO.getConNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String serialNo = (String)res.get("@serial_no"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if ("-2".equals(rsCode)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String serialNo = (String) res.get("@serial_no"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setRegisterNo(serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String conNo = (String)res.get("@times"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String conNo = (String) res.get("@times"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setConNo(conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setAdmDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("挂号流水 @serial_no: " +serialNo+" @times: "+conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("挂号流水 @serial_no: " + serialNo + " @times: " + conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //存储就诊记录 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1316,112 +1352,111 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setRegisterNo(serialNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setConNo(conNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setDate(DateUtil.dateToStr(new Date(),"yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientRegisterDao.save(registerDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //调用电子病历注册 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            manageType = 1;//处理类型(1-新增 2-修改 3-删除) 必填 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registDianziBingli(outpatientDO,basePatientDO,manageType,registerDO.getRegisterNo(),registerDO.getConNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            registDianziBingli(outpatientDO, basePatientDO, manageType, registerDO.getRegisterNo(), registerDO.getConNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //保存日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //保存日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHttpLogDO log = new WlyyHttpLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setCode("registerOutPatient"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setName("挂号"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setPatient(outpatientDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setResponse(rs.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setRequest("outPatientId="+outPatientId+"&doctor="+doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setStatus(rsCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyHttpLogDao.save(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String registDianziBingli(WlyyOutpatientDO outpatientDO,BasePatientDO basePatientDO,Integer manageType,String RegisterSN,String registerCon) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String registDianziBingli(WlyyOutpatientDO outpatientDO, BasePatientDO basePatientDO, Integer manageType, String RegisterSN, String registerCon) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //调用电子病历接口注册居民信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String patientMappingCode =  patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(),outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,String> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("type","PatientInfo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String _xmlStr="<?xml version='1.0' encoding='UTF-8'?>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<HtRequest>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<OutRegister>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RecordFlow>"+outpatientDO.getId()+"</RecordFlow>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterSN>"+RegisterSN+"</RegisterSN>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<TreatDate>"+DateUtil.getStringDate("yyyyMMdd")+"</TreatDate>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterDeptCode>"+outpatientDO.getDept()+"</RegisterDeptCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterDeptName>"+outpatientDO.getDeptName()+"</RegisterDeptName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterDoctorID>"+doctorMappingDO.getMappingCode()+"</RegisterDoctorID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterDoctorName>"+doctorMappingDO.getDoctorName()+"</RegisterDoctorName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<DutyID></DutyID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<DutyName></DutyName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<OutPatientTime></OutPatientTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<NumClassCode></NumClassCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<NumClassName></NumClassName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<JoinGroupCode></JoinGroupCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<JoinGroupName></JoinGroupName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<NumClassNO></NumClassNO>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<AppointmentDateTime></AppointmentDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<AppointSN></AppointSN>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<Pid>"+patientMappingCode+"</Pid>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<CardNO>"+outpatientDO.getCardNo()+"</CardNO>\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<PatientName>"+basePatientDO.getName()+"</PatientName>"+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<SexCode>"+basePatientDO.getSex()+"</SexCode>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(1 == basePatientDO.getSex()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        _xmlStr = _xmlStr + "<Sex>男</Sex>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        _xmlStr = _xmlStr +  "<Sex>女</Sex>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    _xmlStr = _xmlStr + "<Age>"+IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())+"</Age>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<AgeDesc>"+IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())+"岁</AgeDesc>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<PatientClass></PatientClass>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<FeeTypeCode></FeeTypeCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<FeeTypeName></FeeTypeName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<MedicalInsuranceType></MedicalInsuranceType>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<IsFirst>N</IsFirst>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterDateTime>20200121</RegisterDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterUserID>"+patientMappingCode+"</RegisterUserID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterUserName></RegisterUserName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<OutStatus>20</OutStatus>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<ModifierID></ModifierID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<Modifier></Modifier>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<ModifyTime></ModifyTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RetreatDateTime></RetreatDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RetreatUserID></RetreatUserID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RetreatUserName></RetreatUserName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<PaymentMethodCode></PaymentMethodCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<PaymentMethod></PaymentMethod>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterFee></RegisterFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<MedicalFee></MedicalFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<OtherFee></OtherFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<TotalFee></TotalFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<MedicalFloor>N</MedicalFloor>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<MedicalAddress></MedicalAddress>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<LastDeptCode></LastDeptCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<LastDeptName></LastDeptName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<LastDoctorID></LastDoctorID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<LastDoctorName></LastDoctorName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<LastTreatDateTime></LastTreatDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<LastOpid></LastOpid>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<NumTypeCode>0</NumTypeCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<NumTypeName></NumTypeName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RegisterSource>1</RegisterSource>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<AcctNO></AcctNO>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<IsAcct>N</IsAcct>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<ManageType>"+manageType+"</ManageType>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<Times>"+registerCon+"</Times>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "</OutRegister>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<PatientInfo>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<RecordFlow>"+outpatientDO.getId()+"</RecordFlow>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "<PID>"+patientMappingCode+"</PID></PatientInfo></HtRequest>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patientMappingCode = patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, String> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("type", "PatientInfo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String _xmlStr = "<?xml version='1.0' encoding='UTF-8'?>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<HtRequest>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<OutRegister>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RecordFlow>" + outpatientDO.getId() + "</RecordFlow>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterSN>" + RegisterSN + "</RegisterSN>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<TreatDate>" + DateUtil.getStringDate("yyyyMMdd") + "</TreatDate>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterDeptCode>" + outpatientDO.getDept() + "</RegisterDeptCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterDeptName>" + outpatientDO.getDeptName() + "</RegisterDeptName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterDoctorID>" + doctorMappingDO.getMappingCode() + "</RegisterDoctorID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterDoctorName>" + doctorMappingDO.getDoctorName() + "</RegisterDoctorName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<DutyID></DutyID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<DutyName></DutyName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<OutPatientTime></OutPatientTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<NumClassCode></NumClassCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<NumClassName></NumClassName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<JoinGroupCode></JoinGroupCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<JoinGroupName></JoinGroupName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<NumClassNO></NumClassNO>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<AppointmentDateTime></AppointmentDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<AppointSN></AppointSN>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<Pid>" + patientMappingCode + "</Pid>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<CardNO>" + outpatientDO.getCardNo() + "</CardNO>\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<PatientName>" + basePatientDO.getName() + "</PatientName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<SexCode>" + basePatientDO.getSex() + "</SexCode>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (1 == basePatientDO.getSex()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            _xmlStr = _xmlStr + "<Sex>男</Sex>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            _xmlStr = _xmlStr + "<Sex>女</Sex>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        _xmlStr = _xmlStr + "<Age>" + IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()) + "</Age>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<AgeDesc>" + IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()) + "岁</AgeDesc>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<PatientClass></PatientClass>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<FeeTypeCode></FeeTypeCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<FeeTypeName></FeeTypeName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<MedicalInsuranceType></MedicalInsuranceType>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<IsFirst>N</IsFirst>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterDateTime>20200121</RegisterDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterUserID>" + patientMappingCode + "</RegisterUserID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterUserName></RegisterUserName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<OutStatus>20</OutStatus>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<ModifierID></ModifierID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<Modifier></Modifier>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<ModifyTime></ModifyTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RetreatDateTime></RetreatDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RetreatUserID></RetreatUserID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RetreatUserName></RetreatUserName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<PaymentMethodCode></PaymentMethodCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<PaymentMethod></PaymentMethod>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterFee></RegisterFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<MedicalFee></MedicalFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<OtherFee></OtherFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<TotalFee></TotalFee>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<MedicalFloor>N</MedicalFloor>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<MedicalAddress></MedicalAddress>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<LastDeptCode></LastDeptCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<LastDeptName></LastDeptName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<LastDoctorID></LastDoctorID>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<LastDoctorName></LastDoctorName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<LastTreatDateTime></LastTreatDateTime>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<LastOpid></LastOpid>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<NumTypeCode>0</NumTypeCode>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<NumTypeName></NumTypeName>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RegisterSource>1</RegisterSource>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<AcctNO></AcctNO>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<IsAcct>N</IsAcct>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<ManageType>" + manageType + "</ManageType>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<Times>" + registerCon + "</Times>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "</OutRegister>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<PatientInfo>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<RecordFlow>" + outpatientDO.getId() + "</RecordFlow>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "<PID>" + patientMappingCode + "</PID></PatientInfo></HtRequest>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            String xmlStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    "<HtRequest >" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    "<PatientInfo>" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1501,134 +1536,142 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    "<RhBloodType></RhBloodType>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    "</PatientInfo>" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                    "</HtRequest>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String returnValue = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("xmlStr",_xmlStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            returnValue = WebserviceUtil.post("http://192.10.33.34:9080/HtMzWebService/services/Manage", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "http://business.htemr.haitaiinc.com", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "manageAdt", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.info("调用电子病历注册接口请求成功,返回值xmlstr:"+returnValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return returnValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String returnValue = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("xmlStr", _xmlStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        returnValue = WebserviceUtil.post("http://192.10.33.34:9080/HtMzWebService/services/Manage", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "http://business.htemr.haitaiinc.com", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "manageAdt", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("调用电子病历注册接口请求成功,返回值xmlstr:" + returnValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return returnValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取诊断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param pyKey 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getICD10(String pyKey)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS25001(pyKey,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getICD10(String pyKey) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS25001(pyKey, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取药品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getDrugDictionary(String chargeCode,String pyKey,String winNo,String groupNo)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS53001(chargeCode,pyKey,"0",winNo,"0",groupNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS53001(chargeCode, pyKey, "0", winNo, "0", groupNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取药品用法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getDrugUse(String drugNo,String pyKey)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS10110(drugNo,pyKey,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getDrugUse(String drugNo, String pyKey) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS10110(drugNo, pyKey, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 医院频次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getDrugFrequency()throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getDrugFrequency() throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS30012(demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 检查模板选择接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param bz_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param flag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getJcmb(String bz_code,String tc_no,String flag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS25033(bz_code,tc_no,flag,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getJcmb(String bz_code, String tc_no, String flag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS25033(bz_code, tc_no, flag, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 检验选择接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param bz_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param flag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getJymb(String bz_code,String tc_no,String flag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS20030(bz_code,tc_no,flag,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getJymb(String bz_code, String tc_no, String flag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS20030(bz_code, tc_no, flag, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 套餐选择接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param bz_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param flag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getTcxz(String bz_code,String tc_no,String flag)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS02017(bz_code,tc_no,flag,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getTcxz(String bz_code, String tc_no, String flag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS02017(bz_code, tc_no, flag, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 套餐子项目接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param parent_code 检查检验项目的charge_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getTcChild(String parent_code)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS02015(parent_code,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getTcChild(String parent_code) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS02015(parent_code, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 项目子项目接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param zd_charge_code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getInsChild(String zd_charge_code)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS02016(zd_charge_code,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getInsChild(String zd_charge_code) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.MS02016(zd_charge_code, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取检查检验 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getInspectionDictionary(String pyKey,String codes,String winNo)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray rs = entranceService.MS25002(pyKey,codes,winNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(rs!=null&&rs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray getInspectionDictionary(String pyKey, String codes, String winNo) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONArray rs = entranceService.MS25002(pyKey, codes, winNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rs != null && rs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //设置科室翻译名称字典,减少循环层级降低循环次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<DictHospitalDeptDO> depts =dictHospitalDeptDao.findByOrgCode("350211A1002"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String,String> deptDictMap = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(DictHospitalDeptDO dp:depts){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                deptDictMap.put(dp.getCode(),dp.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<DictHospitalDeptDO> depts = dictHospitalDeptDao.findByOrgCode("350211A1002"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Map<String, String> deptDictMap = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (DictHospitalDeptDO dp : depts) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                deptDictMap.put(dp.getCode(), dp.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //翻译执行科室 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<rs.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject dict = (JSONObject)rs.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (int i = 0; i < rs.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                JSONObject dict = (JSONObject) rs.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String dept = dict.getString("exec_unit"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(StringUtils.isNotBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotBlank(dept)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    String deptName = deptDictMap.get(dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(StringUtils.isNotBlank(deptName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        dict.put("exec_unit_name",deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        dict.put("exec_unit_name",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (StringUtils.isNotBlank(deptName)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        dict.put("exec_unit_name", deptName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        dict.put("exec_unit_name", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1638,16 +1681,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 下诊断,线上开方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outPatientId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param advice 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type 1带处方,2不带处方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param type          1带处方,2不带处方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param infoJsons 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param diagnosisJson 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> makeDiagnosis(String outPatientId,String advice,String type,String infoJsons,String diagnosisJson,String inspectionJson)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> makeDiagnosis(String outPatientId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> result = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> result = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取门诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1658,9 +1702,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //创建处方记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionDO prescriptionDO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (prescriptionDOs != null && prescriptionDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO = prescriptionDOs.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO = new WlyyPrescriptionDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDO.setOutpatientId(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1675,44 +1719,44 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //========================处方操作结束============================================================= 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //加入处方状态变更流水日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionLogService.addPrescriptionLog(prescription.getId(),10,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionLogService.addPrescriptionLog(prescription.getId(), 10, 2, outpatientDO.getDoctor(), outpatientDO.getDoctorName(), "", new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //============================下诊断============================================================== 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //删除之前诊断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(ds!=null&&ds.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (ds != null && ds.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDiagnosisDao.delete(ds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = (List<WlyyPrescriptionDiagnosisDO>) com.alibaba.fastjson.JSONArray.parseArray(diagnosisJson, WlyyPrescriptionDiagnosisDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String Icd10 = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String Icd10Name = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("1".equals(diagnosisDO.getType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10 = diagnosisDO.getCode()+","+Icd10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10Name+=diagnosisDO.getName()+","+Icd10Name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10+=diagnosisDO.getCode()+","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10Name+=diagnosisDO.getName()+","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (WlyyPrescriptionDiagnosisDO diagnosisDO : diagnosisDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equals(diagnosisDO.getType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10 = diagnosisDO.getCode() + "," + Icd10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10Name += diagnosisDO.getName() + "," + Icd10Name; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10 += diagnosisDO.getCode() + ","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Icd10Name += diagnosisDO.getName() + ","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            diagnosisDO.setPrescriptionId(prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDiagnosisDao.save(diagnosisDOs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //存储icd10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Icd10 = Icd10.substring(0,Icd10.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Icd10Name = Icd10Name.substring(0,Icd10Name.length()-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Icd10 = Icd10.substring(0, Icd10.length() - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Icd10Name = Icd10Name.substring(0, Icd10Name.length() - 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setIcd10(Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDO.setIcd10Name(Icd10Name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //============================下诊断end============================================================== 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //判断是否有检查检验或药品开方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("1".equals(type)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("1".equals(type)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //doctor转换为his医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(),outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(doctorMappingDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (doctorMappingDO == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new RuntimeException("未找到医生映射信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1722,22 +1766,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //===================药品操作====================================================== 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 删除原有药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(oldInfos!=null&&oldInfos.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (oldInfos != null && oldInfos.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionInfoDao.delete(oldInfos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //存储药品,构建his开方入参 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(infoJsons)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(infoJsons)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //药品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyPrescriptionInfoDO> infoDOs = (List<WlyyPrescriptionInfoDO>) com.alibaba.fastjson.JSONArray.parseArray(infoJsons, WlyyPrescriptionInfoDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(WlyyPrescriptionInfoDO info:infoDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (WlyyPrescriptionInfoDO info : infoDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    info.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    info.setPrescriptionId(prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //设置his药品查询条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    setInfoJsonParam(jsonData,doctorMappingDO,outpatientDO,prescriptionDO,info,Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //保存药品信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                prescriptionInfoDao.save(infoDOs); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1752,20 +1796,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //存储检查检验,构建his开方入参 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //删除之前检查检验 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyInspectionDO> inspectionDels = wlyyInspectionDao.findByOutpatientId(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(inspectionDels!=null&&inspectionDels.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (inspectionDels != null && inspectionDels.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyInspectionDao.delete(inspectionDels); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(StringUtils.isNotBlank(inspectionJson)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNotBlank(inspectionJson)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyInspectionDO> inspections = (List<WlyyInspectionDO>) com.alibaba.fastjson.JSONArray.parseArray(inspectionJson, WlyyInspectionDO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(WlyyInspectionDO ins:inspections){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (WlyyInspectionDO ins : inspections) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    ins.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    ins.setPrescriptionId(prescription.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    ins.setOutpatientId(outPatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //设置his药品查询条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    setInspectionParam(jsonData,doctorMappingDO,outpatientDO,prescriptionDO,ins,Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //保存检查检验。 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyInspectionDao.save(inspections); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1781,14 +1825,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.save(prescription); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //上传his开方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return sendHisDiagnosis(jsonData,outpatientDO,prescription); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return sendHisDiagnosis(jsonData, outpatientDO, prescription); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setStatus("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes","诊断完成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes", "诊断完成"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1796,57 +1840,60 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 计算药品费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param infoDOs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Double getInfoFee(List<WlyyPrescriptionInfoDO> infoDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Double getInfoFee(List<WlyyPrescriptionInfoDO> infoDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Double fee = 0D; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(infoDOs!=null&&infoDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(WlyyPrescriptionInfoDO info:infoDOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (infoDOs != null && infoDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (WlyyPrescriptionInfoDO info : infoDOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Integer quantity = Integer.parseInt(info.getQuantity()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    fee += info.getPackRetprice()*quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    fee += info.getPackRetprice() * quantity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("getInfoFee:"+e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("getInfoFee:" + e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return fee; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 计算检查检验费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param inspections 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Double getInsFee(List<WlyyInspectionDO> inspections){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Double getInsFee(List<WlyyInspectionDO> inspections) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Double fee = 0D; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(inspections!=null&&inspections.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for(WlyyInspectionDO ins:inspections){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (inspections != null && inspections.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                for (WlyyInspectionDO ins : inspections) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Double chargeAmount = Double.parseDouble(ins.getChargeAmount()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    fee += chargeAmount*ins.getQuantity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    fee += chargeAmount * ins.getQuantity(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("getInsFee:"+e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("getInsFee:" + e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return fee; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 计算挂号费用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctor 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Double getChargeFee(String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Double getChargeFee(String doctor) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Double fee = 0D; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getChargeType(),"6"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeTypeAndDeptTypeCode(doctorDO.getChargeType(), "6"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return chargeDictDO.getReqFee(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("getChargeFee:"+e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error("getChargeFee:" + e.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return fee; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1854,18 +1901,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 上传his开方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param prescription 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String,Object> sendHisDiagnosis(com.alibaba.fastjson.JSONArray jsonData,WlyyOutpatientDO outpatientDO,WlyyPrescriptionDO prescription)throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> result = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Map<String, Object> sendHisDiagnosis(com.alibaba.fastjson.JSONArray jsonData, WlyyOutpatientDO outpatientDO, WlyyPrescriptionDO prescription) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> result = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //调用his开方接口 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(),demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(), demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //如果无法解析his系统报文,his系统报错 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(jsonObject==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (jsonObject == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //记录http日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyHttpLogDO log = new WlyyHttpLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            log.setCode("makeDiagnosis"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1882,15 +1930,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescription.setStatus(13); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.save(prescription); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //记录开发失败日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionLogService.addPrescriptionLog(prescription.getId(),13,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionLogService.addPrescriptionLog(prescription.getId(), 13, 2, outpatientDO.getDoctor(), outpatientDO.getDoctorName(), "", new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //开方失败返回值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes","开方失败,his系统异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code", -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes", "开方失败,his系统异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("调用his开方接口: "+jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("调用his开方接口: " + jsonObject.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //判断返回结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String rs = jsonObject.getString("@RESULT"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //保存日志 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1905,7 +1953,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        log.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyHttpLogDao.save(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("0".equals(rs)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if ("0".equals(rs)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String admNo = jsonObject.getString("@ADM_NO"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String realOrder = jsonObject.getString("@real_order"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1915,19 +1963,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDO.setAdmNo(admNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientDao.save(outpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes","开方提交成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes", "开方提交成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //开方失败 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code",-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes",jsonObject.getString("@MSG")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("code", -1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("mes", jsonObject.getString("@MSG")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //更新处方状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescription.setStatus(13); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.save(prescription); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //记录开发失败日志 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionLogService.addPrescriptionLog(prescription.getId(),13,2,outpatientDO.getDoctor(),outpatientDO.getDoctorName(),"",new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionLogService.addPrescriptionLog(prescription.getId(), 13, 2, outpatientDO.getDoctor(), outpatientDO.getDoctorName(), "", new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1935,132 +1983,135 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 设置检查检验his入参 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctorMappingDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param inspectionDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param Icd10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void setInspectionParam(com.alibaba.fastjson.JSONArray jsonData,DoctorMappingDO doctorMappingDO,WlyyOutpatientDO outpatientDO,WlyyPrescriptionDO prescriptionDO,WlyyInspectionDO inspectionDO,String Icd10){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void setInspectionParam(com.alibaba.fastjson.JSONArray jsonData, DoctorMappingDO doctorMappingDO, WlyyOutpatientDO outpatientDO, WlyyPrescriptionDO prescriptionDO, WlyyInspectionDO inspectionDO, String Icd10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(prescriptionDO.getRealOrder())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("realOrder",prescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(prescriptionDO.getRealOrder())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("realOrder", prescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("cardNo",outpatientDO.getCardNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("doctor",doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("dept",outpatientDO.getDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("cardNo", outpatientDO.getCardNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("doctor", doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("dept", outpatientDO.getDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("frequency",inspectionDO.getFrequency()); //组号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("quantity",inspectionDO.getQuantity()); //数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serialNo",outpatientDO.getRegisterNo()); //挂号流水号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("groupNo","00"); //-库房号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serial","00"); //药品序列号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("frequency", inspectionDO.getFrequency()); //组号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("quantity", inspectionDO.getQuantity()); //数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serialNo", outpatientDO.getRegisterNo()); //挂号流水号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("groupNo", "00"); //-库房号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serial", "00"); //药品序列号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("winNo",outpatientDO.getWinNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeFlag",2); //项目类别-必输  1-药品 2检验检查 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("winNo", outpatientDO.getWinNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeFlag", 2); //项目类别-必输  1-药品 2检验检查 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  code;//项目编码', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  name;//(检查方法)', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  information;//病史与体征', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  checkEquip;//类别', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  checkPart;//部位', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  adresult;//辅助检查治疗', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  goal;//检查目的', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  opview;//手术所见-病理申请单必填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  specimenName;//标本名称-病理申请单必填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  specimenNum;//标本数量-病理申请单必填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  ywjcResult;//以往检查结果-病理申请单选填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  ywjcDate;//以往检查时间-病理申请单选填 格式:yyyy-mm-dd', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  blzd;//病理诊断-病理申请单选填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          *  fixationfluid;//固定液 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  code;//项目编码', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  name;//(检查方法)', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  information;//病史与体征', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  checkEquip;//类别', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  checkPart;//部位', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  adresult;//辅助检查治疗', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  goal;//检查目的', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  opview;//手术所见-病理申请单必填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  specimenName;//标本名称-病理申请单必填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  specimenNum;//标本数量-病理申请单必填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  ywjcResult;//以往检查结果-病理申请单选填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  ywjcDate;//以往检查时间-病理申请单选填 格式:yyyy-mm-dd', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  blzd;//病理诊断-病理申请单选填', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *  fixationfluid;//固定液 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("parentCode",inspectionDO.getParentCode()); //父节点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeCode",inspectionDO.getCode()); //项目编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("name",inspectionDO.getName()); //挂号流水号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("information",inspectionDO.getInformation());//库房号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("checkEquip",inspectionDO.getCheckEquip()); //药品序列号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("checkPart",inspectionDO.getCheckPart()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("adresult",inspectionDO.getAdresult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("goal",inspectionDO.getGoal()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("opview",inspectionDO.getOpview()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("specimenName",inspectionDO.getSpecimenName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("specimenNum",inspectionDO.getSpecimenNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("ywjcResult",inspectionDO.getYwjcResult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("ywjcDate",inspectionDO.getYwjcDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("blzd",inspectionDO.getBlzd()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("fixationfluid",inspectionDO.getFixationfluid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("parentCode", inspectionDO.getParentCode()); //父节点 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeCode", inspectionDO.getCode()); //项目编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("name", inspectionDO.getName()); //挂号流水号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("information", inspectionDO.getInformation());//库房号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("checkEquip", inspectionDO.getCheckEquip()); //药品序列号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("checkPart", inspectionDO.getCheckPart()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("adresult", inspectionDO.getAdresult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("goal", inspectionDO.getGoal()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("opview", inspectionDO.getOpview()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("specimenName", inspectionDO.getSpecimenName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("specimenNum", inspectionDO.getSpecimenNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("ywjcResult", inspectionDO.getYwjcResult()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("ywjcDate", inspectionDO.getYwjcDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("blzd", inspectionDO.getBlzd()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("fixationfluid", inspectionDO.getFixationfluid()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置诊断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        setIcd10(json,Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        setIcd10(json, Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonData.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("json:" +json.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("json:" + json.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 设置药品his入参 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctorMappingDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param outpatientDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param info 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param Icd10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void setInfoJsonParam(com.alibaba.fastjson.JSONArray jsonData,DoctorMappingDO doctorMappingDO,WlyyOutpatientDO outpatientDO,WlyyPrescriptionDO prescriptionDO,WlyyPrescriptionInfoDO info,String Icd10){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void setInfoJsonParam(com.alibaba.fastjson.JSONArray jsonData, DoctorMappingDO doctorMappingDO, WlyyOutpatientDO outpatientDO, WlyyPrescriptionDO prescriptionDO, WlyyPrescriptionInfoDO info, String Icd10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(prescriptionDO.getRealOrder())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("realOrder",prescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("cardNo",outpatientDO.getCardNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("doctor",doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("dept",outpatientDO.getDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeCode",info.getDrugNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("winNo",outpatientDO.getWinNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeFlag",1); //项目类别-必输  1-药品 2检验检查 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("quantity",info.getQuantity()); //数量-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serialNo",outpatientDO.getRegisterNo()); //挂号流水号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("groupNo",info.getGroupNo());//库房号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serial",info.getSerial()); //药品序列号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("dosage",info.getDosage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("unit",info.getUnit()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("usage",info.getUsageCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("supplyCode",info.getSupplyCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(info.getDays())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("days",info.getDays()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(prescriptionDO.getRealOrder())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("realOrder", prescriptionDO.getRealOrder()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("cardNo", outpatientDO.getCardNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("doctor", doctorMappingDO.getMappingCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("dept", outpatientDO.getDept()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeCode", info.getDrugNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("winNo", outpatientDO.getWinNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("chargeFlag", 1); //项目类别-必输  1-药品 2检验检查 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("quantity", info.getQuantity()); //数量-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serialNo", outpatientDO.getRegisterNo()); //挂号流水号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("groupNo", info.getGroupNo());//库房号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("serial", info.getSerial()); //药品序列号-必输 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("dosage", info.getDosage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("unit", info.getUnit()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("usage", info.getUsageCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("supplyCode", info.getSupplyCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(info.getDays())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("days", info.getDays()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //如果是中草药,贴数为天数,没有默认1天 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("days",StringUtils.isNotBlank(info.getPostCount())?info.getPostCount():"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("days", StringUtils.isNotBlank(info.getPostCount()) ? info.getPostCount() : "1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("frequency",info.getFrequency()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("comm",info.getComm()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("frequency", info.getFrequency()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        json.put("comm", info.getComm()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置诊断 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        setIcd10(json,Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        setIcd10(json, Icd10); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonData.add(json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("json:" +json.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("json:" + json.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void setIcd10(com.alibaba.fastjson.JSONObject json,String Icd10){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void setIcd10(com.alibaba.fastjson.JSONObject json, String Icd10) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String Icd10s[] = Icd10.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for(int i=0;i<Icd10s.length;i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(i==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("icdCode",Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(i==1){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagTwo",Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(i==2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagThree",Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(i==3){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagFour",Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else if(i==4){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagFive",Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (int i = 0; i < Icd10s.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (i == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("icdCode", Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if (i == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagTwo", Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if (i == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagThree", Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if (i == 3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagFour", Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else if (i == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.put("diagFive", Icd10s[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 订单查询 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param oneselfPickupFlg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param nameKey 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2070,8 +2121,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findExpressageList(String status,String oneselfPickupFlg,String nameKey,String startTime,String endTime,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findExpressageList(String status, String oneselfPickupFlg, String nameKey, String startTime, String endTime, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_outpatient o " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2079,20 +2130,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND p.status in("+status+")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND p.status in(" + status + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(oneselfPickupFlg)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND e.oneself_pickup_flg ="+oneselfPickupFlg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(oneselfPickupFlg)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.oneself_pickup_flg =" + oneselfPickupFlg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(nameKey)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND e.name like '%"+nameKey+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(nameKey)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.name like '%" + nameKey + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND e.create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql+=" AND e.create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2100,7 +2151,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rstotal != null && rstotal.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = (Long) rstotal.get(0).get("total"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " e.create_time AS createTime, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " e.`name`, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " e.oneself_pickup_flg AS oneselfPickupFlg, " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2115,44 +2166,44 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " 1=1"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND p.status in("+status+")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(status)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND p.status in(" + status + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(oneselfPickupFlg)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND e.oneself_pickup_flg ="+oneselfPickupFlg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(oneselfPickupFlg)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND e.oneself_pickup_flg =" + oneselfPickupFlg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(nameKey)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND e.name like '%"+nameKey+"%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(nameKey)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND e.name like '%" + nameKey + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND e.create_time >='"+startTime+" 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND e.create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" AND e.create_time <='"+endTime+" 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND e.create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean setMailno(String mailno, String expressageId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO =  prescriptionExpressageDao.findOne(expressageId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Boolean setMailno(String mailno, String expressageId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionExpressageDO expressageDO = prescriptionExpressageDao.findOne(expressageId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        expressageDO.setMailno(mailno); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionExpressageDao.save(expressageDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void pushListWrite(OutputStream os, List<Map<String,Object>> ls) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void pushListWrite(OutputStream os, List<Map<String, Object>> ls) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WritableSheet ws; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ws = wwb.createSheet("sheet",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            ws = wwb.createSheet("sheet", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] header = {"订单日期","收货人","诊断结果","配送方式", "订单状态"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String[] header = {"订单日期", "收货人", "诊断结果", "配送方式", "订单状态"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int k = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (String h : header) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, 0, k, h);//表名,行,列,header 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2160,12 +2211,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int i = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String,Object> m : ls) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 0, DateUtil.dateToStr((Date)m.get("createTime"),"yyyy-MM-dd HH:mm:ss"),""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 1, (String)m.get("name"),""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 2, (String)m.get("icd10Name"),""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 3, getOneselfPickupFlgString((Integer)m.get("oneselfPickupFlg")),""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 4, getStatusName((Integer)m.get("status")),""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> m : ls) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 0, DateUtil.dateToStr((Date) m.get("createTime"), "yyyy-MM-dd HH:mm:ss"), ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 1, (String) m.get("name"), ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 2, (String) m.get("icd10Name"), ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 3, getOneselfPickupFlgString((Integer) m.get("oneselfPickupFlg")), ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                addCell(ws, i, 4, getStatusName((Integer) m.get("status")), ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                i++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wwb.write(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2178,45 +2229,44 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getOneselfPickupFlgString(Integer oneselfPickupFlg){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(1 == oneselfPickupFlg){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getOneselfPickupFlgString(Integer oneselfPickupFlg) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (1 == oneselfPickupFlg) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "自取"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(0 == oneselfPickupFlg){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (0 == oneselfPickupFlg) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "快递"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "其他"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getStatusName(Integer status){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(31==status){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getStatusName(Integer status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (31 == status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "待配送"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(32==status){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (32 == status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "配送中"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else if(100==status){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else if (100 == status) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "已完成"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return "其他"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //添加单元格内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Label label = new Label(column ,row, data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Label label = new Label(column, row, data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ws.addCell(label); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    //添加单元格内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Label label = new Label(column ,row, data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!org.springframework.util.StringUtils.isEmpty(memo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Label label = new Label(column, row, data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!org.springframework.util.StringUtils.isEmpty(memo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WritableCellFeatures cellFeatures = new WritableCellFeatures(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            cellFeatures.setComment(memo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            label.setCellFeatures(cellFeatures); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2224,14 +2274,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ws.addCell(label); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyChargeDictVO> findByDeptTypeCode(String deptTypeCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyChargeDictVO> findByDeptTypeCode(String deptTypeCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyChargeDictDO> dictDOs = wlyyChargeDictDao.findByDeptTypeCode(deptTypeCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyChargeDictVO> dictVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return convertToModels(dictDOs,dictVOs,WlyyChargeDictVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return convertToModels(dictDOs, dictVOs, WlyyChargeDictVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //获取医生排班规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalSysDictDO> list = sysDictDao.findByDictName("Scheduling"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2245,93 +2295,93 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ecTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置几天号源,及最后天号源的开放时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int days =Integer.parseInt(findHospitalSysDictValue(list,"OpenDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String closeTime = findHospitalSysDictValue(list,"CloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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))){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyDoctorWorkTimeDO> times = doctorWorkTimeDao.findDoctorWorkTime(doctor, scTime.getTime(), ecTime.getTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        workTimeFilter(list,times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        workTimeFilter(list, times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        convertToModels(times,timeVOs,WlyyDoctorWorkTimeVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        convertToModels(times, timeVOs, WlyyDoctorWorkTimeVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(timeVOs!=null&&timeVOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyDoctorWorkTimeVO timeVO : timeVOs){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeDO> workTimeFilter(List<WlyyHospitalSysDictDO> sys, List<WlyyDoctorWorkTimeDO> times) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(times!=null&×.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (times != null && times.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //上午号源开放的最早天数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int AMCloseDays =Integer.parseInt(findHospitalSysDictValue(sys,"AMCloseDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int AMCloseDays = Integer.parseInt(findHospitalSysDictValue(sys, "AMCloseDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //每一天上午的最早预约的过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String AMCloseTime = findHospitalSysDictValue(sys,"AMCloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String AMCloseTime = findHospitalSysDictValue(sys, "AMCloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //下午号源开放的最早天数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int PMCloseDays =Integer.parseInt(findHospitalSysDictValue(sys,"PMCloseDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            int PMCloseDays = Integer.parseInt(findHospitalSysDictValue(sys, "PMCloseDays")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //每一天下午的最早预约的过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String PMCloseTime = findHospitalSysDictValue(sys,"PMCloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String PMCloseTime = findHospitalSysDictValue(sys, "PMCloseTime"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Iterator it = times.iterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            while (it.hasNext()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            while (it.hasNext()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //设置上午过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Calendar scAMTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scAMTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scAMTime.add(Calendar.DAY_OF_MONTH,AMCloseDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scAMTime.add(Calendar.DAY_OF_MONTH, AMCloseDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //设置下午午过号时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Calendar scPMTime = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scPMTime.setTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scPMTime.add(Calendar.DAY_OF_MONTH,PMCloseDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                scPMTime.add(Calendar.DAY_OF_MONTH, PMCloseDays); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyDoctorWorkTimeDO time = (WlyyDoctorWorkTimeDO)it.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyDoctorWorkTimeDO time = (WlyyDoctorWorkTimeDO) it.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Boolean filter = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //1.【上午的排班中】 且 【排班结束时间】如果在【开放时间】前,则移除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(filter&&"1".equals(time.getTimeType())&&time.getEndTime().before(scAMTime.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (filter && "1".equals(time.getTimeType()) && time.getEndTime().before(scAMTime.getTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    filter=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    filter = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //2.【下午午的排班中】 且 【排班结束时间】如果在【开放时间】前,则移除该排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(filter&&"2".equals(time.getTimeType())&&time.getEndTime().before(scPMTime.getTime())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (filter && "2".equals(time.getTimeType()) && time.getEndTime().before(scPMTime.getTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    filter=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    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 (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())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (time.getEndTime().before(scAMTime.getTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        filter=false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        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 (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())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (time.getEndTime().before(scPMTime.getTime())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        it.remove(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2341,11 +2391,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findHospitalSysDictValue(List<WlyyHospitalSysDictDO> list,String dictCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String findHospitalSysDictValue(List<WlyyHospitalSysDictDO> list, String dictCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(WlyyHospitalSysDictDO sysDictDO : list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(dictCode.equals(sysDictDO.getDictCode())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (WlyyHospitalSysDictDO sysDictDO : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (dictCode.equals(sysDictDO.getDictCode())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return sysDictDO.getDictValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2355,17 +2405,80 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取卡信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param cardNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param demoFlag 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public net.sf.json.JSONObject getCardInfo(String cardNo, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.qutpatientBalance(cardNo,demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.qutpatientBalance(cardNo, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 新排班号源详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findWorkTimeInfo(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyDoctorWorkTimeDO timeDO = doctorWorkTimeDao.findOne(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long ss = timeDO.getEndTime().getTime()-timeDO.getStartTime().getTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long s = ss/timeDO.getSourceNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //加上时间间隔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date temp =new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            temp.setTime(sc.getTime().getTime()+s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sc.setTime(temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //加上时间间隔 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date temp =new Date(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            temp.setTime(sc.getTime().getTime()+s); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sc.setTime(temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            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; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Deprecated 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> findWorkTimeInfoOld(String id){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyDoctorWorkTimeDO timeDO = doctorWorkTimeDao.findOne(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Calendar sc = Calendar.getInstance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sc.setTime(timeDO.getStartTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3409,6 +3522,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    t.setEndTime(time.getEndTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    t.setDate(time.getDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    t.setTimeInterval(time.getTimeInterval()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    t.setSourceNumber(time.getSourceNumber()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    rs.add(t); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info(rs.size()+""); 
			 |