Quellcode durchsuchen

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

wangzhinan vor 4 Jahren
Ursprung
Commit
03789620a8
17 geänderte Dateien mit 386 neuen und 711 gelöschten Zeilen
  1. 5 0
      common/common-entity/sql记录
  2. 42 0
      common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceOrderDO.java
  3. 0 94
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java
  4. 0 83
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java
  5. 0 83
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java
  6. 0 126
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java
  7. 0 116
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java
  8. 53 0
      common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java
  9. 3 0
      common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java
  10. 10 4
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java
  11. 16 4
      svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java
  12. 24 16
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java
  13. 95 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  14. 128 151
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java
  15. 8 20
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  16. 2 1
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java
  17. 0 12
      svr/svr-wlyy-specialist/src/main/resources/application.yml

+ 5 - 0
common/common-entity/sql记录

@ -71,3 +71,8 @@ CREATE TABLE `wlyy_followup_drugs` (
ALTER TABLE wlyy_door_fee_detail ADD pay_status TINYINT(1) COMMENT '付款状态:0未付款 1已付款' ;
-- 2021-01-28 skj 上门服务添加护理人员相关
alter table base.wlyy_door_service_order add `nursing_staff` varchar(50) DEFAULT NULL COMMENT '护理人员code';
alter table base.wlyy_door_service_order add `nursing_staff_name` varchar(50) DEFAULT NULL COMMENT '护理人员name';
alter table base.wlyy_door_service_order add `nursing_staff_type` varchar(50) DEFAULT NULL COMMENT '接单的医生类型:医生,健管师,护士等';

+ 42 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/WlyyDoorServiceOrderDO.java

@ -356,6 +356,21 @@ public class WlyyDoorServiceOrderDO extends UuidIdentityEntityWithOperator {
     */
    private String doctorType;
    /**
     * 接单的护理人员code
     */
    private String nursingStaff;
    /**
     * 接单的护理人员姓名
     */
    private String nursingStaffName;
    /**
     * 接单的护理人员类型:医生,健管师,护士等
     */
    private String nursingStaffType;
    /**
     * 医生预计到达时间
     */
@ -1214,4 +1229,31 @@ public class WlyyDoorServiceOrderDO extends UuidIdentityEntityWithOperator {
    public void setFollowupDate(String followupDate) {
        this.followupDate = followupDate;
    }
    @Column(name = "nursing_staff")
    public String getNursingStaff() {
        return nursingStaff;
    }
    public void setNursingStaff(String nursingStaff) {
        this.nursingStaff = nursingStaff;
    }
    @Column(name = "nursing_staff_name")
    public String getNursingStaffName() {
        return nursingStaffName;
    }
    public void setNursingStaffName(String nursingStaffName) {
        this.nursingStaffName = nursingStaffName;
    }
    @Column(name = "nursing_staff_type")
    public String getNursingStaffType() {
        return nursingStaffType;
    }
    public void setNursingStaffType(String nursingStaffType) {
        this.nursingStaffType = nursingStaffType;
    }
}

+ 0 - 94
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java

@ -1,94 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/5/29.
// */
//@Entity
//@Table(name = "wlyy_patient_label")
//public class PatientLabelDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "label_name")
//    private String labelName;//标签名称',
//    @Column(name = "label_code")
//    private String labelCode;//标签code',
//    @Column(name = "label_type")
//    private String labelType;//标签类型:1.装病类型;2.健康情况;3.自定义',
//    @Column(name = "sort")
//    private Integer sort;//排序',
//    @Column(name = "team_code")
//    private String teamCode;//团队code',
//    @Column(name = "del")
//    private String del;//1:有效;0:删除',
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getLabelName() {
//        return labelName;
//    }
//
//    public void setLabelName(String labelName) {
//        this.labelName = labelName;
//    }
//
//
//    public String getLabelCode() {
//        return labelCode;
//    }
//
//    public void setLabelCode(String labelCode) {
//        this.labelCode = labelCode;
//    }
//
//
//    public String getLabelType() {
//        return labelType;
//    }
//
//    public void setLabelType(String labelType) {
//        this.labelType = labelType;
//    }
//
//
//    public Integer getSort() {
//        return sort;
//    }
//
//    public void setSort(Integer sort) {
//        this.sort = sort;
//    }
//
//
//    public String getTeamCode() {
//        return teamCode;
//    }
//
//    public void setTeamCode(String teamCode) {
//        this.teamCode = teamCode;
//    }
//
//
//    public String getDel() {
//        return del;
//    }
//
//    public void setDel(String del) {
//        this.del = del;
//    }
//}

+ 0 - 83
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java

@ -1,83 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/5/29.
// */
//@Entity
//@Table(name = "wlyy_patient_label_info")
//public class PatientLabelInfoDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "patient")
//    private String patient;//居民code',
//    @Column(name = "label_name")
//    private String labelName;//标签名称',
//    @Column(name = "label_code")
//    private String labelCode;//标签code',
//    @Column(name = "label_type")
//    private String labelType;//标签类别',
//    @Column(name = "team_code")
//    private String teamCode;//团队code',
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getPatient() {
//        return patient;
//    }
//
//    public void setPatient(String patient) {
//        this.patient = patient;
//    }
//
//
//    public String getLabelName() {
//        return labelName;
//    }
//
//    public void setLabelName(String labelName) {
//        this.labelName = labelName;
//    }
//
//
//    public String getLabelCode() {
//        return labelCode;
//    }
//
//    public void setLabelCode(String labelCode) {
//        this.labelCode = labelCode;
//    }
//
//
//    public String getLabelType() {
//        return labelType;
//    }
//
//    public void setLabelType(String labelType) {
//        this.labelType = labelType;
//    }
//
//
//    public String getTeamCode() {
//        return teamCode;
//    }
//
//    public void setTeamCode(String teamCode) {
//        this.teamCode = teamCode;
//    }
//}

+ 0 - 83
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java

@ -1,83 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist_Article")
//public class SpecialistArticleDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "patient")
//    private String patient;//居民
//    @Column(name = "patient_name")
//    private String patientName;//居民
//    @Column(name = "doctor")
//    private String doctor;//医生
//    @Column(name = "doctor_name")
//    private String doctorName;//医生
//    @Column(name = "article")
//    private String article;//文章
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getPatient() {
//        return patient;
//    }
//
//    public void setPatient(String patient) {
//        this.patient = patient;
//    }
//
//
//    public String getPatientName() {
//        return patientName;
//    }
//
//    public void setPatientName(String patientName) {
//        this.patientName = patientName;
//    }
//
//
//    public String getDoctor() {
//        return doctor;
//    }
//
//    public void setDoctor(String doctor) {
//        this.doctor = doctor;
//    }
//
//
//    public String getDoctorName() {
//        return doctorName;
//    }
//
//    public void setDoctorName(String doctorName) {
//        this.doctorName = doctorName;
//    }
//
//
//    public String getArticle() {
//        return article;
//    }
//
//    public void setArticle(String article) {
//        this.article = article;
//    }
//}

+ 0 - 126
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java

@ -1,126 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist_consult")
//public class SpecialistConsultDO extends IdEntityWithOperation implements Serializable {
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "consult")
//    private String consult;//关联咨询code
//    @Column(name = "doctor")
//    private String doctor;//专科医生
//    @Column(name = "doctor_name")
//    private String doctorName;//专科医生姓名
//    @Column(name = "type")
//    private String type;//类型:1.家庭医生咨询,2.居民咨询
//    @Column(name = "member")
//    private String member;//咨询对象
//    @Column(name = "member_name")
//    private String memberName;//咨询对象
//    @Column(name = "status")
//    private String status;// 1.咨询完成,0.咨询进行中
//    @Column(name = "reply")
//    private String reply;// 1.专科医生已经参与;0.~未参与
//    @Column(name = "content")
//    private String content;//咨询内容
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getConsult() {
//        return consult;
//    }
//
//    public void setConsult(String consult) {
//        this.consult = consult;
//    }
//
//
//    public String getDoctor() {
//        return doctor;
//    }
//
//    public void setDoctor(String doctor) {
//        this.doctor = doctor;
//    }
//
//
//    public String getDoctorName() {
//        return doctorName;
//    }
//
//    public void setDoctorName(String doctorName) {
//        this.doctorName = doctorName;
//    }
//
//
//    public String getType() {
//        return type;
//    }
//
//    public void setType(String type) {
//        this.type = type;
//    }
//
//
//    public String getMember() {
//        return member;
//    }
//
//    public void setMember(String member) {
//        this.member = member;
//    }
//
//
//    public String getMemberName() {
//        return memberName;
//    }
//
//    public void setMemberName(String memberName) {
//        this.memberName = memberName;
//    }
//
//
//    public String getStatus() {
//        return status;
//    }
//
//    public void setStatus(String status) {
//        this.status = status;
//    }
//
//
//    public String getReply() {
//        return reply;
//    }
//
//    public void setReply(String reply) {
//        this.reply = reply;
//    }
//
//
//    public String getContent() {
//        return content;
//    }
//
//    public void setContent(String content) {
//        this.content = content;
//    }
//}

+ 0 - 116
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java

@ -1,116 +0,0 @@
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist")
//public class SpecialistDO extends IdEntityWithOperation implements Serializable {
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "name")
//    private String name; //专科医生姓名
//    @Column(name = "profession")
//    private String profession; //专业
//    @Column(name = "profession_name")
//    private String professionName; // 专业名称
//    @Column(name = "dept")
//    private String dept; //科室
//    @Column(name = "dept_name")
//    private String deptName; //科室名称
//
//    @Column(name = "hospital")
//    private String hospital;//医院
//    @Column(name = "hospital_name")
//    private String hospitalName;//医院名称
//    @Column(name = "del")
//    private String del;//1:有效;0:删除
//
//
//    public String getLeaderCode() {
//        return saasId;
//    }
//
//    public void setLeaderCode(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//
//    public String getProfession() {
//        return profession;
//    }
//
//    public void setProfession(String profession) {
//        this.profession = profession;
//    }
//
//
//    public String getProfessionName() {
//        return professionName;
//    }
//
//
//    public void setProfessionName(String professionName) {
//        this.professionName = professionName;
//    }
//
//
//    public String getDept() {
//        return dept;
//    }
//
//    public void setDept(String dept) {
//        this.dept = dept;
//    }
//
//
//    public String getDeptName() {
//        return deptName;
//    }
//
//    public void setDeptName(String deptName) {
//        this.deptName = deptName;
//    }
//
//    public String getHospital() {
//        return hospital;
//    }
//
//    public void setHospital(String hospital) {
//        this.hospital = hospital;
//    }
//
//
//    public String getHospitalName() {
//        return hospitalName;
//    }
//
//    public void setHospitalName(String hospitalName) {
//        this.hospitalName = hospitalName;
//    }
//
//
//    public String getDel() {
//        return del;
//    }
//
//    public void setDel(String del) {
//        this.del = del;
//    }
//}

+ 53 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/util/AesEncryptUtils.java

@ -6,6 +6,9 @@ import org.springframework.util.StringUtils;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.spec.SecretKeySpec;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
 * 前后端数据传输加密工具类
@ -21,6 +24,56 @@ public class AesEncryptUtils {
    //AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a')
    public static String decryptMysql(String name,String alias){
        return decryptMysql(name)+" as "+alias+" ";
    }
    public static String decryptMysql(String name){
        return ","+decryptMysqlNo(name);
    }
    public static String decryptMysqlNo(String name){
        return "CAST(AES_DECRYPT(from_base64("+name+"), '"+KEY+"') AS char)";
    }
    /**
     * 针对 GROUP_CONCAT 函数,逗号分隔符进行解密
     * @param str
     * @return
     */
    public static String DHFGF(String str){
        char searchChar = ',';
        int count = 0;
        char[] charArray = str.toCharArray();
        for (char item : charArray) {
            if (item == searchChar) {
                count++;
            }
        }
        StringBuffer sb = new StringBuffer();
        String[] ss = new String[count];
        if (count == 0){
            sb.append(AesEncryptUtils.decrypt(str)); ;
        }else {
            for (int i=0;i<count;i++){
                ss = str.split(",") ;
            }
            List<String> list = new ArrayList<String>();
            Collections.addAll(list,ss);
            for (int j=0;j<list.size();j++){
                str = AesEncryptUtils.decrypt(list.get(j));
                sb.append(str);
                if (j == (list.size()-1)){
                    break;
                }
                sb.append(",");
            }
        }
        return sb.toString();
    }
    /**
     * 加密
     * @param content 加密的字符串

+ 3 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java

@ -198,6 +198,9 @@ public class IdCardUtil {
     */
    public static String getSexForIdcard(String CardCode)
            throws Exception {
        if(StringUtils.isEmpty(CardCode)){
            return level_sex_3_name;
        }
        String sex = level_sex_3_name;
        try {
            if (CardCode.length() == 18) {

+ 10 - 4
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/controller/doctor/DoorOrderController.java

@ -196,9 +196,12 @@ public class DoorOrderController extends BaseController {
            @ApiParam(name = "dispathcherName", value = "当前医生姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName) {
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName,
            @ApiParam(name = "nursingStaff", value = "护理人员code") @RequestParam(value = "nursingStaff", required = false) String nursingStaff,
            @ApiParam(name = "nursingStaffName", value = "护理人员姓名") @RequestParam(value = "nursingStaffName", required = false) String nursingStaffName,
            @ApiParam(name = "nursingStaffType", value = "护理人员职称") @RequestParam(value = "nursingStaffType", required = false) String nursingStaffType) {
        try{
            JSONObject result = wlyyDoorServiceOrderService.transferOrder(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            JSONObject result = wlyyDoorServiceOrderService.transferOrder(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName,nursingStaff,nursingStaffName,nursingStaffType);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return error( -1,result.getString(ResponseContant.resultMsg));
            }
@ -901,9 +904,12 @@ public class DoorOrderController extends BaseController {
            @ApiParam(name = "dispathcherName", value = "调度员姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName) {
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = true) String doctorJobName,
            @ApiParam(name = "nursingStaff", value = "护理人员code") @RequestParam(value = "nursingStaff", required = false) String nursingStaff,
            @ApiParam(name = "nursingStaffName", value = "护理人员姓名") @RequestParam(value = "nursingStaffName", required = false) String nursingStaffName,
            @ApiParam(name = "nursingStaffType", value = "护理人员职称") @RequestParam(value = "nursingStaffType", required = false) String nursingStaffType) {
        try{
            JSONObject result = wlyyDoorServiceOrderService.sendOrderToDoctor(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            JSONObject result = wlyyDoorServiceOrderService.sendOrderToDoctor(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName,nursingStaff,nursingStaffName,nursingStaffType);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return error( -1,result.getString(ResponseContant.resultMsg));
            }

+ 16 - 4
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -717,7 +717,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        if(StringUtils.isNoneBlank(orderDO.getDoctor())){
            //服务医生修改,直接转派
            BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
            sendOrderToDoctor(orderDO.getId(),null,"system","系统",transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName());
            BaseDoctorDO transNursingStaff = doctorDao.findById(orderDO.getNursingStaff());
            sendOrderToDoctor(orderDO.getId(),null,"system","系统",transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName(),transNursingStaff.getId(),transNursingStaff.getName(),transNursingStaff.getJobTitleName());
        }
        return result;
@ -2214,7 +2215,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject sendOrderToDoctor(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName){
    public JSONObject sendOrderToDoctor(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName,String nursingStaff,String nursingStaffName,String nursingStaffType){
        JSONObject result = new JSONObject();
        WlyyDoorServiceOrderDO doorServiceOrderDO = wlyyDoorServiceOrderDao.findOne(orderId);
@ -2247,6 +2248,11 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        doorServiceOrderDO.setUpdateUser(dispatcher);
        doorServiceOrderDO.setUpdateUserName(dispathcherName);
        doorServiceOrderDO.setDispatcherResponseTime(new Date());
        doorServiceOrderDO.setNursingStaff(nursingStaff);
        doorServiceOrderDO.setNursingStaffName(nursingStaffName);
        doorServiceOrderDO.setNursingStaffType(nursingStaffType);
        this.save(doorServiceOrderDO);
        // 给医生发派单消息
@ -2290,7 +2296,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public JSONObject transferOrder(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName){
    public JSONObject transferOrder(String orderId,String remark,String dispatcher,String dispathcherName,String doctor,String doctorName,String doctorJobName,String nursingStaff,String nursingStaffName,String nursingStaffType){
        JSONObject result = new JSONObject();
        WlyyDoorServiceOrderDO doorServiceOrderDO = wlyyDoorServiceOrderDao.findOne(orderId);
        if(null == doorServiceOrderDO){
@ -2322,6 +2328,11 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        doorServiceOrderDO.setUpdateUser(dispatcher);
        doorServiceOrderDO.setUpdateUserName(dispathcherName);
        doorServiceOrderDO.setDispatcherResponseTime(new Date());
        doorServiceOrderDO.setNursingStaff(nursingStaff);
        doorServiceOrderDO.setNursingStaffName(nursingStaffName);
        doorServiceOrderDO.setNursingStaffType(nursingStaffType);
        this.save(doorServiceOrderDO);
        // 给医生发派单消息
@ -2872,7 +2883,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            //服务医生修改,直接转派
            BaseDoctorDO doctor = doctorDao.findById(doctorCode);
            BaseDoctorDO transDoctor = doctorDao.findById(orderDO.getDoctor());
            transferOrder(orderDO.getId(),null,doctor.getId(),doctor.getName(),transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName());
            BaseDoctorDO transNursingStaff = doctorDao.findById(orderDO.getNursingStaff());
            transferOrder(orderDO.getId(),null,doctor.getId(),doctor.getName(),transDoctor.getId(),transDoctor.getName(),transDoctor.getJobTitleName(),transNursingStaff.getId(),transNursingStaff.getName(),transNursingStaff.getJobTitleName());
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);

+ 24 - 16
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java

@ -266,14 +266,7 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        StringBuffer sql1= new StringBuffer("SELECT  b.* FROM (");
        sql1.append(sql).append(") b GROUP BY b.order_no limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql1.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        for (int i=0;i<list.size();i++){
            list.get(i).setQualityLeader(AesEncryptUtils.decrypt(list.get(i).getQualityLeader()));
            list.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getQualityLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        List<IotDeviceQualityInspectionPlanDO> list = transfor(sql1.toString(),args);
        long count = list.size();
@ -283,6 +276,26 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,qualityInspectionPlanVOList, page, size,count);
    }
    public List<IotDeviceQualityInspectionPlanDO> transfor(String sql,List<Object> args){
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        return transfor(list);
    }
    public List<IotDeviceQualityInspectionPlanDO> transfor(String sql){
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        return transfor(list);
    }
    public List<IotDeviceQualityInspectionPlanDO> transfor(List<IotDeviceQualityInspectionPlanDO> list){
        for (int i=0;i<list.size();i++){
            list.get(i).setQualityLeader(AesEncryptUtils.decrypt(list.get(i).getQualityLeader()));
            list.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(list.get(i).getQualityLeaderPhone()));
            list.get(i).setCreateUserName(AesEncryptUtils.decrypt(list.get(i).getCreateUserName()));
            list.get(i).setUpdateUserName(AesEncryptUtils.decrypt(list.get(i).getUpdateUserName()));
        }
        return list;
    }
    /**
     * 质检计划时间提醒
     * @param time
@ -314,7 +327,7 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
            args.add(time);
        }
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        List<IotDeviceQualityInspectionPlanDO> list = transfor(sql.toString(),args);
        return list;
@ -332,13 +345,8 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        sql.append(" and c.order_no = ").append(orderNo);
        sql.append("  ORDER BY c.plan_time DESC LIMIT ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> listOrderNo = jdbcTempalte.query(sql.toString(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        for (int i=0;i<listOrderNo.size();i++){
            listOrderNo.get(i).setQualityLeader(AesEncryptUtils.decrypt(listOrderNo.get(i).getQualityLeader()));
            listOrderNo.get(i).setQualityLeaderPhone(AesEncryptUtils.decrypt(listOrderNo.get(i).getQualityLeaderPhone()));
            listOrderNo.get(i).setCreateUserName(AesEncryptUtils.decrypt(listOrderNo.get(i).getCreateUserName()));
            listOrderNo.get(i).setUpdateUserName(AesEncryptUtils.decrypt(listOrderNo.get(i).getUpdateUserName()));
        }
        List<IotDeviceQualityInspectionPlanDO> listOrderNo = transfor(sql.toString());
        List<IotDeviceQualityInspectionPlanVO> list = transforList(listOrderNo);
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,list,page,size,count);

+ 95 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -1,5 +1,6 @@
package com.yihu.iot.service.device;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.elasticsearch.ElasticSearchHelper;
import com.yihu.iot.dao.company.IotCompanyDao;
@ -506,6 +507,15 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        return list;
    }
@ -549,12 +559,63 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " +(page-1)* pageSize + "," +pageSize;
            List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            list.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Device.message_success_find, list,page, pageSize,count);
        }
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        list.forEach(one->{
            one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
            one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
            one.setPatientName(AesEncryptUtils.DHFGF(one.getPatientName()));
            one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
            one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
            one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
            one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
        });
        return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
    }
    public static void main(String[] args) {
        String str = "wfL8T2aAmlBnZv2S8QwZXQ==,BFPvVzBHgwa7plBHhkcOQw==,BD4ExdUzPKini5xns11z6Q==,IJOA+Ug/mjvF+L64a/Dq5g==";
        char searchChar = ',';
        int count = 0;
        char[] charArray = str.toCharArray();
        for (char item : charArray) {
            if (item == searchChar) {
                count++;
            }
        }
        StringBuffer sb = new StringBuffer();
        String[] ss = new String[count];
        if (count == 0){
            sb.append(AesEncryptUtils.decrypt(str)); ;
        }else {
            for (int i=0;i<count;i++){
                ss = str.split(",") ;
            }
            List<String>list = new ArrayList<String>();
            Collections.addAll(list,ss);
            for (int j=0;j<list.size();j++){
                str = AesEncryptUtils.decrypt(list.get(j));
                sb.append(str);
                if (j == (list.size()-1)){
                    break;
                }
                sb.append(",");
            }
        }
        System.out.println(sb.toString());
    }
    public void deleteRepairDevice(String deviceSn) {
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findAllByDeviceSn(deviceSn);
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){
@ -599,9 +660,23 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            for (int i=0;i<deviceVOList.size();i++){
                deviceVOList.get(i).setPatientName(AesEncryptUtils.decrypt(deviceVOList.get(i).getPatientName()));
                deviceVOList.get(i).setIdcard(AesEncryptUtils.decrypt(deviceVOList.get(i).getIdcard()));
                deviceVOList.get(i).setMobile(AesEncryptUtils.decrypt(deviceVOList.get(i).getMobile()));
                deviceVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getCreateUserName()));
                deviceVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            for (int i=0;i<deviceVOList.size();i++){
                deviceVOList.get(i).setPatientName(AesEncryptUtils.decrypt(deviceVOList.get(i).getPatientName()));
                deviceVOList.get(i).setIdcard(AesEncryptUtils.decrypt(deviceVOList.get(i).getIdcard()));
                deviceVOList.get(i).setMobile(AesEncryptUtils.decrypt(deviceVOList.get(i).getMobile()));
                deviceVOList.get(i).setCreateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getCreateUserName()));
                deviceVOList.get(i).setUpdateUserName(AesEncryptUtils.decrypt(deviceVOList.get(i).getUpdateUserName()));
            }
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
    }
@ -616,7 +691,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            sql += "and d.device_sn like '%" + deviceSn + "%' ";
        }
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patient_name like '%" + patientName + "%' ";
//            sql += "and d.patient_name like '%" + patientName + "%' ";
            sql += "and AES_DECRYPT(from_base64(d.patient_name),'jkzl2021ZJXL*#%a') like '%" + patientName + "%' ";
        }
        if(StringUtils.isNotBlank(deviceName)){
            sql += "and d.device_name like '%" + deviceName + "%' ";
@ -638,9 +714,27 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            deviceVOList.forEach(one->{
                one.setIdcard(AesEncryptUtils.decrypt(one.getIdcard()));
                one.setMobile(AesEncryptUtils.decrypt(one.getMobile()));
                one.setPatientName(AesEncryptUtils.decrypt(one.getPatientName()));
                one.setContactsName(AesEncryptUtils.decrypt(one.getContactsName()));
                one.setContactsMobile(AesEncryptUtils.decrypt(one.getContactsMobile()));
                one.setCreateUserName(AesEncryptUtils.decrypt(one.getCreateUserName()));
                one.setUpdateUserName(AesEncryptUtils.decrypt(one.getUpdateUserName()));
            });
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
    }

+ 128 - 151
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -10,6 +10,7 @@ import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanDO;
import com.yihu.jw.entity.specialist.rehabilitation.PatientRehabilitationPlanLogDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationDetailDO;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationOperateRecordsDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.specialist.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -51,8 +52,6 @@ public class SpecialistService{
    private JdbcTemplate jdbcTemplate;
    @Value("${basedb.name}")
    private String basedb;
    @Value("${encrypt.key}")
    private String key;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
@ -74,18 +73,18 @@ public class SpecialistService{
    public MixEnvelop<SpecialistPatientRelationVO, SpecialistPatientRelationVO> findSpecialistPatientRelation(String doctor, Integer page, Integer size)throws ParseException {
        String sql = "SELECT " +
                " r.id, " +
                " r.doctor, " +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char) AS doctor_name, " +
                " r.saas_id AS sassId, " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patient_name, " +
                " r.health_doctor AS healthDoctor, " +
                " CAST(AES_DECRYPT(from_base64(r.health_doctor_name), '" + key + "') AS char) AS healthDoctorName, " +
                " r.sign_code AS signCode, " +
                " r.doctor " +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctor_name") +
                " ,r.saas_id AS sassId, " +
                " r.patient " +
                 AesEncryptUtils.decryptMysql("r.patient_name","patient_name") +
                " ,r.health_doctor AS healthDoctor " +
                AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
                " ,r.sign_code AS signCode, " +
                " r.sign_year AS signYear, " +
                " r.sign_doctor AS sign_doctor, " +
                " CAST(AES_DECRYPT(from_base64(r.sign_doctor_name), '" + key + "') AS char) AS signDoctorName, " +
                " r.create_time AS createTime," +
                " r.sign_doctor AS sign_doctor " +
                AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
                " ,r.create_time AS createTime," +
                " r.status " +
                "FROM " +
                " wlyy_specialist_patient_relation r " +
@ -135,9 +134,9 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findNoLabelPatientRelation(String doctor){
        String sql ="SELECT " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo, " +
                " rd.create_time AS createTime ," +
                " p.sex " +
@ -175,9 +174,9 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> findPatientRelatioByAssistant(String doctor , String assistant, Integer page, Integer size){
        String sql ="SELECT " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                " ,IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.photo ," +
                " p.sex," +
                " h.label_name as health, " +
@ -207,8 +206,8 @@ public class SpecialistService{
    public MixEnvelop<PatientLabelVO, PatientLabelVO> getPatientByLabel(String doctor, String labelType,String teamCode, String labelCode, Integer page, Integer size,String shareDoctor){
        String sql="SELECT " +
                " CAST(AES_DECRYPT(from_base64(s.patient_name), '" + key + "') AS char)  AS name, " +
                " p. CODE, " +
                " p. CODE " +
                AesEncryptUtils.decryptMysql("s.patient_name","name") +
                " p.sex," +
                " IFNULL( " +
                "  YEAR ( " +
@ -222,10 +221,10 @@ public class SpecialistService{
                " p.photo, " +
                " lb.labelName as health, " +
                " lb.label AS healthcode ," +
                " s.health_assistant AS healthAssistant," +
                " CAST(AES_DECRYPT(from_base64(s.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                " s.health_assistant AS healthAssistant" +
                AesEncryptUtils.decryptMysql("s.health_assistant_name","healthAssistantName") +
//                " s.health_assistant_name AS healthAssistantName," +
                " s.is_manage AS isManage," +
                " ,s.is_manage AS isManage," +
                " s.id AS specialCode" +
                " FROM " +
                " ( " +
@ -252,19 +251,19 @@ public class SpecialistService{
        System.out.print("日志:"+sql);
        if("7".equals(labelType)){
            sql = "SELECT " +
                    "c.CODE," +
                    " CAST(AES_DECRYPT(from_base64(a.patient_name), '" + key + "') AS char)  AS name, " +
                    "c.CODE" +
                    AesEncryptUtils.decryptMysql("a.patient_name","name") +
//                    "c.NAME," +
                    "c.sex," +
                    ",c.sex," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
                    "c.photo,b.disease AS label," +
                    "b.disease_name AS labelName," +
                    "d.label_name AS health," +
                    "d.label AS healthcode," +
                    "a.health_assistant AS healthAssistant," +
                    " CAST(AES_DECRYPT(from_base64(a.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                    "a.health_assistant AS healthAssistant" +
                    AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    "a.is_manage AS isManage, " +
                    ",a.is_manage AS isManage, " +
                    "a.id AS specialCode " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient_disease_server b ON a.id=b.specialist_relation_code AND b.disease=" +labelCode+" and b.del=1 "+
@ -281,16 +280,16 @@ public class SpecialistService{
        
        if("pending".equals(labelType)){
            sql = "SELECT " +
                    "c.CODE," +
                    " CAST(AES_DECRYPT(from_base64(a.patient_name), '" + key + "') AS char)  AS name, " +
                    "c.CODE" +
                    AesEncryptUtils.decryptMysql("a.patient_name","name") +
//                    "c.NAME," +
                    "c.sex," +
                    ",c.sex," +
                    "IFNULL(YEAR (from_days(datediff(now(),c.birthday))),'未知') age," +
                    "c.photo," +
                    "a.health_assistant AS healthAssistant," +
                    " CAST(AES_DECRYPT(from_base64(a.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                    "a.health_assistant AS healthAssistant" +
                    AesEncryptUtils.decryptMysql("a.health_assistant_name","healthAssistantName") +
//                    "a.health_assistant_name AS healthAssistantName, " +
                    "a.is_manage AS isManage " +
                    ",a.is_manage AS isManage " +
                    "FROM wlyy_specialist.wlyy_specialist_patient_relation a " +
                    "JOIN "+basedb+".wlyy_patient c ON a.patient=c.CODE " +
                    " WHERE a.sign_status> 0 AND a.`status`>=0 AND (a.is_manage = 0 or a.is_manage is null)" +
@ -346,10 +345,10 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByName(String doctor, String nameKey,String teamCode, Integer page, Integer size){
        String sql ="SELECT " +
                " p.code AS patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " p.code AS patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " p.`name` AS patientName, " +
                " p.photo, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.sex ," +
                " h.label_name as health, " +
@ -372,7 +371,7 @@ public class SpecialistService{
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                "' ) " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND CAST(AES_DECRYPT(from_base64 (r.patient_name),'" + key + "') AS CHAR) LIKE '%"+nameKey+"%' "+
                " AND " + AesEncryptUtils.decryptMysqlNo("r.patient_name") + " LIKE '%"+nameKey+"%' "+
                " LIMIT "+(page-1)*size+","+size;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
@ -383,10 +382,10 @@ public class SpecialistService{
    public MixEnvelop<PatientRelationVO, PatientRelationVO> getDoctorPatientByNameOrIdCard(String doctor, String filter,String teamCode, Integer page, Integer size){
        String sql ="SELECT " +
                " p.code AS code, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " p.code AS code " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " p.`name` AS name, " +
                " p.photo, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.sex ," +
                " p.idcard ," +
@ -410,7 +409,7 @@ public class SpecialistService{
                " r.doctor IN ( SELECT m.doctor_code FROM wlyy.wlyy_admin_team_member m WHERE m.team_id ='" +teamCode+
                "' ) " +
                " AND r.status >=0  AND r.sign_status >0 " +
                " AND (CAST(AES_DECRYPT(from_base64 (r.patient_name),'" + key + "') AS CHAR) LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
                " AND (" +  AesEncryptUtils.decryptMysqlNo("r.patient_name")  + " LIKE '%"+filter+"%' OR p.idcard LIKE '%"+filter+"%') "+
                " LIMIT "+(page-1)*size+","+size;
        List<PatientRelationVO> patientRelationVOs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientRelationVO.class));
@ -449,10 +448,10 @@ public class SpecialistService{
        }
        String sql ="SELECT " +
                " p.code AS patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " p.code AS patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " p.`name` AS patientName, " +
                " p.photo, " +
                " ,p.photo, " +
                " IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                " p.sex, " +
                " h.label_name as health, " +
@ -487,14 +486,14 @@ public class SpecialistService{
        //1.查询该居民是否已经与该专科医生签约
        String checkDoctorSql = "SELECT " +
                " r.id AS relationCode," +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " r.team_code AS teamCode, " +
                " ,r.team_code AS teamCode, " +
                " t.`name`, " +
                " d.photo ," +
                " d.code AS doctor," +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char)  AS doctorName " +
                " d.code AS doctor" +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
//                " d.name AS doctorName" +
                " FROM " +
                " wlyy_specialist_patient_relation r " +
@ -511,17 +510,7 @@ public class SpecialistService{
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " CAST(AES_DECRYPT(from_base64(d.`name`), '" + key + "') AS char)  AS doctorName " +
//                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                List<AdminTeamMemberVO> adminTeamMemberVOs = findTeamMember(specialistTeamVO.getTeamCode());
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
            return MixEnvelop.getSuccess(SpecialistMapping.doctor_exist,specialistTeamVOs.get(0));
@ -530,10 +519,10 @@ public class SpecialistService{
        //验证团队是否已经签约
        String checkTeamSql = "SELECT " +
                " r.id AS relationCode," +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " r.team_code AS teamCode, " +
                " ,r.team_code AS teamCode, " +
                " t.`name`, " +
                " d.photo " +
                " FROM " +
@ -550,17 +539,7 @@ public class SpecialistService{
        if(teamVOs!=null&&teamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:teamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " CAST(AES_DECRYPT(from_base64(d.`name`), '" + key + "') AS char)  AS doctorName " +
//                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                List<AdminTeamMemberVO> adminTeamMemberVOs = findTeamMember(specialistTeamVO.getTeamCode());
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
            return MixEnvelop.getSuccess(SpecialistMapping.team_exist,teamVOs.get(0));
@ -583,6 +562,20 @@ public class SpecialistService{
        return MixEnvelop.getSuccess(SpecialistMapping.api_success,relationDO.getId());
    }
    public List<AdminTeamMemberVO> findTeamMember(Long teamId){
        String menberSql = "SELECT " +
                " m.doctor_code AS doctorCode " +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
//                        " d.`name` AS doctorName " +
                " FROM " +
                " "+basedb+".wlyy_admin_team_member m " +
                " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                " WHERE  " +
                " m.available='1' " +
                " AND m.team_id="+teamId;
        return jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
    }
    public MixEnvelop<Boolean, Boolean> agreeSpecialistTeam(String state, String relationCode, String remark,String health_assistant,String health_assistant_name){
        SpecialistPatientRelationDO relation = specialistPatientRelationDao.findOne(relationCode);
@ -607,13 +600,13 @@ public class SpecialistService{
    public MixEnvelop<PatientSignInfoVO, PatientSignInfoVO> findPatientSigninfo(String code){
        String sql = "SELECT " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " r.doctor, " +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char)  AS doctorName, " +
                " ,r.doctor " +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
//                " r.doctor_name AS doctorName, " +
                " d.hospital, " +
                " ,d.hospital, " +
                " d.hospital_name AS hospitalName, " +
                " d.photo, " +
                " d.dept, " +
@ -638,16 +631,16 @@ public class SpecialistService{
    public MixEnvelop<SpecialistTeamVO, SpecialistTeamVO> findPatientTeamList(String patient){
        String sql = "SELECT " +
                " r.id AS relationCode, " +
                " r.patient, " +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.patient " +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " r.team_code,r.sign_date , " +
                " ,r.team_code,r.sign_date , " +
                " t.`name` AS name," +
                " d.photo," +
                " md.code AS doctor," +
                " CAST(AES_DECRYPT(from_base64(md.name), '" + key + "') AS char)  AS doctorName, " +
                " md.code AS doctor" +
                AesEncryptUtils.decryptMysql("md.name","doctorName") +
//                " md.name AS doctorName," +
                "d.hospital,d.hospital_name " +
                ",d.hospital,d.hospital_name " +
                " FROM " +
                " wlyy_specialist_patient_relation r  " +
                " JOIN "+basedb+".wlyy_admin_team t ON t.id = r.team_code " +
@ -661,17 +654,7 @@ public class SpecialistService{
        if(specialistTeamVOs!=null&&specialistTeamVOs.size()>0){
            for(SpecialistTeamVO specialistTeamVO:specialistTeamVOs){
                String menberSql = "SELECT " +
                        " m.doctor_code AS doctorCode, " +
                        " CAST(AES_DECRYPT(from_base64(d.name), '" + key + "') AS char)  AS doctorName " +
//                        " d.`name` AS doctorName " +
                        " FROM " +
                        " "+basedb+".wlyy_admin_team_member m " +
                        " JOIN "+basedb+".wlyy_doctor d ON m.doctor_code = d.`code` " +
                        " WHERE  " +
                        " m.available='1' " +
                        " AND m.team_id="+specialistTeamVO.getTeamCode();
                List<AdminTeamMemberVO> adminTeamMemberVOs = jdbcTemplate.query(menberSql,new BeanPropertyRowMapper(AdminTeamMemberVO.class));
                List<AdminTeamMemberVO> adminTeamMemberVOs = findTeamMember(specialistTeamVO.getTeamCode());
                specialistTeamVO.setMembers(adminTeamMemberVOs);
            }
        }
@ -682,12 +665,12 @@ public class SpecialistService{
        String sql = "SELECT " +
                " r.id AS relationCode, " +
                " r.patient, " +
                " r.team_code AS teamCode," +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.team_code AS teamCode" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
//                " d.name AS doctorName, " +
                " CAST(AES_DECRYPT(from_base64(d.name), '" + key + "') AS char)  AS doctorName, " +
                " d.code AS doctor, " +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
                " ,d.code AS doctor, " +
                " d.photo, " +
                " d.dept, " +
                " d.dept_name AS deptName, " +
@ -714,16 +697,16 @@ public class SpecialistService{
                "(SELECT " +
                " r.id AS relationCode," +
                " r.patient, " +
                " r.team_code AS teamCode," +
                " CAST(AES_DECRYPT(from_base64(r.patient_name), '" + key + "') AS char)  AS patientName, " +
                " r.team_code AS teamCode" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
//                " r.patient_name AS patientName, " +
                " r.health_assistant AS healthAssistant," +
                " CAST(AES_DECRYPT(from_base64(r.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                " ,r.health_assistant AS healthAssistant" +
                AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
//                " r.health_assistant_name AS healthAssistantName," +
                " r.create_time AS createTime," +
                " CAST(AES_DECRYPT(from_base64(d.name), '" + key + "') AS char)  AS doctorName, " +
                " ,r.create_time AS createTime" +
                AesEncryptUtils.decryptMysql("d.name","doctorName") +
//                " d.name AS doctorName, " +
                " d.code AS doctor, " +
                " ,d.code AS doctor, " +
                " d.photo, " +
                " d.dept, " +
                " d.dept_name AS deptName, " +
@ -753,10 +736,10 @@ public class SpecialistService{
        
        if(StringUtils.isNotBlank(name)){
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    " CAST(AES_DECRYPT(from_base64(doctor.NAME), '" + key + "') AS char)  AS NAME, " +
                    "doctor.CODE AS CODE" +
                    AesEncryptUtils.decryptMysql("doctor.name","name") +
//                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    ",doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
@ -778,13 +761,14 @@ public class SpecialistService{
                    "SELECT a.doctor_health AS doctorcode FROM wlyy.wlyy_sign_family a RIGHT JOIN ( " +
                    "SELECT patient FROM wlyy_specialist_patient_relation WHERE sign_status> 0 AND `status`>=0 AND doctor='"+doctor+"') b ON a.patient=b.patient WHERE a.`status`=1 AND a.expenses_status = 1 " +
                    ") " +
                    "t ON doctor.CODE=t.doctorcode and CAST(AES_DECRYPT(from_base64(doctor.NAME), '" + key + "') AS char)  like '%"+name+"%'";
                    "t ON doctor.CODE=t.doctorcode and " + AesEncryptUtils.decryptMysqlNo("doctor.name")  + "  like '%"+name+"%'";
        }else{
            sql = "SELECT " +
                    "doctor.CODE AS CODE," +
                    " CAST(AES_DECRYPT(from_base64(doctor.NAME), '" + key + "') AS char)  AS NAME, " +
                    "doctor.CODE AS CODE" +
                    AesEncryptUtils.decryptMysql("doctor.name","name") +
//                    "doctor.NAME AS NAME," +
                    "doctor.sex AS sex," +
                    ",doctor.sex AS sex," +
                    "doctor.birthday AS birthday," +
                    "doctor.photo AS photo," +
                    "doctor.mobile AS mobile," +
@ -832,10 +816,10 @@ public class SpecialistService{
    
    public MixEnvelop<PatientRelationVO,PatientRelationVO> getSpecialistSignFamilyPatientByName(String specialdoctor, String familydoctor, String nameKey, Integer page, Integer size) {
        String sql ="SELECT " +
                "p.CODE AS patient," +
                " CAST(AES_DECRYPT(from_base64(p.`name`), '" + key + "') AS char)  AS patientName, " +
                "p.CODE AS patient" +
                AesEncryptUtils.decryptMysql("p.name","patientName") +
//                "p.`name` AS patientName," +
                "p.photo," +
                ",p.photo," +
                "IFNULL(YEAR (from_days(datediff(now(),p.birthday))),'未知') age," +
                "p.sex " +
                "FROM wlyy.wlyy_patient p " +
@ -845,7 +829,8 @@ public class SpecialistService{
                "  AND doctor='"+specialdoctor+"') " +
                "  AND (a.doctor='"+familydoctor+"' OR a.doctor_health='"+familydoctor+"') ";
        if(StringUtils.isNotBlank(nameKey)){
            sql= sql + " AND CAST(AES_DECRYPT(from_base64(a.`name`), '" + key + "') AS char) LIKE '%"+nameKey+"%' ";
            sql= sql + " AND " + AesEncryptUtils.decryptMysqlNo("a.name") + " LIKE '%"+nameKey+"%' ";
        }
        sql= sql +" AND a.`status`=1 AND a.expenses_status=1) s ON p.CODE=s.patient" +
                " LIMIT "+(page-1)*size+","+size;
@ -862,7 +847,7 @@ public class SpecialistService{
                "IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age, " +
                "p.birthday, " +
                "p.photo " +
                "FROM (SELECT s.disease,s.disease_name,s.patient,CAST(AES_DECRYPT(from_base64(s.patient_name), '" + key + "') AS char) as patient_name,r.team_code from " +
                "FROM (SELECT s.disease,s.disease_name,s.patient" + AesEncryptUtils.decryptMysql("s.patient_name","patient_name") + ",r.team_code from " +
                "(SELECT id, team_code FROM wlyy_specialist_patient_relation WHERE doctor='" + doctor + "' and sign_status > 0 and `status` >= 0) r " +
                "JOIN "+basedb+".wlyy_patient_disease_server s on r.id = s.specialist_relation_code WHERE s.del = 1) s " +
                "JOIN "+basedb+".wlyy_patient p on s.patient = p.`code` where p.`status` >0 ";
@ -878,21 +863,6 @@ public class SpecialistService{
    }
//    public Envelop<Boolean> createSpecialists(List<SpecialistDO> info){
//        specialistDao.save(info);
//        return Envelop.getSuccess(SpecialistMapping.api_success,true);
//    }
//    public Envelop<Boolean> createSpecialistArticle(SpecialistArticleDO articleDO){
//        specialistArticleDao.save(articleDO);
//        return Envelop.getSuccess(SpecialistMapping.api_success,true);
//    }
//
//    public Envelop<Boolean> createSpscialistConsult(SpecialistConsultDO consultDO){
//        specialistConsultDao.save(consultDO);
//        return Envelop.getSuccess(SpecialistMapping.api_success,true);
//    }
    /**
     * 专科-模糊搜索注册居民(未与该医生所在团队医生签约的居民)
     * @param doctorCode
@ -997,7 +967,7 @@ public class SpecialistService{
        jsonObject.put("doctorInfo", jdbcTemplate.queryForMap(doctorSql));
        //3、获取该医生所属团队及团队成员信息
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code,  CAST(AES_DECRYPT(from_base64(wd.NAME), '" + key + "') AS char)  AS doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
@ -1048,7 +1018,7 @@ public class SpecialistService{
        jsonObject.put("specialistPatientRelationId", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getId());
        jsonObject.put("signCertificate", null == specialistPatientRelationDO ? null : specialistPatientRelationDO.getSignCertificate());
        //1、获取居民基础信息
        String preSql = "SELECT CAST(AES_DECRYPT(from_base64(p.name ), '" + key + "') AS char) as name, p.photo as photo,p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
        String preSql = "SELECT p.photo as photo" +  AesEncryptUtils.decryptMysql("p.name","name") + ", p.idcard as idcard,p.mobile as mobile,p.medicare_number as medicareNumber,p.ssc as ssc," +
                " CASE  WHEN wd.name is null THEN '无' ELSE wd.name END as doctorName,CASE  WHEN wd.hospital_name is NULL THEN '无' ELSE wd.hospital_name END as hospitalName,CASE  WHEN wd.mobile is NULL THEN '无' ELSE wd.mobile END as doctorMobole ";
        String patientSql = " from " + basedb + ".wlyy_patient p LEFT JOIN " + basedb + ".wlyy_sign_family wsf " +
                " ON p.code=wsf.patient AND wsf.type='2' AND wsf.status='1' " +
@ -1069,9 +1039,9 @@ public class SpecialistService{
        jsonObject.put("patientInfo", map);
        //2、获取医生信息(所属医院、科室、姓名)
        String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
        String doctorSql = "SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + doctorCode + "'";;
        if("0".equals(signStatus)){
            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName,wd.name as name FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
            doctorSql="SELECT wd.hospital_name as hospitalName,wd.dept_name as deptName"+AesEncryptUtils.decryptMysql("wd.name","name")+" FROM " + basedb + ".wlyy_doctor wd WHERE wd.code='" + specialistPatientRelationDO.getDoctor() + "'";
        }
        Map<String,Object> result =jdbcTemplate.queryForMap(doctorSql);
        if ("0".equals(signStatus) && !(doctorCode.equals(specialistPatientRelationDO.getDoctor()))) {
@ -1082,7 +1052,8 @@ public class SpecialistService{
        jsonObject.put("doctorInfo", result);
        //3、获取该医生所属团队及团队成员信息
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code,  CAST(AES_DECRYPT(from_base64(wd.NAME), '" + key + "') AS char) as doctorName  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
        String teamSql = "SELECT at.name teamName, tm.team_id , tm.doctor_code" + AesEncryptUtils.decryptMysql("wd.name","doctorName") + "  FROM " + basedb + ".wlyy_doctor wd LEFT JOIN  " + basedb + ".wlyy_admin_team_member tm ON wd. CODE = tm.doctor_code, " + basedb + ".wlyy_admin_team at " +
                "WHERE tm.team_id IN ( SELECT watm.team_id teamId FROM  " + basedb + ".wlyy_admin_team_member watm WHERE watm.doctor_code ='" + doctorCode + "'" + " AND watm.available = '1' ) AND tm.available='1' AND `at`.id=tm.team_id";
        List<Map<String, Object>> teamList = jdbcTemplate.queryForList(teamSql);
        Map<Integer, List<Map<String, Object>>> m = teamList.stream().collect(Collectors.groupingBy(tem -> ((Integer) tem.get("team_id")).intValue(), Collectors.toList()));
@ -1201,12 +1172,14 @@ public class SpecialistService{
     * @return
     */
    public List<SpecialistPatientRelationDO> selectByAssistant(String patient,String doctor){
        String sql = "select *,CAST(AES_DECRYPT(from_base64(r.patient_name ), '" + key + "') AS char) as patientName," +
                " CAST(AES_DECRYPT(from_base64(r.doctor_name), '" + key + "') AS char)  AS doctorName, " +
                " CAST(AES_DECRYPT(from_base64(r.health_assistant_name), '" + key + "') AS char)  AS healthAssistantName, " +
                " CAST(AES_DECRYPT(from_base64(r.health_doctor_name), '" + key + "') AS char)  AS healthDoctorName, " +
                " CAST(AES_DECRYPT(from_base64(r.sign_doctor_name), '" + key + "') AS char)  AS signDoctorName, " +
                " CAST(AES_DECRYPT(from_base64(r.create_user_name), '" + key + "') AS char)  AS createUserName " +
        String sql = "select *" +
                AesEncryptUtils.decryptMysql("r.patient_name","patientName") +
                AesEncryptUtils.decryptMysql("r.doctor_name","doctorName") +
                AesEncryptUtils.decryptMysql("r.health_assistant_name","healthAssistantName") +
                AesEncryptUtils.decryptMysql("r.health_doctor_name","healthDoctorName") +
                AesEncryptUtils.decryptMysql("r.sign_doctor_name","signDoctorName") +
                AesEncryptUtils.decryptMysql("r.create_user_name","createUserName") +
                " from wlyy_specialist_patient_relation r where r.health_assistant = '"+doctor+"' and r.patient = '"+patient+"' ";
        List<SpecialistPatientRelationDO> relationDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SpecialistPatientRelationDO.class));
        return relationDOS;
@ -1219,7 +1192,8 @@ public class SpecialistService{
     */
    public MixEnvelop searchPatientInSpecialistNew(String doctorCode,String keywords,Integer page,Integer pageSize) throws Exception{
        String sql1 = " select count(1) as num ";
        String sql2 = " select CAST(AES_DECRYPT(from_base64(p.name ), '" + key + "') AS char) as name,p.idcard,p.code,p.photo";
        String sql2 = " select p.idcard" + AesEncryptUtils.decryptMysql("p.name","name")  + ",p.code,p.photo";
        String whereSql ="";
        if(!StringUtils.isEmpty(keywords)){
            whereSql+=" and  p.mobile ='"+keywords+"'";
@ -1334,10 +1308,12 @@ public class SpecialistService{
        if (!teamCode.equals(toTeamCode)){//跨团队
            flag=true;
        }
        String sql =" select CAST(AES_DECRYPT(from_base64(name), '" + key + "') AS char) as name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
        String sql =" select name from wlyy.wlyy_doctor where code='"+toDoctorCode+"'";
        String toDoctorName = jdbcTemplate.queryForObject(sql,String.class);
        sql =" select CAST(AES_DECRYPT(from_base64(name), '" + key + "') AS char) as name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
        toDoctorName = AesEncryptUtils.decrypt(toDoctorName);
        sql =" select name from wlyy.wlyy_doctor where code='"+doctorCode+"'";
        String doctorName = jdbcTemplate.queryForObject(sql,String.class);
        doctorName = AesEncryptUtils.decrypt(doctorName);
        JSONObject result = new JSONObject();
        JSONArray planObject = new JSONArray();
        JSONArray planDetailObject = new JSONArray();
@ -1346,6 +1322,7 @@ public class SpecialistService{
        for (String patientCode:patient){
            sql ="select name from wlyy.wlyy_patient where code='"+patientCode+"' ";
            String patientName = jdbcTemplate.queryForObject(sql,String.class);
            patientName = AesEncryptUtils.decrypt(patientName);
            List<PatientRehabilitationPlanDO> planList  = patientRehabilitationPlanDao.findByPatientAndCreateUserAndTeamCode(patientCode,doctorCode,Integer.parseInt(teamCode));{
                for (PatientRehabilitationPlanDO plan:planList){
                    plan.setCreateUser(toDoctorCode);

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

@ -6,6 +6,7 @@ import com.yihu.jw.dao.SpecialistPatientRelationDao;
import com.yihu.jw.dao.rehabilitation.*;
import com.yihu.jw.entity.specialist.SpecialistPatientRelationDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -91,7 +92,8 @@ 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+"'" ;
//        }
        String leftSql = "";
        String sql = " select p.*  from wlyy_specialist.wlyy_patient_rehabilitation_plan p  " ;
        String sql = " select p.*" + AesEncryptUtils.decryptMysql("p.name","patientName") + "  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 ";
@ -107,7 +109,8 @@ public class RehabilitationManageService {
            sql+=" and p.disease='"+diseaseCode+"'";
        }
        if(StringUtils.isNotEmpty(patientCondition)){
            sql += " and p.name like '%"+patientCondition+"%' ";
            sql += " and " + AesEncryptUtils.descryptMysqlNo("p.name") + " like '%"+patientCondition+"%' ";
        }
        String finalSql = "";
@ -149,7 +152,7 @@ public class RehabilitationManageService {
//                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"));
                resultMap.put("patientName",one.get("patientName"));
                resultMap.put("patientCode",one.get("patient"));
                resultMap.put("id",one.get("id"));
                resultMap.put("status",one.get("status"));//康复计划状态
@ -227,21 +230,6 @@ public class RehabilitationManageService {
            Map<String,Object> specialistMap = specialistRelationList.get(0);
            resultMap.put("specialistAdminTeamName",specialistMap.get("teamName"));
            resultMap.put("specialistHospitalName",specialistMap.get("specialistHospitalName"));//专科医生所在医院
//            Integer specialistUnfinishCount = null;
//            Integer specialistFinishCount = null;
//            Integer specialistServiceCount = null;
//            if(specialistMap.get("health_assistant")==null){
//
//                specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
//                specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
//                specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,patientCode,1);
//            }else{
//                specialistUnfinishCount = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode,1);
//                specialistFinishCount = rehabilitationDetailDao.findItemByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode);
//                specialistServiceCount = rehabilitationDetailDao.completeServiceByDoctor(doctorCode,specialistMap.get("health_assistant")+"",patientCode,1);
//            }
//            resultMap.put("specialistFinishItemCount",specialistFinishCount-specialistUnfinishCount);//完成项目
//            resultMap.put("specialistServiceRecordCount",specialistServiceCount);//服务次数
            Integer specialistUnfinishCount1 = rehabilitationDetailDao.unfinishItemByDoctor(doctorCode,patientCode,1);
            Integer specialistFinishCount1 = rehabilitationDetailDao.findItemByDoctor(doctorCode,patientCode);
@ -254,7 +242,7 @@ public class RehabilitationManageService {
            resultMap.put("specialistFinishItemCount",specialistFinishCount1-specialistUnfinishCount1+specialistFinishCount2-specialistUnfinishCount2);//完成项目
            resultMap.put("specialistServiceRecordCount",specialistServiceCount1+specialistServiceCount2);//服务次数
            //家庭医生(包括全科医生、健管师)
            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+"'";
            String signFamilySql = "SELECT f.*,t.name as teamName" + AesEncryptUtils.decryptMysql("f.name","patientName") + " 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);
            if(signFamilyList != null && signFamilyList.size() >0 ) {
                Map<String, Object> signFamilyMap = signFamilyList.get(0);
@ -282,7 +270,7 @@ public class RehabilitationManageService {
                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"));
                resultMap.put("patientName", signFamilyMap.get("patientName"));
            }
            //疾病类型
            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")+"' ";

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

@ -8,6 +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.restmodel.specialist.PatientSignInfoVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -378,7 +379,7 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        Map<String,Object> map = new HashedMap();
        int result = 0;
        String name= "";
        String sql ="SELECT rp.patient,rp.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 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+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if (list!=null && list.size()>0){
            if (String.valueOf(list.get(0).get("patient")).equals(patietCode)){

+ 0 - 12
svr/svr-wlyy-specialist/src/main/resources/application.yml

@ -104,8 +104,6 @@ im:
  #im_list_get: http://192.168.131.24:3000/
  data_base_name: ichat
encrypt:
  key: jkzl2021ZJXL*#%a
---
spring:
  profiles: jwtest
@ -142,8 +140,6 @@ im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
encrypt:
  key: jkzl2021ZJXL*#%a
---
spring:
  profiles: iotyanshi
@ -180,8 +176,6 @@ im:
  im_list_get: http://172.26.0.191:3000/
  data_base_name: im_new
encrypt:
  key: jkzl2021ZJXL*#%a
---
spring:
  profiles: jwdevtest
@ -217,9 +211,6 @@ wechat:
im:
  im_list_get: http://172.26.0.118:3000/
  data_base_name: im_new
encrypt:
  key: jkzl2021ZJXL*#%a
---
spring:
  profiles: prod
@ -255,6 +246,3 @@ wechat:
im:
  im_list_get: http://27.155.101.77:3000/
  data_base_name: im
encrypt:
  key: jkzl2021ZJXL*#%a