|
@ -40,13 +40,16 @@ import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.management.MXBean;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
import java.sql.SQLClientInfoException;
|
|
import java.sql.Timestamp;
|
|
import java.sql.Timestamp;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
@ -68,8 +71,6 @@ public class RehabilitationManageService {
|
|
@Autowired
|
|
@Autowired
|
|
private GuidanceMessageLogDao guidanceMessageLogDao;
|
|
private GuidanceMessageLogDao guidanceMessageLogDao;
|
|
@Autowired
|
|
@Autowired
|
|
private SpecialistPatientRelationDao specialistPatientRelationDao;
|
|
|
|
@Autowired
|
|
|
|
private RehabilitationOperateRecordsDao rehabilitationOperateRecordsDao;
|
|
private RehabilitationOperateRecordsDao rehabilitationOperateRecordsDao;
|
|
@Autowired
|
|
@Autowired
|
|
private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
|
|
private RehabilitationDetailAppointmentDao rehabilitationDetailAppointmentDao;
|
|
@ -183,7 +184,7 @@ public class RehabilitationManageService {
|
|
sql+=" and p.disease='"+diseaseCode+"'";
|
|
sql+=" and p.disease='"+diseaseCode+"'";
|
|
}
|
|
}
|
|
if(StringUtils.isNotEmpty(patientCondition)){//姓名idcard模糊查询
|
|
if(StringUtils.isNotEmpty(patientCondition)){//姓名idcard模糊查询
|
|
sql +=" AND EXISTS (select code from base_patient where `id` = p.patient and ( `name` LIKE '%"+patientCondition+"%' or idcard like '%"+patientCondition+"%') )";
|
|
|
|
|
|
sql +=" AND EXISTS (select id from base_patient where `id` = p.patient and ( `name` LIKE '%"+patientCondition+"%' or idcard like '%"+patientCondition+"%') )";
|
|
}
|
|
}
|
|
if (doctorType==1){
|
|
if (doctorType==1){
|
|
sql +=" AND (p.create_user = '"+doctorCode+"' \n" +
|
|
sql +=" AND (p.create_user = '"+doctorCode+"' \n" +
|
|
@ -272,8 +273,52 @@ public class RehabilitationManageService {
|
|
return MixEnvelop.getSuccessListWithPage(SpecialistMapping.api_success,resultList,page,pageSize,Long.valueOf(count));
|
|
return MixEnvelop.getSuccessListWithPage(SpecialistMapping.api_success,resultList,page,pageSize,Long.valueOf(count));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询康复计划
|
|
|
|
public MixEnvelop findPatientRehabilitation(String doctor,String diseaseCode,String patientCondition,Integer page,Integer pageSize){
|
|
|
|
String sql ="select DISTINCT t.* from wlyy_patient_rehabilitation_plan t left join base_patient b on t.patient=b.id" +
|
|
|
|
" left join wlyy_rehabilitation_plan_detail p on t.id=p.plan_id where 1=1";
|
|
|
|
String countSql="select count(1) as \"count\" from wlyy_patient_rehabilitation_plan t left join base_patient b on t.patient=b.id " +
|
|
|
|
" left join wlyy_rehabilitation_plan_detail p on t.id=p.plan_id where 1=1";
|
|
|
|
if (StringUtils.isNotBlank(doctor)){
|
|
|
|
sql+=" and (t.create_user='"+doctor+"' or p.doctor='"+doctor+"')";
|
|
|
|
countSql+=" and (t.create_user='"+doctor+"' or p.doctor='"+doctor+"')";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(diseaseCode)){
|
|
|
|
sql+=" and t.disease='"+diseaseCode+"'";
|
|
|
|
countSql+=" and t.disease='"+diseaseCode+"'";
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(patientCondition)){
|
|
|
|
sql+=" and (b.name like '%"+patientCondition+"%' or b.idcard like '%"+patientCondition+"%')";
|
|
|
|
countSql+=" and (b.name like '%"+patientCondition+"%' or b.idcard like '%"+patientCondition+"%')";
|
|
|
|
}
|
|
|
|
countSql+=" group by t.id";
|
|
|
|
sql+=" order by t.create_time desc";
|
|
|
|
List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
|
|
List<Map<String,Object>> countList = hibenateUtils.createSQLQuery(countSql);
|
|
|
|
Integer count=0;
|
|
|
|
if (countList!=null&&countList.size()>0){
|
|
|
|
count=Integer.parseInt(countList.get(0).get("count").toString());
|
|
|
|
}
|
|
|
|
MixEnvelop mixEnvelop= new MixEnvelop();
|
|
|
|
mixEnvelop.setTotalCount(count);
|
|
|
|
mixEnvelop.setDetailModelList(list);
|
|
|
|
mixEnvelop.setPageSize(pageSize);
|
|
|
|
mixEnvelop.setCurrPage(page);
|
|
|
|
return mixEnvelop;
|
|
|
|
}
|
|
|
|
//删除康复计划
|
|
|
|
public void delteRehabilitaionPlan(String planId,String doctorCode) throws Exception{
|
|
|
|
PatientRehabilitationPlanDO patientRehabilitationPlanDO = patientRehabilitationPlanDao.findById(planId);
|
|
|
|
if (patientRehabilitationPlanDO!=null){
|
|
|
|
if (!doctorCode.equalsIgnoreCase(patientRehabilitationPlanDO.getCreateUser())){
|
|
|
|
throw new Exception("当前医生非创建者不能删除");
|
|
|
|
}if (patientRehabilitationPlanDO.getStatus()>=1){
|
|
|
|
throw new Exception("开始的计划不能删除");
|
|
|
|
}
|
|
|
|
patientRehabilitationPlanDao.delete(patientRehabilitationPlanDO);
|
|
|
|
rehabilitationDetailDao.deleteDetailOnlyByPlanId(planId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 康复管理更多计划
|
|
* 康复管理更多计划
|
|
@ -1747,6 +1792,8 @@ public class RehabilitationManageService {
|
|
resultMap.put("specialistPatientRelationDO",doctorPatientRelationDO);
|
|
resultMap.put("specialistPatientRelationDO",doctorPatientRelationDO);
|
|
if (p!=null){
|
|
if (p!=null){
|
|
resultMap.put("disease",p.getDisease());
|
|
resultMap.put("disease",p.getDisease());
|
|
|
|
resultMap.put("planType",p.getPlanType());
|
|
|
|
resultMap.put("healthStatusCode",p.getHealthStatusCode());
|
|
resultMap.put("diseaseName",p.getDiseaseName());
|
|
resultMap.put("diseaseName",p.getDiseaseName());
|
|
resultMap.put("createUser",p.getCreateUser());
|
|
resultMap.put("createUser",p.getCreateUser());
|
|
resultMap.put("planTitle",p.getTitle());
|
|
resultMap.put("planTitle",p.getTitle());
|
|
@ -1764,6 +1811,11 @@ public class RehabilitationManageService {
|
|
resultMap.put("createUserDeptName",baseDoctorHospitalDO.get(0).getDeptName());
|
|
resultMap.put("createUserDeptName",baseDoctorHospitalDO.get(0).getDeptName());
|
|
}
|
|
}
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOTo = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
List<BaseDoctorHospitalDO> baseDoctorHospitalDOTo = baseDoctorHospitalDao.findByDoctorCode(doctor);
|
|
|
|
BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor);
|
|
|
|
if (baseDoctorDO!=null){
|
|
|
|
resultMap.put("photo",baseDoctorDO.getPhoto());
|
|
|
|
resultMap.put("jobTitle",baseDoctorDO.getJobTitleName());
|
|
|
|
}
|
|
if (baseDoctorHospitalDOTo!=null&&baseDoctorHospitalDOTo.size()>0){
|
|
if (baseDoctorHospitalDOTo!=null&&baseDoctorHospitalDOTo.size()>0){
|
|
resultMap.put("doctorName",doctorName);
|
|
resultMap.put("doctorName",doctorName);
|
|
resultMap.put("doctor",doctor);
|
|
resultMap.put("doctor",doctor);
|
|
@ -2099,7 +2151,7 @@ public class RehabilitationManageService {
|
|
|
|
|
|
@Transactional(propagation= Propagation.NOT_SUPPORTED)
|
|
@Transactional(propagation= Propagation.NOT_SUPPORTED)
|
|
public com.alibaba.fastjson.JSONArray selectPlanServerDoctor(String planId,String doctorCode) throws Exception{
|
|
public com.alibaba.fastjson.JSONArray selectPlanServerDoctor(String planId,String doctorCode) throws Exception{
|
|
String sql ="SELECT t.patient,t.create_user FROM wlyy_patient_rehabilitation_plan t where t.id='"+planId+"'";//专科
|
|
|
|
|
|
String sql ="SELECT distinct t.patient,t.create_user as create_user FROM wlyy_patient_rehabilitation_plan t left join wlyy_rehabilitation_plan_detail b on t.id = b.plan_id where t.id='"+planId+"'";//专科
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
|
|
com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
|
|
com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
|
|
String patient = "";
|
|
String patient = "";
|
|
@ -2679,7 +2731,7 @@ public class RehabilitationManageService {
|
|
" where 1=1 " ;
|
|
" where 1=1 " ;
|
|
|
|
|
|
if(StringUtils.isNoneBlank(patientInfo)){
|
|
if(StringUtils.isNoneBlank(patientInfo)){
|
|
sql +=" AND (p.idcard like '%"+patientInfo+"%' OR p.`name`like '%"+patientInfo+"%') ";
|
|
|
|
|
|
sql +=" AND (p.idcard like '%"+patientInfo+"%' OR p.`name`like '%"+patientInfo+"%' or d.doctor_name like '%"+patientInfo+"%') ";
|
|
}
|
|
}
|
|
if (doctorType.equalsIgnoreCase("1")){
|
|
if (doctorType.equalsIgnoreCase("1")){
|
|
sql +=" AND d.doctor = '"+doctor+"'";
|
|
sql +=" AND d.doctor = '"+doctor+"'";
|
|
@ -2698,7 +2750,7 @@ public class RehabilitationManageService {
|
|
sqlCondition +=" and pr.id IN (SELECT pds.specialist_relation_code FROM wlyy_patient_disease_server pds WHERE pds.del=1 and pds.disease ='"+disease+"')";
|
|
sqlCondition +=" and pr.id IN (SELECT pds.specialist_relation_code FROM wlyy_patient_disease_server pds WHERE pds.del=1 and pds.disease ='"+disease+"')";
|
|
}*/
|
|
}*/
|
|
//LIMIT+(page-1)*pageSize+","+pageSize
|
|
//LIMIT+(page-1)*pageSize+","+pageSize
|
|
sql += " ORDER BY p.create_time DESC ";
|
|
|
|
|
|
sql += " ORDER BY t.create_time DESC ";
|
|
List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql,page,pageSize);
|
|
System.out.println("mapList"+sql);
|
|
System.out.println("mapList"+sql);
|
|
for (Map<String,Object> map:mapList){
|
|
for (Map<String,Object> map:mapList){
|
|
@ -2882,7 +2934,7 @@ public class RehabilitationManageService {
|
|
{//康复咨询
|
|
{//康复咨询
|
|
//总康复咨询数量
|
|
//总康复咨询数量
|
|
String sqlTotal = "select count(*)\n" +
|
|
String sqlTotal = "select count(*)\n" +
|
|
"from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18";
|
|
|
|
|
|
"from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.doctor='"+doctorCode+"'";
|
|
Integer consultTotal = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
|
|
Integer consultTotal = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
|
|
/*String healthCount = "SELECT * FROM wlyy_patient_reservation WHERE incidental_msg_type = 0 AND source = 4 AND patient = '"+map.get("patient")+"' ORDER BY start_time DESC";
|
|
/*String healthCount = "SELECT * FROM wlyy_patient_reservation WHERE incidental_msg_type = 0 AND source = 4 AND patient = '"+map.get("patient")+"' ORDER BY start_time DESC";
|
|
List<Map<String , Object>> healthList = jdbcTemplate.queryForList(healthCount);
|
|
List<Map<String , Object>> healthList = jdbcTemplate.queryForList(healthCount);
|
|
@ -2890,12 +2942,12 @@ public class RehabilitationManageService {
|
|
map.put("total",consultTotal );
|
|
map.put("total",consultTotal );
|
|
//完成康复咨询数量
|
|
//完成康复咨询数量
|
|
sqlTotal = "select count(*)\n" +
|
|
sqlTotal = "select count(*)\n" +
|
|
"from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.`status`=1";
|
|
|
|
|
|
"from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.`status`=1 and b.doctor='"+doctorCode+"'";
|
|
consultTotal = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
|
|
consultTotal = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
|
|
map.put("compeletTotal",consultTotal );
|
|
map.put("compeletTotal",consultTotal );
|
|
//上次发起时间
|
|
//上次发起时间
|
|
String sqlTemp ="select a.czrq\n" +
|
|
String sqlTemp ="select a.czrq\n" +
|
|
"from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 order by a.czrq desc limit 1";
|
|
|
|
|
|
"from wlyy_consult a,wlyy_consult_team b where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.doctor='"+doctorCode+"' order by a.czrq desc limit 1";
|
|
List<Map<String,Object>> czrqMap = jdbcTemplate.queryForList(sqlTemp);
|
|
List<Map<String,Object>> czrqMap = jdbcTemplate.queryForList(sqlTemp);
|
|
if(czrqMap.size()!=0){
|
|
if(czrqMap.size()!=0){
|
|
if(czrqMap.get(0).get("czrq")!=null){
|
|
if(czrqMap.get(0).get("czrq")!=null){
|
|
@ -2911,7 +2963,7 @@ public class RehabilitationManageService {
|
|
"WHERE p.participant_id = d.id AND t.session_id = p.session_id AND t.session_id = s.id\n" +
|
|
"WHERE p.participant_id = d.id AND t.session_id = p.session_id AND t.session_id = s.id\n" +
|
|
"AND s.type =18 AND t.`reply` = 0 AND a.consult = t.id\n" +
|
|
"AND s.type =18 AND t.`reply` = 0 AND a.consult = t.id\n" +
|
|
"and a.id in( select b.id from wlyy_consult a,wlyy_consult_team b \n" +
|
|
"and a.id in( select b.id from wlyy_consult a,wlyy_consult_team b \n" +
|
|
"where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 )\n" +
|
|
|
|
|
|
"where a.id = b.consult and a.patient = '"+map.get("patient")+"' and a.del = '1' and a.type=18 and b.doctor='"+doctorCode+"' )\n" +
|
|
")";
|
|
")";
|
|
Integer noReplay = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
|
|
Integer noReplay = jdbcTemplate.queryForObject(sqlTotal,Integer.class);
|
|
map.put("noReplay",noReplay);
|
|
map.put("noReplay",noReplay);
|
|
@ -3225,7 +3277,7 @@ public class RehabilitationManageService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
String sql = "select d.id as doctor,p.create_time as createTime,p.id,d.photo,p.title,d.idcard,YEAR (now()) - YEAR (substring(d.idcard, 7, 8)) AS age, d.sex,p.name,p.patient,d.name as doctorName,p.advice_content as adviceContent,p.medical_records_code as medicalRecordsCode,p.create_time as create_time " +
|
|
|
|
|
|
String sql = "select d.id as doctor,p.create_time as createTime,p.disease,p.disease_name,p.id,d.photo,p.title,d.idcard,YEAR (now()) - YEAR (substring(d.idcard, 7, 8)) AS age, d.sex,p.name,p.patient,d.name as doctorName,p.advice_content as adviceContent,p.medical_records_code as medicalRecordsCode,p.create_time as create_time " +
|
|
" FROM wlyy_patient_rehabilitation_plan p " +
|
|
" FROM wlyy_patient_rehabilitation_plan p " +
|
|
" LEFT JOIN base_doctor d ON d.id = p.create_user " +
|
|
" LEFT JOIN base_doctor d ON d.id = p.create_user " +
|
|
"WHERE p.patient='"+patient+"'";
|
|
"WHERE p.patient='"+patient+"'";
|