|
@ -1866,7 +1866,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"patient.photo AS photo," +
|
|
|
"patient.birthday AS birthday," +
|
|
|
"room.consult_type AS consult_type," +
|
|
|
"room.reservation_time AS time," +
|
|
|
"date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
|
|
|
"outpatient.disease_img AS disease_img," +
|
|
|
"outpatient.description AS description," +
|
|
|
"outpatient.origin_con_no AS origin_con_no " +
|
|
@ -1948,20 +1948,133 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> findClinicRoomList(String dept) {
|
|
|
public List<JSONObject> findClinicRoomList(String dept,String date) {
|
|
|
if(StringUtils.isBlank(date)){
|
|
|
date = DateUtil.getStringDateShort();
|
|
|
}
|
|
|
|
|
|
String sql ="SELECT " +
|
|
|
"id," +
|
|
|
"doctor_name," +
|
|
|
"clinic_status AS visit_status," +
|
|
|
"patient_name AS patient_name," +
|
|
|
"waiting_count AS waiting_count," +
|
|
|
"room_name AS room_name " +
|
|
|
"FROM wlyy_doctor_clinic_room ";
|
|
|
//获取今天的排班列表
|
|
|
String doctorsql ="SELECT doctor,doctor_name FROM wlyy_doctor_work_time WHERE date='"+date+"' GROUP BY doctor";
|
|
|
|
|
|
List<Map<String,Object>> doctorlist = jdbcTemplate.queryForList(doctorsql);
|
|
|
|
|
|
HashMap<String ,JSONObject> result = new HashMap<>();
|
|
|
|
|
|
for (int i = 0; i < doctorlist.size(); i++) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("id",(String)doctorlist.get(0).get("doctor"));
|
|
|
|
|
|
if(StringUtils.isNoneBlank((String)doctorlist.get(0).get("doctor_name"))){
|
|
|
jsonObject.put("doctor_name",(String)doctorlist.get(0).get("doctor_name"));
|
|
|
}else{
|
|
|
jsonObject.put("doctor_name","");
|
|
|
}
|
|
|
jsonObject.put("visit_status",0);
|
|
|
jsonObject.put("waiting_count",0);
|
|
|
jsonObject.put("patient_name","");
|
|
|
jsonObject.put("time_cost",0);
|
|
|
result.put((String)doctorlist.get(0).get("doctor"),jsonObject);
|
|
|
}
|
|
|
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
//获取预约了今天的候诊居民
|
|
|
String waitingSql ="SELECT count(op.id) AS waitCount," +
|
|
|
"room.doctor AS doctor, " +
|
|
|
"room.doctor_name AS doctorName " +
|
|
|
"FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
|
|
|
"WHERE op.`status`=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
|
|
|
"AND room.doctor IS NOT NULL " +
|
|
|
"AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor; ";
|
|
|
|
|
|
List<Map<String,Object>> waitinglist = jdbcTemplate.queryForList(waitingSql);
|
|
|
if(waitinglist!=null&&waitinglist.size()>0){
|
|
|
//根据身份证计算年龄
|
|
|
for(Map<String,Object> waitObj :waitinglist){
|
|
|
String doctor = (String) waitObj.get("doctor");
|
|
|
if(StringUtils.isNoneBlank(doctor)){
|
|
|
Long waitCount = (Long) waitObj.get("waitCount");
|
|
|
if(result.keySet().contains(doctor)){
|
|
|
result.get(doctor).put("waiting_count",waitCount);
|
|
|
}else{
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("id",doctor);
|
|
|
jsonObject.put("visit_status",0);
|
|
|
jsonObject.put("waiting_count",waitCount);
|
|
|
if(StringUtils.isNoneBlank((String)waitObj.get("doctorName"))){
|
|
|
jsonObject.put("doctor_name",(String)waitObj.get("doctorName"));
|
|
|
}else{
|
|
|
jsonObject.put("doctor_name","");
|
|
|
}
|
|
|
jsonObject.put("patient_name","");
|
|
|
jsonObject.put("time_cost",0);
|
|
|
result.put(doctor,jsonObject);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return list;
|
|
|
//获取进行中的居民
|
|
|
String onlineSql ="SELECT " +
|
|
|
"room.outpatient_id AS id," +
|
|
|
"room.patient_id AS patient_id," +
|
|
|
"room.patient_name AS patient_name," +
|
|
|
"patient.sex AS sex," +
|
|
|
"patient.idcard AS idcard," +
|
|
|
"patient.photo AS photo," +
|
|
|
"patient.birthday AS birthday," +
|
|
|
"room.consult_type AS consult_type," +
|
|
|
"date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
|
|
|
"TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS time_cost," +
|
|
|
"room.doctor AS doctor, " +
|
|
|
"room.doctor_name AS doctorName " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"base_patient patient," +
|
|
|
"wlyy_outpatient outpatient," +
|
|
|
"wlyy_consult_team consult " +
|
|
|
"WHERE " +
|
|
|
"room.patient_id=patient.id " +
|
|
|
"AND room.outpatient_id=outpatient.id " +
|
|
|
"AND consult.relation_code=outpatient.id " +
|
|
|
"AND consult.status=0 " +
|
|
|
"AND room.consult_type=2 " +
|
|
|
"AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' " +
|
|
|
"GROUP BY room.doctor";
|
|
|
List<Map<String,Object>> onlinelist = jdbcTemplate.queryForList(onlineSql);
|
|
|
if(waitinglist!=null&&waitinglist.size()>0){
|
|
|
//根据身份证计算年龄
|
|
|
for(Map<String,Object> onlineObj :onlinelist){
|
|
|
String doctor = (String) onlineObj.get("doctor");
|
|
|
if(StringUtils.isNoneBlank(doctor)){
|
|
|
if(result.keySet().contains(doctor)){
|
|
|
result.get(doctor).put("visit_status",1);
|
|
|
result.get(doctor).put("patient_name",(String) onlineObj.get("patient_name"));
|
|
|
result.get(doctor).put("time_cost",(Long) onlineObj.get("time_cost"));
|
|
|
}else{
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("id",doctor);
|
|
|
|
|
|
if(StringUtils.isNoneBlank((String) onlineObj.get("doctorName"))){
|
|
|
jsonObject.put("doctor_name",(String) onlineObj.get("doctorName"));
|
|
|
}else{
|
|
|
jsonObject.put("doctor_name","");
|
|
|
}
|
|
|
jsonObject.put("visit_status",1);
|
|
|
jsonObject.put("waiting_count",0);
|
|
|
jsonObject.put("patient_name",(String) onlineObj.get("patient_name"));
|
|
|
jsonObject.put("time_cost",(Long) onlineObj.get("time_cost"));
|
|
|
result.put(doctor,jsonObject);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<JSONObject> finalresult = new ArrayList<>();
|
|
|
|
|
|
for (JSONObject jsonObject : result.values()) {
|
|
|
finalresult.add(jsonObject);
|
|
|
}
|
|
|
|
|
|
return finalresult;
|
|
|
}
|
|
|
|
|
|
public WlyyDoctorClinicRoomDO findClinicRoomStatus(String id) {
|
|
@ -2029,7 +2142,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
" FROM " +
|
|
|
" base_doctor d " +
|
|
|
" JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
|
|
|
" Left join ( select count(id) as total,doctor from wlyy_consult_team GROUP BY doctor ) a on a.doctor = d.id ";
|
|
|
" Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 2 GROUP BY doctor ) a on a.doctor = d.id ";
|
|
|
|
|
|
if(StringUtils.isNotBlank(workingTime)){
|
|
|
sql+=" JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
|
|
@ -2331,7 +2444,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"patient.photo AS photo," +
|
|
|
"patient.birthday AS birthday," +
|
|
|
"room.consult_type AS consult_type," +
|
|
|
"room.reservation_time AS time," +
|
|
|
"date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
|
|
|
"room.reservation_type AS reservation_type," +
|
|
|
"outpatient.disease_img AS disease_img," +
|
|
|
"outpatient.description AS description," +
|
|
@ -2346,7 +2459,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"room.patient_id=patient.id " +
|
|
|
"AND room.outpatient_id=outpatient.id " +
|
|
|
"AND consult.relation_code=outpatient.id " +
|
|
|
"AND outpatient.status = 1 " +
|
|
|
"AND consult.status = 0 " +
|
|
|
"AND room.doctor='"+doctor+"' " +
|
|
|
"AND room.consult_type= 2";
|
|
|
|
|
@ -2377,7 +2490,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
"patient.photo AS photo," +
|
|
|
"patient.birthday AS birthday," +
|
|
|
"room.consult_type AS consult_type," +
|
|
|
"room.reservation_time AS time," +
|
|
|
"date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
|
|
|
"date_format(room.reservation_time ,'%Y-%m-%d' ) AS group_date," +
|
|
|
"room.reservation_type AS reservation_type," +
|
|
|
"outpatient.disease_img AS disease_img," +
|
|
@ -2450,7 +2563,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
List<WlyyHospitalWaitingRoomDO> roomDOs =hospitalWaitingRoomDao.findByOutpatientId(outpatientCode);
|
|
|
if(roomDOs!=null&&roomDOs.size()>0){
|
|
|
for(WlyyHospitalWaitingRoomDO roomDO:roomDOs){
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
roomDO.setDoctor(doctor);
|
|
|
roomDO.setDoctorName(baseDoctorDO.getName());
|
|
|
hospitalWaitingRoomDao.save(roomDO);
|
|
|
}
|
|
|
}
|
|
@ -2461,43 +2576,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
* @param doctor
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONObject doctorIndexConsultCount(String doctor) {
|
|
|
public Long doctorIndexConsultCount(String doctor) {
|
|
|
|
|
|
//医生问诊量
|
|
|
List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctor(doctor);
|
|
|
|
|
|
Integer imgCount = 0;
|
|
|
|
|
|
Integer videoCount = 0;
|
|
|
|
|
|
for(WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOs){
|
|
|
//1.图文 2.视频
|
|
|
if("1".equals(wlyyOutpatientDO.getType())){
|
|
|
imgCount ++;
|
|
|
}else if("2".equals(wlyyOutpatientDO.getType())){
|
|
|
videoCount ++;
|
|
|
}else{
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String totalSql = "SELECT count(a.id) AS total " +
|
|
|
"FROM wlyy_consult a,wlyy_consult_team b " +
|
|
|
"WHERE a.id=b.consult AND b.doctor='"+doctor+"' AND a.type=1 AND b.`status`=0";
|
|
|
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
|
|
|
String sql ="SELECT " +
|
|
|
"count(room.outpatient_id) AS total " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"base_patient patient," +
|
|
|
"wlyy_outpatient outpatient, " +
|
|
|
"wlyy_consult_team consult " +
|
|
|
"WHERE " +
|
|
|
"room.patient_id=patient.id " +
|
|
|
"AND room.outpatient_id=outpatient.id " +
|
|
|
"AND consult.relation_code=outpatient.id " +
|
|
|
"AND consult.status = 0 " +
|
|
|
"AND room.doctor='"+doctor+"' " +
|
|
|
"AND room.consult_type= 2";
|
|
|
|
|
|
Long zjCount = 0L;
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
Long videoOnlineCount = 0l;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
zjCount = (Long) rstotal.get(0).get("total");
|
|
|
videoOnlineCount = (Long) rstotal.get(0).get("total");
|
|
|
}
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("imgCount",imgCount);
|
|
|
result.put("videoCount",videoCount);
|
|
|
result.put("zjCount",zjCount);
|
|
|
|
|
|
return result;
|
|
|
|
|
|
return videoOnlineCount;
|
|
|
|
|
|
}
|
|
|
|
|
@ -2566,4 +2670,34 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取候诊居民数量
|
|
|
* @param doctor
|
|
|
* @return
|
|
|
*/
|
|
|
public Long getWaitVideoCount(String doctor) {
|
|
|
String sql ="SELECT " +
|
|
|
"count(room.outpatient_id) AS total " +
|
|
|
"FROM " +
|
|
|
"wlyy_hospital_waiting_room room," +
|
|
|
"base_patient patient," +
|
|
|
"wlyy_outpatient outpatient " +
|
|
|
"WHERE " +
|
|
|
"room.patient_id=patient.id " +
|
|
|
"AND room.outpatient_id=outpatient.id " +
|
|
|
"AND outpatient.status = 0 " +
|
|
|
"AND room.doctor='"+doctor+"' " +
|
|
|
"AND room.reservation_time is not null " +
|
|
|
"AND room.consult_type= 2 ";
|
|
|
|
|
|
List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
Long waitVideoCount = 0l;
|
|
|
if (rstotal != null && rstotal.size() > 0) {
|
|
|
waitVideoCount = (Long) rstotal.get(0).get("total");
|
|
|
}
|
|
|
|
|
|
return waitVideoCount;
|
|
|
}
|
|
|
}
|