Bläddra i källkod

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

liubing 4 år sedan
förälder
incheckning
7c29a12a53

+ 115 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/UuidIdentityEntityWithOperatorAES.java

@ -0,0 +1,115 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.util.StringFStringEncryptConverter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.util.Date;
/**
 * 统一定义id的entity基类.
 * 主键生成策略是UUID
 * 还包含业务表用的 创建人,创建时间 创建人名  修改人,修改时间 修改人名
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class UuidIdentityEntityWithOperatorAES extends UuidIdentityEntity {
    //创建时间
	@CreatedDate
	protected Date createTime;
	//创建者
    @CreatedBy
	protected String createUser;
    //创建者
    @CreatedBy
    protected String createUserName;
    //更新时间
    @LastModifiedDate
	protected Date updateTime;
	//更新者
    @LastModifiedBy
	protected String updateUser;
	//更新者
    @LastModifiedBy
	protected String updateUserName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "create_user",updatable = false)
	public String getCreateUser() {
		return createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name",updatable = false)
	@Convert(converter = StringFStringEncryptConverter.class)
	public String getCreateUserName() {
		return createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@Column(name = "update_time", nullable = false, length = 0)
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	@Column(name = "update_user")
	public String getUpdateUser() {
		return updateUser;
	}
	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	@Column(name = "update_user_name")
	@Convert(converter = StringFStringEncryptConverter.class)
	public String getUpdateUserName() {
		return updateUserName;
	}
	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}
}

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationPlanTemplateDO.java

@ -1,7 +1,7 @@
package com.yihu.jw.entity.specialist.rehabilitation;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperatorAES;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -12,7 +12,7 @@ import java.io.Serializable;
 */
@Entity
@Table(name = "wlyy_rehabilitation_plan_template")
public class RehabilitationPlanTemplateDO extends UuidIdentityEntityWithOperator implements Serializable {
public class RehabilitationPlanTemplateDO extends UuidIdentityEntityWithOperatorAES implements Serializable {
    @Column(name = "saas_id")
    private String saasId;

+ 50 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/util/TransforSqlUtl.java

@ -51,4 +51,54 @@ public class TransforSqlUtl {
    public static String wlyyPatientDeviceLocationIdCard(String sql){
        return sql.replaceAll("idcard","CAST(AES_DECRYPT(from_base64(idcard),'jkzl2021ZJXL*#%a')AS char)");
    }
    public static String wlyy_patient_rehabilitation_planName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(p.name),'jkzl2021ZJXL*#%a') AS CHAR ) AS name ";
        return sql.replaceAll("p.name",str);
    }
    public static String wlyy_patient_rehabilitation_planName2(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(p.name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("p.name",str);
    }
    public static String wlyy_patient_rehabilitation_planAll2(String sql){
        String str = "p.*,CAST(AES_DECRYPT(from_base64(p.name),'jkzl2021ZJXL*#%a') AS CHAR ) AS name,CAST(AES_DECRYPT(from_base64(p.create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS create_user_name,CAST(AES_DECRYPT(from_base64(p.update_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS update_user_name";
        return sql.replace("p.*",str);
    }
    public static String wlyy_patient_rehabilitation_planCreateName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(p.create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("p.create_user_name",str);
    }
    public static String wlyy_plan_detail_appointmentAll(String sql){
        String str = "*,CAST(AES_DECRYPT(from_base64(doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS doctor_name,CAST(AES_DECRYPT(from_base64(appointment_doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS appointment_doctor_name";
        return sql.replace("*",str);
    }
    public static String wlyy_rehabilitation_operate_recordsDoctorName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(r.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("r.doctor_name",str);
    }
    public static String wlyy_rehabilitation_plan_detailAll(String sql){
        String str = "*,CAST(AES_DECRYPT(from_base64(doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS doctor_name,CAST(AES_DECRYPT(from_base64(create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS create_user_name,CAST(AES_DECRYPT(from_base64(update_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS update_user_name";
        return sql.replace("*",str);
    }
    public static String wlyy_rehabilitation_plan_detailAll2(String sql){
        String str = "d.*,CAST(AES_DECRYPT(from_base64(d.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS doctor_name,CAST(AES_DECRYPT(from_base64(d.create_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS create_user_name,CAST(AES_DECRYPT(from_base64(d.update_user_name),'jkzl2021ZJXL*#%a') AS CHAR ) AS update_user_name";
        return sql.replace("d.*",str);
    }
    public static String wlyy_rehabilitation_plan_detailDoctorName(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(d.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) ";
        return sql.replaceAll("d.doctor_name",str);
    }
    public static String wlyy_rehabilitation_plan_detailDoctorName2(String sql){
        String str = "CAST(AES_DECRYPT(from_base64(d.doctor_name),'jkzl2021ZJXL*#%a') AS CHAR ) as doctor_name";
        return sql.replaceAll("d.doctor_name",str);
    }
}

+ 19 - 173
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -89,12 +89,8 @@ public class RehabilitationManageService {
     */
    public MixEnvelop<Map<String,Object>, Map<String,Object>> findRehabilitationPlan(Integer doctorType,String doctorCode, String diseaseCode, Integer planType,Integer todaybacklog, String patientCondition,Integer page, Integer pageSize) throws Exception{
//        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 leftSql = "";
        String sql = " select p.*" + AesEncryptUtils.decryptMysql("p.name","patientName") + "  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        String sql = " select p.*  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        if(doctorType==2){//家医是根据签约关系过滤
            leftSql =" join "+basedb+".wlyy_sign_family f on f.patient=p.patient and f.expenses_status='1' and f.status=1 ";
@ -113,6 +109,7 @@ public class RehabilitationManageService {
            sql += " and " + AesEncryptUtils.decryptMysqlNo("p.name") + " like '%"+patientCondition+"%' ";
        }
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planAll2(sql);
        String finalSql = "";
        String todayStart = DateUtil.getStringDateShort()+" "+"00:00:00";
@ -124,16 +121,7 @@ public class RehabilitationManageService {
        }
        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 "+
//                    "LEFT JOIN ("+sql+") b on a.plan_id=b.id";
//        }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);
@ -374,6 +362,7 @@ public class RehabilitationManageService {
            sql+= " and d.status="+status;
        }
        sql += " ORDER BY d.execute_time ";
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll2(sql);
        List<Map<String,Object>> rehabilitationDetailList = jdbcTemplate.queryForList(sql);
//        List<RehabilitationDetailDO> rehabilitationDetailList = rehabilitationDetailDao.findByPlanId(DateUtil.strToDate(executeStartTime),DateUtil.strToDate(executeEndTime),planId);
        Map<String,Map<String,Object>> map = new LinkedHashMap<>();
@ -518,113 +507,11 @@ public class RehabilitationManageService {
            sql+= "and d.status="+status;
        }
        sql +="  order by d.execute_time desc ";
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(sql);
        List<Map<String,Object>> rehabilitationDetailList = jdbcTemplate.queryForList(sql);
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,rehabilitationDetailList);
    }
    /**
     * 多个康复计划服务项目内容列表
     * @param planDetailIds
     * @return
     * @throws Exception
     */
  /*  public ObjEnvelop serviceItemList(String planDetailIds,String doctorCode) throws Exception{
        String[] s = planDetailIds.split(",");
        String planDetailList = "";
        for(String one:s){
            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 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 " +
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " where d.id in ("+planDetailResult+") order BY d.execute_time ASC ";
        List<Map<String,Object>> serviceItemList = jdbcTemplate.queryForList(sql);
//        if(serviceItemList.size()>0){
//            Map<String,Object> serviceItem = serviceItemList.get(0);
        List<Map<String,Object>> resultList = new ArrayList<>();
        for(Map<String,Object> one:serviceItemList){
            Map<String,Object> resultMap = new HashMap<>();
            Integer isMyTask = 0;
            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")+"");
//            }
            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));//项目标题
            resultMap.put("content",one.get("content"));//项目内容
            resultMap.put("hospitalName",one.get("hospital_name"));//地点
            resultMap.put("executeTime",one.get("execute_time"));//执行时间
            DecimalFormat df = new DecimalFormat("0.00");
            resultMap.put("expense",df.format(((Integer)one.get("expense")*1.00)/100.00));//收费
            resultMap.put("reserve",one.get("reserve"));//是否需要预约(1预约、0不预约)
            resultMap.put("planStatus",one.get("planStatus"));//计划的状态
            Integer status = Integer.valueOf(one.get("status").toString());//状态(0未完成,1已完成,2已预约)
            String statusName = "";
            switch (status){
                case 0:{statusName="未完成";break;}
                case 1:{statusName="已完成";break;}
                case 2:{statusName="已预约";break;}
            }
            resultMap.put("statusName",statusName);//状态
            //指导与汇报
            List<GuidanceMessageLogDO> messageList = guidanceMessageLogDao.findByPlanDetailId(one.get("id").toString());
            List<Map<String,Object>> messageMapList = new ArrayList<>();
            for(GuidanceMessageLogDO one2:messageList){
                Map<String,Object> map = new HashMap<>();
                map.put("doctorName",one2.getDoctorName());
                map.put("adminTeamName",one2.getAdminTeamName());
                map.put("content",one2.getContent());
                map.put("contentType",one2.getContentType());
                map.put("createTime",DateUtil.dateToStr(one2.getCreateTime(),"MM-dd HH:mm"));
                messageMapList.add(map);
            }
            Integer itemType = (Integer) one.get("itemType");
            resultMap.put("messageList",messageMapList);//指导与汇报记录
            resultMap.put("patient",one.get("patient"));
            resultMap.put("itemType",itemType);
            resultMap.put("detaiType",one.get("detaiType"));
            resultMap.put("status",status);//状态
            //是否完成任务
            List<RehabilitationOperateRecordsDO> operateList = rehabilitationOperateRecordsDao.findByRehabilitationDetailId(one.get("id").toString());
            Integer operate = 0;
            if(operateList.size()>0){
                operate =1;
                RehabilitationOperateRecordsDO temp = operateList.get(0);
                operate =1;
                Date completeTime = temp.getCompleteTime();
                String completeTimeStr = DateUtil.dateToStr(completeTime,DateUtil.YYYY_MM_DD_HH_MM);
                resultMap.put("completeTime",completeTimeStr);//完成时间
                resultMap.put("operatorDoctorName",temp.getDoctorName());//执行医生名称
                resultMap.put("node",temp.getNode());
                resultMap.put("relationRecordImg",(temp.getRelationRecordImg()!=null&&StringUtils.isNotEmpty(temp.getRelationRecordImg()))?(new JSONArray(temp.getRelationRecordImg())):null);//json格式
                if(itemType!=1&&itemType!=0){
                    resultMap.put("relationRecordCode",temp.getRelationRecordCode());
                    resultMap.put("completeTimeShort",DateUtil.dateToStr(completeTime,"yyyy/MM/dd"));
                }
            }
            resultMap.put("operate",operate);//是否完成任务(默认0:未完成,1:已完成)
            resultList.add(resultMap);
         }
            return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultList);
//        }
//        return MixEnvelop.getError("没有该服务项详情信息!");
    }*/
    /**
     * 多个康复计划服务项目内容列表
     * @param planDetailIds
@ -644,6 +531,8 @@ public class RehabilitationManageService {
                " LEFT JOIN wlyy_specialist.wlyy_rehabilitation_service_item i on i.code = d.hospital_service_item_id " +
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " where d.id in ("+planDetailResult+") order BY d.execute_time ASC ";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planCreateName(sql);
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName(sql);
        List<Map<String,Object>> serviceItemList = jdbcTemplate.queryForList(sql);
//        if(serviceItemList.size()>0){
//            Map<String,Object> serviceItem = serviceItemList.get(0);
@ -743,6 +632,10 @@ public class RehabilitationManageService {
                " LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id " +
                " LEFT JOIN wlyy_specialist.wlyy_plan_detail_appointment a on d.id=.a.rehabilitation_plan_detail_id " +
                " where d.id = '"+planDetailId+"'";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planName(sql);
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planCreateName(sql);
        sql = TransforSqlUtl.wlyy_plan_detail_appointmentAll(sql);
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName(sql);
        List<Map<String,Object>> serviceItemList = jdbcTemplate.queryForList(sql);
        if (serviceItemList.size()==0){
            return ObjEnvelop.getSuccess(SpecialistMapping.api_success,new HashMap<>());
@ -912,6 +805,7 @@ public class RehabilitationManageService {
//        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status >=0  ";
        String specialistRelationSql = "select DISTINCT d.doctor,d.doctor_name from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.type=2 and  p.patient='"+patientCode+"'";
        specialistRelationSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName2(specialistRelationSql);
        List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
        for(Map<String,Object> one:specialistRelationList){
            String doctor = one.get("doctor")+"";
@ -967,11 +861,7 @@ public class RehabilitationManageService {
            //已完成
            Integer allFinishCount = rehabilitationDetailDao.findByStatusAndPlanId(1,one.getId());
            map.put("allFinishCount",allFinishCount);//已完成
//            //未完成
//            Integer notstartedCount = rehabilitationDetailDao.completenessCount(1,one.getId());//未开始
//            Integer underwayCount = rehabilitationDetailDao.completenessCount(1,one.getId());//进行中
//            Integer unfinishedCount = notstartedCount+underwayCount;
//            map.put("unfinishedCount",unfinishedCount);//未完成
            //完成度(已完成/(已完成+未完成))
            Integer allCount = rehabilitationDetailDao.findAllByPlanId(one.getId());
            map.put("allCount",allCount);//总数
@ -992,51 +882,6 @@ public class RehabilitationManageService {
        //康复计划-已完成、进行中
        resultMap.put("planUnderway",planUnderway);//进行中
        resultMap.put("planFinish",planFinish);//已完成
//        //近期康复相关记录
////        String currentTime = DateUtil.getStringDate();
//        String planDetailSql = " select d.*,i.content,i.title from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN 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 LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where p.patient='"+patientCode+"' and d.executeTime<='"+currentTime+"' order by executeTime desc";
//        List<Map<String,Object>> planDetails = jdbcTemplate.queryForList(planDetailSql);
//        List<Map<String,Object>> planDetailList = new ArrayList<>();
//        for(Map<String,Object> one:planDetails){
//            Date executeTimeDate = (Date)one.get("execute_time");
//            String executeTime = DateUtil.dateToStr(executeTimeDate,"yyyy/MM/dd HH:mm");
//            String content = one.get("content").toString();
//            String title = one.get("title").toString();
//            Integer status = (Integer)one.get("status");
//            String statusName = "";
//            switch (status){
//                case 0:{statusName="未完成";break;}
//                case 1:{statusName="已完成";break;}
//                case 2:{statusName="已预约";break;}
//            }
//            String id = one.get("id").toString();
//            Map<String,Object> map = new HashMap<>();
//            map.put("id",id);//id
//            map.put("executeTime",executeTime);//执行时间
//            map.put("title",title);//项目标题
//            map.put("content",content);//项目内容
//            map.put("statusName",statusName);//状态名称
//            planDetailList.add(map);
//        }
//        resultMap.put("planDetailList",planDetailList);//康复相关记录列表
//        String planDetailCountSql = " select d.status as num from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN 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 LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where p.patient='"+patientCode+"'";
//        List<Map<String,Object>> planDetailList2 = jdbcTemplate.queryForList(planDetailCountSql);
//        Integer planDetailFinish = 0;
//        Integer planDetailUnfinish = 0;
//        for(Map<String,Object> one:planDetailList2){
//
//            Integer status = (Integer)one.get("status");
//            if(status==1){
//                planDetailFinish+=1;
//            }else{
//                planDetailUnfinish+=1;
//            }
//        }
//        resultMap.put("planDetailFinish",planDetailFinish);//已完成
//        resultMap.put("planDetailUnfinish",planDetailUnfinish);//未完成
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,resultMap);
    }
@ -1061,12 +906,8 @@ public class RehabilitationManageService {
            planDetailSql += "  and d.execute_time<='"+endTime+"' ";
        }
        //        List<Map<String,Object>> planDetailsCount = jdbcTemplate.queryForList(planDetailSql);
//        int count = 0;
//        if(planDetailsCount!=null&&planDetailsCount.size()>0){
//            count = planDetailsCount.size();
//        }
        planDetailSql += " ORDER BY s.complete_time DESC LIMIT "+(page-1)*pageSize+","+pageSize;
        planDetailSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll2(planDetailSql);
        List<Map<String,Object>> planDetails = jdbcTemplate.queryForList(planDetailSql);
        List<Map<String,Object>> planDetailList = new ArrayList<>();
        for(Map<String,Object> one:planDetails){
@ -1215,6 +1056,7 @@ public class RehabilitationManageService {
//        String specialistRelationSql = "select * from wlyy_specialist.wlyy_specialist_patient_relation where patient='"+patientCode+"' and sign_status='1' and status='1'";
        String specialistRelationSql = "select DISTINCT d.doctor,d.doctor_name from wlyy_specialist.wlyy_rehabilitation_plan_detail d LEFT JOIN wlyy_specialist.wlyy_patient_rehabilitation_plan p on d.plan_id=p.id where d.type=2 AND d.doctor IS  NOT  NULL and  d.doctor <> ''  and  p.patient='"+patientCode+"'";
        specialistRelationSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailDoctorName2(specialistRelationSql);
        List<Map<String,Object>> specialistRelationList = jdbcTemplate.queryForList(specialistRelationSql);
        for(Map<String,Object> one:specialistRelationList){
            String doctor = one.get("doctor")+"";
@ -1363,6 +1205,7 @@ public class RehabilitationManageService {
            }
            //如果整个计划的服务项都完成了,整个计划也完成了
            String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";
            allSql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(allSql);
            List<RehabilitationDetailDO> rehabilitationDetailDOList = jdbcTemplate.query(allSql,new BeanPropertyRowMapper<>(RehabilitationDetailDO.class));
            int allCount=0;
            String planId="";
@ -1569,6 +1412,7 @@ public class RehabilitationManageService {
        }
        buffer.deleteCharAt(buffer.length()-1);
        String sql = "select * from wlyy_rehabilitation_plan_detail where id in("+buffer+")";
        sql = TransforSqlUtl.wlyy_rehabilitation_plan_detailAll(sql);
        List<RehabilitationDetailDO> rehabilitationDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(RehabilitationDetailDO.class));
        envelop.setObj(rehabilitationDetailDOS);
        return envelop;
@ -1578,7 +1422,7 @@ public class RehabilitationManageService {
        Map<String,Object> reslutMap = new HashMap<>();
        String sql ="SELECT" +
                " p.patient," +
                " p.`name`," +
                " p.name," +
                " p.title," +
                " p.disease_name,p.abort_reason,p.abort_time,p.create_time,p.patient_img," +
                " a.*" +
@ -1606,6 +1450,8 @@ public class RehabilitationManageService {
                " ) a ON p.id = a.plan_id" +
                " WHERE" +
                " p.id = '"+planId+"'";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planName(sql);
        sql = TransforSqlUtl.wlyy_rehabilitation_operate_recordsDoctorName(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Integer allCount = rehabilitationDetailDao.findAllByPlanId(planId);//计划总服务项目数
        Integer finishCount = list.size();//完成服务项目数

+ 3 - 45
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -8,7 +8,7 @@ import com.yihu.jw.entity.rehabilitation.RehabilitationPlanningDO;
import com.yihu.jw.entity.specialist.HospitalServiceItemDO;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.entity.util.TransforSqlUtl;
import com.yihu.jw.restmodel.specialist.PatientSignInfoVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -326,49 +326,6 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
    }
    public MixEnvelop<String,String> createServiceQrCode(String planDetailId,String doctorCode,String imageUrl){
        /*RehabilitationDetailDO rehabilitationDetailDO = rehabilitationDetailDao.findById(planDetailId);
        String fileUrl = "";
        if (rehabilitationDetailDO!=null) {
            if (org.apache.commons.lang3.StringUtils.isNotBlank(rehabilitationDetailDO.getServiceQrCode())) {
                fileUrl = rehabilitationDetailDO.getServiceQrCode();
            } else {
                //String contentJsonStr="{\"planDetailId\":\""+planDetailId+"\",\"sessionId\":\""+sessionId+"\"}";
                String contentJsonStr="https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appId+"&redirect_uri="+wechat_base_url+"/wx/html/kfgl/html/confirm-service.html"+"?paramStr="+planDetailId+","+doctorCode+"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
                InputStream ipt = QrcodeUtil.createQrcode(contentJsonStr, 300, "png");
                if (isneiwang) {
                    // 圖片列表
                    List<String> tempPaths = new ArrayList<String>();
                    try {
                        ObjectNode imgNode = fastDFSHelper.upload(ipt, "png", "plan_service_qrcode" + System.currentTimeMillis());
                        com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(imgNode.toString());
                        tempPaths.add(json.getString("fileId"));
                        String urls = "";
                        for (String image : tempPaths) {
                            if (urls.length() == 0) {
                                urls = image;
                            } else {
                                urls += "," + image;
                            }
                        }
                        fileUrl = fastdfs_file_url + urls;
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    try {
                        UploadVO uploadVO = fileUploadService.request(request, ipt, "png");
                        if (uploadVO!=null){
                            fileUrl = uploadVO.getFullUrl();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                //更新到康复计划居民关系表中
                String sql = "update wlyy_rehabilitation_plan_detail set service_qr_code='" + fileUrl + "' where id='" + planDetailId + "'";
                jdbcTemplate.update(sql);
            }
        }*/
        //更新到康复计划居民关系表中
        String sql = "update wlyy_rehabilitation_plan_detail set service_qr_code='" + imageUrl + "' where id='" + planDetailId + "'";
        jdbcTemplate.update(sql);
@ -379,7 +336,8 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        Map<String,Object> map = new HashedMap();
        int result = 0;
        String name= "";
        String sql ="SELECT rp.patient" + AesEncryptUtils.decryptMysql("rp.name","name") + " FROM `wlyy_rehabilitation_plan_detail` pd LEFT JOIN wlyy_patient_rehabilitation_plan rp ON pd.plan_id = rp.id WHERE pd.id='"+planDetailId+"'";
        String sql ="SELECT p.patient,p.name FROM `wlyy_rehabilitation_plan_detail` pd LEFT JOIN wlyy_patient_rehabilitation_plan p ON pd.plan_id = p.id WHERE pd.id='"+planDetailId+"'";
        sql = TransforSqlUtl.wlyy_patient_rehabilitation_planName(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if (list!=null && list.size()>0){
            if (String.valueOf(list.get(0).get("patient")).equals(patietCode)){