|
@ -73,7 +73,7 @@ public class RehabilitationManageService {
|
|
|
// leftSql += " left join "+basedb+".wlyy_patient_disease_server s on p.patient=s.patient and s.del=1 and s.disease ='"+diseaseCode+"'" ;
|
|
|
// }
|
|
|
if(doctorType==2){//家医是根据签约关系过滤
|
|
|
leftSql+=" and f.doctor='"+doctorCode+"' ";
|
|
|
leftSql+=" and (f.doctor='"+doctorCode+"' or f.doctor_health='"+doctorCode+"') ";
|
|
|
}
|
|
|
String sql = " select p.*,f.idcard,f.hospital_name from wlyy_specialist.wlyy_patient_rehabilitation_plan p " +leftSql+
|
|
|
" where 1=1 " ;
|
|
@ -128,7 +128,6 @@ public class RehabilitationManageService {
|
|
|
resultMap.put("patientName",one.get("name"));
|
|
|
resultMap.put("patientCode",one.get("patient"));
|
|
|
resultMap.put("id",one.get("id"));
|
|
|
resultMap.put("patientCode",one.get("patient"));
|
|
|
resultMap.put("status",one.get("status"));//康复计划状态
|
|
|
//健康情况
|
|
|
resultMap.put("healthyCondition","康复期");
|
|
@ -141,6 +140,7 @@ public class RehabilitationManageService {
|
|
|
case 3:planTypeName="(转)转家庭病床" ;break;
|
|
|
}
|
|
|
resultMap.put("planTypeName",planTypeName);
|
|
|
resultMap.put("planCreateUser",one.get("create_user"));
|
|
|
//今日待办(即今日全部的项目)
|
|
|
Date beginTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"00:00:00");
|
|
|
Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"23:59:59");
|
|
@ -261,95 +261,106 @@ public class RehabilitationManageService {
|
|
|
|
|
|
/**
|
|
|
* 康复管理更多计划
|
|
|
* @param doctorCode
|
|
|
* @param currentDoctorCode
|
|
|
* @param patientCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public ObjEnvelop findRehabilitationPlanDetailList(String doctorCode,String patientCode) throws Exception{
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
resultMap.put("patientCode",patientCode);//居民code
|
|
|
//专科医生
|
|
|
String specialistRelationSql = "select r.*,t.name as teamName,h.name as specialistHospitalName from wlyy_specialist.wlyy_specialist_patient_relation r left join "+basedb+".wlyy_admin_team t on r.team_code=t.id left join "+basedb+".dm_hospital h on t.org_code=h.code where r.sign_status ='1' and r.status in('0','1') and r.patient='"+patientCode+"' and r.doctor='"+doctorCode+"'";
|
|
|
List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
|
|
|
Map<String,Object> specialistMap = specialistRelationList.get(0);
|
|
|
resultMap.put("specialistAdminTeamName",specialistMap.get("teamName"));
|
|
|
resultMap.put("specialistHospitalName",specialistMap.get("specialistHospitalName"));//专科医生所在医院
|
|
|
String specialistFinishItemSql = "";
|
|
|
Integer specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
|
|
|
Integer specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
|
|
|
Integer specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,patientCode,1);
|
|
|
resultMap.put("specialistFinishItemCount",specialistFinishCount-specialistUnfinishCount);//完成项目
|
|
|
resultMap.put("specialistServiceRecordCount",specialistServiceCount);//服务次数
|
|
|
public ObjEnvelop findRehabilitationPlanDetailList(String currentDoctorCode,String patientCode) throws Exception{
|
|
|
String sql = " select DISTINCT r.* from wlyy_specialist.wlyy_specialist_patient_relation r join wlyy_patient_rehabilitation_plan p on r.patient=p.patient where r.sign_status ='1' and r.status in('0','1') and r.patient='"+patientCode+"' ";
|
|
|
List<Map<String,Object>> specialistPatientRelationList = jdbcTemplate.queryForList(sql);
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
for(Map<String,Object> temp: specialistPatientRelationList){
|
|
|
String doctorCode = temp.get("doctor")+"";
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
Integer isOperator = 0;
|
|
|
resultMap.put("patientCode",patientCode);//居民code
|
|
|
//专科医生
|
|
|
String specialistRelationSql = "select r.*,t.name as teamName,h.name as specialistHospitalName from wlyy_specialist.wlyy_specialist_patient_relation r left join "+basedb+".wlyy_admin_team t on r.team_code=t.id left join "+basedb+".dm_hospital h on t.org_code=h.code where r.sign_status ='1' and r.status in('0','1') and r.patient='"+patientCode+"' and r.doctor='"+doctorCode+"'";
|
|
|
List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
|
|
|
Map<String,Object> specialistMap = specialistRelationList.get(0);
|
|
|
resultMap.put("specialistAdminTeamName",specialistMap.get("teamName"));
|
|
|
resultMap.put("specialistHospitalName",specialistMap.get("specialistHospitalName"));//专科医生所在医院
|
|
|
Integer specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
|
|
|
Integer specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
|
|
|
Integer specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,patientCode,1);
|
|
|
resultMap.put("specialistFinishItemCount",specialistFinishCount-specialistUnfinishCount);//完成项目
|
|
|
resultMap.put("specialistServiceRecordCount",specialistServiceCount);//服务次数
|
|
|
|
|
|
//家庭医生(包括全科医生、健管师)
|
|
|
String signFamilySql = "SELECT f.*,t.name as teamName FROM "+basedb+".wlyy_sign_family f LEFT JOIN "+basedb+".wlyy_admin_team t on f.admin_team_code=t.id where f.status =1 and f.expenses_status='1' and f.patient='"+patientCode+"'";
|
|
|
List<Map<String,Object>> signFamilyList = jdbcTemplate.queryForList(signFamilySql);
|
|
|
Map<String,Object> signFamilyMap = signFamilyList.get(0);
|
|
|
resultMap.put("signFamilyAdminTeamName",signFamilyMap.get("teamName"));
|
|
|
resultMap.put("familyHospitalName",signFamilyMap.get("hospital_name"));//家庭医生所在医院
|
|
|
Integer familyUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode,1);
|
|
|
Integer familyFinishCount = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode);
|
|
|
Integer familyServiceCount = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode,1);
|
|
|
resultMap.put("signFamilyFinishItemCount",familyFinishCount-familyUnfinishCount);//完成项目
|
|
|
resultMap.put("signFamilyServiceRecordCount",familyServiceCount);//服务次数
|
|
|
//家庭医生(包括全科医生、健管师)
|
|
|
String signFamilySql = "SELECT f.*,t.name as teamName FROM "+basedb+".wlyy_sign_family f LEFT JOIN "+basedb+".wlyy_admin_team t on f.admin_team_code=t.id where f.status =1 and f.expenses_status='1' and f.patient='"+patientCode+"'";
|
|
|
List<Map<String,Object>> signFamilyList = jdbcTemplate.queryForList(signFamilySql);
|
|
|
Map<String,Object> signFamilyMap = signFamilyList.get(0);
|
|
|
resultMap.put("signFamilyAdminTeamName",signFamilyMap.get("teamName"));
|
|
|
resultMap.put("familyHospitalName",signFamilyMap.get("hospital_name"));//家庭医生所在医院
|
|
|
Integer familyUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode,1);
|
|
|
Integer familyFinishCount = rehabilitationDetailDao.findItemByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode);
|
|
|
Integer familyServiceCount = rehabilitationDetailDao.completeServiceByDoctor(signFamilyMap.get("doctor")+"",signFamilyMap.get("doctor_health")+"",patientCode,1);
|
|
|
resultMap.put("signFamilyFinishItemCount",familyFinishCount-familyUnfinishCount);//完成项目
|
|
|
resultMap.put("signFamilyServiceRecordCount",familyServiceCount);//服务次数
|
|
|
|
|
|
//基础信息
|
|
|
resultMap.put("hospitalName",signFamilyMap.get("hospital_name"));
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(signFamilyMap.get("idcard")+"");
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(signFamilyMap.get("idcard")+"");
|
|
|
resultMap.put("age",age);
|
|
|
resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
|
|
|
resultMap.put("patientName",signFamilyMap.get("name"));
|
|
|
//疾病类型
|
|
|
String diseaseSql = " select s.* from "+basedb+".wlyy_patient_disease_server s where s.del=1 and s.patient='"+patientCode+"' and s.specialist_relation_code='"+specialistMap.get("id")+"' ";
|
|
|
List<Map<String,Object>> diseaseList = jdbcTemplate.queryForList(diseaseSql);
|
|
|
List<String> disease = new ArrayList<>();
|
|
|
for(Map<String,Object> one2:diseaseList){
|
|
|
disease.add(one2.get("disease_name")+"");
|
|
|
}
|
|
|
resultMap.put("diseaseList",disease);
|
|
|
|
|
|
//计划列表
|
|
|
List<PatientRehabilitationPlanDO> list = patientRehabilitationPlanDao.findByPatientAndCreateUser(patientCode,doctorCode);
|
|
|
List<Map<String,Object>> rehabilitationPlanList = new ArrayList<>();
|
|
|
for(PatientRehabilitationPlanDO one:list){
|
|
|
Map<String,Object> planMap = new HashMap<>();
|
|
|
planMap.put("planId",one.getId());
|
|
|
//安排类型
|
|
|
String planTypeName = null;
|
|
|
Integer planTypeTemp = one.getPlanType();
|
|
|
switch (planTypeTemp){
|
|
|
case 1:planTypeName="康复计划" ;break;
|
|
|
case 2:planTypeName="(转)社区医院" ;break;
|
|
|
case 3:planTypeName="(转)转家庭病床" ;break;
|
|
|
//基础信息
|
|
|
resultMap.put("hospitalName",signFamilyMap.get("hospital_name"));
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(signFamilyMap.get("idcard")+"");
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(signFamilyMap.get("idcard")+"");
|
|
|
resultMap.put("age",age);
|
|
|
resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
|
|
|
resultMap.put("patientName",signFamilyMap.get("name"));
|
|
|
//疾病类型
|
|
|
String diseaseSql = " select s.* from "+basedb+".wlyy_patient_disease_server s where s.del=1 and s.patient='"+patientCode+"' and s.specialist_relation_code='"+specialistMap.get("id")+"' ";
|
|
|
List<Map<String,Object>> diseaseList = jdbcTemplate.queryForList(diseaseSql);
|
|
|
List<String> disease = new ArrayList<>();
|
|
|
for(Map<String,Object> one2:diseaseList){
|
|
|
disease.add(one2.get("disease_name")+"");
|
|
|
}
|
|
|
planMap.put("planTypeName",planTypeName);
|
|
|
planMap.put("status",one.getStatus());//0已中止,1进行中,2已完成
|
|
|
resultMap.put("diseaseList",disease);
|
|
|
|
|
|
//状态(0未完成,1已完成,2已预约)
|
|
|
//今日待办
|
|
|
Date beginTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"00:00:00");
|
|
|
Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"23:59:59");
|
|
|
Integer todayBacklogCount = rehabilitationDetailDao.todayBacklogCount(one.getId(),beginTime,endTime);
|
|
|
planMap.put("todayBacklogCount",todayBacklogCount);
|
|
|
//已完成
|
|
|
Integer finishedCount = rehabilitationDetailDao.completenessCount(1,one.getId(),beginTime,endTime);
|
|
|
planMap.put("finishedCount",finishedCount);//已完成
|
|
|
//未完成
|
|
|
Integer notstartedCount = rehabilitationDetailDao.completenessCount(0,one.getId(),beginTime,endTime);//未完成
|
|
|
Integer underwayCount = rehabilitationDetailDao.completenessCount(2,one.getId(),beginTime,endTime);//已预约
|
|
|
Integer unfinishedCount = notstartedCount+underwayCount;
|
|
|
planMap.put("unfinishedCount",unfinishedCount);//未完成
|
|
|
//完成度(已完成/(已完成+未完成))
|
|
|
Integer allFinishCount = rehabilitationDetailDao.findByStatusAndPlanId(1,one.getId());
|
|
|
Integer allCount = rehabilitationDetailDao.findAllByPlanId(one.getId());
|
|
|
planMap.put("allCount",allCount);//总数
|
|
|
planMap.put("allFinishCount",allFinishCount);//全部已完成数
|
|
|
rehabilitationPlanList.add(planMap);
|
|
|
//计划列表
|
|
|
List<PatientRehabilitationPlanDO> list = patientRehabilitationPlanDao.findByPatientAndCreateUser(patientCode,doctorCode);
|
|
|
List<Map<String,Object>> rehabilitationPlanList = new ArrayList<>();
|
|
|
for(PatientRehabilitationPlanDO one:list){
|
|
|
Map<String,Object> planMap = new HashMap<>();
|
|
|
planMap.put("planId",one.getId());
|
|
|
//安排类型
|
|
|
String planTypeName = null;
|
|
|
Integer planTypeTemp = one.getPlanType();
|
|
|
switch (planTypeTemp){
|
|
|
case 1:planTypeName="康复计划" ;break;
|
|
|
case 2:planTypeName="(转)社区医院" ;break;
|
|
|
case 3:planTypeName="(转)转家庭病床" ;break;
|
|
|
}
|
|
|
planMap.put("planTypeName",planTypeName);
|
|
|
planMap.put("status",one.getStatus());//0已中止,1进行中,2已完成
|
|
|
if(currentDoctorCode.equals(doctorCode)){
|
|
|
isOperator = 1;
|
|
|
}
|
|
|
planMap.put("isOperator",isOperator);
|
|
|
//状态(0未完成,1已完成,2已预约)
|
|
|
//今日待办
|
|
|
Date beginTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"00:00:00");
|
|
|
Date endTime = DateUtil.strToDateLong(DateUtil.getStringDateShort()+ " "+"23:59:59");
|
|
|
Integer todayBacklogCount = rehabilitationDetailDao.todayBacklogCount(one.getId(),beginTime,endTime);
|
|
|
planMap.put("todayBacklogCount",todayBacklogCount);
|
|
|
//已完成
|
|
|
Integer finishedCount = rehabilitationDetailDao.completenessCount(1,one.getId(),beginTime,endTime);
|
|
|
planMap.put("finishedCount",finishedCount);//已完成
|
|
|
//未完成
|
|
|
Integer notstartedCount = rehabilitationDetailDao.completenessCount(0,one.getId(),beginTime,endTime);//未完成
|
|
|
Integer underwayCount = rehabilitationDetailDao.completenessCount(2,one.getId(),beginTime,endTime);//已预约
|
|
|
Integer unfinishedCount = notstartedCount+underwayCount;
|
|
|
planMap.put("unfinishedCount",unfinishedCount);//未完成
|
|
|
//完成度(已完成/(已完成+未完成))
|
|
|
Integer allFinishCount = rehabilitationDetailDao.findByStatusAndPlanId(1,one.getId());
|
|
|
Integer allCount = rehabilitationDetailDao.findAllByPlanId(one.getId());
|
|
|
planMap.put("allCount",allCount);//总数
|
|
|
planMap.put("allFinishCount",allFinishCount);//全部已完成数
|
|
|
rehabilitationPlanList.add(planMap);
|
|
|
}
|
|
|
resultMap.put("rehabilitationPlanList",rehabilitationPlanList);
|
|
|
resultList.add(resultMap);
|
|
|
}
|
|
|
resultMap.put("rehabilitationPlanList",rehabilitationPlanList);
|
|
|
return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultMap);
|
|
|
|
|
|
return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultList);
|
|
|
}
|
|
|
|
|
|
|
|
@ -373,12 +384,14 @@ public class RehabilitationManageService {
|
|
|
// sql+="and d.type='"+role+"' " ;
|
|
|
// }
|
|
|
sql+=" and d.doctor='"+doctorCode+"' " ;
|
|
|
}else{
|
|
|
sql+=" and i.type='"+searchTask+"' " ;
|
|
|
}else if(searchTask==2||searchTask==4){
|
|
|
sql+=" and i.type="+searchTask+" " ;
|
|
|
}else if(searchTask==3){
|
|
|
sql+=" and i.reserve="+searchTask+" " ;
|
|
|
}
|
|
|
}
|
|
|
if(status!=null){
|
|
|
sql+= "and d.status="+status;
|
|
|
sql+= " and d.status="+status;
|
|
|
}
|
|
|
|
|
|
List<Map<String,Object>> rehabilitationDetailList = jdbcTemplate.queryForList(sql);
|
|
@ -488,8 +501,10 @@ public class RehabilitationManageService {
|
|
|
if(searchTask!=null){
|
|
|
if(searchTask==1){
|
|
|
sql+="and d.doctor='"+doctorCode+"' ";
|
|
|
}else{
|
|
|
sql+=" and i.type='"+searchTask+"' " ;
|
|
|
}else if(searchTask==2||searchTask==4){
|
|
|
sql+=" and i.type="+searchTask+" " ;
|
|
|
}else if(searchTask==3){
|
|
|
sql+=" and i.reserve="+searchTask+" " ;
|
|
|
}
|
|
|
}
|
|
|
if(status!=null){
|
|
@ -532,9 +547,10 @@ public class RehabilitationManageService {
|
|
|
isMyTask=1;
|
|
|
}
|
|
|
resultMap.put("isMyTask",isMyTask);//0不是自己的任务,1是自己的任务
|
|
|
if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){
|
|
|
executeDoctorList.add(one.get("create_user_name")+"");
|
|
|
}
|
|
|
// if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){
|
|
|
// executeDoctorList.add(one.get("create_user_name")+"");
|
|
|
// }
|
|
|
resultMap.put("executeDoctorCode",one.get("specialistDoctor")+"");//执行医生code
|
|
|
executeDoctorList.add(one.get("specialistDoctorName")+"");
|
|
|
resultMap.put("specialistDoctorCode",one.get("create_user")+"");//专科医生code
|
|
|
resultMap.put("specialistDoctorName",one.get("create_user_name")+"");//专科医生名字
|
|
@ -610,11 +626,12 @@ public class RehabilitationManageService {
|
|
|
isMyTask=1;
|
|
|
}
|
|
|
resultMap.put("isMyTask",isMyTask);//0不是自己的任务,1是自己的任务
|
|
|
if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){
|
|
|
executeDoctorList.add(one.get("create_user_name")+"");
|
|
|
}
|
|
|
// if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){
|
|
|
// executeDoctorList.add(one.get("create_user_name")+"");
|
|
|
// }
|
|
|
executeDoctorList.add(one.get("specialistDoctorName")+"");
|
|
|
resultMap.put("executeDoctorList",executeDoctorList);
|
|
|
resultMap.put("executeDoctorCode",one.get("specialistDoctor")+"");//执行医生code
|
|
|
resultMap.put("specialistDoctorCode",one.get("create_user")+"");//专科医生code
|
|
|
resultMap.put("specialistDoctorName",one.get("create_user_name")+"");//专科医生名字
|
|
|
resultMap.put("title",one.get("title"));//项目标题
|
|
@ -727,7 +744,7 @@ public class RehabilitationManageService {
|
|
|
serviceDoctorList.add(healthDoctorMap);
|
|
|
}
|
|
|
|
|
|
String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status='1'";
|
|
|
String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status >=0 ";
|
|
|
List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
|
|
|
for(Map<String,Object> one:specialistRelationList){
|
|
|
String doctor = one.get("doctor")+"";
|
|
@ -1161,4 +1178,14 @@ public class RehabilitationManageService {
|
|
|
resultMap.put("healthyCondition","康复期");
|
|
|
return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultMap);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据居民获取康复计划
|
|
|
* @param patient
|
|
|
* @return
|
|
|
*/
|
|
|
public ObjEnvelop planListByPatient(String patient){
|
|
|
List<PatientRehabilitationPlanDO> list = patientRehabilitationPlanDao.findbyPatients(patient);
|
|
|
return ObjEnvelop.getSuccess(SpecialistMapping.api_success,list);
|
|
|
}
|
|
|
}
|