Prechádzať zdrojové kódy

智业对接接口完善

hzp 8 rokov pred
rodič
commit
4ea98d1c5f

+ 1 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientRecordService.java

@ -347,9 +347,7 @@ public class PatientRecordService {
        //获取患者
        Patient patient = patientDao.findByCode(patientCode);
        String response = jwSmjkService.getDrugsListPage(patient.getSsc(), page, pageSize);
        if ("[{}]".equals(response)) {
            response = "[]";
        }
        return response;
    }

+ 98 - 121
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java

@ -50,7 +50,7 @@ public class JwSmjkService {
    /**
     * 获取门/急诊记录 + 住院记录
     */
    public String getResidentEventListJson(String strSSID,String type,String page,String pageSize)
    public String getResidentEventListJson(String strSSID,String type,String page,String pageSize)  throws Exception
    {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
@ -58,40 +58,35 @@ public class JwSmjkService {
        }
        else {
            String re = "";
            try {
                String url = jwUrl + "/third/smjk/ResidentEventList";
            String url = jwUrl + "/third/smjk/ResidentEventList";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("strSSID", strSSID));
                if (!StringUtils.isEmpty(type)) {
                    params.add(new BasicNameValuePair("type", type));
                }
                params.add(new BasicNameValuePair("page", page));
                params.add(new BasicNameValuePair("pageSize", pageSize));
                String response = HttpClientUtil.post(url, params, "UTF-8");
                if (!StringUtils.isEmpty(response)) {
                    JSONObject responseObject = new JSONObject(response);
                    int status = responseObject.getInt("status");
                    if (status == 200) {
                        String data = responseObject.getString("data");
                        if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                            throw new Exception(data);
                        } else {
                            JSONObject jsonData = new JSONObject(data);
                            JSONArray jsonArray = jsonData.getJSONArray("EventList");
                            re = jsonArray.toString();
                        }
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            if (!StringUtils.isEmpty(type)) {
                params.add(new BasicNameValuePair("type", type));
            }
            params.add(new BasicNameValuePair("page", page));
            params.add(new BasicNameValuePair("pageSize", pageSize));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            if (!StringUtils.isEmpty(response)) {
                JSONObject responseObject = new JSONObject(response);
                int status = responseObject.getInt("status");
                if (status == 200) {
                    String data = responseObject.getString("data");
                    if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                        throw new Exception(data);
                    } else {
                        throw new Exception(responseObject.getString("msg"));
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EventList");
                        re = jsonArray.toString();
                    }
                } else {
                    throw new Exception("null response.");
                    throw new Exception(responseObject.getString("msg"));
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            } else {
                throw new Exception("null response.");
            }
            if(re.contains("[{}]"))
@ -106,91 +101,80 @@ public class JwSmjkService {
    /**
     * 通过event获取档案类型列表
     */
    public String getEventCatalog(String strSSID,String strEvent)
    public String getEventCatalog(String strSSID,String strEvent)  throws Exception
    {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return "";
        }
        else {
            try {
                String url = jwUrl + "/third/smjk/EventCatalog";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("strSSID", strSSID));
                params.add(new BasicNameValuePair("strEvent", strEvent));
                String response = HttpClientUtil.post(url, params, "UTF-8");
                String result = "";
                if (!StringUtils.isEmpty(response)) {
                    JSONObject jsonObject = new JSONObject(response);
                    int status = jsonObject.getInt("status");
                    if (status == 200) {
                        result = jsonObject.getString("data");
                    }
                    else {
                        throw new Exception(jsonObject.getString("msg"));
            String url = jwUrl + "/third/smjk/EventCatalog";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("strEvent", strEvent));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            String result = "";
            if (!StringUtils.isEmpty(response)) {
                JSONObject jsonObject = new JSONObject(response);
                int status = jsonObject.getInt("status");
                if (status == 200) {
                    result = jsonObject.getString("data");
                    if (result.startsWith("error")) {
                        throw new Exception(result);
                    }
                }
                else {
                    throw new Exception("null response.");
                    throw new Exception(jsonObject.getString("msg"));
                }
                return result;
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
                return "";
            else {
                throw new Exception("null response.");
            }
            return result;
        }
    }
    /**
     * 获取健康档案信息详情
     */
    public String getHealthData(String strSSID, String strEvent, String strCatalog, String strSerial) {
    public String getHealthData(String strSSID, String strEvent, String strCatalog, String strSerial) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getHealthData(strSSID,strEvent,strCatalog,strSerial);
        }
        else {
            try {
                String url = jwUrl + "/third/smjk/HealthData";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("strSSID", strSSID));
                params.add(new BasicNameValuePair("strEvent", strEvent));
                params.add(new BasicNameValuePair("strCatalog", strCatalog));
                params.add(new BasicNameValuePair("strSerial", strSerial));
                String response = HttpClientUtil.post(url, params, "UTF-8");
                String result = "";
                if (!StringUtils.isEmpty(response)) {
                    JSONObject jsonObject = new JSONObject(response);
                    int status = jsonObject.getInt("status");
                    if (status == 200) {
                        result = jsonObject.getString("data");
                        result = result.replaceAll("<\\?xml version=\"1.0\" encoding=\"utf-8\"\\?>", "");
                        if (result.startsWith("error")) {
                            throw new Exception(result);
                        }
                    }
                    else {
                        throw new Exception(jsonObject.getString("msg"));
            String url = jwUrl + "/third/smjk/HealthData";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("strEvent", strEvent));
            params.add(new BasicNameValuePair("strCatalog", strCatalog));
            params.add(new BasicNameValuePair("strSerial", strSerial));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            String result = "";
            if (!StringUtils.isEmpty(response)) {
                JSONObject jsonObject = new JSONObject(response);
                int status = jsonObject.getInt("status");
                if (status == 200) {
                    result = jsonObject.getString("data");
                    result = result.replaceAll("<\\?xml version=\"1.0\" encoding=\"utf-8\"\\?>", "");
                    if (result.startsWith("error")) {
                        throw new Exception(result);
                    }
                }
                else {
                    throw new Exception("null response.");
                    throw new Exception(jsonObject.getString("msg"));
                }
                return result;
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
                return "";
            else {
                throw new Exception("null response.");
            }
            return result;
        }
    }
@ -198,54 +182,47 @@ public class JwSmjkService {
    /**
     * 获取检查检验列表
     */
    public String getExamAndLabReport(String strSSID,String page,String pageSize)
    public String getExamAndLabReport(String strSSID,String page,String pageSize) throws Exception
    {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return "";
        }
        else {
            try {
                String url = jwUrl + "/third/smjk/ExamAndLabReport";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("strSSID", strSSID));
                params.add(new BasicNameValuePair("page", page));
                params.add(new BasicNameValuePair("pageSize", pageSize));
                String response = HttpClientUtil.post(url, params, "UTF-8");
                String re = "";
                if (!StringUtils.isEmpty(response)) {
                    JSONObject jsonObject = new JSONObject(response);
                    int status = jsonObject.getInt("status");
                    if (status == 200) {
                        String data = jsonObject.getString("data");
                        if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                            throw new Exception(data);
                        } else {
                            JSONObject jsonData = new JSONObject(data);
                            JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                            re = jsonArray.toString();
                        }
            String url = jwUrl + "/third/smjk/ExamAndLabReport";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("page", page));
            params.add(new BasicNameValuePair("pageSize", pageSize));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            String re = "";
            if (!StringUtils.isEmpty(response)) {
                JSONObject jsonObject = new JSONObject(response);
                int status = jsonObject.getInt("status");
                if (status == 200) {
                    String data = jsonObject.getString("data");
                    if (!StringUtils.isEmpty(data) && data.startsWith("error")) {
                        throw new Exception(data);
                    } else {
                        throw new Exception(jsonObject.getString("msg"));
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        re = jsonArray.toString();
                    }
                } else {
                    throw new Exception("null response.");
                }
                if(re.contains("[{}]"))
                {
                    re = re.replace("[{}]","[]");
                    throw new Exception(jsonObject.getString("msg"));
                }
                return re;
            } else {
                throw new Exception("null response.");
            }
            catch (Exception ex)
            if(re.contains("[{}]"))
            {
                ex.printStackTrace();
                return "";
                re = re.replace("[{}]","[]");
            }
            return re;
        }
    }