|
@ -12,10 +12,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
import com.yihu.jw.entity.base.org.BaseOrgDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.patient.BasePatientDO;
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageDO;
|
|
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
|
|
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO;
|
|
|
|
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
|
|
|
|
|
|
import com.yihu.jw.entity.base.servicePackage.*;
|
|
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
|
|
import com.yihu.jw.entity.care.apply.PatientBedApplyDo;
|
|
import com.yihu.jw.entity.care.archive.ArchiveDO;
|
|
import com.yihu.jw.entity.care.archive.ArchiveDO;
|
|
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
|
|
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
|
|
@ -84,6 +81,8 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
private DictService dictService;
|
|
private DictService dictService;
|
|
@Autowired
|
|
@Autowired
|
|
private DeviceService deviceService;
|
|
private DeviceService deviceService;
|
|
|
|
@Autowired
|
|
|
|
private BasePatientHelperDao patientHelperDao;
|
|
|
|
|
|
|
|
|
|
public void addPatientSignList(){
|
|
public void addPatientSignList(){
|
|
@ -218,7 +217,6 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
if (StringUtils.isNotBlank(name)){
|
|
if (StringUtils.isNotBlank(name)){
|
|
sql += " and o.name like '%"+name+"%' ";
|
|
sql += " and o.name like '%"+name+"%' ";
|
|
}
|
|
}
|
|
//type =4 新生儿
|
|
|
|
|
|
|
|
List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
|
|
List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
|
|
return list;
|
|
return list;
|
|
@ -294,7 +292,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据签约记录查找医生/助老员
|
|
|
|
|
|
* 根据签约记录查找医生/社工
|
|
* @param signId
|
|
* @param signId
|
|
*/
|
|
*/
|
|
public List<Map<String,Object>> fingdDoctorBySignId(String signId,Integer level){
|
|
public List<Map<String,Object>> fingdDoctorBySignId(String signId,Integer level){
|
|
@ -395,7 +393,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 获取医生签约总数
|
|
|
|
|
|
* 获取社工签约总数
|
|
* @param doctorId
|
|
* @param doctorId
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@ -665,7 +663,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
|
|
|
|
public List<Map<String,Object>> getServerDoctorAll(String patient,String onlineFlag,String doctorLevel){
|
|
public List<Map<String,Object>> getServerDoctorAll(String patient,String onlineFlag,String doctorLevel){
|
|
String sql="SELECT DISTINCT doc.id doctor,doc.name as doctorName,doc.sex,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 " +
|
|
String sql="SELECT DISTINCT doc.id doctor,doc.name as doctorName,doc.sex,CONCAT(doc.`name`,CASE WHEN doc.doctor_level=1 " +
|
|
" THEN '(社区医生)' ELSE '(社工)' END) as name,doc.photo,doc.mobile,doc.job_title_name as jobName,doc.job_title_code as job, " +
|
|
|
|
|
|
" THEN '(社区医生)' ELSE '(社工)' END) as name,doc.photo,doc.doctor_level as level,doc.mobile,doc.job_title_name as jobName,doc.job_title_code as job, " +
|
|
" 0 as onLineFlag,org.code,org.name as orgName ,doc.doctor_level doctorLevel " +
|
|
" 0 as onLineFlag,org.code,org.name as orgName ,doc.doctor_level doctorLevel " +
|
|
"from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor doc, " +
|
|
"from base_service_package_sign_record sr,base_service_package_record r,base_team_member m,base_doctor doc, " +
|
|
"base_service_package pack,base_org org " +
|
|
"base_service_package pack,base_org org " +
|
|
@ -744,7 +742,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
" base_service_package p " +
|
|
" base_service_package p " +
|
|
"WHERE " +
|
|
"WHERE " +
|
|
" sr.id = r.sign_id and r.service_package_id = p.id " +
|
|
" sr.id = r.sign_id and r.service_package_id = p.id " +
|
|
"AND sr.patient = '"+patient+"' ORDER BY sr.create_time desc";
|
|
|
|
|
|
"AND sr.patient = '"+patient+"' ORDER BY sr.create_time,p.id desc";
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
String doctorSql = "SELECT d.name from base_team_member t,base_doctor d WHERE t.team_code = ? and t.doctor_code = d.id and d.del = 1 and t.del =1";
|
|
String doctorSql = "SELECT d.name from base_team_member t,base_doctor d WHERE t.team_code = ? and t.doctor_code = d.id and d.del = 1 and t.del =1";
|
|
for(Map<String,Object> map:list){
|
|
for(Map<String,Object> map:list){
|
|
@ -830,7 +828,7 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
|
|
filters += " and (p.name like '%"+name+"%' or p.idcard like '%"+name+"%') ";
|
|
}
|
|
}
|
|
filters += paitentFilter;
|
|
filters += paitentFilter;
|
|
String orderBy = " ORDER BY sr.create_time DESC " +
|
|
|
|
|
|
String orderBy = " ORDER BY sr.create_time,p.id DESC " +
|
|
"LIMIT "+ (page - 1) * size + "," + size;
|
|
"LIMIT "+ (page - 1) * size + "," + size;
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql+filters+orderBy);
|
|
for (Map<String,Object> map : list){
|
|
for (Map<String,Object> map : list){
|
|
@ -846,4 +844,97 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
|
|
Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
|
|
Long count = jdbcTemplate.queryForObject(countSql+filters,Long.class);
|
|
return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
|
|
return PageEnvelop.getSuccessListWithPage("success",list,page,size,count);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************助老员部分***************************************************************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
*助老员添加监护角色
|
|
|
|
*/
|
|
|
|
public JSONObject helperAddPatient(String patient,String doctor){
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
BasePatientHelperDO patientHelperDO = patientHelperDao.findByPatientAndDoctor(patient,doctor);
|
|
|
|
if (null!=patientHelperDO){
|
|
|
|
result.put(ResponseContant.resultFlag,-1);
|
|
|
|
result.put(ResponseContant.resultMsg,"居民已存在,无需重复添加");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
BasePatientDO patientDO = patientDao.findById(patient);
|
|
|
|
if (null==patientDO){
|
|
|
|
result.put(ResponseContant.resultFlag,-1);
|
|
|
|
result.put(ResponseContant.resultMsg,"添加居民不存在,无法操作");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(doctor);
|
|
|
|
if (null==doctorDO){
|
|
|
|
result.put(ResponseContant.resultFlag,-1);
|
|
|
|
result.put(ResponseContant.resultMsg,"助老员不存在,无法操作");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
//只有存在签约的居民才可被助老员关联
|
|
|
|
String sql = " SELECT count(DISTINCT p.id) " +
|
|
|
|
"from wlyy_archive a,base_patient p WHERE a.patient = p.id and a.sign_status = 1 and EXISTS( " +
|
|
|
|
"SELECT 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.patient = a.patient and sr.status=1 and r.service_package_id = i.service_package_id " +
|
|
|
|
"and i.del = 1 and m.team_code = r.team_code " +
|
|
|
|
"and p.id='"+patient+"' ) ";
|
|
|
|
Integer signFlag = jdbcTemplate.queryForObject(sql,Integer.class);
|
|
|
|
if (signFlag==0){
|
|
|
|
result.put(ResponseContant.resultFlag,-1);
|
|
|
|
result.put(ResponseContant.resultMsg,"当前居民未与社工签约,无法添加");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
patientHelperDO = new BasePatientHelperDO();
|
|
|
|
patientHelperDO.setPatient(patient);
|
|
|
|
patientHelperDO.setPatientName(patientDO.getName());
|
|
|
|
patientHelperDO.setDoctor(doctor);
|
|
|
|
patientHelperDO.setDoctorName(doctorDO.getName());
|
|
|
|
patientHelperDO.setCreateTime(new Date());
|
|
|
|
patientHelperDO.setCreateUser(doctor);
|
|
|
|
patientHelperDO.setDel("1");
|
|
|
|
patientHelperDO.setCreateUserName(doctorDO.getName());
|
|
|
|
patientHelperDao.save(patientHelperDO);
|
|
|
|
result.put(ResponseContant.resultFlag,200);
|
|
|
|
result.put(ResponseContant.resultMsg,"添加成功");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 助老员删除监护老人
|
|
|
|
*/
|
|
|
|
public JSONObject helperDelPatient(String patient,String doctor){
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
BasePatientHelperDO patientHelperDO = patientHelperDao.findByPatientAndDoctor(patient,doctor);
|
|
|
|
if (null==patientHelperDO){
|
|
|
|
result.put(ResponseContant.resultFlag,-1);
|
|
|
|
result.put(ResponseContant.resultMsg,"居民已不在你的列表中");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
BaseDoctorDO doctorDO = doctorDao.findById(doctor);
|
|
|
|
if (null==doctorDO){
|
|
|
|
result.put(ResponseContant.resultFlag,-1);
|
|
|
|
result.put(ResponseContant.resultMsg,"助老员不存在,无法操作");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
patientHelperDO.setDel("0");
|
|
|
|
patientHelperDO.setUpdateTime(new Date());
|
|
|
|
patientHelperDO.setUpdateUser(doctorDO.getId());
|
|
|
|
patientHelperDO.setUpdateUserName(doctorDO.getName());
|
|
|
|
result.put(ResponseContant.resultFlag,200);
|
|
|
|
result.put(ResponseContant.resultMsg,"删除成功");
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************助老员部分******************************************************/
|
|
|
|
/**
|
|
|
|
* 根据居民和服务项查找医生
|
|
|
|
* @param patientId
|
|
|
|
*/
|
|
|
|
public List<Map<String,Object>> findHelperByPatientId(String patientId){
|
|
|
|
String sql = " select distinct doc.id,doc.name from base_patient_helper ph INNER JOIN base_doctor doc " +
|
|
|
|
" on ph.doctor = doc.id where ph.del=1 and ph.patient='"+patientId+"' and doc.del=1 " ;
|
|
|
|
return jdbcTemplate.queryForList(sql);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|