|  | @ -370,13 +370,23 @@ public class PrescriptionInfoService extends BaseService {
 | 
	
		
			
				|  |  |                 com.alibaba.fastjson.JSONObject returnData = (com.alibaba.fastjson.JSONObject)reData.get(0);
 | 
	
		
			
				|  |  |                 p.setVisitNo(returnData.getString("VISIT_NO"));
 | 
	
		
			
				|  |  |                 p.setRecipeNo(returnData.getString("RECIPE_NO"));
 | 
	
		
			
				|  |  |                 //设置状态为待支付
 | 
	
		
			
				|  |  |                 p.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
 | 
	
		
			
				|  |  |                 //设置审核通过
 | 
	
		
			
				|  |  |                 reviewed.setStatus(1);
 | 
	
		
			
				|  |  |                 reviewed.setReviewedTime(new Date());
 | 
	
		
			
				|  |  |                 prescriptionDao.save(p);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                 //审核通过模板消息
 | 
	
		
			
				|  |  |                 sendRMess(code,1);
 | 
	
		
			
				|  |  |                 return 1;
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 p.setStatus(PrescriptionLog.PrescriptionLogStatus.add_error.getValue());
 | 
	
		
			
				|  |  |                 p.setPrescribeReason(byRefParaData.getJSONObject(0).getString("errorMsg"));
 | 
	
		
			
				|  |  |                 p.setPrescribeTime(new Date());
 | 
	
		
			
				|  |  |                 prescriptionDao.save(p);
 | 
	
		
			
				|  |  |                 //审核不通过模板消息
 | 
	
		
			
				|  |  |                 sendRMess(code,0);
 | 
	
		
			
				|  |  |                 return 0;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
	
		
			
				|  | @ -764,16 +774,25 @@ public class PrescriptionInfoService extends BaseService {
 | 
	
		
			
				|  |  |             JSONObject json = new JSONObject(mes);
 | 
	
		
			
				|  |  |             Integer state = json.getInt("state");
 | 
	
		
			
				|  |  |             String code = json.getString("prescription");
 | 
	
		
			
				|  |  |             return sendRMess(code ,state);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error("报文解析失败!",e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return 0;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public int  sendRMess(String code ,Integer state){
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             Prescription prescription = prescriptionDao.findByCode(code);
 | 
	
		
			
				|  |  |             Patient p = patientDao.findByCode(prescription.getPatient());
 | 
	
		
			
				|  |  |             if(state!=null&&state==1){
 | 
	
		
			
				|  |  |                 prescriptionNoticesService.sendMessages(prescription.getPatient(),prescription.getDoctorName(),null,1,1,"prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode()+ "&toName=" + p.getName() +"&code="+prescription.getCode());
 | 
	
		
			
				|  |  |             }else{
 | 
	
		
			
				|  |  |                 prescriptionNoticesService.sendMessages(prescription.getPatient(),prescription.getDoctorName(),null,1,2,"prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode()+ "&toName=" + p.getName() +"&code="+prescription.getCode());
 | 
	
		
			
				|  |  |             if (state != null && state == 1) {
 | 
	
		
			
				|  |  |                 prescriptionNoticesService.sendMessages(prescription.getPatient(), prescription.getDoctorName(), null, 1, 1, "prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode() + "&toName=" + p.getName() + "&code=" + prescription.getCode());
 | 
	
		
			
				|  |  |             } else {
 | 
	
		
			
				|  |  |                 prescriptionNoticesService.sendMessages(prescription.getPatient(), prescription.getDoctorName(), null, 1, 2, "prescription/html/re-prescription_info.html?openid=" + p.getOpenid() + "&toUser=" + p.getCode() + "&toName=" + p.getName() + "&code=" + prescription.getCode());
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             return 1;
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             logger.error("续方消息发送失败!",e);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             logger.error("续方消息发送失败!", e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return 0;
 | 
	
		
			
				|  |  |     }
 | 
	
	
		
			
				|  | @ -1032,7 +1051,7 @@ public class PrescriptionInfoService extends BaseService {
 | 
	
		
			
				|  |  |      * @return 0 审核中,1为处理完成
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public String presCheckState(String code){
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND r.status = 0");
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND pr.status >= 0 AND pr.status < 40");
 | 
	
		
			
				|  |  |         List<Map<String,Object>> mp = jdbcTemplate.queryForList(sql.toString(),code);
 | 
	
		
			
				|  |  |         if(mp!=null&&mp.size()>0){
 | 
	
		
			
				|  |  |             return "0";
 | 
	
	
		
			
				|  | @ -1042,7 +1061,7 @@ public class PrescriptionInfoService extends BaseService {
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String presCheckStateObj(String code){
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND r.status = 0");
 | 
	
		
			
				|  |  |         StringBuffer sql = new StringBuffer(" SELECT pr.code FROM wlyy_prescription pr JOIN wlyy_prescription_reviewed r ON pr.code = r.prescription_code WHERE pr.parent_code = ? AND pr.status >= 0 AND pr.status < 40");
 | 
	
		
			
				|  |  |         List<Map<String,Object>> mp = jdbcTemplate.queryForList(sql.toString(),code);
 | 
	
		
			
				|  |  |         if(mp!=null&&mp.size()>0){
 | 
	
		
			
				|  |  |             return (String)((mp.get(0)).get("code"));
 |