Browse Source

基卫档案相关接口整合

hzp 8 years ago
parent
commit
1f33a67f2e
21 changed files with 733 additions and 1141 deletions
  1. 0 125
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/DrugService.java
  2. 0 68
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HealthDataService.java
  3. 0 128
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HospitalizationService.java
  4. 0 269
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/InspectionService.java
  5. 1 97
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/OutpatientService.java
  6. 0 94
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/RegDeptSpeDoctorService.java
  7. 1 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/EhrService.java
  8. 560 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java
  9. 0 95
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/sign/SignJwService.java
  10. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignSsGetTask.java
  11. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignUploadTask.java
  12. 7 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemConf.java
  13. 16 12
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java
  14. 0 52
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/DrugController.java
  15. 0 57
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HealthDataController.java
  16. 0 53
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HospitalizationController.java
  17. 3 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/InspectionController.java
  18. 1 26
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/OutpatientController.java
  19. 140 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/RecordController.java
  20. 0 56
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/RegDeptSpeDoctorController.java
  21. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

+ 0 - 125
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/DrugService.java

@ -1,125 +0,0 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class DrugService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    @Autowired
    EhrService ehrService;
    /**
     * 获取用药记录
     */
    public String getDrugsList(String strSSID, String startNum,String endNum) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getDrugsList(strSSID);
        }
        else {
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            url = url + "/third/smjk/DrugsList";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
            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)) {
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i + 1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return resultArray.toString();
        }
    }
}

+ 0 - 68
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HealthDataService.java

@ -1,68 +0,0 @@
package com.yihu.wlyy.service.app.record;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class HealthDataService extends BaseService {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    EhrService ehrService;
    /**
     * 获取健康档案信息
     */
    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 {
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            url = url + "/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")) {
                        return result;
                    }
//                if (!StringUtils.isEmpty(xmlData)){
//                    String xmlJson = XMLUtil.xml2json(xmlData);
//                    result = objectMapper.readValue(xmlJson, Map.class);
//                }
                }
            }
            return result;
        }
    }
}

+ 0 - 128
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/HospitalizationService.java

@ -1,128 +0,0 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class HospitalizationService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    @Autowired
    EhrService ehrService;
    /**
     * 获取住院记录
     */
    public String getHospitalizationRecord(String strSSID, String startNum, String endNum) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getHospitalizationRecord(strSSID);
        }
        else {
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            url = url + "/third/smjk/InpatientRecord";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
            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)) {
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i + 1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return resultArray.toString();
        }
    }
}

File diff suppressed because it is too large
+ 0 - 269
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/InspectionService.java


+ 1 - 97
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/OutpatientService.java

@ -26,6 +26,7 @@ import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 * 测试(弃用)
 */
@Service
public class OutpatientService extends BaseService {
@ -36,103 +37,6 @@ public class OutpatientService extends BaseService {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    EhrService ehrService;
    /**
     * 获取门/急诊记录
     */
    public String getOutpatientRecord(String strSSID, String startNum, String endNum) {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getOutpatientRecord(strSSID);
        }
        else{
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            url = url + "/third/smjk/OutpatientRecord";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
            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)){
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i=0; i<jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i+1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return resultArray.toString();
        }
    }
    /**
     * 获取门诊记录详情 0101
     * @param strSSID       健康卡号

+ 0 - 94
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/RegDeptSpeDoctorService.java

@ -1,94 +0,0 @@
package com.yihu.wlyy.service.app.record;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Service
public class RegDeptSpeDoctorService extends BaseService {
    @Autowired
    SystemDictService systemDictService;
    /**
     * 获取转诊预约医生号源信息
     */
    public String getRegDeptSpeDoctorSectionList(String OrgCode,String DeptCode,String strStart,String strEnd,String DocCode)  throws Exception
    {
        String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
        url = url + "/third/smjk/RegDeptSpeDoctorSectionList";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("OrgCode", OrgCode));
        params.add(new BasicNameValuePair("DeptCode", DeptCode));
        params.add(new BasicNameValuePair("strStart", strStart));
        params.add(new BasicNameValuePair("strEnd", strEnd));
        params.add(new BasicNameValuePair("DocCode", DocCode));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray resultArray = new JSONArray();
        List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
        Map<String, String> systemDictMap = new HashMap<>();
        for (SystemDict systemDict : systemDictList) {
            systemDictMap.put(systemDict.getCode(), systemDict.getValue());
        }
        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)){
                    if (data.startsWith("error")) {
                        return data;
                    }
                    JSONObject jsonData = new JSONObject(data);
                    JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                    if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                        Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                        for (int i=0; i<jsonArray.length(); i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String patientId = jsonObject.getString("XMAN_ID");
                            String eventNo = jsonObject.getString("EVENT");
                            Integer orgId = jsonObject.getInt("ORG_ID");
                            String key = patientId + eventNo + orgId;
                            JSONObject catalogObject = new JSONObject();
                            String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                            String catalogValue = systemDictMap.get(catalogCode);
                            jsonObject.remove("CATALOG_CODE");
                            if (jsonObjectMap.containsKey(key)) {
                                jsonObject = jsonObjectMap.get(key);
                                catalogObject = jsonObject.getJSONObject("CATALOG");
                            }
                            catalogObject.put(catalogCode, catalogValue);
                            jsonObject.put("CATALOG", catalogObject);
                            jsonObjectMap.put(key, jsonObject);
                        }
                        for (String key : jsonObjectMap.keySet()) {
                            resultArray.put(jsonObjectMap.get(key));
                        }
                    }
                }
            }
        }
        return resultArray.toString();
    }
}

+ 1 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/EhrService.java

@ -1,4 +1,4 @@
package com.yihu.wlyy.service.app.record;
package com.yihu.wlyy.service.third.ehr;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.patient.Patient;
@ -15,7 +15,6 @@ import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by hzp on 2016/10/25.

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

@ -0,0 +1,560 @@
package com.yihu.wlyy.service.third.jw;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientReservationDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.service.third.ehr.EhrService;
import com.yihu.wlyy.service.third.guahao.GuahaoDoctor;
import com.yihu.wlyy.service.third.guahao.IGuahaoService;
import com.yihu.wlyy.util.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionContext;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
 * Created by hzp on 2016/11/14.
 * 基卫健康档案服务
 */
@Service
public class JwSmjkService {
    //基卫服务地址
    private String jwUrl = SystemConf.getInstance().getJwUrl();
    @Autowired
    private ObjectMapper objectMapper = new ObjectMapper();
    @Autowired
    EhrService ehrService;
    @Autowired
    SystemDictService systemDictService;
    /**
     * 获取住院记录
     */
    public String getHospitalizationRecord(String strSSID, String startNum, String endNum) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getHospitalizationRecord(strSSID);
        }
        else {
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = jwUrl + "/third/smjk/InpatientRecord";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
            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)) {
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i + 1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return resultArray.toString();
        }
    }
    /**
     * 获取门/急诊记录
     */
    public String getOutpatientRecord(String strSSID, String startNum, String endNum) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getOutpatientRecord(strSSID);
        }
        else{
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = jwUrl + "/third/smjk/OutpatientRecord";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
            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)){
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i=0; i<jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i+1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return resultArray.toString();
        }
    }
    /**
     * 获取门/急诊记录 + 住院记录
     */
    public String getResidentEventListJson(String strSSID,String type,String page,String pageSize) throws Exception
    {
        String re = "";
        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) && re.startsWith("error")) {
                    throw new Exception(re);
                }
                else{
                    JSONObject jsonData = new JSONObject(data);
                    JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                    re = jsonArray.toString();
                }
            }
            else{
                throw new Exception(responseObject.getString("msg"));
            }
        }
        else{
            throw new Exception("null response.");
        }
        return re;
    }
    /**
     * 获取健康档案信息
     */
    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 {
            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")) {
                        return result;
                    }
                }
            }
            return result;
        }
    }
    /***************************************************************************************************************************/
    /**
     * 获取检查报告信息
     */
    private JSONArray getChecking(String strSSID, String startNum, String endNum) throws Exception {
        String api = "/third/smjk/ExamReport";
        return getResult(api, strSSID, startNum, endNum);
    }
    /**
     * 获取检验报告信息
     */
    private JSONArray getInspection(String strSSID, String startNum, String endNum) throws Exception {
        String api = "/third/smjk/LabReport";
        return getResult(api, strSSID, startNum, endNum);
    }
    private JSONArray getResult(String api, String strSSID, String startNum, String endNum) {
        String startDate = "1900-01-01";
        String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
        String url = jwUrl + api;
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("strSSID", strSSID));
        params.add(new BasicNameValuePair("startDate", startDate));
        params.add(new BasicNameValuePair("endDate", endDate));
        params.add(new BasicNameValuePair("startNum", startNum));
        params.add(new BasicNameValuePair("endNum", endNum));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        JSONArray resultArray = new JSONArray();
        List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
        Map<String, String> systemDictMap = new HashMap<>();
        for (SystemDict systemDict : systemDictList) {
            systemDictMap.put(systemDict.getCode(), systemDict.getValue());
        }
        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)){
                    if (data.startsWith("error")) {
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("error", data);
                        resultArray.put(jsonObject);
                        return resultArray ;
                    }
                    JSONObject jsonData = new JSONObject(data);
                    JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                    if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                        Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                        for (int i=0; i<jsonArray.length(); i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String patientId = jsonObject.getString("XMAN_ID");
                            String eventNo = jsonObject.getString("EVENT");
                            Integer orgId = jsonObject.getInt("ORG_ID");
                            String key = patientId + eventNo + orgId;
                            JSONObject catalogObject = new JSONObject();
                            String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                            String endTimeNew = jsonObject.get("END_TIME").toString();
                            String catalogValue = systemDictMap.get(catalogCode);
                            jsonObject.remove("CATALOG_CODE");
                            if (jsonObjectMap.containsKey(key)) {
                                jsonObject = jsonObjectMap.get(key);
                                String endTimeOld = jsonObject.get("END_TIME").toString();
                                if (endTimeNew.compareTo(endTimeOld) < 0) {
                                    endTimeNew = endTimeOld;
                                }
                                catalogObject = jsonObject.getJSONObject("CATALOG");
                            }
                            catalogObject.put(catalogCode, catalogValue);
                            jsonObject.put("CATALOG", catalogObject);
                            jsonObject.put("END_TIME", endTimeNew);
                            jsonObjectMap.put(key, jsonObject);
                        }
                        for (String key : jsonObjectMap.keySet()) {
                            resultArray.put(jsonObjectMap.get(key));
                        }
                    }
                }
            }
        }
        return resultArray;
    }
    /**
     * 获取检查检验 信息
     * @param strSSID
     * @param startNum
     * @param endNum
     * @return
     * @throws Exception
     */
    public String getInspectionAndChecking(String strSSID, String startNum, String endNum) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getInspectionAndChecking(strSSID);
        }
        else {
            JSONArray total = new JSONArray();
            JSONArray check = getChecking(strSSID, startNum, endNum);
            if (!check.isNull(0)) {
                JSONObject jsonObject = check.getJSONObject(0);
                if (jsonObject.has("error")) {
                    return jsonObject.get("error").toString();
                }
            }
            JSONArray inspect = getInspection(strSSID, startNum, endNum);
            if (!inspect.isNull(0)) {
                JSONObject jsonObject = inspect.getJSONObject(0);
                if (jsonObject.has("error")) {
                    return jsonObject.get("error").toString();
                }
            }
            //TODO 检查检验数据合并
            for (int i = 0; i < check.length(); i++) {
                total.put(check.getJSONObject(i));
            }
            for (int i = 0; i < inspect.length(); i++) {
                total.put(inspect.getJSONObject(i));
            }
            JSONObject temp;
            for (int i = 0; i < total.length(); i++) {
                for (int j = i + 1; j < total.length(); j++) {
                    String endTimeNew = total.getJSONObject(j).get("END_TIME").toString();
                    String endTimeOld = total.getJSONObject(i).get("END_TIME").toString();
                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                        temp = total.getJSONObject(i);
                        total.put(i, total.getJSONObject(j));
                        total.put(j, temp);  // 两个数交换位置
                    }
                }
            }
            return total.toString();
        }
    }
    /****************************************************************************************************************************/
    /**
     * 获取用药记录
     */
    public String getDrugsList(String strSSID, String startNum,String endNum) throws Exception {
        if(SystemConf.getInstance().getEhrUsed())     //演示环境
        {
            return ehrService.getDrugsList(strSSID);
        }
        else {
            String startDate = "1900-01-01";
            String endDate = DateUtil.dateToStr(DateUtil.getNowDate(), DateUtil.YYYY_MM_DD);
            String url = jwUrl + "/third/smjk/DrugsList";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("strSSID", strSSID));
            params.add(new BasicNameValuePair("startDate", startDate));
            params.add(new BasicNameValuePair("endDate", endDate));
            params.add(new BasicNameValuePair("startNum", startNum));
            params.add(new BasicNameValuePair("endNum", endNum));
            String response = HttpClientUtil.post(url, params, "UTF-8");
            JSONArray resultArray = new JSONArray();
            List<SystemDict> systemDictList = systemDictService.getDictByDictName("EHR_CATALOG");
            Map<String, String> systemDictMap = new HashMap<>();
            for (SystemDict systemDict : systemDictList) {
                systemDictMap.put(systemDict.getCode(), systemDict.getValue());
            }
            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)) {
                        if (data.startsWith("error")) {
                            return data;
                        }
                        JSONObject jsonData = new JSONObject(data);
                        JSONArray jsonArray = jsonData.getJSONArray("EhrList");
                        if (!jsonArray.isNull(0) && jsonArray.getJSONObject(0).length() != 0) {
                            Map<String, JSONObject> jsonObjectMap = new HashMap<>();
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject jsonObject = jsonArray.getJSONObject(i);
                                String patientId = jsonObject.getString("XMAN_ID");
                                String eventNo = jsonObject.getString("EVENT");
                                Integer orgId = jsonObject.getInt("ORG_ID");
                                String key = patientId + eventNo + orgId;
                                JSONObject catalogObject = new JSONObject();
                                String catalogCode = jsonObject.get("CATALOG_CODE").toString();
                                String endTimeNew = jsonObject.get("END_TIME").toString();
                                String catalogValue = systemDictMap.get(catalogCode);
                                jsonObject.remove("CATALOG_CODE");
                                if (jsonObjectMap.containsKey(key)) {
                                    jsonObject = jsonObjectMap.get(key);
                                    String endTimeOld = jsonObject.get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) < 0) {
                                        endTimeNew = endTimeOld;
                                    }
                                    catalogObject = jsonObject.getJSONObject("CATALOG");
                                }
                                catalogObject.put(catalogCode, catalogValue);
                                jsonObject.put("CATALOG", catalogObject);
                                jsonObject.put("END_TIME", endTimeNew);
                                jsonObjectMap.put(key, jsonObject);
                            }
                            for (String key : jsonObjectMap.keySet()) {
                                resultArray.put(jsonObjectMap.get(key));
                            }
                            JSONObject temp;
                            for (int i = 0; i < resultArray.length(); i++) {
                                for (int j = i + 1; j < resultArray.length(); j++) {
                                    String endTimeNew = resultArray.getJSONObject(j).get("END_TIME").toString();
                                    String endTimeOld = resultArray.getJSONObject(i).get("END_TIME").toString();
                                    if (endTimeNew.compareTo(endTimeOld) > 0) {
                                        temp = resultArray.getJSONObject(i);
                                        resultArray.put(i, resultArray.getJSONObject(j));
                                        resultArray.put(j, temp);  // 两个数交换位置
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return resultArray.toString();
        }
    }
    /**
     * 获取转诊预约医生号源信息
     */
    public String getRegDeptSpeDoctorSectionList(String OrgCode,String DeptCode,String strStart,String strEnd,String DocCode)  throws Exception
    {
        String re = "";
        String url = jwUrl + "/third/smjk/RegDeptSpeDoctorSectionList";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("OrgCode", OrgCode));
        params.add(new BasicNameValuePair("DeptCode", DeptCode));
        params.add(new BasicNameValuePair("strStart", strStart));
        params.add(new BasicNameValuePair("strEnd", strEnd));
        params.add(new BasicNameValuePair("DocCode", DocCode));
        return HttpClientUtil.post(url, params, "UTF-8");
    }
}

+ 0 - 95
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/sign/SignJwService.java

@ -1,95 +0,0 @@
package com.yihu.wlyy.service.third.sign;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.patient.PatientReservationDao;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.guahao.GuahaoDoctor;
import com.yihu.wlyy.service.third.guahao.IGuahaoService;
import com.yihu.wlyy.util.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionContext;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
 * Created by hzp on 2016/9/26.
 * 基卫签约服务 (弃用)
 */
@Service
public class SignJwService {
    //基卫服务地址
    private String jwUrl = "";
    @Autowired
    private ObjectMapper objectMapper = new ObjectMapper();
    /**
     * 查询是否已签约
     * true 已签约 false 未签约
     */
    public Boolean CheckSignFamily(String idcard) throws Exception
    {
        boolean re = true;
        String url = jwUrl+"third/sign/CheckSignFamily";
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("idcard", idcard));
        String response = HttpClientUtil.post(url,params,"UTF-8");
        Map<String,Object> map = objectMapper.readValue(response,Map.class);
        if(map.get("status").equals(200))
        {
            Map<String,String> data = (Map<String,String>)map.get("data");
            if(data.get("status").equals("1"))
            {
                System.out.print("已签约ID:"+data.get("code"));
            }
            else{
                re = false;
            }
        }
        else{
            throw new Exception(map.get("msg").toString());
        }
        return re;
    }
    /**
     * 推送签约接口
     */
    public Boolean UploadSignFamily(String code)
    {
        try{
            String url = jwUrl+"third/sign/UploadSignFamily";
            List<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair("code", code));
            String response = HttpClientUtil.post(url,params,"UTF-8");
            Map<String,Object> map = objectMapper.readValue(response,Map.class);
            if(map.get("status").equals(200))
            {
                return true;
            }
            else{
                System.out.print(map.get("msg"));
                return false;
            }
        }
        catch (Exception ex)
        {
            System.out.print(ex.getMessage());
            return false;
        }
    }
}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignSsGetTask.java

@ -22,7 +22,7 @@ public class SignSsGetTask implements Runnable {
    public void run() {
        try {
            Thread.sleep(3000);
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String url = SystemConf.getInstance().getJwUrl();
            String resultStr = HttpUtil.sendPost(url + "/third/sign/LoadSanshiSignFamily?idcard=" + idcard, "");
            JSONObject json = new JSONObject(resultStr);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/task/SignUploadTask.java

@ -29,7 +29,7 @@ public class SignUploadTask implements Runnable {
    public void run() {
        try {
            Thread.sleep(3000);
            String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String url = SystemConf.getInstance().getJwUrl();
            String resultStr = HttpUtil.sendPost(url + "/third/sign/UploadSignFamily?code=" + code, "");
            JSONObject json = new JSONObject(resultStr);

+ 7 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemConf.java

@ -310,6 +310,13 @@ public class SystemConf {
	/****************************************************************************************/
	/**
	 * 基卫服务地址
	 */
	public String getJwUrl() {
		return getSystemProperties().getProperty("sign_check_upload");
	}
	/********************************* EHR配置 **********************************************/
	/**
	 * 是否启用EHR演示

+ 16 - 12
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.common.util;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.BaseController;
@ -29,6 +30,10 @@ import java.util.*;
public class WlyySerivceController extends BaseController{
    @Autowired
    private GuahaoXMService guahaoXM;
    @Autowired
    private JwSmjkService jwSmjkService;
    /**
     * 检查是否签约
     *
@ -39,7 +44,7 @@ public class WlyySerivceController extends BaseController{
    @ApiOperation("检查是否签约")
    public String checkSignFamily(@RequestParam("idcard") String idcard){
        try{
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String checkUrl = SystemConf.getInstance().getJwUrl();;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/CheckSignFamily?idcard=" + idcard, "");
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
@ -62,7 +67,7 @@ public class WlyySerivceController extends BaseController{
    @ApiOperation("上传签约数据")
    public String uploadSignFamily(@RequestParam("code")String code){
        try{
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String checkUrl = SystemConf.getInstance().getJwUrl();;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/UploadSignFamily?code=" + code, "");
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
@ -85,7 +90,7 @@ public class WlyySerivceController extends BaseController{
    @ApiOperation("初次采集签约接口")
    public String loadAllSignFamily(@RequestParam("start_time")String start_time){
        try{
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String checkUrl = SystemConf.getInstance().getJwUrl();;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/LoadAllSignFamily?start_time=" + start_time, "");
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
@ -108,7 +113,7 @@ public class WlyySerivceController extends BaseController{
    @ApiOperation("单条采集签约接口")
    public String loadSingleSignFamily(@RequestParam("idcard")String idcard){
        try{
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String checkUrl = SystemConf.getInstance().getJwUrl();;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/LoadSignFamily?idcard=" + idcard, "");
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
@ -132,7 +137,7 @@ public class WlyySerivceController extends BaseController{
    @ApiOperation("时间范围采集签约接口")
    public String loadSignFamilyBatch(@RequestParam("start_time")String start_time,@RequestParam("end_time")String end_time){
        try{
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String checkUrl = SystemConf.getInstance().getJwUrl();;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/LoadSignFamilyBatch?start_time=" + start_time + "&end_time=" + end_time, "");
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
@ -153,7 +158,7 @@ public class WlyySerivceController extends BaseController{
    @RequestMapping(value = "/third/sign/ReUploadSignFamily",method = RequestMethod.POST)
    public String reuploadSignFamily(){
        try{
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String checkUrl = SystemConf.getInstance().getJwUrl();;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/ReUploadSignFamily", "");
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
@ -174,7 +179,7 @@ public class WlyySerivceController extends BaseController{
    @RequestMapping(value = "/third/sign/ReUpdateSignFamily",method = RequestMethod.POST)
    public String reupdateSignFamily(){
        try{
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String checkUrl = SystemConf.getInstance().getJwUrl();;
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/ReUpdateSignFamily", "");
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
@ -203,16 +208,15 @@ public class WlyySerivceController extends BaseController{
            Date tenDateAfter =  getDateAfter(nowDate,10);
            String strStart = sm.format(nowDate);
            String strEnd = sm.format(tenDateAfter);
            String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
            String param = "?OrgCode="+OrgCode+"&DeptCode="+DeptCode+"&strStart="+strStart+"&strEnd="+strEnd+"&DocCode="+DocCode;
            //String response = jwSmjkService.getRegDeptSpeDoctorSectionList(OrgCode,DeptCode,strStart,strEnd,DocCode);
            /*****modify by linz 暂时把号源转换成普通号源****/
            List<Map<String,Object>> list =  guahaoXM.GetDoctorArrange(OrgCode,DeptCode,DocCode);
            //String jsonString = HttpUtil.sendPost(checkUrl + "/third/smjk/RegDeptSpeDoctorSectionList"+param,"" );
            //if(StringUtils.isEmpty(jsonString)){
            //if(StringUtils.isEmpty(response)){
            //    return write(-1,"医生排班时间获取失败");
            //}else{
            //    JSONObject myJsonObject = new JSONObject(jsonString);
            //    return write(200,"医生排班时间获取成功","data",parseXmlForSpe(myJsonObject.get("data").toString()));
            //    return write(200,"医生排班时间获取成功","data",parseXmlForSpe(response));
            //}
            for(Map map :list){
                String date = (String)map.get("date");

+ 0 - 52
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/DrugController.java

@ -1,52 +0,0 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.DrugService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/wlyy_service/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案用药记录")
public class DrugController extends BaseController {
    @Autowired
    private DrugService drugService;
    /**
     * 获取用药记录
     *
     * @return
     */
    @RequestMapping(value = "/drug", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取用药记录")
    public String getDrugsList(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                               @RequestParam(value="strSSID",required = true) String strSSID,
                               @RequestParam(value="startNum",required = true) String startNum,
                               @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                               @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = drugService.getDrugsList(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取用药记录成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取用药记录失败!");
        }
    }
}

+ 0 - 57
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HealthDataController.java

@ -1,57 +0,0 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.HealthDataService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/wlyy_service/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案信息")
public class HealthDataController extends BaseController {
    @Autowired
    private HealthDataService healthDataService;
    /**
     * 获取门/急诊数据
     *
     * @return
     */
    @RequestMapping(value = "/healthData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取健康档案信息")
    public String getHealthData(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                @RequestParam(value="strSSID",required = true) String strSSID,
                                @ApiParam(name="strEvent",value="事件ID",defaultValue = "")
                                @RequestParam(value="strEvent",required = true) String strEvent,
                                @ApiParam(name="strCatalog",value="档案类型",defaultValue = "")
                                @RequestParam(value="strCatalog",required = true) String strCatalog,
                                @ApiParam(name="strSerial",value="该类别顺序号,默认填1",defaultValue = "1")
                                @RequestParam(value="strSerial",required = true) String strSerial) {
        try {
            String result = healthDataService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取健康档案信息成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取健康档案信息失败!");
        }
    }
}

+ 0 - 53
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/HospitalizationController.java

@ -1,53 +0,0 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.HospitalizationService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/wlyy_service/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案住院记录")
public class HospitalizationController extends BaseController {
    @Autowired
    private HospitalizationService hospitalizationService;
    /**
     * 获取门/急诊数据
     *
     * @return
     */
    @RequestMapping(value = "/hospitalization", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取住院记录")
    public String getHospitalizationRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                     @RequestParam(value="strSSID",required = true) String strSSID,
                                     @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                                     @RequestParam(value="startNum",required = true) String startNum,
                                     @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                                     @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = hospitalizationService.getHospitalizationRecord(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取住院记录成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取住院记录失败!");
        }
    }
}

+ 3 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/InspectionController.java

@ -1,6 +1,6 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.InspectionService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
public class InspectionController extends BaseController {
    @Autowired
    private InspectionService inspectionService;
    private JwSmjkService jwSmjkService;
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ResponseBody
@ -40,7 +40,7 @@ public class InspectionController extends BaseController {
            @RequestParam(value = "endNum") String endNum) {
        try {
            //TODO 检查/检验报告接口
            String result = inspectionService.getInspectionAndChecking(strSSID, startNum, endNum);
            String result = jwSmjkService.getInspectionAndChecking(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }

+ 1 - 26
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/OutpatientController.java

@ -20,36 +20,11 @@ import java.util.Map;
 */
@Controller
@RequestMapping(value = "/wlyy_service/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案门/急诊记录")
@Api(description = "医生端-健康档案门/急诊记录(测试)")
public class OutpatientController extends BaseController {
    @Autowired
    private OutpatientService outpatientService;
    /**
     * 获取门/急诊数据
     *
     * @return
     */
    @ApiOperation("获取门/急诊数据")
    @RequestMapping(value = "/outpatient", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getOutpatientRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "B09036263193")
                      @RequestParam(value="strSSID",required = true) String strSSID,
                      @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                      @RequestParam(value="startNum",required = true) String startNum,
                      @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                      @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = outpatientService.getOutpatientRecord(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取门/急诊数据成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取门/急诊数据失败!");
        }
    }
    @ApiOperation("XML转JSOn")

+ 140 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/RecordController.java

@ -0,0 +1,140 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/wlyy_service/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-健康档案服务")
public class RecordController extends BaseController {
    @Autowired
    private JwSmjkService jwSmjkService;
    @RequestMapping(value = "/hospitalization", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取住院记录")
    public String getHospitalizationRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                           @RequestParam(value="strSSID",required = true) String strSSID,
                                           @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                                           @RequestParam(value="startNum",required = true) String startNum,
                                           @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                                           @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = jwSmjkService.getHospitalizationRecord(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取住院记录成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取住院记录失败!");
        }
    }
    /**
     * 获取门/急诊数据
     *
     * @return
     */
    @ApiOperation("获取门/急诊数据")
    @RequestMapping(value = "/outpatient", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getOutpatientRecord(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "B09036263193")
                                      @RequestParam(value="strSSID",required = true) String strSSID,
                                      @ApiParam(name="startNum",value="需要获取的起始行数",defaultValue = "0")
                                      @RequestParam(value="startNum",required = true) String startNum,
                                      @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                                      @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = jwSmjkService.getOutpatientRecord(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取门/急诊数据成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取门/急诊数据失败!");
        }
    }
    @RequestMapping(value = "/healthData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取健康档案信息")
    public String getHealthData(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                @RequestParam(value="strSSID",required = true) String strSSID,
                                @ApiParam(name="strEvent",value="事件ID",defaultValue = "")
                                @RequestParam(value="strEvent",required = true) String strEvent,
                                @ApiParam(name="strCatalog",value="档案类型",defaultValue = "")
                                @RequestParam(value="strCatalog",required = true) String strCatalog,
                                @ApiParam(name="strSerial",value="该类别顺序号,默认填1",defaultValue = "1")
                                @RequestParam(value="strSerial",required = true) String strSerial) {
        try {
            String result = jwSmjkService.getHealthData(strSSID, strEvent, strCatalog, strSerial);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取健康档案信息成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取健康档案信息失败!");
        }
    }
    @RequestMapping(value = "/residentEventList", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取健康档案信息")
    public String getResidentEventListJson(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                                @RequestParam(value="strSSID",required = true) String strSSID,
                                @ApiParam(name="type",value="类型",defaultValue = "")
                                @RequestParam(value="type",required = true) String type,
                                @ApiParam(name="page",value="第几页",defaultValue = "")
                                @RequestParam(value="page",required = true) String page,
                                @ApiParam(name="pageSize",value="",defaultValue = "10")
                                @RequestParam(value="pageSize",required = true) String pageSize) {
        try {
            String result = jwSmjkService.getResidentEventListJson(strSSID, type, page, pageSize);
            return write(200, "获取健康档案信息成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, e.getMessage());
        }
    }
    @RequestMapping(value = "/drug", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取用药记录")
    public String getDrugsList(@ApiParam(name="strSSID",value="健康卡号",defaultValue = "A20140513123")
                               @RequestParam(value="strSSID",required = true) String strSSID,
                               @RequestParam(value="startNum",required = true) String startNum,
                               @ApiParam(name="endNum",value="需要获取的结束的行数",defaultValue = "10")
                               @RequestParam(value="endNum",required = true) String endNum) {
        try {
            String result = jwSmjkService.getDrugsList(strSSID, startNum, endNum);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取用药记录成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取用药记录失败!");
        }
    }
}

+ 0 - 56
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/record/RegDeptSpeDoctorController.java

@ -1,56 +0,0 @@
package com.yihu.wlyy.web.doctor.record;
import com.yihu.wlyy.service.app.record.RegDeptSpeDoctorService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by zhenglingfeng on 2016/10/17.
 */
@Controller
@RequestMapping(value = "/wlyy_service/record", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-获取转诊预约医生号源信息")
public class RegDeptSpeDoctorController extends BaseController {
    @Autowired
    private RegDeptSpeDoctorService regDeptSpeDoctorService;
    /**
     * 获取转诊预约医生号源信息
     *
     * @return
     */
    @ApiOperation("获取转诊预约医生号源信息")
    @RequestMapping(value = "regDeptSpeDoctor", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ResponseBody
    public String getRegDeptSpeDoctorSectionList(@ApiParam(name="OrgCode",value="机构编码",defaultValue = "350211A1001")
                                                 @RequestParam(value="OrgCode",required = true) String OrgCode,
                                                 @ApiParam(name="DeptCode",value="科室编码",defaultValue = "1040610")
                                                 @RequestParam(value="DeptCode",required = true) String DeptCode,
                                                 @ApiParam(name="strStart",value="预约排班开始时间",defaultValue = "2016-10-18")
                                                 @RequestParam(value="strStart",required = true) String strStart,
                                                 @ApiParam(name="strEnd",value="预约排班结束时间",defaultValue = "2016-10-20")
                                                 @RequestParam(value="strEnd",required = true) String strEnd,
                                                 @ApiParam(name="DocCode",value="医生编码",defaultValue = "80772")
                                                 @RequestParam(value="DocCode",required = true) String DocCode) {
        try {
            String result = regDeptSpeDoctorService.getRegDeptSpeDoctorSectionList(OrgCode, DeptCode, strStart, strEnd, DocCode);
            if (result.startsWith("error")) {
                return write(200, result, "data", new JSONArray().toString());
            }
            return write(200, "获取转诊预约医生号源信息成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取转诊预约医生号源信息失败!");
        }
    }
}

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -292,7 +292,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
        try {
            if (type != 2) {
                try {
                    String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
                    String checkUrl = SystemConf.getInstance().getJwUrl();
                    String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/CheckSignFamily?idcard=" + patientIDcard, "");
                    if (!StringUtils.isEmpty(jsonString)) {
@ -521,7 +521,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            JSONObject result = new JSONObject();
            try {
                String checkUrl = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
                String checkUrl = SystemConf.getInstance().getJwUrl();
                String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/CheckSignFamily?idcard=" + idCard, "");
                if (!StringUtils.isEmpty(jsonString)) {