| 
					
				 | 
			
			
				@ -257,13 +257,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findReOutpatientList(String patient,Integer status,String startTime,String endTime,Integer page,Integer size){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) AS \"total\" " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_outpatient o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = ? AND o.outpatient_type != '2' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Object> totalParams = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        totalParams.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient =:patient AND o.outpatient_type != '2' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> totalParams = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        totalParams.put("patient",patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql +=  " AND o.status =:status "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.put("status",status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND o.create_time >=:createTime "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.put("createTime",DateUtil.strToDateLong(startTime+" 00:00:00")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND o.create_time <=:endTime "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.put("endTime",DateUtil.strToDateLong(endTime+" 23:59:59")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       /* totalParams.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql +=  " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(status); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -275,64 +289,65 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND create_time <= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalParams.add(DateUtil.strToDateLong(endTime+" 23:59:59")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql,totalParams.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql,totalParams); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rstotal != null && rstotal.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = Long.parseLong(rstotal.get(0).get("total").toString()) ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql ="SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.id, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.adm_no AS admNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_adm_no AS originAdmNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.register_no AS registerNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_register_no AS originRegisterNo, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_con_no AS originConNo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.con_no AS conNo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.hospital," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.hospital_name AS hospitalName," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.win_no AS winNo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.type," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.dept AS dept, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.dept_name AS deptName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient AS patient, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient_name AS patientName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.doctor AS doctor, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.doctor_name AS doctorName, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.idcard AS idcard, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.card_no AS cardNo," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.mjz AS mjz, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.icd10 AS icd10, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.icd10_name AS icd10Name, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.adm_date AS admDate, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.con_date AS conDate, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.description AS description, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.disease_img AS diseaseImg, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.create_time AS createTime, " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.`status` AS `status`," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.register_date AS registerDate," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.evaluate_status AS evaluateStatus   " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.id AS \"id\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.adm_no AS \"admNo\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_adm_no AS \"originAdmNo\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.register_no AS \"registerNo\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_register_no AS \"originRegisterNo\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.origin_con_no AS \"originConNo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.con_no AS \"conNo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.hospital AS \"hospital\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.hospital_name AS \"hospitalName\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.win_no AS \"winNo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.type AS  \"type\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.dept AS \"dept\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.dept_name AS \"deptName\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient AS \"patient\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient_name AS \"patientName\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.doctor AS \"doctor\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.doctor_name AS \"doctorName\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.idcard AS \"idcard\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.card_no AS \"cardNo\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.mjz AS \"mjz\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.icd10 AS \"icd10\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.icd10_name AS \"icd10Name\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.adm_date AS \"admDate\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.con_date AS \"conDate\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.description AS \"description\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.disease_img AS \"diseaseImg\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.create_time AS \"createTime\", " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.status AS \"status\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.register_date AS \"registerDate\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.evaluate_status AS \"evaluateStatus\"" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.pay_status as \"payStatus\" "+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " wlyy_outpatient o " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " WHERE " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Object> params = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " o.patient =:patient "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.put("patient",patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(status!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=  " AND o.status = ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=  " AND o.status =:status "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("status",status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time >= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(DateUtil.strToDateLong(startTime+" 00:00:00")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time >=:createTime "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("createTime",DateUtil.strToDateLong(startTime+" 00:00:00")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNotBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time <= ? "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.add(DateUtil.strToDateLong(endTime+" 23:59:59")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND o.create_time <=:endTime "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("endTime",DateUtil.strToDateLong(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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -398,14 +413,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("expressage",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //物流配送新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      /*  //物流配送新 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //预约记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId); 
			 |