|
@ -3,6 +3,9 @@ package com.yihu.wlyy.service;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.wlyy.util.StringUtil;
|
|
|
import com.yihu.wlyy.util.WebserviceUtil;
|
|
|
import net.sf.json.JSON;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import net.sf.json.xml.XMLSerializer;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@ -51,23 +54,14 @@ public class CAService {
|
|
|
/**
|
|
|
* 银医通下载
|
|
|
**/
|
|
|
public String callYYTServerService() throws Exception {
|
|
|
public String callYYTServerService(String cardNo) throws Exception {
|
|
|
String re = "";
|
|
|
String action = YYT_DOWN;
|
|
|
String info_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
|
|
|
"<root>\n" +
|
|
|
"<ip>172.16.50.40</ip>\n" +
|
|
|
"<port>5516</port>\n" +
|
|
|
"<compress_encode_flag>1</compress_encode_flag>\n" +
|
|
|
"</root>\n";
|
|
|
String reqmsg_xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
|
|
|
"<root><sick_id>DB8687139</sick_id>\n" +
|
|
|
"<cus_card_no>DB8687139</cus_card_no>\n" +
|
|
|
"<req_type>2001</req_type><\n" +
|
|
|
"trade_type>2001</trade_type>\n" +
|
|
|
"<req_oper>8644</req_oper>\n" +
|
|
|
"<req_term>192001019019</req_term>\n" +
|
|
|
"<win_no>6</win_no></root>\n";
|
|
|
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>";
|
|
|
try {
|
|
|
Map<String, String> params = new HashMap<>();
|
|
|
params.put("ServerInfo", info_xml);
|
|
@ -75,6 +69,18 @@ public class CAService {
|
|
|
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= ((JSONObject) json).get("error_code");
|
|
|
if("ok".equals(errorCode)){
|
|
|
JSON json2 = xmlSerializer.read(((JSONObject) json).get("response").toString());
|
|
|
System.out.println("银医通下载response:"+json2.toString(1));
|
|
|
}else {
|
|
|
Object errorMsg=((JSONObject) json).get("error_msg");
|
|
|
//{"error_type":"0","error_code":"10002","error_msg":"卡号无效"}
|
|
|
throw new Exception("银医通下载失败,"+errorMsg);
|
|
|
}
|
|
|
System.out.println("json="+json.toString(1));
|
|
|
if (StringUtil.isEmpty(re)) {
|
|
|
throw new Exception("返回为空!");
|
|
|
} else {
|