| 
					
				 | 
			
			
				@ -54,6 +54,7 @@ import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.hospital.prescription.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ListEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -179,6 +180,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private YkyyService ykyyService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PrescriptionCheckDao prescriptionCheckDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Value("${demo.flag}") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2292,7 +2295,7 @@ 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) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findExpressageList(String status, String oneselfPickupFlg, String nameKey, String startTime, String endTime, Integer page, Integer size,String wxId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " COUNT(1) AS total " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " FROM " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2305,18 +2308,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND p.status in(" + status + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(oneselfPickupFlg)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.oneself_pickup_flg =" + oneselfPickupFlg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.oneself_pickup_flg = " + oneselfPickupFlg; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(nameKey)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.name like '%" + nameKey + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equals(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql +=" and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += " AND e.create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            totalSql += " AND e.create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equals(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql +=" and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += " AND e.create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (rstotal != null && rstotal.size() > 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2347,14 +2360,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND e.name like '%" + nameKey + "%'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(startTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND e.create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equals(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql +=" and e.create_time >= to_date('" + startTime + " 00:00:00','YYYY-MM-DD HH24:MI:SS')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += " AND e.create_time >='" + startTime + " 00:00:00'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(endTime)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND e.create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equals(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql +=" and e.create_time <= to_date('" + endTime + " 23:59:59','YYYY-MM-DD HH24:MI:SS')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                totalSql += " AND e.create_time <='" + endTime + " 23:59:59'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " LIMIT " + (page - 1) * size + "," + size + ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("info",wlyyPrescriptionInfoDOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4176,7 +4202,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param realOrder 处方号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Object getSFExpressInfo(String admNo,String realOrder)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public Object getSFExpressInfo(String admNo,String realOrder,String wxId)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //根据门诊唯一号取就诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4214,12 +4240,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("mailno", sfexpress_obj.getMailno()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("mailtype", "标准快递"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("destcode", "592"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("j_name", "厦门大学附属中山医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(wxId.equalsIgnoreCase("xm_zsyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_name", "厦门大学附属中山医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_phone", "4003008888"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_townName", "思明区"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_address", "湖滨南路201-209号"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    }else if (wxId.equalsIgnoreCase("xm_ykyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_name", "厦门大学附属中山医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_phone", "4003008888"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_townName", "思明区"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfJsonObject.put("j_address", "湖滨南路201-209号"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("j_provinceName", "福建省"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("j_cityName", "厦门市"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("j_townName", "思明区"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("j_address", "湖滨南路201-209号"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("j_phone", "4003008888"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("d_name", sfexpress_obj.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("d_provinceName", sfexpress_obj.getProvinceName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("d_cityName", sfexpress_obj.getCityName()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5171,4 +5205,161 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return hibenateUtils.createSQLQuery(sql,params,page,pagesize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String,Object>> selectByCondition(String hospital, String dept, String status, String startTime, String endTime, String nameInfo, Integer page, Integer pagesize, String wxId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> maps = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.doctor as \"doctor\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.id as \"id\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.doctor_name as \"doctorName\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.dept as \"dept\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.dept_name as \"deptName\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.hospital as \"hospital\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.hospital_name as \"hospitalName\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.patient_code as \"patientCode\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.patient_name as \"patientName\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.idcard as \"idcard\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tp.ssc as \"ssc\",\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if("xm_ykyy_wx".equals(wxId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = sql + "to_char(p.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"createTime\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql +="\tp.`status` as \"status\"\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\twlyy_prescription P\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "WHERE\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\t1 = 1  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(hospital)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and p.hospital =:hospital"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("hospital",hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and p.dept =:dept"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("dept",dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and p.status =:status"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("status",status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and p.create_time >=:startTime"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("startTime",DateUtil.stringToDate(startTime,"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and p.create_time <=:endTime"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params.put("endTime",DateUtil.stringToDate(endTime,"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(nameInfo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql +=" and (p.patient_name like '%"+nameInfo+"%' or p.doctor_name like '%"+nameInfo+"%')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql +=" order by p.create_time desc"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,params,page,pagesize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sqlTotal = "select COUNT(1) AS \"total\" from wlyy_prescription p where 1=1  "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> params1 = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(hospital)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotal +=" and p.hospital =:hospital"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params1.put("hospital",hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(dept)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotal +=" and p.dept =:dept"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params1.put("dept",dept); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(status)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotal +=" and p.status =:status"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params1.put("status",status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotal +=" and p.create_time >=:startTime"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params1.put("startTime",DateUtil.stringToDate(startTime,"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotal +=" and p.create_time <=:endTime"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            params1.put("endTime",DateUtil.stringToDate(endTime,"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(nameInfo)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sqlTotal +=" and (p.patient_name like '%"+nameInfo+"%' or p.doctor_name like '%"+nameInfo+"%')"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(total!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = hibenateUtils.objTransformLong(total.get(0).get("total")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String,Object> map = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        map.put("count",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        map.put("list",mapList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        maps.add(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return maps; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 修改处方状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param prescriptionId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updateStatus(String prescriptionId,Integer status){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionDao.updateStatus(prescriptionId,status,new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     *  更改订单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param mailNo 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updateMailNoById(String id,String mailNo){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionExpressageDao.updateMailNoById(id,mailNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 审方 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param operate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param operateName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param reason 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param prescriptionId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyPrescriptionCheckDO saveCheck(String operate,String operateName,String reason,Integer status,String prescriptionId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyPrescriptionCheckDO prescriptionCheckDO = new WlyyPrescriptionCheckDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setOperate(operate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setOperateName(operateName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setCreateUser(operate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setCreateUserName(operateName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setReason(reason); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO.setStatus(status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (status==4){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.updateStatus(prescriptionId,12); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setMkTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setMkFailReason(reason); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyPrescriptionDO.setStatus(11); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDao.save(wlyyPrescriptionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return prescriptionCheckDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 查询审批记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param prescriptionId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionCheckDO> findPrescriptionCheck(String prescriptionId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  prescriptionCheckDao.findByPrescriptionId(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |