|
@ -6344,17 +6344,23 @@ public class StatisticsEsService {
|
|
|
public JSONObject getDrugAndExaminationFeeList(ScreenQvo qvo) throws Exception {
|
|
|
System.out.println("getDrugAndExaminationFeeList获取:诊查费(21) + 处方费(3)");
|
|
|
if (qvo.getFlag() == 1) {
|
|
|
//本月
|
|
|
qvo.setStartDate(DateUtil.getFirstMonthDay());
|
|
|
qvo.setEndDate(DateUtil.getLastMonthDay());
|
|
|
if (StringUtils.isBlank(qvo.getStartDate())) {
|
|
|
//本月
|
|
|
qvo.setStartDate(DateUtil.getFirstMonthDay());
|
|
|
qvo.setEndDate(DateUtil.getLastMonthDay());
|
|
|
}
|
|
|
} else if (qvo.getFlag() == 2) {
|
|
|
//近半年
|
|
|
qvo.setStartDate(DateUtil.getMonthDate(new Date(), -6));
|
|
|
qvo.setEndDate(DateUtil.getStringDateShort());
|
|
|
if (StringUtils.isBlank(qvo.getStartDate())) {
|
|
|
//近半年
|
|
|
qvo.setStartDate(DateUtil.getMonthDate(new Date(), -6));
|
|
|
qvo.setEndDate(DateUtil.getStringDateShort());
|
|
|
}
|
|
|
} else if (qvo.getFlag() == 3) {
|
|
|
//全年
|
|
|
qvo.setStartDate(DateUtil.getCurrentYearStartTime());
|
|
|
qvo.setEndDate(DateUtil.getCurrentYearEndTime());
|
|
|
if (StringUtils.isBlank(qvo.getStartDate())) {
|
|
|
//全年
|
|
|
qvo.setStartDate(DateUtil.getCurrentYearStartTime());
|
|
|
qvo.setEndDate(DateUtil.getCurrentYearEndTime());
|
|
|
}
|
|
|
}
|
|
|
System.out.println("赋值时间-参数:" + JSON.toJSONString(qvo));
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
@ -6397,17 +6403,23 @@ public class StatisticsEsService {
|
|
|
public JSONObject getDeptOrDoctorVolumeList(ScreenQvo qvo) throws Exception {
|
|
|
JSONObject result = new JSONObject();
|
|
|
if (qvo.getFlag() == 1) {
|
|
|
//本月
|
|
|
qvo.setStartDate(DateUtil.getFirstMonthDay());
|
|
|
qvo.setEndDate(DateUtil.getLastMonthDay());
|
|
|
if (StringUtils.isBlank(qvo.getStartDate())) {
|
|
|
//本月
|
|
|
qvo.setStartDate(DateUtil.getFirstMonthDay());
|
|
|
qvo.setEndDate(DateUtil.getLastMonthDay());
|
|
|
}
|
|
|
} else if (qvo.getFlag() == 2) {
|
|
|
//近半年
|
|
|
qvo.setStartDate(DateUtil.getMonthDate(new Date(), -6));
|
|
|
qvo.setEndDate(DateUtil.getStringDateShort());
|
|
|
if (StringUtils.isBlank(qvo.getStartDate())) {
|
|
|
//近半年
|
|
|
qvo.setStartDate(DateUtil.getMonthDate(new Date(), -6));
|
|
|
qvo.setEndDate(DateUtil.getStringDateShort());
|
|
|
}
|
|
|
} else if (qvo.getFlag() == 3) {
|
|
|
//全年
|
|
|
qvo.setStartDate(DateUtil.getCurrentYearStartTime());
|
|
|
qvo.setEndDate(DateUtil.getCurrentYearEndTime());
|
|
|
if (StringUtils.isBlank(qvo.getStartDate())) {
|
|
|
//全年
|
|
|
qvo.setStartDate(DateUtil.getCurrentYearStartTime());
|
|
|
qvo.setEndDate(DateUtil.getCurrentYearEndTime());
|
|
|
}
|
|
|
}
|
|
|
//查科室
|
|
|
if ("4".equals(String.valueOf(qvo.getLevel()))) {
|
|
@ -6498,23 +6510,30 @@ public class StatisticsEsService {
|
|
|
//数据转换
|
|
|
List<Map<String, Object>> list = mergeAndSortLists(listOfLists, "2");
|
|
|
//过滤科室和医生
|
|
|
if (StringUtils.isNotBlank(qvo.getDeptCode()) || StringUtils.isNotBlank(qvo.getDeptName())) {
|
|
|
if (StringUtils.isNotBlank(qvo.getDeptCode()) || StringUtils.isNotBlank(qvo.getDoctorName())) {
|
|
|
List<Map<String, Object>> filterDoctortList = new ArrayList<>();
|
|
|
|
|
|
if (StringUtils.isNotBlank(qvo.getDeptCode()) && StringUtils.isNotBlank(qvo.getDoctorName())) {
|
|
|
//科室
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if (qvo.getDeptCode().equals(map.get("deptCode").toString())) {
|
|
|
filterDoctortList.add(map);
|
|
|
//医生
|
|
|
if (map.get("doctorName").toString().contains(qvo.getDoctorName())) {
|
|
|
filterDoctortList.add(map);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//医生
|
|
|
for (Map<String, Object> map : filterDoctortList) {
|
|
|
if (map.get("doctorName").toString().contains(qvo.getDoctorName())) {
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(qvo.getDeptCode()) && StringUtils.isBlank(qvo.getDoctorName())) {
|
|
|
//科室
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if (qvo.getDeptCode().equals(map.get("deptCode").toString())) {
|
|
|
filterDoctortList.add(map);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isBlank(qvo.getDeptCode()) && StringUtils.isNotBlank(qvo.getDoctorName())) {
|
|
|
//医生
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if (map.get("doctorName").toString().contains(qvo.getDoctorName())) {
|
|
|
filterDoctortList.add(map);
|
|
@ -6523,9 +6542,10 @@ public class StatisticsEsService {
|
|
|
}
|
|
|
result.put("resultList", filterDoctortList);
|
|
|
result.put("resultListSize", filterDoctortList.size());
|
|
|
} else {
|
|
|
result.put("resultList", list);
|
|
|
result.put("resultListSize", list.size());
|
|
|
}
|
|
|
result.put("resultList", list);
|
|
|
result.put("resultListSize", list.size());
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@ -7368,8 +7388,8 @@ public class StatisticsEsService {
|
|
|
return todayFree;
|
|
|
}, execute);
|
|
|
CompletableFuture.allOf(future01, future02, future03, future04).get();
|
|
|
SaveModel model01 = future01.get();
|
|
|
SaveModel model02 = future02.get();
|
|
|
SaveModel model01 = future01.get();//处方费
|
|
|
SaveModel model02 = future02.get(); //检查费
|
|
|
SaveModel monthModel = future03.get();
|
|
|
String todayFree = future04.get();
|
|
|
long checkFree = 0;
|
|
@ -7383,8 +7403,8 @@ public class StatisticsEsService {
|
|
|
}
|
|
|
allCount = prescriptionFee + checkFree;
|
|
|
|
|
|
resultMap.put("checkFree", checkFree);//处方费
|
|
|
resultMap.put("prescriptionFee", prescriptionFee);//检查费
|
|
|
resultMap.put("checkFree", checkFree);//检查费
|
|
|
resultMap.put("prescriptionFee", prescriptionFee);//处方费
|
|
|
resultMap.put("allCount", allCount);//总费用
|
|
|
if (allCount == 0) {
|
|
|
resultMap.put("avgFree", 0);
|
|
@ -7452,43 +7472,48 @@ public class StatisticsEsService {
|
|
|
public List<Map<String, Object>> getPatientBehavior() throws ExecutionException, InterruptedException {
|
|
|
String sql01 = "SELECT q.*,CONCAT('患者',q.patientName,'发起了',q.title)'description' FROM (\n" +
|
|
|
" SELECT\n" +
|
|
|
" patient_name 'patientName',\n" +
|
|
|
" b.id 'patientId', a.patient_name 'patientName', b.idcard, b.ssc,b.mobile,\n" +
|
|
|
" b.birthday,TIMESTAMPDIFF(YEAR, b.birthday, CURDATE()) AS age, b.address,\n" +
|
|
|
" CASE \n" +
|
|
|
" WHEN outpatient_type='1' THEN '在线复诊'\n" +
|
|
|
" WHEN outpatient_type='2' THEN '协同门诊'\n" +
|
|
|
" WHEN outpatient_type='3' AND type='1' THEN '图文咨询'\n" +
|
|
|
" WHEN outpatient_type='3' AND type='2' THEN '视频咨询'\n" +
|
|
|
" WHEN a.outpatient_type='1' THEN '在线复诊'\n" +
|
|
|
" WHEN a.outpatient_type='2' THEN '协同门诊'\n" +
|
|
|
" WHEN a.outpatient_type='3' AND a.type='1' THEN '图文咨询'\n" +
|
|
|
" WHEN a.outpatient_type='3' AND a.type='2' THEN '视频咨询'\n" +
|
|
|
" END 'title',\n" +
|
|
|
" DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%S') 'createTime'\n" +
|
|
|
" DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%S') 'createTime'\n" +
|
|
|
" FROM\n" +
|
|
|
" wlyy_outpatient \n" +
|
|
|
" wlyy_outpatient a INNER JOIN base_patient b ON a.patient=b.id\n" +
|
|
|
" WHERE\n" +
|
|
|
" 1 = 1 \n" +
|
|
|
" AND pay_status IN ( '1', '2' )\n" +
|
|
|
" ORDER BY create_time DESC LIMIT 5\n" +
|
|
|
" AND a.pay_status IN ( '1', '2' )\n" +
|
|
|
" ORDER BY a.create_time DESC LIMIT 5\n" +
|
|
|
")q";
|
|
|
|
|
|
|
|
|
String sql02 = "SELECT q.*,CONCAT('患者',q.patientName,'购药成功了')'description' FROM (\n" +
|
|
|
" SELECT\n" +
|
|
|
" patient_name 'patientName',\n" +
|
|
|
" b.id 'patientId', a.patient_name 'patientName', b.idcard, b.ssc,b.mobile,\n" +
|
|
|
" b.birthday,TIMESTAMPDIFF(YEAR, b.birthday, CURDATE()) AS age, b.address,\n" +
|
|
|
" CASE \n" +
|
|
|
" WHEN `status`='30' THEN '购药成功'\n" +
|
|
|
" END 'title',\n" +
|
|
|
" DATE_FORMAT( create_time, '%Y-%m-%d %H:%i:%S' ) 'createTime' \n" +
|
|
|
" DATE_FORMAT( a.create_time, '%Y-%m-%d %H:%i:%S' ) 'createTime' \n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_prescription \n" +
|
|
|
" wlyy_prescription a INNER JOIN base_patient b ON a.patient_code=b.id\n" +
|
|
|
"WHERE\n" +
|
|
|
" `status` = '30' ORDER BY create_time DESC LIMIT 5\n" +
|
|
|
")q";
|
|
|
" a.`status` = '30' ORDER BY a.create_time DESC LIMIT 5\n" +
|
|
|
")q;";
|
|
|
|
|
|
String sql03 = "SELECT q.*,CONCAT('患者',q.patientName,'出院转',q.title,'诊后管理') 'description' FROM (\n" +
|
|
|
" SELECT\n" +
|
|
|
" `name` 'patientName',disease_name 'title',DATE_FORMAT( create_time, '%Y-%m-%d %H:%i:%S' ) 'createTime' \n" +
|
|
|
" b.id 'patientId', a.`name` 'patientName', b.idcard, b.ssc,b.mobile,\n" +
|
|
|
" b.birthday,TIMESTAMPDIFF(YEAR, b.birthday, CURDATE()) AS age, b.address,\n" +
|
|
|
" \n" +
|
|
|
" a.disease_name 'title',DATE_FORMAT( a.create_time, '%Y-%m-%d %H:%i:%S' ) 'createTime' \n" +
|
|
|
"FROM\n" +
|
|
|
" wlyy_patient_rehabilitation_plan \n" +
|
|
|
" wlyy_patient_rehabilitation_plan a INNER JOIN base_patient b ON a.patient=b.id\n" +
|
|
|
"ORDER BY\n" +
|
|
|
" create_time DESC \n" +
|
|
|
" a.create_time DESC \n" +
|
|
|
" LIMIT 5\n" +
|
|
|
")q";
|
|
|
CompletableFuture<List<Map<String, Object>>> future01 = CompletableFuture.supplyAsync(() -> {
|
|
@ -7725,10 +7750,10 @@ public class StatisticsEsService {
|
|
|
* 查询用户基本信息
|
|
|
*/
|
|
|
public Map<String, Object> getPatientInfo(ScreenQvo qvo) {
|
|
|
String sql="SELECT id 'patientId',`name` 'patientName',idcard,ssc,birthday, TIMESTAMPDIFF(YEAR, birthday, CURDATE()) AS age ,mobile,address,phone \n" +
|
|
|
"FROM base_patient WHERE idcard='"+qvo.getIdcard()+"' AND del='1'";
|
|
|
String sql = "SELECT id 'patientId',`name` 'patientName',idcard,ssc,birthday, TIMESTAMPDIFF(YEAR, birthday, CURDATE()) AS age ,mobile,address,phone \n" +
|
|
|
"FROM base_patient WHERE idcard='" + qvo.getIdcard() + "' AND del='1'";
|
|
|
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
if (!list.isEmpty()){
|
|
|
if (!list.isEmpty()) {
|
|
|
return list.get(0);
|
|
|
}
|
|
|
return null;
|
|
@ -7748,10 +7773,28 @@ public class StatisticsEsService {
|
|
|
* 调用i健康就诊情况
|
|
|
*/
|
|
|
public JSONObject getEventByIjk(ScreenQvo qvo) {
|
|
|
String param = "?&idcard=" + qvo.getIdcard() + "ssc=" + qvo.getSsc() + "&type=1&page=1&pageSize=100";
|
|
|
String param = "?idcard=" + qvo.getIdcard() + "ssc=" + qvo.getSsc() + "&type=1&page=1&pageSize=100";
|
|
|
JSONObject re = wlyyHttpService.sendWlyyMesGet("getEventList", param);
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取i健康的健康设备
|
|
|
*/
|
|
|
public JSONObject getHealthDeviceByIjk(ScreenQvo qvo) {
|
|
|
String param = "?idcard=" + qvo.getIdcard();
|
|
|
JSONObject re = wlyyHttpService.sendWlyyMesGet("healthDevice", param);
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取i健康的患者的健康指标数据
|
|
|
*/
|
|
|
public JSONObject getHealthChart(ScreenQvo qvo) {
|
|
|
String param = "?idcard=" + qvo.getIdcard() + "&type=" + qvo.getType() + "&gi_type="+qvo.getIndex() + "&time=" + qvo.getTime() + "&begin=" + qvo.getStartDate() + "&end=" + qvo.getEndDate();
|
|
|
JSONObject re = wlyyHttpService.sendWlyyMesGet("chart", param);
|
|
|
return re;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|