|  | @ -3325,7 +3325,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |         return  rs;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 发送微信模板消息  本地无法测试消息是否发送成功
 | 
	
		
			
				|  |  |      * @param wxId
 | 
	
		
			
				|  |  |      * @param outpatientDO
 | 
	
		
			
				|  |  |      * @param type
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void sendWxTemplateMsg(String wxId,WlyyOutpatientDO outpatientDO,String type){
 | 
	
		
			
				|  |  |         List<BasePatientWechatDo> ps = basePatientWechatDao.findByWechatIdAndPatientId(wxId, outpatientDO.getPatient());
 | 
	
		
			
				|  |  |         if(ps.isEmpty()){
 | 
	
	
		
			
				|  | @ -6598,43 +6603,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) {
 | 
	
		
			
				|  |  |         String uid = userAgent.getUID();
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer("select a.* from wlyy_prescription a,wlyy_prescription_info b where a.patient_code ='");
 | 
	
		
			
				|  |  |         StringBuffer countSql = new StringBuffer("select COUNT(a.id) count from wlyy_prescription a,wlyy_prescription_info b  where a.patient_code ='");
 | 
	
		
			
				|  |  |         sql.append(uid).append("' AND a.id = b.prescription_id");
 | 
	
		
			
				|  |  |         countSql.append(uid).append("' AND a.id = b.prescription_id ");
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer("SELECT b.*, c.oneself_pickup_flg FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
 | 
	
		
			
				|  |  |         StringBuffer countSql = new StringBuffer("select COUNT(b.id) count FROM (SELECT a.* FROM wlyy_prescription a WHERE a.patient_code = '");
 | 
	
		
			
				|  |  |         sql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id");
 | 
	
		
			
				|  |  |         countSql.append(uid).append("') b LEFT JOIN wlyy_prescription_info d ON b.id = d.prescription_id JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id ");
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(keyName)){
 | 
	
		
			
				|  |  |             sql.append(" AND (" +
 | 
	
		
			
				|  |  |                     " a.doctor_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR a.dept_name LIKE'%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR a.hospital_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.drug_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR a.real_order LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " b.doctor_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.dept_name LIKE'%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.hospital_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR d.drug_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.real_order LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     ")");
 | 
	
		
			
				|  |  |             countSql.append(" AND (" +
 | 
	
		
			
				|  |  |                     " a.doctor_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR a.dept_name LIKE'%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR a.hospital_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.drug_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR a.real_order LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " b.doctor_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.dept_name LIKE'%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.hospital_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR d.drug_name LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     " OR b.real_order LIKE '%"+keyName+"%' " +
 | 
	
		
			
				|  |  |                     ")");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (StringUtils.isNotEmpty(status)){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             status= status.substring(1, status.length() - 1);
 | 
	
		
			
				|  |  |             sql.append(" AND a.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |             countSql.append(" AND a.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |             sql.append(" AND b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |             countSql.append(" AND b.status IN(").append(status).append(")");
 | 
	
		
			
				|  |  |         }else {
 | 
	
		
			
				|  |  |             sql.append("  and a.status IN(20,21,30,31,32,100,101)");
 | 
	
		
			
				|  |  |             countSql.append(" and a.status IN(20,21,30,31,32,100,101) ");
 | 
	
		
			
				|  |  |             sql.append("  and b.status IN(20,21,30,31,32,100,101)");
 | 
	
		
			
				|  |  |             countSql.append(" and b.status IN(20,21,30,31,32,100,101) ");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql.append(" order by a.prescribe_time limit ").append((page-1)*size).append(",").append(size);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionDO.class));
 | 
	
		
			
				|  |  |         sql.append(" order by b.prescribe_time limit ").append((page-1)*size).append(",").append(size);
 | 
	
		
			
				|  |  |         List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
 | 
	
		
			
				|  |  |         List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
 | 
	
		
			
				|  |  |         long count = Long.parseLong(mapList.get(0).get("count").toString());
 | 
	
		
			
				|  |  |         logger.info("sql="+sql.toString());
 | 
	
		
			
				|  |  |         logger.info("countSql="+countSql.toString());
 | 
	
		
			
				|  |  |         return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,size,count);
 | 
	
		
			
				|  |  |         return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, list,page,size,count);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 |