|
@ -38,13 +38,30 @@ public class PatientRecordService {
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
/**
|
|
|
* 字符串List排序
|
|
|
*/
|
|
|
public List<Map<String, String>> sortMapList(List<Map<String, String>> mapList, final String sort, final String order) {
|
|
|
Collections.sort(mapList, new Comparator<Map<String, String>>() {
|
|
|
public int compare(Map<String, String> o1, Map<String, String> o2) {
|
|
|
String map1value = o1.get(sort);
|
|
|
String map2value = o2.get(sort);
|
|
|
if ("DESC".equals(order.toUpperCase())) {
|
|
|
return map2value.compareTo(map1value);
|
|
|
} else {
|
|
|
return map1value.compareTo(map2value);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
return mapList;
|
|
|
}
|
|
|
/******************************************************************************************************************/
|
|
|
/**
|
|
|
* 获取门/急诊记录 + 住院记录
|
|
|
*/
|
|
|
public List<Map<String,Object>> getAllEvent(String patientCode, String type, String page, String pageSize) throws Exception
|
|
|
public List<Map<String,String>> getAllEvent(String patientCode, String type, String page, String pageSize) throws Exception
|
|
|
{
|
|
|
List<Map<String,Object>> re = new ArrayList<>();
|
|
|
List<Map<String,String>> re = new ArrayList<>();
|
|
|
|
|
|
//获取患者
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
@ -57,10 +74,20 @@ public class PatientRecordService {
|
|
|
if(!StringUtils.isEmpty(response))
|
|
|
{
|
|
|
JSONArray array = new JSONArray(response);
|
|
|
|
|
|
String max = "";
|
|
|
String min = "";
|
|
|
for (int i=0;i<array.length();i++) {
|
|
|
JSONObject item = array.getJSONObject(i);
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
if(i==0) //最大值
|
|
|
{
|
|
|
max = item.optString("END_TIME");
|
|
|
}
|
|
|
else if(i==array.length()-1) //最小值
|
|
|
{
|
|
|
min = item.optString("END_TIME");
|
|
|
}
|
|
|
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("id",item.optString("EVENT"));
|
|
|
map.put("patient",patientCode);
|
|
|
map.put("eventDate",item.optString("END_TIME"));
|
|
@ -72,24 +99,38 @@ public class PatientRecordService {
|
|
|
re.add(map);
|
|
|
}
|
|
|
|
|
|
//*******排序、过滤
|
|
|
}
|
|
|
else{
|
|
|
//过滤***********
|
|
|
for(PatientEvent item:eventList)
|
|
|
{
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("id",item.getId().toString());
|
|
|
map.put("patient",item.getPatient());
|
|
|
map.put("eventDate",DateUtil.dateToStrLong(item.getEventDate()));
|
|
|
map.put("eventType",item.getEventType());
|
|
|
map.put("orgName",item.getOrgName());
|
|
|
map.put("dianosis",item.getDianosis());
|
|
|
map.put("createTime",DateUtil.dateToStrLong(item.getCreateTime()));
|
|
|
map.put("dataFrom","2"); //APP数据
|
|
|
re.add(map);
|
|
|
}
|
|
|
|
|
|
//排序
|
|
|
re = sortMapList(re,"eventDate","DESC");
|
|
|
}
|
|
|
|
|
|
for(PatientEvent item:eventList)
|
|
|
{
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("id",item.getId().toString());
|
|
|
map.put("patient",item.getPatient());
|
|
|
map.put("eventDate",DateUtil.dateToStrLong(item.getEventDate()));
|
|
|
map.put("eventType",item.getEventType());
|
|
|
map.put("orgName",item.getOrgName());
|
|
|
map.put("dianosis",item.getDianosis());
|
|
|
map.put("createTime",DateUtil.dateToStrLong(item.getCreateTime()));
|
|
|
map.put("dataFrom","2"); //APP数据
|
|
|
re.add(map);
|
|
|
else{
|
|
|
for(PatientEvent item:eventList)
|
|
|
{
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("id",item.getId().toString());
|
|
|
map.put("patient",item.getPatient());
|
|
|
map.put("eventDate",DateUtil.dateToStrLong(item.getEventDate()));
|
|
|
map.put("eventType",item.getEventType());
|
|
|
map.put("orgName",item.getOrgName());
|
|
|
map.put("dianosis",item.getDianosis());
|
|
|
map.put("createTime",DateUtil.dateToStrLong(item.getCreateTime()));
|
|
|
map.put("dataFrom","2"); //APP数据
|
|
|
re.add(map);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return re;
|
|
@ -125,9 +166,9 @@ public class PatientRecordService {
|
|
|
/**
|
|
|
* 获取检查检验列表
|
|
|
*/
|
|
|
public List<Map<String,Object>> getExamAndLabReport(String patientCode,String page,String pageSize) throws Exception
|
|
|
public List<Map<String,String>> getExamAndLabReport(String patientCode,String page,String pageSize) throws Exception
|
|
|
{
|
|
|
List<Map<String,Object>> re = new ArrayList<>();
|
|
|
List<Map<String,String>> re = new ArrayList<>();
|
|
|
|
|
|
//获取患者
|
|
|
Patient patient = patientDao.findByCode(patientCode);
|
|
@ -139,7 +180,7 @@ public class PatientRecordService {
|
|
|
String sql = "select a.*,b.img_type as catalog,GROUP_CONCAT(b.img_label) as label from wlyy_patient_event a\n" +
|
|
|
"left join wlyy_patient_event_img b on b.event_id=a.id and b.img_type in ('检查报告','检验报告')\n" +
|
|
|
"where a.patient='"+patientCode+"'\n" +
|
|
|
"group by b.img_type";
|
|
|
"group by b.img_type order by a.event_date desc";
|
|
|
List<Map<String,Object>> appList = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
if(!StringUtils.isEmpty(response))
|
|
@ -148,7 +189,7 @@ public class PatientRecordService {
|
|
|
|
|
|
for (int i=0;i<array.length();i++) {
|
|
|
JSONObject item = array.getJSONObject(i);
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("id",item.optString("EVENT"));
|
|
|
map.put("patient",patientCode);
|
|
|
map.put("eventDate",item.optString("END_TIME"));
|
|
@ -170,34 +211,58 @@ public class PatientRecordService {
|
|
|
re.add(map);
|
|
|
}
|
|
|
|
|
|
//*******排序、过滤
|
|
|
}
|
|
|
else{
|
|
|
|
|
|
}
|
|
|
|
|
|
for(Map<String,Object> item:appList)
|
|
|
{
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("id",item.get("id"));
|
|
|
map.put("patient",patientCode);
|
|
|
map.put("eventDate",DateUtil.dateToStrLong((Date) item.get("event_date")));
|
|
|
String type = "";
|
|
|
if("检验报告".equals(item.get("catalog")))
|
|
|
//*******过滤
|
|
|
for(Map<String,Object> item:appList)
|
|
|
{
|
|
|
type = "检验";
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("id",item.get("id").toString());
|
|
|
map.put("patient",patientCode);
|
|
|
map.put("eventDate",DateUtil.dateToStrLong((Date) item.get("event_date")));
|
|
|
String type = "";
|
|
|
if("检验报告".equals(item.get("catalog")))
|
|
|
{
|
|
|
type = "检验";
|
|
|
}
|
|
|
else if("检查报告".equals(item.get("catalog")))
|
|
|
{
|
|
|
type = "检查";
|
|
|
}
|
|
|
map.put("type",type);
|
|
|
map.put("catalogCode","");
|
|
|
map.put("serial","");
|
|
|
map.put("orgName",String.valueOf(item.get("org_name")));
|
|
|
map.put("label",String.valueOf(item.get("label"))); //检测项目
|
|
|
map.put("dataFrom","2");//基卫数据
|
|
|
re.add(map);
|
|
|
}
|
|
|
else if("检查报告".equals(item.get("catalog")))
|
|
|
|
|
|
//排序
|
|
|
re = sortMapList(re,"eventDate","DESC");
|
|
|
}
|
|
|
else{
|
|
|
for(Map<String,Object> item:appList)
|
|
|
{
|
|
|
type = "检查";
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("id",String.valueOf(item.get("id")));
|
|
|
map.put("patient",patientCode);
|
|
|
map.put("eventDate",DateUtil.dateToStrLong((Date) item.get("event_date")));
|
|
|
String type = "";
|
|
|
if("检验报告".equals(item.get("catalog")))
|
|
|
{
|
|
|
type = "检验";
|
|
|
}
|
|
|
else if("检查报告".equals(item.get("catalog")))
|
|
|
{
|
|
|
type = "检查";
|
|
|
}
|
|
|
map.put("type",type);
|
|
|
map.put("catalogCode","");
|
|
|
map.put("serial","");
|
|
|
map.put("orgName",String.valueOf(item.get("org_name")));
|
|
|
map.put("label",String.valueOf(item.get("label"))); //检测项目
|
|
|
map.put("dataFrom","2");//基卫数据
|
|
|
re.add(map);
|
|
|
}
|
|
|
map.put("type",type);
|
|
|
map.put("catalogCode","");
|
|
|
map.put("serial","");
|
|
|
map.put("orgName",item.get("org_name"));
|
|
|
map.put("label",item.get("label")); //检测项目
|
|
|
map.put("dataFrom","1");//基卫数据
|
|
|
re.add(map);
|
|
|
}
|
|
|
|
|
|
return re;
|