|
@ -2,18 +2,21 @@ package com.yihu.jw.care.service.doctor;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.jw.care.dao.doorCoach.BaseDoorCoachOrderDao;
|
|
|
import com.yihu.jw.care.service.birthday.BirthdayWishesService;
|
|
|
import com.yihu.jw.care.service.device.DeviceService;
|
|
|
import com.yihu.jw.care.service.role.RoleService;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
|
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
|
|
|
import com.yihu.jw.doctor.dao.DoctorSpecialDiseaseDao;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
|
|
|
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
|
|
|
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
|
|
|
import com.yihu.jw.im.service.ImService;
|
|
|
import com.yihu.jw.org.dao.BaseOrgDao;
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
import com.yihu.jw.util.common.IdCardUtil;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.StringUtil;
|
|
|
import com.yihu.mysql.query.BaseJpaService;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
@ -24,10 +27,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Created by yeshijie on 2021/3/3.
|
|
@ -60,6 +60,8 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
private ImService imService;
|
|
|
@Autowired
|
|
|
private DeviceService deviceService;
|
|
|
@Autowired
|
|
|
private BirthdayWishesService birthdayWishesService;
|
|
|
|
|
|
/**
|
|
|
* 获取医生简单详情
|
|
@ -76,7 +78,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
String sql1 = "SELECT COUNT(DISTINCT sr.patient) FROM " +
|
|
|
" base_service_package_sign_record sr, base_service_package_record r, base_service_package_item i, base_team_member m " +
|
|
|
" WHERE sr.id = r.sign_id and sr.status=1 AND r.service_package_id = i.service_package_id " +
|
|
|
" AND i.del = 1 and m.team_code = i.team_code " +
|
|
|
" AND i.del = 1 and m.team_code = r.team_code " +
|
|
|
" and m.del = '1' and m.doctor_code = '"+doctorId+"'";
|
|
|
Integer signNum = jdbcTemplate.queryForObject(sql1,Integer.class);
|
|
|
String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
|
|
@ -547,4 +549,57 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
|
|
|
|
|
|
}
|
|
|
|
|
|
public JSONObject baseInfoCount(String doctor){
|
|
|
JSONObject result = new JSONObject();
|
|
|
result.put("lifeCare",0);
|
|
|
result.put("emergencyAssistance",0);
|
|
|
result.put("patientCare",0);//人文关怀
|
|
|
result.put("security",0);
|
|
|
List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
|
|
|
String hospital = doctorHospitalDOs.get(0).getOrgCode();
|
|
|
//生活照料
|
|
|
String countSql = "SELECT " +
|
|
|
" count(o.id) " +
|
|
|
" FROM " +
|
|
|
" base_life_care_order o " +
|
|
|
" LEFT JOIN base_patient p ON o.patient = p.id " +
|
|
|
" WHERE " +
|
|
|
" o.hospital = 'hospital' "+
|
|
|
" AND o.status = 1 and o.pay_status>0 ";
|
|
|
Long count = jdbcTemplate.queryForObject(countSql,Long.class);
|
|
|
if (count>0){
|
|
|
result.put("lifeCare",count);
|
|
|
}
|
|
|
//紧急救助
|
|
|
countSql = " select count(ord.id) count from base_emergency_assistance_order ord where ord.status=1 " +
|
|
|
"AND EXISTS (SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
" base_service_package_item i ,base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and " +
|
|
|
" sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and m.team_code = r.team_code " +
|
|
|
" and i.del = 1 and sr.`status`=1 and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
|
|
|
count = jdbcTemplate.queryForObject(countSql,Long.class);
|
|
|
if (count>0){
|
|
|
result.put("emergencyAssistance",count);
|
|
|
}
|
|
|
//安防工单
|
|
|
countSql = " select count(ord.id) count from base_security_monitoring_order ord where ord.status=1 " +
|
|
|
"AND EXISTS (SELECT sr.patient from base_service_package_sign_record sr,base_service_package_record r, " +
|
|
|
" base_service_package_item i ,base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and " +
|
|
|
" sr.id = r.sign_id and sr.status=1 and r.service_package_id = i.service_package_id and m.team_code = r.team_code " +
|
|
|
" and i.del = 1 and sr.`status`=1 and i.topic_item='security' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
|
|
|
count = jdbcTemplate.queryForObject(countSql,Long.class);
|
|
|
if (count>0){
|
|
|
result.put("security",count);
|
|
|
}
|
|
|
//人文关怀
|
|
|
try {
|
|
|
Integer counts = birthdayWishesService.getPatientByDoctorCount(doctor);
|
|
|
if (count>0){
|
|
|
result.put("patientCare",count);
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|