| 
					
				 | 
			
			
				@ -43,6 +43,8 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.common.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.http.HttpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.security.Code16; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.security.MD5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import jxl.write.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import net.sf.json.JSONArray; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -57,6 +59,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.jdbc.core.JdbcTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.transaction.annotation.Transactional; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.util.CollectionUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.io.OutputStream; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -118,6 +121,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorHospitalDao baseDoctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PrescriptionExpressageService sfexpressService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -295,7 +301,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDOs = prescriptionDao.findById(prescriptionId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1761,7 +1766,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //删除门诊号源 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyPatientRegisterTimeDO> list = patientRegisterTimeDao.findByOutpatientId(wlyyOutpatientDO.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        patientRegisterTimeDao.delete(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null&&list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientRegisterTimeDao.delete(list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("code",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        rs.put("mes","取消成功"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2259,20 +2266,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private HttpClientUtil httpClientUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String test() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         * http://www.mstpay.com:1811/ehcService/gateway.do 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public String app_id = "1BQA48ETK000A718A8C000001FFAA482"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public String app_key = "1BQA48ETK001A718A8C00000FE996B9B"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public String term_id = "35020010001"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<NameValuePair> params = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("method", "ehc.ehealthcard.authurl")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("app_id", "1BQA48ETK000A718A8C000001FFAA482")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("term_id", "b60bab0617c04b23b7fa0a059cc83eb6")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("version","o0hubt3byGmNYLyC-UvmSVyUuZkI")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("timestamp", "ihealth_pa8DIRJasL")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("sign_type", "jkzl1h7aj39dnasyi23fnkv92")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("sign", "b60bab0617c04b23b7fa0a059cc83eb6")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("enc_type","o0hubt3byGmNYLyC-UvmSVyUuZkI")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("biz_content", "ihealth_pa8DIRJasL")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = httpClientUtil.post("http://172.16.1.21:6601/ehcService/gateway.do", params, "UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("term_id", "35020010001")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("version","X.M.0.1")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("timestamp", DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("sign_type", "MD5")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("sign", getSign())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("enc_type","AES")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        params.add(new BasicNameValuePair("biz_content", "")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String res = httpClientUtil.post("http://www.mstpay.com:1811/ehcService/gateway.do", params, "UTF-8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return res; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2282,7 +2293,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        com.alibaba.fastjson.JSONObject object1 = com.alibaba.fastjson.JSONObject.parseObject(responseMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        return object1.toString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getSign(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String str ="app_id=1BQA48ETK000A718A8C000001FFAA482" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "&enc_type=AES" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "&method=ehc.ehealthcard.authurl" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "&sign_type=MD5" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "&term_id=35020010001" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "×tamp=" +DateUtil.dateToStr(new Date(),"yyyyMMddHHmmss")+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "&version=X.M.0.1key=<你的密钥>"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String md5str =  MD5.GetMD5Code(str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String str16 = Code16.toStringHex1(md5str); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return str16.substring(0,16).toUpperCase(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 获取正在进行中的视频复诊/协同门诊 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -2468,4 +2492,70 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 根据门诊唯一号,处方号,到顺丰下单,下单成功返回面单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param admNo 门诊唯一号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param realOrder 处方号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public String getSFExpressInfo(String admNo,String realOrder)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //根据门诊唯一号取就诊记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctor(admNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String result = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(!wlyyOutpatientDOs.isEmpty() && wlyyOutpatientDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId",wlyyOutpatientDOs.get(0).getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyPrescriptionExpressageDO sfexpress_obj = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if(CollectionUtils.isEmpty(expressageDOList)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                throw new Exception("顺丰快递下单失败,未找到该处方的派送地址!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sfexpress_obj = expressageDOList.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //处方已下单成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //如果该处方的快递单号未生成,则继续下单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //根据业务订单号判断是否已经下单成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    boolean go_on = sfexpressService.sfOrderSearchService(sfexpress_obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    //如果该业务订单号未下单成功过,则重新下单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if(go_on){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //请求顺丰接口下单,成功下单后,返回快递单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfexpress_obj = sfexpressService.postSFOrderService(sfexpress_obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        //保存快递单号和增加处方物流记录为配送 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        sfexpressService.updatePrescriptionExpressage(sfexpress_obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if(sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    com.alibaba.fastjson.JSONObject sfJsonObject = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("mailno", sfexpress_obj.getMailno()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("mailtype", "标准快递"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("destcode", "592"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("j_name", "厦门大学附属中山医院"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("d_address", sfexpress_obj.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("d_phone",sfexpress_obj.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("express_type",11); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("pay_method",2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sfJsonObject.put("dispensaryType",2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    result = sfJsonObject.toJSONString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |