|  | @ -118,6 +118,7 @@ public class PrescriptionAdjustService extends BaseService {
 | 
	
		
			
				|  |  |      * 上传ca认证信息
 | 
	
		
			
				|  |  |      * @param code
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional
 | 
	
		
			
				|  |  |     public JSONObject uploadCaDigital(String code){
 | 
	
		
			
				|  |  |         JSONObject re = new JSONObject();
 | 
	
		
			
				|  |  |         Prescription prescription = prescriptionDao.findByCode(code);
 | 
	
	
		
			
				|  | @ -130,36 +131,45 @@ public class PrescriptionAdjustService extends BaseService {
 | 
	
		
			
				|  |  |                 if("1".equals(zyCode)){
 | 
	
		
			
				|  |  |                     JSONArray returnData = data.getJSONArray("returnData");
 | 
	
		
			
				|  |  |                     if(returnData.size()>0){
 | 
	
		
			
				|  |  |                         JSONObject pre = returnData.getJSONArray(0).getJSONObject(0);
 | 
	
		
			
				|  |  |                         //认证成功-审核完成
 | 
	
		
			
				|  |  |                         prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
 | 
	
		
			
				|  |  |                         //设置审核通过
 | 
	
		
			
				|  |  |                         PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
 | 
	
		
			
				|  |  |                         reviewed.setStatus(1);
 | 
	
		
			
				|  |  |                         reviewed.setReviewedTime(new Date());
 | 
	
		
			
				|  |  |                         prescriptionDao.save(prescription);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         //审核通过模板消息
 | 
	
		
			
				|  |  |                         prescriptionInfoService.sendRMess(prescription.getCode(), 1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         //发送Im消息
 | 
	
		
			
				|  |  |                         JSONObject content = new JSONObject();
 | 
	
		
			
				|  |  |                         content.put("title", "我已经审核您" + DateUtil.dateToStr(prescription.getCreateTime(), "yyyy-MM-dd") + "发起的续方申请");
 | 
	
		
			
				|  |  |                         content.put("result", "审核通过");
 | 
	
		
			
				|  |  |                         content.put("reason", "");
 | 
	
		
			
				|  |  |                         content.put("url", "");
 | 
	
		
			
				|  |  |                         imUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "15", content.toString(), null);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         //修改系统的续方消息的审核状态
 | 
	
		
			
				|  |  |                         messageDao.updatePreScriptionMessage(prescription.getConsult(), "1", 6);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         //获取智业待结算接口,更新药品金额
 | 
	
		
			
				|  |  |                         prescriptionService.getPerscriptionInfoCostFromPayInfo(prescription.getCode());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         //添加日志
 | 
	
		
			
				|  |  |                         prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),1,2);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         re.put("status",200);
 | 
	
		
			
				|  |  |                         //{"status":200,"msg":"CA认证通过接口!","data":"{\"CODE\":\"1\",\"returnData\":[{\"result\":\"True\"}],\"byRefParaData\":[{ \"errorMsg\": \"\" }]}"}
 | 
	
		
			
				|  |  |                         JSONObject pre = returnData.getJSONObject(0);
 | 
	
		
			
				|  |  |                         if("True".equals(pre.getString("result"))){
 | 
	
		
			
				|  |  |                             //认证成功-审核完成
 | 
	
		
			
				|  |  |                             prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.wait_pay.getValue());
 | 
	
		
			
				|  |  |                             //设置审核通过
 | 
	
		
			
				|  |  |                             PrescriptionReviewed reviewed = prescriptionReviewedDao.findByPrescriptionCode(code);
 | 
	
		
			
				|  |  |                             reviewed.setStatus(1);
 | 
	
		
			
				|  |  |                             reviewed.setReviewedTime(new Date());
 | 
	
		
			
				|  |  |                             prescriptionDao.save(prescription);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //审核通过模板消息
 | 
	
		
			
				|  |  |                             prescriptionInfoService.sendRMess(prescription.getCode(), 1);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //修改系统的续方消息的审核状态
 | 
	
		
			
				|  |  |                             messageDao.updatePreScriptionMessage(prescription.getConsult(), "1", 6);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //获取智业待结算接口,更新药品金额
 | 
	
		
			
				|  |  |                             prescriptionService.getPerscriptionInfoCostFromPayInfo(prescription.getCode());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //添加日志
 | 
	
		
			
				|  |  |                             prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),1,2);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             //发送Im消息
 | 
	
		
			
				|  |  |                             JSONObject content = new JSONObject();
 | 
	
		
			
				|  |  |                             content.put("title", "我已经审核您" + DateUtil.dateToStr(prescription.getCreateTime(), "yyyy-MM-dd") + "发起的续方申请");
 | 
	
		
			
				|  |  |                             content.put("result", "审核通过");
 | 
	
		
			
				|  |  |                             content.put("reason", "");
 | 
	
		
			
				|  |  |                             content.put("url", "");
 | 
	
		
			
				|  |  |                             imUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "15", content.toString(), null);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             re.put("status",200);
 | 
	
		
			
				|  |  |                         }else {
 | 
	
		
			
				|  |  |                             //请求失败
 | 
	
		
			
				|  |  |                             prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
 | 
	
		
			
				|  |  |                             JSONArray byRefParaData = data.getJSONArray("byRefParaData");
 | 
	
		
			
				|  |  |                             re.put("status",-1);
 | 
	
		
			
				|  |  |                             re.put("msg",byRefParaData.getJSONObject(0).getString("errorMsg"));
 | 
	
		
			
				|  |  |                         }
 | 
	
		
			
				|  |  |                     }else {
 | 
	
		
			
				|  |  |                         //请求失败
 | 
	
		
			
				|  |  |                         prescriptionLogService.addLog(prescription,PrescriptionLog.PrescriptionLogType.zy.getValue(),0,2);
 |