|  | @ -15,6 +15,8 @@ import com.yihu.wlyy.repository.prescription.PrescriptionDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.prescription.PrescriptionInfoDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.repository.prescription.PrescriptionLogDao;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.service.BaseService;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.DateUtil;
 | 
	
		
			
				|  |  | import com.yihu.wlyy.util.ImUtill;
 | 
	
		
			
				|  |  | import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  | import org.json.JSONArray;
 | 
	
		
			
				|  |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @ -44,6 +46,11 @@ public class PrescriptionInfoService extends BaseService {
 | 
	
		
			
				|  |  |     private PatientDao patientDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionLogDao prescriptionLogDao;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private PrescriptionDiagnosisService prescriptionDiagnosisService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private ImUtill imUtill;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 获取处方下的详细药品
 | 
	
		
			
				|  |  |      * @param prescriptionCode
 | 
	
	
		
			
				|  | @ -264,6 +271,14 @@ public class PrescriptionInfoService extends BaseService {
 | 
	
		
			
				|  |  |             log.setRemark("医生审核");
 | 
	
		
			
				|  |  |             prescriptionLogDao.save(log);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //发送Im消息
 | 
	
		
			
				|  |  |             JSONObject content = new JSONObject();
 | 
	
		
			
				|  |  |             content.put("title","我已经审核您"+ DateUtil.dateToStr(p.getCreateTime(),"yyyy-MM-dd")+"发起的续方申请");
 | 
	
		
			
				|  |  |             content.put("result","1".equals(state)?"审核通过":"审核不通过");
 | 
	
		
			
				|  |  |             content.put("reason","1".equals(state)?"":reason);
 | 
	
		
			
				|  |  |             content.put("url","");
 | 
	
		
			
				|  |  |             imUtill.sendTopicIM(p.getDoctor(),p.getDoctorName(),p.getConsult(),"1",content.toString(),null);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             //同步智业接口
 | 
	
		
			
				|  |  |             upLoadPrescriotionState();
 | 
	
		
			
				|  |  |             return 1;
 | 
	
	
		
			
				|  | @ -271,4 +286,40 @@ public class PrescriptionInfoService extends BaseService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         return 0;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public int updatePresInfo(String code,String infos){
 | 
	
		
			
				|  |  |         if(StringUtils.isNotBlank(code)&&StringUtils.isNotBlank(infos)){
 | 
	
		
			
				|  |  |             //同步智业接口
 | 
	
		
			
				|  |  |             upload();
 | 
	
		
			
				|  |  |             //删除所有药品
 | 
	
		
			
				|  |  |             StringBuffer sql = new StringBuffer("UPDATE wlyy_prescription_info SET del = 0 WHERE prescription_code = '"+code+"'");
 | 
	
		
			
				|  |  |             jdbcTemplate.execute(sql.toString());
 | 
	
		
			
				|  |  |             JSONArray jsonArray = new  JSONArray(infos);
 | 
	
		
			
				|  |  |             Iterator<Object> it = jsonArray.iterator();
 | 
	
		
			
				|  |  |             while (it.hasNext()){
 | 
	
		
			
				|  |  |                 JSONObject info = (JSONObject) it.next();
 | 
	
		
			
				|  |  |                 PrescriptionInfo p = new PrescriptionInfo();
 | 
	
		
			
				|  |  |                 p.setCode(getCode());
 | 
	
		
			
				|  |  |                 p.setDel(1);
 | 
	
		
			
				|  |  |                 p.setPrescriptionCode(code);
 | 
	
		
			
				|  |  |                 p.setPrice(info.getDouble("price"));
 | 
	
		
			
				|  |  |                 p.setDrugCode(info.getString("drugCode"));
 | 
	
		
			
				|  |  |                 p.setDrugName(info.getString("drugName"));
 | 
	
		
			
				|  |  |                 p.setDrugRate(info.getString("drugRate"));
 | 
	
		
			
				|  |  |                 p.setDrugFormat(info.getString("drugFormat"));
 | 
	
		
			
				|  |  |                 p.setNum(info.getInteger("num"));
 | 
	
		
			
				|  |  |                 p.setIsRefrigerate(info.getInteger("isRefrigerate"));
 | 
	
		
			
				|  |  |                 p.setDirection(info.getString("direction"));
 | 
	
		
			
				|  |  |                 prescriptionInfoDao.save(p);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             //设置处方疾病类型
 | 
	
		
			
				|  |  |             prescriptionDiagnosisService.setPrescriptionDiagnosis(code);
 | 
	
		
			
				|  |  |             return 1 ;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return 0;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public String upload(){
 | 
	
		
			
				|  |  |      return null;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |