|
@ -4,41 +4,36 @@ package com.yihu.jw.hospital.prescription.service;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
|
|
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
|
|
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
|
|
|
|
import com.yihu.jw.entity.hospital.prescription.BaseNatAppointmentDO;
|
|
|
|
import com.yihu.jw.entity.order.BusinessOrderDO;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
|
|
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
|
|
|
|
|
|
import com.yihu.jw.hospital.prescription.dao.BaseNatAppointmentDao;
|
|
|
|
import com.yihu.jw.order.dao.BusinessOrderDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.patient.dao.BasePatientDao;
|
|
import com.yihu.jw.restmodel.hospital.doctor.PersonInfoVO;
|
|
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
import com.yihu.jw.utils.WebserviceUtil;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
|
|
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
|
|
|
|
import com.yihu.utils.date.DateUtil;
|
|
import net.sf.json.xml.XMLSerializer;
|
|
import net.sf.json.xml.XMLSerializer;
|
|
import nu.xom.Builder;
|
|
|
|
import nu.xom.Document;
|
|
|
|
import nu.xom.Element;
|
|
|
|
import nu.xom.Elements;
|
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.http.NameValuePair;
|
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
|
import org.checkerframework.checker.units.qual.A;
|
|
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.StringReader;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Transactional
|
|
@Transactional
|
|
@ -58,6 +53,10 @@ public class TasyNatService {
|
|
private BasePatientWechatDao basePatientWechatDao;
|
|
private BasePatientWechatDao basePatientWechatDao;
|
|
@Autowired
|
|
@Autowired
|
|
private WxTemplateConfigDao wxTemplateConfigDao;
|
|
private WxTemplateConfigDao wxTemplateConfigDao;
|
|
|
|
@Autowired
|
|
|
|
private BaseNatAppointmentDao baseNatAppointmentDao;
|
|
|
|
@Autowired
|
|
|
|
private BusinessOrderDao businessOrderDao;
|
|
|
|
|
|
public String getOperateUrl(){
|
|
public String getOperateUrl(){
|
|
|
|
|
|
@ -66,6 +65,13 @@ public class TasyNatService {
|
|
String url = list.get(0).getDictCode();
|
|
String url = list.get(0).getDictCode();
|
|
return url;
|
|
return url;
|
|
}
|
|
}
|
|
|
|
public String gethsQueryDataWS(){
|
|
|
|
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("hdrQueryDataWSUrl");
|
|
|
|
|
|
|
|
String url = list.get(0).getDictCode();
|
|
|
|
return url;
|
|
|
|
}
|
|
public String getTaszWebServiceInfo(String api, Map<String,String> params, String url)throws Exception{
|
|
public String getTaszWebServiceInfo(String api, Map<String,String> params, String url)throws Exception{
|
|
|
|
|
|
logger.info("url"+url);
|
|
logger.info("url"+url);
|
|
@ -79,6 +85,7 @@ public class TasyNatService {
|
|
return WebserviceUtil.post(url,xzzxNamespace,api,params);
|
|
return WebserviceUtil.post(url,xzzxNamespace,api,params);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 线上注册
|
|
* 线上注册
|
|
* @return
|
|
* @return
|
|
@ -451,17 +458,17 @@ public class TasyNatService {
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
}
|
|
}
|
|
System.out.println(url);
|
|
System.out.println(url);
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
|
|
/*List<NameValuePair> params = new ArrayList<>();
|
|
params.add(new BasicNameValuePair("payType", jsonObject.getString("payType")));
|
|
params.add(new BasicNameValuePair("payType", jsonObject.getString("payType")));
|
|
params.add(new BasicNameValuePair("tradeNo", jsonObject.getString("tradeNo")));
|
|
params.add(new BasicNameValuePair("tradeNo", jsonObject.getString("tradeNo")));
|
|
params.add(new BasicNameValuePair("openId", jsonObject.getString("openId")));
|
|
params.add(new BasicNameValuePair("openId", jsonObject.getString("openId")));
|
|
params.add(new BasicNameValuePair("name", jsonObject.getString("name")));
|
|
params.add(new BasicNameValuePair("name", jsonObject.getString("name")));
|
|
params.add(new BasicNameValuePair("idNo", jsonObject.getString("idNo")));
|
|
params.add(new BasicNameValuePair("idNo", jsonObject.getString("idNo")));
|
|
params.add(new BasicNameValuePair("amount", jsonObject.getString("amount")));
|
|
|
|
System.out.println(params.toString());
|
|
|
|
String response = httpClientUtil.post(url,params ,"UTF-8");
|
|
|
|
|
|
params.add(new BasicNameValuePair("amount", jsonObject.getString("amount")));*/
|
|
|
|
System.out.println(jsonObject.toString());
|
|
|
|
String response = httpClientUtil.postBody(url,jsonObject);
|
|
System.out.println("res"+response);
|
|
System.out.println("res"+response);
|
|
saveHttpLog("placeOrder",params.toString(),response,url);
|
|
|
|
|
|
saveHttpLog("placeOrder",jsonObject.toString(),response,url);
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
|
|
|
|
@ -472,12 +479,9 @@ public class TasyNatService {
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
}
|
|
}
|
|
System.out.println(url);
|
|
System.out.println(url);
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("orderNo", jsonObject.getString("orderNo")));
|
|
|
|
System.out.println(params.toString());
|
|
|
|
String response = httpClientUtil.post(url,params ,"UTF-8");
|
|
|
|
|
|
String response = httpClientUtil.postBody(url,jsonObject);
|
|
System.out.println("res"+response);
|
|
System.out.println("res"+response);
|
|
saveHttpLog("orderStatus",params.toString(),response,url);
|
|
|
|
|
|
saveHttpLog("orderStatus",jsonObject.toString(),response,url);
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
|
|
|
|
@ -488,22 +492,16 @@ public class TasyNatService {
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
}
|
|
}
|
|
System.out.println(url);
|
|
System.out.println(url);
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("tempateId", jsonObject.getString("tempateId")));
|
|
|
|
params.add(new BasicNameValuePair("url", jsonObject.getString("url")));
|
|
|
|
params.add(new BasicNameValuePair("openId", jsonObject.getString("openId")));
|
|
|
|
params.add(new BasicNameValuePair("data", jsonObject.getJSONObject("data").toString()));
|
|
|
|
System.out.println(params.toString());
|
|
|
|
String response = httpClientUtil.post(url,params ,"UTF-8");
|
|
|
|
|
|
String response = httpClientUtil.postBody(url,jsonObject);
|
|
System.out.println("res"+response);
|
|
System.out.println("res"+response);
|
|
saveHttpLog("tmpPush",params.toString(),response,url);
|
|
|
|
|
|
saveHttpLog("tmpPush",jsonObject.toString(),response,url);
|
|
return response;
|
|
return response;
|
|
}
|
|
}
|
|
public void saveHttpLog(String name,String req,String res,String code){
|
|
public void saveHttpLog(String name,String req,String res,String code){
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
|
|
wlyyHttpLogDO.setRequest(req);
|
|
wlyyHttpLogDO.setRequest(req);
|
|
wlyyHttpLogDO.setName(name);
|
|
wlyyHttpLogDO.setName(name);
|
|
wlyyHttpLogDO.setCode(code);
|
|
|
|
|
|
//wlyyHttpLogDO.setCode(code);
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
wlyyHttpLogDO.setCreateTime(new Date());
|
|
wlyyHttpLogDO.setResponse(res);
|
|
wlyyHttpLogDO.setResponse(res);
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
wlyyHttpLogDao.save(wlyyHttpLogDO);
|
|
@ -513,13 +511,19 @@ public class TasyNatService {
|
|
String url="";
|
|
String url="";
|
|
String openId="";
|
|
String openId="";
|
|
JSONObject key=new JSONObject();
|
|
JSONObject key=new JSONObject();
|
|
|
|
JSONObject first=new JSONObject();
|
|
JSONObject key1=new JSONObject();
|
|
JSONObject key1=new JSONObject();
|
|
JSONObject key2=new JSONObject();
|
|
JSONObject key2=new JSONObject();
|
|
|
|
JSONObject key3=new JSONObject();
|
|
|
|
JSONObject key4=new JSONObject();
|
|
|
|
JSONObject key5=new JSONObject();
|
|
|
|
JSONObject remark=new JSONObject();
|
|
|
|
BaseNatAppointmentDO baseNatAppointmentD0 = baseNatAppointmentDao.findOne(Integer.valueOf(relationCode));
|
|
List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId("xm_tasy_wx",patient);
|
|
List<BasePatientWechatDo> basePatientWechatDo = basePatientWechatDao.findByWechatIdAndPatientId("xm_tasy_wx",patient);
|
|
if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
|
|
if (basePatientWechatDo!=null&&basePatientWechatDo.size()>0){
|
|
openId=basePatientWechatDo.get(0).getOpenid();
|
|
openId=basePatientWechatDo.get(0).getOpenid();
|
|
}
|
|
}
|
|
if ("hszfcg".equalsIgnoreCase(scene)){
|
|
|
|
|
|
if ("hszfcgtx".equalsIgnoreCase(scene)){
|
|
//开始发送模板消息
|
|
//开始发送模板消息
|
|
logger.info("开始发送模板消息");
|
|
logger.info("开始发送模板消息");
|
|
List<WxTemplateConfigDO> wxTemplateConfigDO = wxTemplateConfigDao.findByWechatIdAndScene("xm_tasy_wx",scene);
|
|
List<WxTemplateConfigDO> wxTemplateConfigDO = wxTemplateConfigDao.findByWechatIdAndScene("xm_tasy_wx",scene);
|
|
@ -528,16 +532,31 @@ public class TasyNatService {
|
|
wxTemplateConfigDO1 = wxTemplateConfigDO.get(0);
|
|
wxTemplateConfigDO1 = wxTemplateConfigDO.get(0);
|
|
}
|
|
}
|
|
url=wxTemplateConfigDO1.getUrl()+relationCode;
|
|
url=wxTemplateConfigDO1.getUrl()+relationCode;
|
|
key1.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
|
|
|
|
|
|
first.put("value",wxTemplateConfigDO1.getFirst());
|
|
|
|
first.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key1.put("value",baseNatAppointmentD0.getDoctorName());
|
|
key1.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
key1.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
key2.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
|
|
|
|
|
|
key2.put("value",baseNatAppointmentD0.getChargeAmount());
|
|
key2.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
key2.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key3.put("value",wxTemplateConfigDO1.getKeyword3());
|
|
|
|
key3.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key4.put("value",baseNatAppointmentD0.getDoctorName());
|
|
|
|
key4.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key5.put("value",baseNatAppointmentD0.getVoucherNo());
|
|
|
|
key5.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
remark.put("value",wxTemplateConfigDO1.getRemark());
|
|
|
|
remark.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key.put("first",first);
|
|
key.put("keyword1",key1);
|
|
key.put("keyword1",key1);
|
|
key.put("keyword2",key2);
|
|
key.put("keyword2",key2);
|
|
|
|
key.put("keyword3",key3);
|
|
|
|
key.put("keyword4",key4);
|
|
|
|
key.put("keyword5",key5);
|
|
|
|
key.put("remark",remark);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("tempateId",wxTemplateConfigDO1.getTemplateId());//
|
|
|
|
|
|
jsonObject.put("template_id",wxTemplateConfigDO1.getTemplateId());//
|
|
jsonObject.put("data",key);
|
|
jsonObject.put("data",key);
|
|
jsonObject.put("openId",openId);
|
|
|
|
|
|
jsonObject.put("touser",openId);
|
|
jsonObject.put("url",url);
|
|
jsonObject.put("url",url);
|
|
logger.info("核酸检测支付成功模板消息推送param"+jsonObject.toString());
|
|
logger.info("核酸检测支付成功模板消息推送param"+jsonObject.toString());
|
|
String tmResilt= tmpPush(jsonObject);
|
|
String tmResilt= tmpPush(jsonObject);
|
|
@ -551,29 +570,353 @@ public class TasyNatService {
|
|
wxTemplateConfigDO1 = wxTemplateConfigDO.get(0);
|
|
wxTemplateConfigDO1 = wxTemplateConfigDO.get(0);
|
|
}
|
|
}
|
|
url=wxTemplateConfigDO1.getUrl()+relationCode;
|
|
url=wxTemplateConfigDO1.getUrl()+relationCode;
|
|
key1.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
|
|
|
|
|
|
first.put("value",wxTemplateConfigDO1.getFirst());
|
|
|
|
first.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key1.put("value",name);
|
|
key1.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
key1.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
key2.put("value",wxTemplateConfigDO1.getKeyword1().replace("key1",name));
|
|
|
|
|
|
key2.put("value",baseNatAppointmentD0.getDeptName());
|
|
key2.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
key2.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key3.put("value",wxTemplateConfigDO1.getKeyword3());
|
|
|
|
key3.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key4.put("value",baseNatAppointmentD0.getDoctorName());
|
|
|
|
key4.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key5.put("value", DateUtil.formatDate(baseNatAppointmentD0.getCreateTime(),"yyyy-MM-dd hh:mm:ss"));
|
|
|
|
key5.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
remark.put("value",wxTemplateConfigDO1.getRemark());
|
|
|
|
remark.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key.put("first",first);
|
|
key.put("keyword1",key1);
|
|
key.put("keyword1",key1);
|
|
key.put("keyword2",key2);
|
|
key.put("keyword2",key2);
|
|
|
|
key.put("keyword3",key3);
|
|
|
|
key.put("keyword4",key4);
|
|
|
|
key.put("keyword5",key5);
|
|
|
|
key.put("remark",remark);
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
jsonObject.put("tempateId",wxTemplateConfigDO1.getTemplateId());//
|
|
|
|
|
|
jsonObject.put("template_id",wxTemplateConfigDO1.getTemplateId());//
|
|
jsonObject.put("data",key);
|
|
jsonObject.put("data",key);
|
|
jsonObject.put("openId",openId);
|
|
|
|
|
|
jsonObject.put("touser",openId);
|
|
jsonObject.put("url",url);
|
|
jsonObject.put("url",url);
|
|
logger.info("核酸检测支付提醒模板消息推送param"+jsonObject.toString());
|
|
logger.info("核酸检测支付提醒模板消息推送param"+jsonObject.toString());
|
|
String tmResilt= tmpPush(jsonObject);
|
|
String tmResilt= tmpPush(jsonObject);
|
|
return tmResilt;
|
|
return tmResilt;
|
|
|
|
} else if ("hsyycg".equalsIgnoreCase(scene)) {
|
|
|
|
//开始发送模板消息
|
|
|
|
logger.info("开始发送模板消息");
|
|
|
|
List<WxTemplateConfigDO> wxTemplateConfigDO = wxTemplateConfigDao.findByWechatIdAndScene("xm_tasy_wx",scene);
|
|
|
|
WxTemplateConfigDO wxTemplateConfigDO1 = new WxTemplateConfigDO();
|
|
|
|
if (wxTemplateConfigDO!=null&&wxTemplateConfigDO.size()>0){
|
|
|
|
wxTemplateConfigDO1 = wxTemplateConfigDO.get(0);
|
|
|
|
}
|
|
|
|
url=wxTemplateConfigDO1.getUrl()+relationCode;
|
|
|
|
first.put("value",wxTemplateConfigDO1.getFirst().replace("key1",name));
|
|
|
|
first.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key1.put("value",name);
|
|
|
|
key1.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key2.put("value",baseNatAppointmentD0.getInspectionName());
|
|
|
|
key2.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key3.put("value",DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"));
|
|
|
|
key3.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key4.put("value",wxTemplateConfigDO1.getKeyword4());
|
|
|
|
key4.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
remark.put("value",wxTemplateConfigDO1.getRemark());
|
|
|
|
remark.put("color",wxTemplateConfigDO1.getKeyword6());
|
|
|
|
key.put("first",first);
|
|
|
|
key.put("keyword1",key1);
|
|
|
|
key.put("keyword2",key2);
|
|
|
|
key.put("keyword3",key3);
|
|
|
|
key.put("keyword4",key4);
|
|
|
|
key.put("remark",remark);
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
jsonObject.put("template_id",wxTemplateConfigDO1.getTemplateId());//
|
|
|
|
jsonObject.put("data",key);
|
|
|
|
jsonObject.put("touser",openId);
|
|
|
|
jsonObject.put("url",url);
|
|
|
|
logger.info("核酸检测预约成功模板消息推送param"+jsonObject.toString());
|
|
|
|
String tmResilt= tmpPush(jsonObject);
|
|
|
|
return tmResilt;
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
|
|
//查询排班部门
|
|
|
|
public String departMent(String ApplyType){
|
|
|
|
String url = "";
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("DepartMentUrl");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
url+="?ApplyType="+ApplyType;
|
|
|
|
System.out.println(url);
|
|
|
|
String response = httpClientUtil.get(url,"UTF-8");
|
|
|
|
System.out.println("res"+response);
|
|
|
|
saveHttpLog("departMent",ApplyType,response,url);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
//保存预约
|
|
|
|
public String saveRegOrder(String DepartId,String OrderDate,String OrderTime,String OrderID,String HisID,String Tel,
|
|
|
|
String HisName,String ApplyType){
|
|
|
|
String url = "";
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("saveNatOrderUrl");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
url+="?DepartId="+DepartId+"&OrderDate="+OrderDate+"&OrderTime="+OrderTime+"&OrderID="+OrderID
|
|
|
|
+"&HisID="+HisID+"&Tel="+Tel+"&HisName="+HisName+"&ApplyType="+ApplyType;
|
|
|
|
System.out.println(url);
|
|
|
|
String response = httpClientUtil.get(url,"UTF-8");
|
|
|
|
System.out.println("res"+response);
|
|
|
|
saveHttpLog("saveRegOrder",url,response,url);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
//取消预约
|
|
|
|
public String cancleOrder(String HisID,String HisSeqNo,String OrderNumber) throws Exception{
|
|
|
|
String url = "";
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("CancleOrderUrl");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
url+="?HisID="+HisID+"&HisSeqNo="+HisSeqNo+"&OrderNumber="+OrderNumber;
|
|
|
|
System.out.println(url);
|
|
|
|
|
|
|
|
String response = httpClientUtil.get(url,"UTF-8");
|
|
|
|
System.out.println("res"+response);
|
|
|
|
saveHttpLog("cancleOrder",url,response,url);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
//查询排班医生
|
|
|
|
public String GetDoctorWorkDate(String ApplyType,String DepartId){
|
|
|
|
String url = "";
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetDoctorWorkDateUrl");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
url+="?ApplyType="+ApplyType+"&DepartId="+DepartId;
|
|
|
|
System.out.println(url);
|
|
|
|
String response = httpClientUtil.get(url,"UTF-8");
|
|
|
|
System.out.println("res"+response);
|
|
|
|
saveHttpLog("departMent",url,response,url);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
//预约查询
|
|
|
|
public String GetOrderInfo(String HisID,String ApplyType){
|
|
|
|
String url = "";
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetOrderInfoUrl");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
url+="?ApplyType="+ApplyType+"&HisID="+HisID;
|
|
|
|
System.out.println(url);
|
|
|
|
String response = httpClientUtil.get(url,"UTF-8");
|
|
|
|
System.out.println("res"+response);
|
|
|
|
saveHttpLog("departMent",url,response,url);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
//获取号源
|
|
|
|
public String GetOrderSource(String DepartId,String DoctorId,String QueryDate,String ApplyType,String IsAll,String QueryTime){
|
|
|
|
String url = "";
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("GetOrderSourceUrl");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
url=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
url+="?DepartId="+DepartId+"&DoctorId="+DoctorId+"&QueryDate="+QueryDate+"&ApplyType="+ApplyType+"&IsAll="+IsAll+"&QueryTime="+QueryTime;
|
|
|
|
System.out.println(url);
|
|
|
|
String response = httpClientUtil.get(url,"UTF-8");
|
|
|
|
System.out.println("res"+response);
|
|
|
|
saveHttpLog("GetOrderInfo",url,response,url);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
//查询患者就诊卡
|
|
|
|
public String findHisPatientCard(String idcard) throws Exception{
|
|
|
|
String api = "QuerySickInfo";
|
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
|
"<root> " +
|
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
|
" <format>xml</format>" +
|
|
|
|
" <callOperator>"+operator+"</callOperator> " +
|
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
|
"</root>";
|
|
|
|
String condition ="";
|
|
|
|
if (StringUtils.isNoneBlank(idcard)){
|
|
|
|
condition += "<IdNo>"+idcard+"</IdNo>";
|
|
|
|
condition += "<IdType>100</IdType>";
|
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception{
|
|
|
|
String xml="<StringResponse><StringValue><![CDATA[<?xml version=\"1.0\" encoding=\"utf-8\"?><root><ReturnCode>1</ReturnCode><hisTradeNo>599907010</hisTradeNo><ReturnMsg></ReturnMsg></root>]]></StringValue></StringResponse>";
|
|
|
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
|
params.put("msgBody",msgBody);
|
|
|
|
logger.info("QuerySickInfo params:"+params.toString());
|
|
|
|
String xml = getTaszWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
xml=xml.substring(xml.indexOf("<root>"),xml.lastIndexOf("]]"));
|
|
xml=xml.substring(xml.indexOf("<root>"),xml.lastIndexOf("]]"));
|
|
System.out.println(xml);
|
|
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
|
logger.info("QuerySickInfo json:"+json);
|
|
|
|
return json;
|
|
|
|
}
|
|
|
|
public JSONArray findPatientCard(String patient) throws Exception{
|
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(patient);
|
|
|
|
String idcard="";
|
|
|
|
if (basePatientDO!=null){
|
|
|
|
idcard=basePatientDO.getIdcard();
|
|
|
|
}
|
|
|
|
String res = findHisPatientCard(idcard);
|
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
|
if (StringUtils.isNoneBlank(res)){
|
|
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
|
|
jsonArray.add(jsonObject);
|
|
|
|
return jsonArray;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
//病人单据状态查询
|
|
|
|
public String QueryApplyInfo(String nullahNumber) throws Exception{
|
|
|
|
String api = "QueryApplyInfo";
|
|
|
|
String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
|
"<root> " +
|
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
|
" <format>xml</format>" +
|
|
|
|
" <callOperator>"+operator+"</callOperator> " +
|
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
|
"</root>";
|
|
|
|
String condition ="";
|
|
|
|
if (StringUtils.isNoneBlank(nullahNumber)){
|
|
|
|
condition += "<NullahNumber>"+nullahNumber+"</NullahNumber>";
|
|
|
|
}
|
|
|
|
|
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
|
|
|
|
"<root>"+condition+"</root>";
|
|
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
|
params.put("msgHeader",msgHeader);
|
|
|
|
params.put("msgBody",msgBody);
|
|
|
|
logger.info("QueryApplyInfo params:"+params.toString());
|
|
|
|
String xml = getTaszWebServiceInfo("CallInterface",params,getOperateUrl());
|
|
|
|
xml=xml.substring(xml.indexOf("<root>"),xml.lastIndexOf("]]"));
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
|
logger.info("QueryApplyInfo json:"+json);
|
|
|
|
return json;
|
|
|
|
}
|
|
|
|
public void savePayStatusByHis(String patientId) throws Exception {
|
|
|
|
List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
|
|
|
|
for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
|
|
|
|
String res = QueryApplyInfo(baseNatAppointmentDO.getRealOrder());
|
|
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
|
|
if (jsonObject!=null){
|
|
|
|
if (jsonObject.getString("ReturnCode").equalsIgnoreCase("1")){
|
|
|
|
String voucherNo = jsonObject.getString("ApplyNo");
|
|
|
|
baseNatAppointmentDO.setVoucherNo(voucherNo);
|
|
|
|
if ("已扣费".equalsIgnoreCase(jsonObject.getString("Status"))){
|
|
|
|
baseNatAppointmentDO.setPayStatus("1");
|
|
|
|
}
|
|
|
|
baseNatAppointmentDao.save(baseNatAppointmentDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public String selectByRelationCode(String relationCode) throws Exception{
|
|
|
|
BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
|
|
|
|
if (NumberUtils.isDigits(relationCode) ){
|
|
|
|
BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.valueOf(relationCode));
|
|
|
|
if (baseNatAppointmentDO!=null&&"-1".equalsIgnoreCase(baseNatAppointmentDO.getIsSuccess())){
|
|
|
|
throw new Exception("订单已取消");
|
|
|
|
}
|
|
|
|
if (businessOrderDO!=null&&businessOrderDO.getStatus()==1){
|
|
|
|
throw new Exception("订单已支付");
|
|
|
|
}
|
|
|
|
String openId="";
|
|
|
|
List<BasePatientWechatDo> wechatList=basePatientWechatDao.findByWechatIdAndPatientId("xm_tasy_wx",baseNatAppointmentDO.getConsumer());
|
|
|
|
if (wechatList!=null&&wechatList.size()>0){
|
|
|
|
openId=wechatList.get(0).getOpenid();
|
|
|
|
}
|
|
|
|
businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
|
|
|
|
com.alibaba.fastjson.JSONObject orderObj= new com.alibaba.fastjson.JSONObject();
|
|
|
|
orderObj.put("payType",1);
|
|
|
|
orderObj.put("tradeNo",businessOrderDO.getOrderNo());
|
|
|
|
orderObj.put("openId",openId);
|
|
|
|
orderObj.put("name",baseNatAppointmentDO.getName());
|
|
|
|
orderObj.put("idNo",baseNatAppointmentDO.getCardNo());
|
|
|
|
BigDecimal b = new BigDecimal(baseNatAppointmentDO.getChargeAmount());
|
|
|
|
b=b.setScale(2, BigDecimal.ROUND_DOWN);
|
|
|
|
System.out.println("amount"+b);
|
|
|
|
orderObj.put("amount",b);
|
|
|
|
//重新下单
|
|
|
|
String orderRes=placeOrder(orderObj);
|
|
|
|
if (StringUtils.isNoneBlank(orderRes)){
|
|
|
|
com.alibaba.fastjson.JSONObject jsonObject= JSON.parseObject(orderRes);
|
|
|
|
if (jsonObject!=null){
|
|
|
|
if("0".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
|
com.alibaba.fastjson.JSONObject dataObj= com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("data"));
|
|
|
|
businessOrderDO.setTraceNo(dataObj.getString("orderNo"));
|
|
|
|
businessOrderDO.setRematk(dataObj.toJSONString());
|
|
|
|
businessOrderDO=businessOrderDao.save(businessOrderDO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return businessOrderDO.getRematk();
|
|
|
|
}
|
|
|
|
public String getNatResult(String patientId) throws Exception{
|
|
|
|
BasePatientDO basePatientDO = basePatientDao.findById(patientId);
|
|
|
|
Calendar c = Calendar.getInstance();
|
|
|
|
c.add(Calendar.MONTH, -6);
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
String dateStr = sdf.format(c.getTime());
|
|
|
|
String idcard="";
|
|
|
|
String hospitalOid="";
|
|
|
|
String wsCode="";
|
|
|
|
if (basePatientDO!=null){
|
|
|
|
idcard=basePatientDO.getIdcard();
|
|
|
|
}
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("hdrQueryDataParam");
|
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:list){
|
|
|
|
if ("hospitalOid".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
|
hospitalOid=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
if ("wsCode".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
|
wsCode=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String res=hdrQueryDataWS(idcard,wsCode,hospitalOid,dateStr);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//病人单据状态查询
|
|
|
|
public String hdrQueryDataWS(String idcard,String wsCode,String oid,String time) throws Exception{
|
|
|
|
/*String api = "hdrQueryDataWS";*/
|
|
|
|
/*String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
|
|
|
|
"<root> " +
|
|
|
|
" <serverName>"+api+"</serverName> " +
|
|
|
|
" <format>xml</format>" +
|
|
|
|
" <callOperator>"+operator+"</callOperator> " +
|
|
|
|
" <certificate>"+key+"</certificate> " +
|
|
|
|
"</root>";*/
|
|
|
|
String msg="<HOSPITAL_OID>"+oid+"</HOSPITAL_OID>";
|
|
|
|
if (StringUtils.isNoneBlank()){
|
|
|
|
msg+="<ID_CARD>"+idcard+"</ID_CARD>";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNoneBlank(wsCode)){
|
|
|
|
msg+="<WS_CODE>"+wsCode+"</WS_CODE>";
|
|
|
|
}
|
|
|
|
String condition ="";
|
|
|
|
if (StringUtils.isNoneBlank(time)){
|
|
|
|
condition+="<CONDITION><ELEM NAME=\"LAB_ITEM_NAME\" VALUE=\"核酸\" OPERATOR=\"like\"></ELEM>" +
|
|
|
|
"<ELEM NAME=\"REPORT_TIME\" VALUE=\""+time+"\" OPERATOR=\">=\"></ELEM></CONDITION>";
|
|
|
|
}
|
|
|
|
|
|
|
|
String msgBody ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
|
|
|
"<MSG>"+msg+condition+"</MSG>";
|
|
|
|
|
|
|
|
Map<String,String> params = new HashedMap();
|
|
|
|
params.put("msg",msgBody);
|
|
|
|
logger.info("hdrQueryDataWS params:"+params.toString());
|
|
|
|
String xml = getTaszWebServiceInfo("hdrQueryDataWS",params,gethsQueryDataWS());
|
|
|
|
xml=xml.substring(xml.indexOf("<ArrayList>"),xml.lastIndexOf("]]"));
|
|
|
|
XMLSerializer xmlSerializer = new XMLSerializer();
|
|
|
|
String json = xmlSerializer.read(xml).toString();
|
|
|
|
logger.info("hdrQueryDataWS json:"+json);
|
|
|
|
return json;
|
|
}
|
|
}
|
|
}
|
|
}
|