|
@ -77,11 +77,7 @@ public class RehabilitationManageService {
|
|
|
}
|
|
|
String sql = " select p.*,f.idcard,f.hospital_name from wlyy_specialist.wlyy_patient_rehabilitation_plan p " +leftSql+
|
|
|
" where 1=1 " ;
|
|
|
if(doctorType==1){//专科医生是根据计划的创建者字段过滤
|
|
|
sql+=" and (p.create_user in (select r.doctor assistant from " +
|
|
|
" wlyy_specialist.wlyy_specialist_patient_relation r where r.health_assistant ='"+doctorCode+"') " +
|
|
|
" or p.create_user='"+doctorCode+"') ";
|
|
|
}
|
|
|
|
|
|
if(planType!=null){
|
|
|
sql += " and p.plan_type="+planType;
|
|
|
}
|
|
@ -100,7 +96,7 @@ public class RehabilitationManageService {
|
|
|
if(todaybacklog!=null&&todaybacklog==1){
|
|
|
condition += " and execute_time>='"+todayStart+"' and execute_time<='"+todayEnd+"'";
|
|
|
}
|
|
|
finalSql =" select DISTINCT b.* from (select DISTINCT plan_id from wlyy_specialist.wlyy_rehabilitation_plan_detail where 1=1 "+condition+") a " +
|
|
|
finalSql =" select DISTINCT b.* from (select plan_id,doctor from wlyy_specialist.wlyy_rehabilitation_plan_detail where 1=1 "+condition+") a " +
|
|
|
" JOIN ("+sql+") b on a.plan_id=b.id ";
|
|
|
// if(todaybacklog!=null&&todaybacklog==1){
|
|
|
// finalSql = " select DISTINCT b.* from (select DISTINCT plan_id from wlyy_specialist.wlyy_rehabilitation_plan_detail where execute_time>='"+todayStart+"' and execute_time<='"+todayEnd+"') a "+
|
|
@ -108,6 +104,12 @@ public class RehabilitationManageService {
|
|
|
// }else{
|
|
|
// finalSql = " select b.* from ("+sql+") b ";
|
|
|
// }
|
|
|
if(doctorType==1){//专科医生是根据计划的创建者字段过滤
|
|
|
// sql+=" and (p.create_user in (select r.doctor assistant from " +
|
|
|
// " wlyy_specialist.wlyy_specialist_patient_relation r where r.health_assistant ='"+doctorCode+"') " +
|
|
|
// " or p.create_user='"+doctorCode+"') ";
|
|
|
finalSql += " where b.create_user = '"+doctorCode+"' or a.doctor ='"+doctorCode+"'";
|
|
|
}
|
|
|
List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(finalSql);
|
|
|
int count = 0;
|
|
|
if(rstotal!=null&&rstotal.size()>0&&rstotal.get(0).get("id")!=null){
|
|
@ -167,96 +169,6 @@ public class RehabilitationManageService {
|
|
|
}
|
|
|
|
|
|
|
|
|
// public MixEnvelop<Map<String,Object>, Map<String,Object>> findRehabilitationPlanDetailList(String doctorCode, String diseaseCode, Integer planType,Integer todaybacklog,String patientCode,Integer page, Integer pageSize) throws Exception{
|
|
|
// List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
// String leftSql =" left join "+basedb+".wlyy_sign_family f on f.patient=p.patient ";
|
|
|
// if(StringUtils.isNotEmpty(diseaseCode)){
|
|
|
// leftSql += " left join "+basedb+".wlyy_patient_disease_server s on p.patient=s.patient and s.del=1 and s.disease ='"+diseaseCode+"'" ;
|
|
|
// }
|
|
|
// String sql = " select p.*,f.idcard,f.hospital_name,f.admin_team_code from wlyy_specialist.wlyy_patient_rehabilitation_plan p " +leftSql+
|
|
|
// " where (p.create_user in (select r.health_assistant assistant from " +
|
|
|
// " wlyy_specialist.wlyy_specialist_patient_relation r where r.health_assistant is not null) " +
|
|
|
// " or p.create_user='"+doctorCode+"') and p.patient='"+patientCode+"'" ;
|
|
|
// if(planType!=null){
|
|
|
// sql += " and p.plan_type="+planType;
|
|
|
// }
|
|
|
// String finalSql = "";
|
|
|
// if(todaybacklog!=null&&todaybacklog==1){
|
|
|
// finalSql = " select b.* from (select DISTINCT program_id wlyy_rehabilitation_plan_detail where execute_time>='' and execute_time<='') a "+
|
|
|
// "LEFT JOIN ("+sql+") b on a.program_id=b.id";
|
|
|
// }else{
|
|
|
// finalSql = " select b.* from ("+sql+") b ";
|
|
|
// }
|
|
|
// List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(finalSql);
|
|
|
// int count = 0;
|
|
|
// if(rstotal!=null&&rstotal.size()>0){
|
|
|
// count = rstotal.size();
|
|
|
// }
|
|
|
// finalSql += " ORDER BY b.create_time DESC LIMIT "+(page-1)*pageSize+","+pageSize;
|
|
|
// List<Map<String,Object>> patientRehabilitationPlanDOList = jdbcTemplate.queryForList(finalSql);
|
|
|
// for(Map<String,Object> one:patientRehabilitationPlanDOList){
|
|
|
// Map<String,Object> resultMap = new HashMap<>();
|
|
|
// Integer age = IdCardUtil.getAgeForIdcard(one.get("idcard")+"");
|
|
|
// String sex = IdCardUtil.getSexForIdcard_new(one.get("idcard")+"");
|
|
|
// resultMap.put("age",age);
|
|
|
// resultMap.put("hospitalName",one.get("hospital_name"));
|
|
|
// resultMap.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
|
|
|
// resultMap.put("patientName",one.get("name"));
|
|
|
//
|
|
|
// //疾病类型
|
|
|
// String diseaseSql = " select s.* from "+basedb+".wlyy_patient_disease_server s where s.del=1 and s.patient='"+patientCode+"' ";
|
|
|
// 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);
|
|
|
//
|
|
|
// //家庭医生
|
|
|
// Integer adminTeamCode = Integer.valueOf(one.get("admin_team_code").toString());
|
|
|
// String adminTeamSql = " select t.*,h.name as hospitalName from "+basedb+".wlyy_admin_team t left join "+basedb+".dm_hospital h on h.code=t.org_code where t.available = 1 and t.id="+adminTeamCode;
|
|
|
// List<Map<String,Object>> adminTeamList = jdbcTemplate.queryForList(adminTeamSql);
|
|
|
// String teanName = adminTeamList.size()>0?adminTeamList.get(0).get("name").toString():"";
|
|
|
// String hospitalName = adminTeamList.size()>0?adminTeamList.get(0).get("hospitalName").toString():"";
|
|
|
//
|
|
|
// resultMap.put("teanName",teanName);
|
|
|
// resultMap.put("teanHospitalName",hospitalName);
|
|
|
//
|
|
|
// //专科医生
|
|
|
// String specialistSql = " select * from wlyy_specialist.wlyy_specialist_patient_relation where doctor='"+doctorCode+
|
|
|
// "' and patient ='"+patientCode+"' and status in ('1','0') and sign_status ='1' " ;
|
|
|
// List<Map<String,Object>> specialistList = jdbcTemplate.queryForList(specialistSql);
|
|
|
// Integer specialistAdminTeamCode = specialistList.size()>0?(Integer)specialistList.get(0).get("team_code"):0;
|
|
|
// String specialistAdminTeamSql = " select t.*,h.name as hospitalName from "+basedb+".wlyy_admin_team t left join "+basedb+".dm_hospital h on h.code=t.org_code where t.available = 1 and t.id="+adminTeamCode;
|
|
|
// List<Map<String,Object>> specialistAdminTeamList = jdbcTemplate.queryForList(specialistAdminTeamSql);
|
|
|
// String specialistTeanName = specialistAdminTeamList.size()>0?specialistAdminTeamList.get(0).get("name").toString():"";
|
|
|
// String specialistHospitalName = specialistAdminTeamList.size()>0?specialistAdminTeamList.get(0).get("hospitalName").toString():"";
|
|
|
// resultMap.put("specialistTeanName",specialistTeanName);
|
|
|
// resultMap.put("specialistHospitalName",specialistHospitalName);
|
|
|
//
|
|
|
// //安排类型
|
|
|
// String planTypeName = null;
|
|
|
// Integer planTypeTemp = (Integer)one.get("plan_type");
|
|
|
// switch (planTypeTemp){
|
|
|
// case 1:planTypeName="康复计划" ;break;
|
|
|
// case 2:planTypeName="(转)社区医院" ;break;
|
|
|
// case 3:planTypeName="(转)转家庭病床" ;break;
|
|
|
// }
|
|
|
//
|
|
|
// //服务项列表
|
|
|
// String planDetailSql = "select DISTINCT d.service_item_id from wlyy_rehabilitation_plan_detail d where d.program_id ='"+one.get("id")+"'";
|
|
|
// List<Map<String,Object>> planDetailList = jdbcTemplate.queryForList(planDetailSql);
|
|
|
// List<Map<String,Object>> planDetail = new ArrayList<>();
|
|
|
// for(Map<String,Object> one3:planDetailList){
|
|
|
// Map<String,Object> temp = new HashMap<>();
|
|
|
// temp.put("planTypeName",planTypeName);
|
|
|
// temp.put("status",one3.get("status"));
|
|
|
// one3.get("status");
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// return MixEnvelop.getSuccessListWithPage(SpecialistMapping.api_success,resultList,page,pageSize,Long.valueOf(count));
|
|
|
// }
|
|
|
|
|
|
|
|
|
/**
|
|
@ -372,17 +284,12 @@ public class RehabilitationManageService {
|
|
|
* @param doctorCode 登陆医生
|
|
|
*/
|
|
|
public ObjEnvelop calendarPlanDetail(String executeStartTime,String executeEndTime,String planId,Integer searchTask,Integer status,String doctorCode) throws Exception{
|
|
|
// String executeStartTime = DateUtil.getFristDayOfMonth()+" "+"00:00:00";
|
|
|
// String executeEndTime = DateUtil.getLastDayOfMonth()+" "+"23:59:59";
|
|
|
String sql = " select d.* from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
|
|
|
" LEFT JOIN wlyy_specialist.wlyy_hospital_service_item h on d.hospital_service_item_id = h.id "+
|
|
|
" LEFT JOIN wlyy_service_item i on i.id = h.service_item_id " +
|
|
|
" where d.execute_time>='"+executeStartTime+"' and d.execute_time<='"+executeEndTime+"' and d.plan_id='"+planId+"' " ;
|
|
|
if(searchTask!=null){
|
|
|
if(searchTask==1){
|
|
|
// if(role==1){
|
|
|
// sql+="and d.type='"+role+"' " ;
|
|
|
// }
|
|
|
sql+=" and d.doctor='"+doctorCode+"' " ;
|
|
|
}else if(searchTask==2||searchTask==4){
|
|
|
sql+=" and i.type="+searchTask+" " ;
|
|
@ -528,8 +435,8 @@ public class RehabilitationManageService {
|
|
|
planDetailList +=",'"+one+"'";
|
|
|
}
|
|
|
String planDetailResult = StringUtils.isNotEmpty(planDetailList)?planDetailList.substring(1):"";
|
|
|
String sql = "select i.title,i.content,i.type as itemType,i.reserve,d.id,d.execute_time,d.hospital_name,d.status,d.type as detailType,d.expense,d.doctor as specialistDoctor," +
|
|
|
" d.doctor_name as specialistDoctorName,p.patient ,p.create_user ,p.create_user_name, p.status as planStatus " +
|
|
|
String sql = "select i.title,i.content,i.type as itemType,i.reserve,d.id,d.execute_time,d.hospital_name,d.status,d.type as detailType,d.expense,d.doctor as executeDoctor," +
|
|
|
" d.doctor_name as executeDoctorName,p.patient ,p.create_user as createDoctor,p.create_user_name as createDoctorName, p.status as planStatus " +
|
|
|
" from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
|
|
|
" LEFT JOIN wlyy_specialist.wlyy_hospital_service_item h on d.hospital_service_item_id = h.id "+
|
|
|
" LEFT JOIN wlyy_specialist.wlyy_service_item i on i.id = h.service_item_id " +
|
|
@ -541,20 +448,21 @@ public class RehabilitationManageService {
|
|
|
List<Map<String,Object>> resultList = new ArrayList<>();
|
|
|
for(Map<String,Object> one:serviceItemList){
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
List<String> executeDoctorList = new ArrayList<>();
|
|
|
Integer isMyTask = 0;
|
|
|
if(StringUtils.isNotEmpty(doctorCode)&&doctorCode.equals(one.get("specialistDoctor")+"")){
|
|
|
if(StringUtils.isNotEmpty(doctorCode)&&doctorCode.equals(one.get("executeDoctor")+"")){
|
|
|
isMyTask=1;
|
|
|
}
|
|
|
resultMap.put("isMyTask",isMyTask);//0不是自己的任务,1是自己的任务
|
|
|
// 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")+"");//专科医生名字
|
|
|
resultMap.put("executeDoctorList",executeDoctorList);
|
|
|
List<String> executeDoctorList = new ArrayList<>();
|
|
|
executeDoctorList.add(one.get("executeDoctorName")+"");
|
|
|
resultMap.put("executeDoctorList",executeDoctorList);//执行医生名称列表
|
|
|
resultMap.put("executeDoctorCode",one.get("executeDoctor")+"");//执行医生code
|
|
|
resultMap.put("executeDoctorName",one.get("executeDoctorName")+"");//执行医生code
|
|
|
resultMap.put("specialistDoctorCode",one.get("createDoctor")+"");//创建人(专科)医生code
|
|
|
resultMap.put("specialistDoctorName",one.get("createDoctorName")+"");//创建人(专科)医生名字
|
|
|
resultMap.put("title",one.get("title"));//项目标题
|
|
|
resultMap.put("planDetaiId",one.get("id"));//计划服务项目id
|
|
|
resultMap.put("shortExecuteTime",DateUtil.dateToStr((Date) one.get("execute_time"),DateUtil.HH_MM));//项目标题
|
|
@ -611,8 +519,8 @@ public class RehabilitationManageService {
|
|
|
*
|
|
|
*/
|
|
|
public ObjEnvelop serviceItem(String planDetailId,String doctorCode) throws Exception{
|
|
|
String sql = "select i.title,i.content,i.type as itemType,i.reserve,d.id,d.execute_time,d.hospital_name,d.status,d.type,d.expense,d.doctor as specialistDoctor, " +
|
|
|
" d.doctor_name as specialistDoctorName,p.patient ,p.name as patientName,p.create_user ,p.create_user_name, p.status as planStatus" +
|
|
|
String sql = "select i.title,i.content,i.type as itemType,i.reserve,d.id,d.execute_time,d.hospital_name,d.status,d.type,d.expense,d.doctor as executeDoctor, " +
|
|
|
" d.doctor_name as executeDoctorName,p.patient ,p.name as patientName,p.create_user as createDoctor,p.create_user_name as createDoctorName, p.status as planStatus" +
|
|
|
" from wlyy_specialist.wlyy_rehabilitation_plan_detail d " +
|
|
|
" LEFT JOIN wlyy_specialist.wlyy_hospital_service_item h on d.hospital_service_item_id = h.id "+
|
|
|
" LEFT JOIN wlyy_specialist.wlyy_service_item i on i.id = h.service_item_id " +
|
|
@ -623,18 +531,20 @@ public class RehabilitationManageService {
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
List<String> executeDoctorList = new ArrayList<>();
|
|
|
Integer isMyTask = 0;
|
|
|
if(StringUtils.isNotEmpty(doctorCode)&&doctorCode.equals(one.get("specialistDoctor")+"")){
|
|
|
//判断登陆者和执行医生是不是同一个人
|
|
|
if(StringUtils.isNotEmpty(doctorCode)&&doctorCode.equals(one.get("executeDoctor")+"")){
|
|
|
isMyTask=1;
|
|
|
}
|
|
|
resultMap.put("isMyTask",isMyTask);//0不是自己的任务,1是自己的任务
|
|
|
// 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")+"");//专科医生名字
|
|
|
executeDoctorList.add(one.get("executeDoctorName")+"");
|
|
|
resultMap.put("executeDoctorList",executeDoctorList);//执行医生名称列表
|
|
|
resultMap.put("executeDoctorCode",one.get("executeDoctor")+"");//执行医生code
|
|
|
resultMap.put("executeDoctorName",one.get("executeDoctorName")+"");//执行医生code
|
|
|
resultMap.put("specialistDoctorCode",one.get("createDoctor")+"");//创建人(专科)医生code
|
|
|
resultMap.put("specialistDoctorName",one.get("createDoctorName")+"");//创建人(专科)医生名字
|
|
|
resultMap.put("title",one.get("title"));//项目标题
|
|
|
resultMap.put("shortExecuteTime",DateUtil.dateToStr((Date) one.get("execute_time"),DateUtil.HH_MM));//项目标题
|
|
|
resultMap.put("content",one.get("content"));//项目内容
|