|
@ -3,6 +3,7 @@ package com.yihu.jw.internet.service;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.internet.dao.HospitalImgDao;
|
|
|
import com.yihu.jw.internet.dao.IntUpErrorLogDao;
|
|
|
import com.yihu.jw.internet.dao.InternetUpLogDao;
|
|
@ -13,11 +14,9 @@ import com.yihu.jw.internet.wsapi.Wsapi;
|
|
|
import com.yihu.jw.internet.wsapi.WsapiProxy;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.ImageConvertUtil;
|
|
|
import com.yihu.jw.utils.JSONUtils;
|
|
|
import com.yihu.jw.utils.encode.AESUtils;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -31,7 +30,6 @@ import java.io.DataInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.net.URL;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@ -54,12 +52,15 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
@Autowired
|
|
|
private HospitalImgDao hospitalImgDao;
|
|
|
|
|
|
@Autowired
|
|
|
private WlyyHospitalSysDictDao dictDao;
|
|
|
|
|
|
static String userName = "xmzsyy";
|
|
|
static String psw = "7j7s9e";
|
|
|
static String appId = "ws007";
|
|
|
static String AesEncodeKey = "98sfkf53sf19609j";
|
|
|
// static String urlString = "http://10.120.102.202:18081/micc/wsapi/1.0?wsdl"; // 正式线路径
|
|
|
static String urlString = "http://fjhlw.bsoft.com.cn:18081/micc/wsapi/1.0?wsdl"; // 测试线路径
|
|
|
static String urlString = "http://10.120.102.202:18081/micc/wsapi/1.0?wsdl"; // 正式线路径
|
|
|
// static String urlString = "http://fjhlw.bsoft.com.cn:18081/micc/wsapi/1.0?wsdl"; // 测试线路径
|
|
|
static String method = "execute";
|
|
|
static String token = "";
|
|
|
static String orgCode = "123502004266006872";
|
|
@ -70,13 +71,21 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
public ObjectMapper objectMapper;
|
|
|
|
|
|
/**
|
|
|
* 监管平台上传地址
|
|
|
* @return
|
|
|
*/
|
|
|
public String getUrl(){
|
|
|
return dictDao.findByDictName("dataUpload").get(0).getDictCode();
|
|
|
}
|
|
|
|
|
|
// 0 调用省监管平台接口
|
|
|
public String postToInter(String token, String api, JSONArray params) throws Exception {
|
|
|
public String postToInter(String token, String api, JSONArray params,String url) throws Exception {
|
|
|
WsapiProxy proxy = new WsapiProxy();
|
|
|
proxy.setEndpoint(urlString);
|
|
|
proxy.setEndpoint(url);
|
|
|
Wsapi wsapi = proxy.getWsapi();
|
|
|
|
|
|
logger.info(JSONUtils.toString(new String[] {token, params.toString()}));
|
|
|
//logger.info(JSONUtils.toString(new String[] {token, params.toString()}));
|
|
|
|
|
|
String encryptParams = AESUtils.encrypt(JSONUtils.toString(new String[] {token, params.toString()}), AesEncodeKey);
|
|
|
String result = wsapi.invoke(appId, "", api, method, encryptParams);
|
|
@ -88,9 +97,9 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
}
|
|
|
|
|
|
// 1 接口用户信息,获取TOKEN值 micc.upNsUserToken --- 完成
|
|
|
public String upNsUserToken() throws Exception {
|
|
|
public String upNsUserToken(String url) throws Exception {
|
|
|
WsapiProxy proxy = new WsapiProxy();
|
|
|
proxy.setEndpoint(urlString);
|
|
|
proxy.setEndpoint(url);
|
|
|
Wsapi wsapi = proxy.getWsapi();
|
|
|
|
|
|
String api = "micc.upNsUserToken";
|
|
@ -112,6 +121,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 2 医院基本信息 micc.upNsOrganBas --- 完成
|
|
|
public String upNsOrganBas() throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upNsOrganBase";
|
|
|
|
|
|
JSONObject jb = new JSONObject();
|
|
@ -255,14 +265,15 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
|
|
|
String token = upNsUserToken();
|
|
|
String res = postToInter(token, api, jsonArray);
|
|
|
String token = upNsUserToken(url);
|
|
|
String res = postToInter(token, api, jsonArray,url);
|
|
|
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
// 3 医师基本信息 micc.upNsDoctorRecord --- 完成
|
|
|
public String upNsDoctorRecord(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upNsDoctorRecord";
|
|
|
String upid = getCode();
|
|
|
String res = "";
|
|
@ -270,7 +281,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
int success = 0;
|
|
|
int error = 0;
|
|
|
int dataError = 0;
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
|
|
|
// 因为要上传的是医师信息,所以针对到注册用户且无部门信息的用户数据不上传
|
|
|
String sql = "select a.id,a.name,a.idcard,a.sex,a.birthday, a.cert_no, a.prac_no\n" +
|
|
@ -345,7 +356,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
//上传监管平台
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token, api, jsonArray);
|
|
|
res = postToInter(token, api, jsonArray,url);
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
|
success++;
|
|
@ -363,6 +374,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 4 获取监管平台医师唯一标识 micc.achNsDoctorRecord --- 完成
|
|
|
public String achNsDoctorRecord(String idCardNo) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.achNsDoctorRecord";
|
|
|
JSONObject jb = new JSONObject();
|
|
|
jb.put("organ_code", orgCode);
|
|
@ -371,8 +383,8 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
String token = upNsUserToken();
|
|
|
String res = postToInter(token, api, jsonArray);
|
|
|
String token = upNsUserToken(url);
|
|
|
String res = postToInter(token, api, jsonArray,url);
|
|
|
JSONObject rs = (JSONObject) JSONObject.parse(res);
|
|
|
String msg = rs.getString("msg");
|
|
|
if("200".equals(msg)){
|
|
@ -385,6 +397,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 5 网上预约挂号 micc.upAppointmentOnline --- 完成
|
|
|
public String upAppointmentOnline(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upAppointmentOnline";
|
|
|
String upid = getCode();
|
|
|
String res = "";
|
|
@ -393,7 +406,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
int dataError = 0;
|
|
|
int error = 0;
|
|
|
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
|
|
|
String sql = "SELECT p.id,p.register_no, p.status, p.dept, p.dept_name,patient.name as paName,d.name as docName\n" +
|
|
|
" , patient.sex, patient.idcard, patient.mobile, dic.req_fee,reg.date\n" +
|
|
@ -451,7 +464,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
@ -470,9 +483,10 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 6 在线医技预约 micc.upMedicalOnline --- 完成
|
|
|
public String upMedicalOnline(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upMedicalOnline";
|
|
|
String upid = getCode();
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
String res = "";
|
|
|
int total = 0;
|
|
|
int success = 0;
|
|
@ -540,7 +554,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
@ -562,6 +576,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 7 医生评价信息 micc.upNsDoctorScore --- 完成
|
|
|
public String upNsDoctorScore(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upNsDoctorScore";
|
|
|
String upid = getCode();
|
|
|
String res = "";
|
|
@ -570,7 +585,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
int error = 0;
|
|
|
int dataError = 0;
|
|
|
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
|
|
|
String sql = "select a.id, c.name,a.score,a.patient_name,a.create_time,content_table.content,c.idcard as docIdCard, d.dept_code, d.dept_name\n" +
|
|
|
" from base_evaluate_score a \n" +
|
|
@ -633,7 +648,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
|
success++;
|
|
@ -651,9 +666,10 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 8 网络咨询服务信息 micc.upNsOnlineAsk --- 完成
|
|
|
public String upNsOnlineAsk(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upNsOnlineAsk";
|
|
|
String upid = getCode();
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
String res = "";
|
|
|
int total = 0;
|
|
|
int success = 0;
|
|
@ -736,7 +752,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
String str = jb.toJSONString();
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
@ -755,6 +771,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 9 网络诊疗服务信息 micc.upNsOnlineMed ---
|
|
|
public String upNsOnlineMed(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upNsOnlineMed";
|
|
|
String upid = getCode();
|
|
|
String res = "";
|
|
@ -763,7 +780,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
int error = 0;
|
|
|
int dataError = 0;
|
|
|
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
|
|
|
String sql = "select a.id,a.register_no, a.type, b.id as docId, a.doctor_name, b.idcard as docIdCard\n" +
|
|
|
" , a.dept, a.dept_name, c.name as paName, c.idcard as paId, c.sex,c.mobile,a.create_time,b.charge_type\n" +
|
|
@ -859,7 +876,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
@ -879,6 +896,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 10 电子处方表 micc.upPrescription --- 完成
|
|
|
public String upPrescription(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upPrescription";
|
|
|
String upid =getCode();
|
|
|
String res = "";
|
|
@ -887,7 +905,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
int error = 0;
|
|
|
int dataError = 0;
|
|
|
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
|
|
|
String sql = "select a.id,a.real_order,a.patient_code,a.outpatient_id,a.patient_name\n" +
|
|
|
" ,b.sex,b.birthday" +
|
|
@ -980,7 +998,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
@ -999,9 +1017,10 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 11 电子处方_药品明细表 micc.upPrescriptionDrug --- 完成
|
|
|
public String upPrescriptionDrug(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upPrescriptionDrug";
|
|
|
String upid = getCode();
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
String res = "";
|
|
|
int total = 0;
|
|
|
int success = 0;
|
|
@ -1063,7 +1082,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
@ -1081,9 +1100,10 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
// 12.在线诊疗服务信息-过程图片上传 --- 完成
|
|
|
public String upNsOnlineImg(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upNsOnlineImg";
|
|
|
String upid = getCode();
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
String res = "";
|
|
|
int total = 0;
|
|
|
int success = 0;
|
|
@ -1129,7 +1149,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|
|
@ -1149,9 +1169,10 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
|
|
|
//13.用户协议信息
|
|
|
public String upNsOrganProtocol(String startDate, String endDate,String keyId) throws Exception {
|
|
|
String url = getUrl();
|
|
|
String api = "micc.upNsOrganProtocol";
|
|
|
String upid = getCode();
|
|
|
String token = upNsUserToken();
|
|
|
String token = upNsUserToken(url);
|
|
|
String res = "";
|
|
|
int total = 0;
|
|
|
int success = 0;
|
|
@ -1334,7 +1355,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
|
|
|
if(!errorFlag){
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
jsonArray.add(jb);
|
|
|
res = postToInter(token,api, jsonArray);
|
|
|
res = postToInter(token,api, jsonArray,url);
|
|
|
|
|
|
JSONObject resJson = (JSONObject) JSONObject.parse(res);
|
|
|
if("200".equals(resJson.get("msg").toString())){
|