|
@ -1,13 +1,18 @@
|
|
|
package com.yihu.wlyy.service.service.guahao;
|
|
|
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.wlyy.service.common.http.HttpApiException;
|
|
|
import com.yihu.wlyy.service.common.util.DateUtil;
|
|
|
import com.yihu.wlyy.service.common.util.SOAPUtil;
|
|
|
import com.yihu.wlyy.service.common.util.StringUtil;
|
|
|
import com.yihu.wlyy.service.dao.*;
|
|
|
import com.yihu.wlyy.service.entity.Patient;
|
|
|
import com.yihu.wlyy.service.entity.PatientReservation;
|
|
|
import com.yihu.wlyy.service.entity.SignFamily;
|
|
|
import com.yihu.wlyy.service.service.LogService;
|
|
|
import com.yihu.wlyy.service.service.ZysoftApi;
|
|
|
import com.zoe.phip.ssp.sdk.ApiException;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.dom4j.Document;
|
|
|
import org.dom4j.DocumentHelper;
|
|
@ -15,8 +20,11 @@ import org.dom4j.Element;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.PrintWriter;
|
|
|
import java.io.StringWriter;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@ -58,6 +66,9 @@ public class GuahaoService {
|
|
|
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
@Value("${zyapi.openCrypto}")
|
|
|
private Boolean openCrypto;
|
|
|
|
|
|
/**
|
|
|
* 解析挂号后
|
|
@ -1138,6 +1149,75 @@ public class GuahaoService {
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* =============================计免预约挂号相关接口==========================================START
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
* 获取儿童信息
|
|
|
* @param credential 条形编码
|
|
|
* @param orgCode
|
|
|
* @param regCode
|
|
|
* @return
|
|
|
*/
|
|
|
public String GetChildrenInfo(String credential)throws Exception {
|
|
|
String result = "";
|
|
|
|
|
|
Map<String,String> params = new HashMap<>();
|
|
|
params.put("Credential", credential);
|
|
|
|
|
|
return immPostSecond("GetChildrenInfo","计免预约-获取儿童信息",params);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 计免预约Post接口
|
|
|
*/
|
|
|
private String immPostSecond(String api,String content, Map<String,String> params) throws Exception
|
|
|
{
|
|
|
String re = "";
|
|
|
|
|
|
//新增日志
|
|
|
String method = "POST";
|
|
|
Boolean isSuccess = true;
|
|
|
String error = "";
|
|
|
|
|
|
int times = 0;
|
|
|
try {
|
|
|
re = ZysoftApi.getSingleton().post("imm/"+api, params, null,openCrypto);
|
|
|
|
|
|
Map<String,String> map = objectMapper.readValue(re,Map.class);
|
|
|
String code = map.get("CODE");
|
|
|
|
|
|
if(!code.equals("1"))
|
|
|
{
|
|
|
throw new HttpApiException(Integer.valueOf(code),map.get("MESSAGE"));
|
|
|
}
|
|
|
|
|
|
//保存http日志
|
|
|
logService.saveHttpLog(isSuccess,api,content,method,api, net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
StringWriter sw = new StringWriter();
|
|
|
PrintWriter pw = new PrintWriter(sw);
|
|
|
ex.printStackTrace(pw);
|
|
|
error = sw.toString();
|
|
|
isSuccess = false;
|
|
|
|
|
|
//保存http日志
|
|
|
logService.saveHttpLog(isSuccess,api,content,method,api,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
|
|
|
|
|
|
if(ex instanceof ApiException)
|
|
|
{
|
|
|
ApiException apiEx = (ApiException) ex;
|
|
|
throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
|
|
|
}
|
|
|
else{
|
|
|
throw new HttpApiException(-1,ex.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return re;
|
|
|
}
|
|
|
}
|