|  | @ -7,26 +7,23 @@ import com.yihu.jw.entity.hospital.mapping.HospitalDeptMappingDO;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.mapping.dao.HospitalDeptMappingDao;
 |  | import com.yihu.jw.hospital.mapping.dao.HospitalDeptMappingDao;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
 |  | import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
 |  | import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.hospital.prescription.service.entrance.util.WebserviceUtil;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyHisPrescriptionVO;
 |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyHisPrescriptionVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
 |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
 |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
 |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.ListEnvelop;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | import io.swagger.annotations.ApiParam;
 |  | 
 | 
												
													
														
															|  | 
 |  | import net.sf.json.JSON;
 | 
												
													
														
															|  | import net.sf.json.JSONArray;
 |  | import net.sf.json.JSONArray;
 | 
												
													
														
															|  | 
 |  | import net.sf.json.xml.XMLSerializer;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
													
														
															|  | import org.json.JSONObject;
 |  | import org.json.JSONObject;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | import org.springframework.core.io.ClassPathResource;
 |  | import org.springframework.core.io.ClassPathResource;
 | 
												
													
														
															|  | import org.springframework.core.io.Resource;
 |  | import org.springframework.core.io.Resource;
 | 
												
													
														
															|  | import org.springframework.stereotype.Controller;
 |  | 
 | 
												
													
														
															|  | import org.springframework.stereotype.Service;
 |  | import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | import org.springframework.web.bind.annotation.RequestParam;
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import javax.transaction.Transactional;
 |  | 
 | 
												
													
														
															|  | import java.io.BufferedReader;
 |  | import java.io.BufferedReader;
 | 
												
													
														
															|  | import java.io.IOException;
 |  | 
 | 
												
													
														
															|  | import java.io.InputStream;
 |  | import java.io.InputStream;
 | 
												
													
														
															|  | import java.io.InputStreamReader;
 |  | import java.io.InputStreamReader;
 | 
												
													
														
															|  | import java.util.*;
 |  | import java.util.*;
 | 
												
											
												
													
														
															|  | @ -114,22 +111,29 @@ public class EntranceService {
 | 
												
													
														
															|  |         if(demoFlag){
 |  |         if(demoFlag){
 | 
												
													
														
															|  |             resp=getJosnFileResullt(fid);
 |  |             resp=getJosnFileResullt(fid);
 | 
												
													
														
															|  |         }else{
 |  |         }else{
 | 
												
													
														
															|  |             JSONObject msg=new JSONObject();
 |  | 
 | 
												
													
														
															|  |             msg.put("endNum","20000");
 |  | 
 | 
												
													
														
															|  |             msg.put("Msg", new net.sf.json.JSONArray() );
 |  | 
 | 
												
													
														
															|  |             JSONObject query=new JSONObject();
 |  | 
 | 
												
													
														
															|  |             query.put("@compy","=");
 |  | 
 | 
												
													
														
															|  |             query.put("@item","CARD_NO");
 |  | 
 | 
												
													
														
															|  |             query.put("@splice","and");
 |  | 
 | 
												
													
														
															|  |             query.put("@value",cardNo);
 |  | 
 | 
												
													
														
															|  |             msg.put("query",query);
 |  | 
 | 
												
													
														
															|  |             msg.put("startNum",1);
 |  | 
 | 
												
													
														
															|  |             List<String> stringList=new ArrayList<>();
 |  | 
 | 
												
													
														
															|  |             stringList.add(cardNo);
 |  | 
 | 
												
													
														
															|  |             //获取消息
 |  | 
 | 
												
													
														
															|  |             resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList);
 |  | 
 | 
												
													
														
															|  |             //解析
 |  | 
 | 
												
													
														
															|  |             resp= MqSdkUtil.xml2jsonObject(resp);
 |  | 
 | 
												
													
														
															|  | 
 |  |             //先调用银医通获取下载余额到his,再查询his中卡余额
 | 
												
													
														
															|  | 
 |  |             net.sf.json.JSONObject jsonObject= callYYTServerService(cardNo);
 | 
												
													
														
															|  | 
 |  |            if(null==jsonObject && "success".equals(jsonObject.get("code").toString())){
 | 
												
													
														
															|  | 
 |  |                JSONObject msg=new JSONObject();
 | 
												
													
														
															|  | 
 |  |                msg.put("endNum","20000");
 | 
												
													
														
															|  | 
 |  |                msg.put("Msg", new net.sf.json.JSONArray() );
 | 
												
													
														
															|  | 
 |  |                JSONObject query=new JSONObject();
 | 
												
													
														
															|  | 
 |  |                query.put("@compy","=");
 | 
												
													
														
															|  | 
 |  |                query.put("@item","CARD_NO");
 | 
												
													
														
															|  | 
 |  |                query.put("@splice","and");
 | 
												
													
														
															|  | 
 |  |                query.put("@value",cardNo);
 | 
												
													
														
															|  | 
 |  |                msg.put("query",query);
 | 
												
													
														
															|  | 
 |  |                msg.put("startNum",1);
 | 
												
													
														
															|  | 
 |  |                List<String> stringList=new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |                stringList.add(cardNo);
 | 
												
													
														
															|  | 
 |  |                //获取消息
 | 
												
													
														
															|  | 
 |  |                resp = MqSdkUtil.putReqAndGetResp(msg.toString(), fid, "1",stringList);
 | 
												
													
														
															|  | 
 |  |                //解析
 | 
												
													
														
															|  | 
 |  |                resp= MqSdkUtil.xml2jsonObject(resp);
 | 
												
													
														
															|  | 
 |  |            }else {
 | 
												
													
														
															|  | 
 |  |                return jsonObject;
 | 
												
													
														
															|  | 
 |  |            }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return  ConvertUtil.convertObjectEnvelopByString(resp);
 |  |         return  ConvertUtil.convertObjectEnvelopByString(resp);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
											
												
													
														
															|  | @ -819,4 +823,47 @@ public class EntranceService {
 | 
												
													
														
															|  |         return resp;
 |  |         return resp;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 银医通下载
 | 
												
													
														
															|  | 
 |  |      * @param cardNo 待查询的卡号
 | 
												
													
														
															|  | 
 |  |      **/
 | 
												
													
														
															|  | 
 |  |     public net.sf.json.JSONObject callYYTServerService(String cardNo) throws Exception {
 | 
												
													
														
															|  | 
 |  |         String re = "";
 | 
												
													
														
															|  | 
 |  |         net.sf.json.JSONObject jsonObject=new net.sf.json.JSONObject();
 | 
												
													
														
															|  | 
 |  |         String action = "CallYYTServerService";
 | 
												
													
														
															|  | 
 |  |         String info_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" +
 | 
												
													
														
															|  | 
 |  |                 "<root><ip>172.16.50.40</ip><port>5516</port></root>";
 | 
												
													
														
															|  | 
 |  |         String reqmsg_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" +
 | 
												
													
														
															|  | 
 |  |                 "<root><sick_id>" + cardNo + "</sick_id><cus_card_no>" + cardNo + "</cus_card_no>" +
 | 
												
													
														
															|  | 
 |  |                 "<req_type>2001</req_type><trade_type>2001</trade_type><req_oper>8644</req_oper><req_term>192001019019</req_term><win_no>6</win_no></root>";
 | 
												
													
														
															|  | 
 |  |         Map<String, String> params = new HashMap<>();
 | 
												
													
														
															|  | 
 |  |         params.put("ServerInfo", info_xml);
 | 
												
													
														
															|  | 
 |  |         params.put("RegMsg", reqmsg_xml);
 | 
												
													
														
															|  | 
 |  |         String urlString = "http://172.16.50.40:80/ZyXmyytRequestService/ZyXmyytRequestServiceWs.dll?Handler=ZyXmyytRequestServiceWsService";
 | 
												
													
														
															|  | 
 |  |         String namespace = "zysoft";
 | 
												
													
														
															|  | 
 |  |         re = WebserviceUtil.post(urlString, namespace, action, params);
 | 
												
													
														
															|  | 
 |  |         XMLSerializer xmlSerializer = new XMLSerializer();
 | 
												
													
														
															|  | 
 |  |         JSON json = xmlSerializer.read(re);
 | 
												
													
														
															|  | 
 |  |         Object errorCode = ((net.sf.json.JSONObject) json).get("error_code");
 | 
												
													
														
															|  | 
 |  |         if ("ok".equals(errorCode)) {
 | 
												
													
														
															|  | 
 |  |             JSON json2 = xmlSerializer.read(((net.sf.json.JSONObject) json).get("response").toString());
 | 
												
													
														
															|  | 
 |  |             System.out.println("银医通下载response:" + json2.toString(1));
 | 
												
													
														
															|  | 
 |  |             jsonObject.element("code","success");
 | 
												
													
														
															|  | 
 |  |             jsonObject.element("obj",json);
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             Object errorMsg = ((net.sf.json.JSONObject) json).get("error_msg");
 | 
												
													
														
															|  | 
 |  |             jsonObject.element("code","error");
 | 
												
													
														
															|  | 
 |  |             jsonObject.element("obj","银医通下载失败," +errorMsg);
 | 
												
													
														
															|  | 
 |  |             //{"error_type":"0","error_code":"10002","error_msg":"卡号无效"}
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isEmpty(re)) {
 | 
												
													
														
															|  | 
 |  |             throw new Exception("返回为空!");
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             if (re.startsWith("error")) {
 | 
												
													
														
															|  | 
 |  |                 throw new Exception(re);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return jsonObject;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |