|
@ -1,6 +1,9 @@
|
|
package com.yihu.wlyy.service.app.record;
|
|
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.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.HttpClientUtil;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
import com.yihu.wlyy.util.XMLUtil;
|
|
import com.yihu.wlyy.util.XMLUtil;
|
|
@ -8,11 +11,14 @@ import org.apache.http.NameValuePair;
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author HZY
|
|
* @author HZY
|
|
@ -22,44 +28,49 @@ import java.util.List;
|
|
@Service
|
|
@Service
|
|
public class InspectionService extends BaseService {
|
|
public class InspectionService extends BaseService {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
SystemDictService systemDictService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取检查报告信息
|
|
* 获取检查报告信息
|
|
*/
|
|
*/
|
|
public JSONArray getChecking(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
|
|
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
|
|
|
|
url = url + "/third/smjk/ExamReport";
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
JSONArray result = new JSONArray();
|
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
|
|
|
|
|
|
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)){
|
|
|
|
JSONObject jsonData = new JSONObject(data);
|
|
|
|
result = jsonData.getJSONArray("EhrList");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
public JSONArray getChecking(String strSSID, String startNum, String endNum) throws Exception {
|
|
|
|
String api = "/third/smjk/ExamReport";
|
|
|
|
return getResult(api, strSSID, startNum, endNum);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取检验报告信息
|
|
* 获取检验报告信息
|
|
*/
|
|
*/
|
|
public JSONArray getInspection(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
|
|
|
|
|
|
public JSONArray getInspection(String strSSID, String startNum, String endNum) throws Exception {
|
|
|
|
String api = "/third/smjk/LabReport";
|
|
|
|
return getResult(api, strSSID, startNum, endNum);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取检查检验 信息
|
|
|
|
* @param strSSID
|
|
|
|
* @param startNum
|
|
|
|
* @param endNum
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public String getInspectionAndChecking(String strSSID, String startNum, String endNum) throws Exception {
|
|
|
|
JSONArray total = new JSONArray();
|
|
|
|
JSONArray check = getChecking(strSSID, startNum, endNum);
|
|
|
|
JSONArray inspect = getInspection(strSSID, startNum, endNum);
|
|
|
|
//TODO 检查检验数据合并
|
|
|
|
total.put(check);
|
|
|
|
total.put(inspect);
|
|
|
|
return total.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public 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 = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
|
|
String url = SystemConf.getInstance().getSystemProperties().getProperty("sign_check_upload");
|
|
url = url + "/third/smjk/LabReport";
|
|
|
|
|
|
url = url + api;
|
|
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
params.add(new BasicNameValuePair("strSSID", strSSID));
|
|
params.add(new BasicNameValuePair("strSSID", strSSID));
|
|
@ -68,43 +79,53 @@ public class InspectionService extends BaseService {
|
|
params.add(new BasicNameValuePair("startNum", startNum));
|
|
params.add(new BasicNameValuePair("startNum", startNum));
|
|
params.add(new BasicNameValuePair("endNum", endNum));
|
|
params.add(new BasicNameValuePair("endNum", endNum));
|
|
|
|
|
|
JSONArray result = new JSONArray();
|
|
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
String response = HttpClientUtil.post(url, params, "UTF-8");
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
|
JSONObject jsonObject = new JSONObject(response);
|
|
|
|
int status = jsonObject.getInt("status");
|
|
|
|
|
|
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 (!org.apache.commons.lang3.StringUtils.isEmpty(response)){
|
|
|
|
JSONObject responseObject = new JSONObject(response);
|
|
|
|
int status = responseObject.getInt("status");
|
|
if (status == 200){
|
|
if (status == 200){
|
|
String data = jsonObject.getString("data");
|
|
|
|
if (!StringUtils.isEmpty(data)){
|
|
|
|
|
|
String data = responseObject.getString("data");
|
|
|
|
if (!org.apache.commons.lang3.StringUtils.isEmpty(data)){
|
|
JSONObject jsonData = new JSONObject(data);
|
|
JSONObject jsonData = new JSONObject(data);
|
|
result = jsonData.getJSONArray("EhrList");
|
|
|
|
|
|
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 result;
|
|
|
|
|
|
return resultArray;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
|
|
* 获取检查检验 信息
|
|
|
|
* @param strSSID
|
|
|
|
* @param startDate
|
|
|
|
* @param endDate
|
|
|
|
* @param startNum
|
|
|
|
* @param endNum
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
public JSONArray getInspectionAndChecking(String strSSID, String startDate, String endDate, String startNum, String endNum) throws Exception {
|
|
|
|
JSONArray total = new JSONArray();
|
|
|
|
JSONArray check = getChecking(strSSID, startDate, endDate, startNum, endNum);
|
|
|
|
JSONArray inspect = getInspection(strSSID, startDate, endDate, startNum, endNum);
|
|
|
|
//TODO 检查检验数据合并
|
|
|
|
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 档案详情
|
|
* 档案详情
|
|
* @param strSSID 健康卡号
|
|
* @param strSSID 健康卡号
|