Browse Source

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

Conflicts:
	svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
yeshijie 4 years ago
parent
commit
d5b38a76c6

+ 611 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/door/SignFamily.java

@ -0,0 +1,611 @@
package com.yihu.jw.entity.door;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.iot.gateway.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * 家庭签约
 *
 * @author George
 */
@Entity
@Table(name = "wlyy_sign_family")
public class SignFamily extends IdEntity {
    private static final long serialVersionUID = 364799142991631092L;
    private String code;        // 签约标识
    private String lwCode;      // 两网标识
    private Integer type;       // 签约类型:1三师签约,2网络签约
    private String patient;     // 患者标识
    private String openid;      // 微信OPENID
    private String name;        // 患者姓名
    private String idcard;      // 身份证号
    private String ssc;         // 社保卡号
    private String mobile;      // 手机号
    private String emerMobile;  // 紧急联系人手机号
    private String hospital;    // 签约医院标识
    private String hospitalName;    // 签约医院名称
    private String doctor;      // 全科医生
    private String doctorName;  // 全科医生姓名
    private String doctorHealth;    // 健康管理师
    private String doctorHealthName;    // 健康管理师姓名
    private Date begin;         // 签约开始日期
    private Date end;           // 签约结束日期
    private Integer status;     // 签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期 -5超过1500同步智业不成功 -6智业返回不成功 未建档,0待签约,1已签约,2患者申请取消签约
    private String images;      // 签约图片附件URL,多图以逗号分隔
    private String reason;      // 解约原因
    private Date czrq;          // 操作时间
    private String teamCode;
    private Date applyDate;     //签约时间
    private Date applyUnsignDate;//解约时间
    private Date patientApplyDate;//患者发起签约时间
    private Date patientApplyUnsignDate;//患者发起解约时间
    private String signType;//1 用户自己申请  2医生手工带签  3.医生发起邀请
    private String familyCode;//签约code
    private Double expenses;//签约费用
    private String expensesStatus;//扣费状态【0未扣费 1已扣费 2已退费 3医保取消】
    private String signSource;// 签约来源【1 社区签约 2 移动签约】
    private String signDoctorCode;//簽約人code
    private String signDoctorName;//簽約人銘
    private String signDoctorLevel;//簽約人等级
    private String expensesType;//补贴类型(4种类型:01无补贴,02全部贴,03补个人承担部分(20),04补统筹基金(70))
    private String signYear;//签约年度
    private String medicalInsuranceNum;//医保流水号
    private String agentDoctorCode;//代理簽約人code
    private String agentDoctorName;//代理簽約人銘
    private String agentDoctorLevel;//代理簽約人等级
    private Long adminTeamId;//行政团队ID
    private Date expensesTime;//缴费时间
    private Integer num;//签约数
    //1.3.3.2新增字段
    //基卫服务类型
    private String serverType;
    //基卫服务类型名称
    private String serverTypeName;
    //基卫特殊人群类别
    private String specialPopulation;
    //基卫特殊人群类别名称
    private String specialPopulationName;
    //续签标志 1 医生续签 2 医生改签续签
    private String renewFlag;
    //转签原因
    private String renewChangeReason;
    //1.3.5新增居委会字段
    // 居委会字段id
    private String sickVillage;
    // 居委会字段名称
    private String sickVillageName;
    private Integer signPaySource;//签约支付渠道: 1线下 2线上
    //1.4.3新增医生拒签原因
    private String refuseSpeak;//医生拒签原因
    // add by hmf on 2019.6.19
    private String specialist;//专科医生code
    private String specialistName;//专科医生名字
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }
    public String getRefuseSpeak() {
        return refuseSpeak;
    }
    public void setRefuseSpeak(String refuseSpeak) {
        this.refuseSpeak = refuseSpeak;
    }
    public Integer getSignPaySource() {
        return signPaySource;
    }
    public void setSignPaySource(Integer signPaySource) {
        this.signPaySource = signPaySource;
    }
    public String getRenewFlag() {
        return renewFlag;
    }
    public void setRenewFlag(String renewFlag) {
        this.renewFlag = renewFlag;
    }
    public String getRenewChangeReason() {
        return renewChangeReason;
    }
    public void setRenewChangeReason(String renewChangeReason) {
        this.renewChangeReason = renewChangeReason;
    }
    public String getServerType() {
        return serverType;
    }
    public void setServerType(String serverType) {
        this.serverType = serverType;
    }
    public String getServerTypeName() {
        return serverTypeName;
    }
    public void setServerTypeName(String serverTypeName) {
        this.serverTypeName = serverTypeName;
    }
    public String getSpecialPopulation() {
        return specialPopulation;
    }
    public void setSpecialPopulation(String specialPopulation) {
        this.specialPopulation = specialPopulation;
    }
    public String getSpecialPopulationName() {
        return specialPopulationName;
    }
    public void setSpecialPopulationName(String specialPopulationName) {
        this.specialPopulationName = specialPopulationName;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getLwCode() {
        return lwCode;
    }
    public void setLwCode(String lwCode) {
        this.lwCode = lwCode;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "emer_mobile")
    public String getEmerMobile() {
        return emerMobile;
    }
    public void setEmerMobile(String emerMobile) {
        this.emerMobile = emerMobile;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "doctor_health")
    public String getDoctorHealth() {
        return doctorHealth;
    }
    public void setDoctorHealth(String doctorHealth) {
        this.doctorHealth = doctorHealth;
    }
    @Column(name = "doctor_health_name")
    public String getDoctorHealthName() {
        return doctorHealthName;
    }
    public void setDoctorHealthName(String doctorHealthName) {
        this.doctorHealthName = doctorHealthName;
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getBegin() {
        return begin;
    }
    public void setBegin(Date begin) {
        this.begin = begin;
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getEnd() {
        return end;
    }
    public void setEnd(Date end) {
        this.end = end;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getImages() {
        return images;
    }
    public void setImages(String images) {
        this.images = images;
    }
    public String getReason() {
        return reason;
    }
    public void setReason(String reason) {
        this.reason = reason;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Column(name = "team_code")
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    @Column(name = "sign_type")
    public String getSignType() {
        return signType;
    }
    public void setSignType(String signType) {
        this.signType = signType;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "apply_date")
    public Date getApplyDate() {
        return applyDate;
    }
    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }
    @Column(name = "patient_apply_date")
    public Date getPatientApplyDate() {
        return patientApplyDate;
    }
    public void setPatientApplyDate(Date patientApplyDate) {
        this.patientApplyDate = patientApplyDate;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "patient_apply_unsgin_date")
    public Date getPatientApplyUnsignDate() {
        return patientApplyUnsignDate;
    }
    public void setPatientApplyUnsignDate(Date patientApplyUnsignDate) {
        this.patientApplyUnsignDate = patientApplyUnsignDate;
    }
    @Column(name = "family_code")
    public String getFamilyCode() {
        return familyCode;
    }
    public void setFamilyCode(String familyCode) {
        this.familyCode = familyCode;
    }
    @Column(name = "expenses")
    public Double getExpenses() {
        return expenses;
    }
    public void setExpenses(Double expenses) {
        this.expenses = expenses;
    }
    @Column(name = "sign_doctor_code")
    public String getSignDoctorCode() {
        return signDoctorCode;
    }
    public void setSignDoctorCode(String signDoctorCode) {
        this.signDoctorCode = signDoctorCode;
    }
    @Column(name = "sign_doctor_name")
    public String getSignDoctorName() {
        return signDoctorName;
    }
    public void setSignDoctorName(String signDoctorName) {
        this.signDoctorName = signDoctorName;
    }
    @Column(name = "sign_doctor_level")
    public String getSignDoctorLevel() {
        return signDoctorLevel;
    }
    public void setSignDoctorLevel(String signDoctorLevel) {
        this.signDoctorLevel = signDoctorLevel;
    }
    @Column(name = "apply_unsign_date")
    public Date getApplyUnsignDate() {
        return applyUnsignDate;
    }
    public void setApplyUnsignDate(Date applyUnsignDate) {
        this.applyUnsignDate = applyUnsignDate;
    }
    @Column(name = "expenses_type")
    public String getExpensesType() {
        return expensesType;
    }
    public void setExpensesType(String expensesType) {
        this.expensesType = expensesType;
    }
    @Column(name = "sign_year")
    public String getSignYear() {
        return signYear;
    }
    public void setSignYear(String signYear) {
        this.signYear = signYear;
    }
    @Column(name = "medical_insurance_num")
    public String getMedicalInsuranceNum() {
        return medicalInsuranceNum;
    }
    public void setMedicalInsuranceNum(String medicalInsuranceNum) {
        this.medicalInsuranceNum = medicalInsuranceNum;
    }
    @Column(name = "agent_doctor_code")
    public String getAgentDoctorCode() {
        return agentDoctorCode;
    }
    public void setAgentDoctorCode(String agentDoctorCode) {
        this.agentDoctorCode = agentDoctorCode;
    }
    @Column(name = "agent_doctor_name")
    public String getAgentDoctorName() {
        return agentDoctorName;
    }
    public void setAgentDoctorName(String agentDoctorName) {
        this.agentDoctorName = agentDoctorName;
    }
    @Column(name = "agent_doctor_level")
    public String getAgentDoctorLevel() {
        return agentDoctorLevel;
    }
    public void setAgentDoctorLevel(String agentDoctorLevel) {
        this.agentDoctorLevel = agentDoctorLevel;
    }
    @Column(name = "expenses_status")
    public String getExpensesStatus() {
        return expensesStatus;
    }
    public void setExpensesStatus(String expensesStatus) {
        this.expensesStatus = expensesStatus;
    }
    @Column(name = "sign_source")
    public String getSignSource() {
        return signSource;
    }
    public void setSignSource(String signSource) {
        this.signSource = signSource;
    }
    @Column(name = "admin_team_code")
    public Long getAdminTeamId() {
        return adminTeamId;
    }
    public void setAdminTeamId(Long adminTeamId) {
        this.adminTeamId = adminTeamId;
    }
    @Override
    public String toString() {
        return "SignFamily{" +
                "code='" + code + '\'' +
                ", lwCode='" + lwCode + '\'' +
                ", type=" + type +
                ", patient='" + patient + '\'' +
                ", openid='" + openid + '\'' +
                ", name='" + name + '\'' +
                ", idcard='" + idcard + '\'' +
                ", ssc='" + ssc + '\'' +
                ", mobile='" + mobile + '\'' +
                ", emerMobile='" + emerMobile + '\'' +
                ", hospital='" + hospital + '\'' +
                ", hospitalName='" + hospitalName + '\'' +
                ", doctor='" + doctor + '\'' +
                ", doctorName='" + doctorName + '\'' +
                ", doctorHealth='" + doctorHealth + '\'' +
                ", doctorHealthName='" + doctorHealthName + '\'' +
                ", begin=" + begin +
                ", end=" + end +
                ", status=" + status +
                ", images='" + images + '\'' +
                ", reason='" + reason + '\'' +
                ", czrq=" + czrq +
                ", teamCode='" + teamCode + '\'' +
                ", applyDate=" + applyDate +
                ", signType='" + signType + '\'' +
                ", familyCode='" + familyCode + '\'' +
                '}';
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getExpensesTime() {
        return expensesTime;
    }
    public void setExpensesTime(Date expensesTime) {
        this.expensesTime = expensesTime;
    }
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
    @Transient
    public Integer getNum() {
        return num;
    }
    public void setNum(Integer num) {
        this.num = num;
    }
    public String getSpecialist() {
        return specialist;
    }
    public void setSpecialist(String specialist) {
        this.specialist = specialist;
    }
    public String getSpecialistName() {
        return specialistName;
    }
    public void setSpecialistName(String specialistName) {
        this.specialistName = specialistName;
    }
}

+ 461 - 0
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/dao/common/SignFamilyDao.java

@ -0,0 +1,461 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.door.dao.common;
import com.yihu.jw.entity.door.SignFamily;
import com.yihu.jw.entity.patient.Patient;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Long>, JpaSpecificationExecutor<SignFamily> {
    @Query("select count(1) from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status >= 0")
    int hasSingStatus(String idcard);
    @Modifying
    @Query("update SignFamily a set a.mobile = ?2 where a.patient = ?1")
    int updatePatientMobile(String patient, String mobile);
    //更新有效签约患者手机号
    @Modifying
    @Query("update SignFamily a set a.mobile = ?2 where a.patient = ?1 and a.status > 0 ")
    int updateSignMobile(String patient, String mobile);
    @Query("select a from SignFamily a where a.idcard = ?1 and status = ?2 and a.type = 2")
    SignFamily findByPatientStatus(String idcard, int status);
    @Query("select a from SignFamily a where a.patient = ?1 and status = ?2 and a.type = 2")
    SignFamily findByPatientCodeStatus(String patient, int status);
    @Query("select a from SignFamily a where a.patient = ?1 and status >= ?2 and a.type = 2")
    SignFamily findByPatientCodeStatus2(String patient, int status);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status >= 1")
    SignFamily findByPatientAndType(String patient, int type);
    SignFamily findByFamilyCode(String familyCode);
    SignFamily findByTeamCode(String TeamCode);
    @Query("select a from SignFamily a where a.teamCode = ?1 and a.type = 2 and a.code=?2")
    List<SignFamily> findByTeamCodeIsValid(String teamCode, String code);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
    SignFamily findByDoctorPatient(String doctor, String patient);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and (a.type = 2 or a.type=1) and a.status >= 0")
    List<SignFamily> findSSandFamilyByDoctorPatient(String doctor, String patient);
    @Query("select a from SignFamily a where a.doctorHealth = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0 ")
    SignFamily findByDoctorHealthPatient(String doctor, String patient);
    @Query("select p from Patient p,SignFamily a where a.doctorHealth = ?1  and a.adminTeamId=?2 and a.patient =p.code and a.type = 2 and a.status >= 0")
    List<Patient> findByDoctorHealthPatient(String doctor, Long team);
    @Query("select p from Patient p,SignFamily a where (a.doctorHealth = ?1 or a.doctor=?2 ) and a.patient =p.code and a.type = 2 and a.status >= 0")
    List<Patient> findByDoctorOrDoctorHealthPatient(String doctorHealth, String doctor);
    @Query("select p from Patient p,SignFamily a where a.doctor = ?1 and a.adminTeamId=?2 and a.patient =p.code and a.type = 2 and a.status >= 0")
    List<Patient> findByDoctorPatient(String doctor, Long team);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 1 and a.status > 0")
    SignFamily findSsSignByDoctorPatient(String doctor, String patient);
    @Query("select a from SignFamily a,DoctorTeamMember w where a.teamCode = w.team and w.del = '1' and w.memberCode = ?1 and a.patient = ?2 and a.status > 0")
    List<SignFamily> findByDoctorAndPatient(String doctor, String patient);
    @Query(value = "select a from SignFamily a where a.doctor =?1 and a.patient = ?2 and a.status =0 and a.signYear =?3")
    List<SignFamily> findByDoctorAndPatientOverDue(String doctor, String patient, String signYear);
    @Query(value = "select a from SignFamily a where a.doctorHealth =?1 and a.patient = ?2 and a.status =0 and a.signYear =?3")
    List<SignFamily> findByDoctorHealthAndPatient(String doctorHealth, String patient, String signYear);
    @Query(value = "select a from SignFamily a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamily> findByDoctorAndPatientIsValid(String doctor, String patient, String signYear);
    @Query(value = "select a from SignFamily a where a.doctorHealth =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamily> findByDoctorHealthAndPatientIsValid(String doctorHealth, String patient, String signYear);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.status = 1 and a.type = 2")
    SignFamily findByFamilyDoctorAndPatient(String doctor, String patient);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.status = 1 and a.type = 1")
    SignFamily findBySanshiDoctorAndPatient(String doctor, String patient);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.openid = ?2 and a.type = 2 and a.status >= 0")
    SignFamily findByDoctorOpenid(String doctor, String openid);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.idcard = ?2 and a.type = 2 and a.status >= 0")
    SignFamily findByDoctorIdcard(String doctor, String idcard);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status >= 0")
    SignFamily findByIdcard(String idcard);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status > 0 and a.expensesStatus ='1'")
    SignFamily getExpensesSignByIdcard(String idcard);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.type =1 and a.status >= 0")
    SignFamily findSSByIdcard(String idcard);
    @Query("select a from SignFamily a where a.idcard = ?1 ")
    List<SignFamily> findAllByIdcard(String idcard);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.status >= 0")
    List<SignFamily> findSSandJTByIdcard(String idcard);
    @Query("select a from SignFamily a where a.openid = ?1 and a.type = 2 and a.status >= 0")
    SignFamily findByOpenid(String openid);
    // 取消签约申请
    @Modifying
    @Query("update SignFamily a set a.status = -1 where a.patient = ?1 and a.doctor = ?2 and a.type = 2 and a.status = 0")
    void unsignByPatient(String patient, String doctor);
    // 取消签约申请
    @Modifying
    @Query("update SignFamily a set a.status = -1 where a.openid = ?1 and a.doctor = ?2 and a.type = 2 and a.status = 0")
    void unsignByOpenid(String openid, String doctor);
    // 查询医生的签约数量
    @Query("select count(1) from SignFamily a where a.doctor = ?1")
    int countByDoctor(String doctor);
    // 查询医生的签约数量
    @Query("select count(1) from SignFamily a")
    int countByDoctor();
    // 更新状态为待解约
    @Modifying
    @Query("update SignFamily a set a.status = 2 where a.patient = ?1 and a.doctor = ?2 and a.status = 1 and a.type = 2")
    int surrender(String patient, String doctor);
    // 更新待签约状态为拒绝或同意状态
    @Modifying
    @Query("update SignFamily a set a.status = ?1 where a.patient = ?2 and a.status = 0 and a.type = 2")
    int handleSign(int status, String patient);
    // 更新已签约状态为解约
    @Modifying
    @Query("update SignFamily a set a.status = -3, a.reason = ?1 where a.patient = ?2 and a.status = 2 and a.type = 2")
    int handleSurrender(String reason, String patient);
    // 拒绝解约
    @Modifying
    @Query("update SignFamily a set a.status = 1 where a.patient = ?1 and a.status = 2 and a.type = 2")
    int refuseSurrender(String patient);
    // 查询患者已生效的家庭签约
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status > 0")
    SignFamily findSignByPatient(String patient);
    @Modifying
    @Query("update SignFamily a set a.openid = ?1 where patient = ?2")
    int updateOpenidByPatient(String openid, String patient);
    // 查询已签约的总数
    @Query("select count(1) from SignFamily a where (a.doctor = ?1 or a.doctorHealth = ?1) and (a.status = 1 or a.status = 2) and a.type = 2")
    int countAmountSignedByDoctor(String doctor);
    // 查询待签约总数
    @Query("select count(1) from SignFamily a where (a.doctor = ?1 or a.doctorHealth = ?1) and a.status = 0 and a.type = 2")
    int countAmountUnsignByDoctor(String doctor);
    // 查询团队中的健康管理师 sf.doctorHealth,sf.doctorHealthName,
    //select sf.doctorHealth,sf.doctorHealthName,count(*) totalContract from SignFamily sf where sf.healthDoctor = ?1
    @Query("select sf.doctorHealth,sf.doctorHealthName,count(sf)  from SignFamily sf where sf.doctorHealth = ?1")
    List<Object> findTeamHealthDoctors(String healthDoctor);
    // 查询团队中的全科医生 sf.doctor,sf.doctorName,d.hosptialName,
    //select sf.doctor,sf.doctorName,d.hosptialName,count(*) totalContract from SignFamily sf left join Doctor d on sf.doctor = d.code where sf.doctor = ?1
    @Query("select sf.doctor,sf.doctorName,d.hospitalName,count(sf) from SignFamily sf, Doctor d  where ( sf.doctor is null or sf.doctor = d.code) and sf.doctor = ?1")
    List<Object> findTeamQkDoctors(String doctor);
    // 待签约 待解决 已签约
    @Query("select a.code,a.doctor,b.code,b.name,b.provinceName,b.cityName,b.townName,b.address,b.photo,a.status,a.id,a.applyDate,a.reason,b.streetName,b.sex from SignFamily a,Patient b,DoctorTeam t,DoctorTeamMember td where a.patient=b.code and a.teamCode=t.code and t.code=td.team and td.memberCode=?1 and td.type=?2 and a.status=?3 order by a.begin desc")
    Page<Object> findToBeSignSignWebByDoctor(String doctor, int doctorType, int status, Pageable pageRequest);
    /**
     * 查询全科医生签约患者
     *
     * @param doctor
     * @param status
     * @param pageRequest
     * @return
     */
    @Query("select a.code,a.doctor,b.code,b.name,b.provinceName,b.cityName,b.townName,b.address,b.photo,a.status,a.id,a.applyDate,a.reason,b.streetName,b.sex from SignFamily a,Patient b where a.patient=b.code and a.doctor = ?1 and a.status=?2 order by a.begin desc")
    Page<Object> findSignedPatientByQkDoctor(String doctor, int status, Pageable pageRequest);
    /**
     * 查询健康管理师签约患者
     *
     * @param doctor
     * @param status
     * @param pageRequest
     * @return
     */
    @Query("select a.code,a.doctor,b.code,b.name,b.provinceName,b.cityName,b.townName,b.address,b.photo,a.status,a.id,a.applyDate,a.reason,b.streetName,b.sex from SignFamily a,Patient b where a.patient=b.code and a.doctorHealth = ?1 and a.status=?2 order by a.begin desc")
    Page<Object> findSignedPatientByJkDoctor(String doctor, int status, Pageable pageRequest);
    /**
     * 查询全科医生已解约患者
     *
     * @param doctor
     * @param pageRequest
     * @return
     */
    @Query("select a.code,a.doctor,b.code,b.name,b.provinceName,b.cityName,b.townName,b.address,b.photo,a.status,a.id,a.applyDate,a.reason,b.streetName,b.sex from SignFamily a,Patient b where a.patient=b.code and a.doctor = ?1 and (a.status=-3 or a.status=-4) order by a.begin desc")
    Page<Object> findUnSignedPatientByQkDoctor(String doctor, Pageable pageRequest);
    /**
     * 查询健康管理师已解约患者
     *
     * @param doctor
     * @param pageRequest
     * @return
     */
    @Query("select a.code,a.doctor,b.code,b.name,b.provinceName,b.cityName,b.townName,b.address,b.photo,a.status,a.id,a.applyDate,a.reason,b.streetName,b.sex from SignFamily a,Patient b where a.patient=b.code and a.doctorHealth = ?1 and (a.status=-3 or a.status=-4) order by a.begin desc")
    Page<Object> findUnSignedPatientByJkDoctor(String doctor, Pageable pageRequest);
    //已经解约
    @Query("select a.code,a.doctor,b.code,b.name,b.provinceName,b.cityName,b.townName,b.address,b.photo,a.status,a.id,a.applyDate,a.reason,b.streetName,b.sex from SignFamily a,Patient b,DoctorTeam t,DoctorTeamMember td where a.patient=b.code and a.teamCode=t.code and t.code=td.team and td.memberCode=?1 and td.type=?2 and(a.status=-3 or a.status=-4 ) order by a.begin desc")
    Page<Object> findToBeSignSignWebByDoctor_34(String doctor, int doctorType, Pageable pageRequest);
    @Query("select a from SignFamily a where a.mobile = ?1 and a.type = 2 and a.status >= 0")
    SignFamily findByMobile(String mobile);
    @Query("select a.code,a.doctor,b.code,b.name,b.provinceName,b.cityName,b.townName,b.address,b.photo,a.status,a.id,a.applyDate,a.reason,b.streetName,b.sex from SignFamily a,Patient b where a.patient=b.code and a.doctor=?1 and a.status=?2 order by a.begin desc")
    Page<Object> findToBeSignSignWebByDoctor_0(String doctor, int i, Pageable pageRequest);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =1 and a.status >= 1")
    SignFamily findBySanshiPatient(String code);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =1 and a.status >= 0")
    SignFamily findBySsPatient(String code);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >= 1")
    SignFamily findByjiatingPatient(String code);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status = 1")
    SignFamily findByjiatingPatientYes(String code);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =1 and a.status = 1")
    SignFamily findBySanshiPatientYes(String id);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 1 and a.status in (0,1,2,3)")
    SignFamily findByPatientSanshiSignInfo(String idCard);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 2 and a.status in (0,1,2,3)")
    SignFamily findByPatientFamilySignInfo(String idCard);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >=0")
    SignFamily findByjiatingPatientStatus0(String patient);
    //查找昨天的家庭签约数据
    @Query(" from SignFamily a where  a.type =2 and a.status = 1  and unix_timestamp(a.applyDate)>=unix_timestamp(?1) and unix_timestamp(a.applyDate)<unix_timestamp(?2) and a.expensesStatus=1 ")
    List<SignFamily> findByJiatingSignYesterdayExpensesStatus(String yesterday, String today);
    //查找昨天的家庭签约数据
    @Query(" from SignFamily a where  a.type =2 and a.status >= 1  and  unix_timestamp(a.applyDate)<=unix_timestamp(?1) and a.expensesStatus=1 ")
    List<SignFamily> findByJiatingSignYesterdayExpensesStatus(String yesterday);
    //查找昨天的家庭签约数据
    @Query(" from SignFamily a where  a.type =2 and a.status >= 1  and  unix_timestamp(a.applyDate)<=unix_timestamp(?1) ")
    List<SignFamily> findByJiatingSignYesterday(String yesterday);
    //查找昨天的家庭解约数据
    @Query(" from SignFamily a where  a.type =2 and a.status in (-3,-4) and unix_timestamp(a.applyUnsignDate)>=unix_timestamp(?1) and unix_timestamp(a.applyUnsignDate)<unix_timestamp(?2) and a.expensesStatus=1")
    List<SignFamily> findByJiatingUnSignYesterdayExpensesStatus(String yesterday, String today);
    //查找昨天的家庭待数据
    @Query(" from SignFamily a where  a.type =2 and a.status =0  and unix_timestamp(a.patientApplyDate)>=unix_timestamp(?1) and unix_timestamp(a.patientApplyDate)<unix_timestamp(?2)")
    List<SignFamily> findByJiatingWaitSignYesterdayExpensesStatus(String yesterday, String today);
    //查找昨天的家庭待改签
    @Query(" from SignFamily a where  a.type =2 and a.status =100  and unix_timestamp(a.patientApplyDate)>=unix_timestamp(?1) and unix_timestamp(a.patientApplyDate)<unix_timestamp(?2) and a.expensesStatus=1 ")
    List<SignFamily> findByJiatingChaangeSignYesterdayExpensesStatus(String yesterday, String now);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = 1 and a.status in (0,1,2)")
    SignFamily findSanshiSignByPatient(String patientCode);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status in (0,1,2)")
    SignFamily findFamilySignByPatient(String patientCode);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status =-4 and a.signYear =?2")
    SignFamily findFamilySignByPatientOverDue(String patientCode, String signYear);
    @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and a.patient = p.code and a.status in (1,2,3)")
    List<Object> findDoctorSignPatients(String doctor);
    @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard  from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and p.name like ?2 and a.patient = p.code and a.status in (1,2,3)")
    List<Object> findDoctorSignPatientsLikeName(String doctor, String name);
    @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard  from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and a.type = ?2 and a.patient = p.code and a.status in (1,2,3)")
    List<Object> findDoctorSignPatientsBySignType(String doctor, int type);
    @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard  from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and a.type = ?2 and p.name like ?3 and a.patient = p.code and a.status in (1,2,3)")
    List<Object> findDoctorSignPatientsByTypeName(String doctor, int type, String name);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >= 0")
    SignFamily findByPatient(String patient);
    @Query("select a from SignFamily a where a.teamCode = ?1 and a.type =2 and a.status >= 0")
    SignFamily findByTeam(String teamCode);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.status >= 0")
    List<SignFamily> findByPatients(String patient);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type =2 and a.signYear =?2 and a.status in (-4,1,2,3) order by a.id desc ")
    List<SignFamily> findByPatientsLastYear(String patient, String signYear);
    @Query("select a from SignFamily a where a.idcard = ?1 and a.type = 1 and a.status >= 0")
    SignFamily findBySanshiIdcard(String idcard);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = ?2 and a.status > 0")
    SignFamily findSignByPatient(String patient, int type);
    SignFamily findByCode(String code);
    @Query(" from SignFamily a where a.patient = ?1 and a.type = ?2 and (a.status=-3 or a.status=-4)  order by a.id desc")
    List<SignFamily> findLastJySignByPatient(String patient, int type);
    @Query(" from SignFamily a where  a.type =1 and unix_timestamp(a.czrq)=unix_timestamp( ?1 )  ")
    List<SignFamily> findByDate(String s);
    @Modifying
    @Query("update SignFamily set expenses_type = ?1 where patient = ?2 and status > 0 and type = 2")
    int updateExpensesType(String expensesType, String patient);
    @Query("select count(*) from SignFamily where patient = ?1 and status > 0 and type = 1")
    int countPatientSsSign(String patient);
    @Query("select count(*) from SignFamily where patient = ?1 and status > 0 and type = 2")
    int countPatientJtSign(String patient);
    // 查询患者已生效的家庭签约
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status = 0")
    SignFamily findSigningByPatient(String patient);
    //找出家庭签约中 团队是空的值
    @Query("select a from SignFamily a where a.type = 2 and a.status = 1 and a.adminTeamId is null")
    List<SignFamily> findBySignTypeAndTeamCode();
    //找出没有健康管理师的签约数据
    @Query("select a from SignFamily a where a.type = 2 and a.status >= 1 and a.doctorHealth is null and a.adminTeamId = ?1 order by a.czrq desc")
    List<SignFamily> findNoHealthSignFamilyNum(Long teamCode);
    //找出没有健康管理师的签约数据
    @Query("select a from SignFamily a where a.type = 2 and a.status >= 1 and a.doctorHealth is null and a.doctor=?1 order by a.czrq desc")
    Page<SignFamily> findNoHealthSignFamilyHealth(String doctor, Pageable pageRequest);
    @Query("select a from SignFamily a where a.type = ?1 and a.signSource = ?2 and a.status > 0 order by a.id")
    Page<SignFamily> findByTypeAndSignSource(Integer type, String signSource, Pageable pageable);
    @Query("select a from SignFamily a where a.type = ?1 and a.signSource = ?2 and a.status > 0 and a.id >= ?3 and a.id <= ?4 order by a.id")
    Page<SignFamily> findByTypeAndSignSourceAndId(Integer type, String signSource, Long start, Long end, Pageable pageable);
    @Query("select a from SignFamily a where a.patient = ?1 and a.status >= 0")
    List<SignFamily> findAllSignByPatient(String patient);
    /**
     * 获取所有有效的签约信息(不包含-1 -2)
     *
     * @param patient
     * @return
     */
    @Query("select a from SignFamily a where a.patient = ?1 and a.status <> -1 and a.status <> -2 order by a.czrq")
    List<SignFamily> findAllActiveSignByPatient(String patient);
    @Query("select a.patient from SignFamily a where a.doctor = ?1 and a.type = 2 and a.status > 0 and a.doctorHealth is null")
    List<String> findNohealthByDoctor(String doctor);
    /**
     * 获取团队中有效的患者
     *
     * @param teamCode
     * @param status
     * @return
     */
    @Query("select count(f) from SignFamily f where f.adminTeamId = ?1 and f.status >= ?2 ")
    int findByAdminTeamIdAndStatus(long teamCode, int status);
    @Query("select f from SignFamily f where f.patient = ?1 and f.adminTeamId = ?2 and f.status > 0 and f.type = ?3")
    SignFamily findByPatientAndAdminTeamId(String patient, Long teamCode, Integer type);
    //根据医生和居民判断是否存在签约关系(全科及健管)
    @Query("select count(1) from SignFamily f where f.status > 0 and f.patient = ?1 and ( f.doctor = ?2 or doctorHealth = ?2  )")
    int findByPatientAndDoctor(String patient, String doctor);
    @Query(value = "select a from SignFamily a where a.patient = ?1 and a.signYear =?2 and a.status >= 0")
    List<SignFamily> findByDoctorAndPatientHossPost(String patient, String signYear);
    @Query(value = " select a.*  from wlyy_sign_family a where a.patient = ?1  and a.status = -4 order by a.apply_date desc limit 0,1", nativeQuery = true)
    SignFamily findOutTimeSigningByPatient(String patient);
    @Query(value = " select a.*  from wlyy_sign_family a where a.patient = ?1  and a.status = -4 and a.team_code = ?2 order by a.apply_date desc limit 0,1", nativeQuery = true)
    SignFamily findOutTimeSigningByPatientAndTeamCode(String patient, String teamCode);
    //      完成缴费后更新签约开始时间begin 缴费状态expensesStatus 医保流水号medical_insurance_num  扣费时间expenses_time
    @Modifying
    @Query("update SignFamily a set a.begin = ?2 ,a.medicalInsuranceNum=?3,a.expensesStatus = ?4,a.expensesTime = ?2,a.signPaySource = ?5 where a.code = ?1 ")
    int updatePatientBegin(String code, Date begin, String medicalInsuranceNum, String expensesStatus, int signPaySource);
    //查询居民的扣费状态
    @Query(" select a from SignFamily a where a.patient = ?1 ")
    SignFamily findPatientExpensesStatus(String patient);
    // 查询团队已签约的总数
    @Query("select count(1) from SignFamily a where  a.adminTeamId = ?1 and (a.status = 1 or a.status = 2) and a.type = 2")
    int countAmountSignedByAdminTeam(Long id);
    // 查询已签约未缴费居民
    @Query("select a from SignFamily a where  a.patient = ?1 and a.type = 2 and a.expensesStatus = '0' and a.status >0")
    SignFamily findUnpay(String patient);
    //根据身份证号码查询该人的签约情况
    @Query("select count(1) from SignFamily a where a.idcard=?1 and a.status>0 and a.type=2")
    int hasSignCount(String idcard);
    //根据patient查找有效签约的hospital
    @Query("select a.hospital from SignFamily a where a.patient = ?1 and a.status = 1 and a.expensesStatus = '1'")
    String getHospital(String patient);
    //查看团队内医生签约人数
    @Query("select count(1) from SignFamily a where a.status > 0 and a.adminTeamId = ?1 and (a.doctor = ?2 or a.doctorHealth = ?2)")
    int countByAdminTeamId(Long adminTeamId, String doctor);
    //根据居民和医生找出居民签约团队
    @Query("select f from SignFamily f where f.status > 0 and f.patient = ?1 and ( f.doctor = ?2 or doctorHealth = ?2  )")
    SignFamily findSignFamilyByPatientAndDoctor(String patient, String doctor);
    //根据居民获取有效的签约
    List<SignFamily> findByPatientAndExpensesStatusAndStatus(String patient, String expensesStatus, Integer status);
    //根据居民找出居民签约团队
    @Query("select a from SignFamily a where a.patient = ?1 and a.status = 1 and a.expensesStatus = '1'")
    SignFamily findSignFamilyByPatient(String patient);
    //根据居民查出有效签约
    @Query("select a from SignFamily a where a.patient = ?1 and a.status > 0 order by czrq desc")
    List<SignFamily> getSignFamilyByPatient(String patient);
    @Query("select count(distinct a.patient) from SignFamily a where  a.status = 1 and a.expensesStatus = '1'")
    int allCountSignNum();
    @Modifying
    @Query("update SignFamily p set p.ssc = ?1 where p.idcard = ?2 and p.status=1")
    int updateSscByIdCard(String ssc, String idCard);
    
    //根据年份,社区查出有效签约居民
    @Query("select a from SignFamily a where a.signYear = ?1 and a.status = 1 and a.hospital = ?2")
    List<SignFamily> getSignFamilyBySignYearAndStatusAndHospital(String signyear, String hospital);
}

+ 26 - 45
svr/svr-door-serivce/src/main/java/com/yihu/jw/door/service/WlyyDoorServiceOrderService.java

@ -11,11 +11,11 @@ import com.yihu.jw.door.service.consult.ConsultTeamService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.door.*;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.message.dao.MessageDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
@ -23,7 +23,6 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.entity.EntityUtils;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
@ -69,13 +68,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    private Logger logger = LoggerFactory.getLogger(WlyyDoorServiceOrderService.class);
/*    @Value("${server.server_url}")
    private String wxServerUrl;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
/* @Autowired
    private HttpClientUtil httpClientUtil;*/
    @Autowired
    private WlyyDoorServiceOrderDao wlyyDoorServiceOrderDao;
@ -110,9 +103,6 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    @Autowired
    private WlyyDoorTransRecordDao wlyyDoorTransRecordDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private ImUtil imUtill;
@ -139,12 +129,12 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
/*    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SignFamilyDao signFamilyDao;*/
*/
    @Autowired
    private DoorOrderService doorOrderService;
    @Value("${systemSetting.isApplication}")
    private String isApplication;
    @Autowired
    private DoorServiceVoucherDao doorServiceVoucherDao;
@ -593,15 +583,6 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            return result;
        }
/*        SignFamily signFamily = signFamilyDao.findSignFamilyByPatient(orderDO.getPatient());
        if (signFamily == null) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "当前服务对象未完成家庭医生签约,请完成签约后再预约上门服务!";
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        }*/
        //已取消的订单也可以申请
        boolean bool = wlyyDoorServiceOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                new Integer[]{WlyyDoorServiceOrderDO.Status.waitForSend.getType(),
@ -1156,7 +1137,6 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                " LEFT JOIN dm_hospital dm on o.hospital = dm.code " +
                " WHERE " +
                "  (o.patient = '{patient}' " +
//                "or o.proxy_patient = '{patient}'" +
                ") " +
                " AND (o.`status` = {status} or -100 = {status})" +
                "  group by o.id " +
@ -1879,7 +1859,7 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        //
        String sql = "SELECT " +
                "  d.code as doctor, " +
                "  d.id as doctor, " +
                "  d.photo as photo, " +
                "  d.name as name," +
                "  case d.sex  " +
@ -1892,8 +1872,9 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
                "  IFNULL(ds.`status`,5) as status," +
                "  1 as sortFlag ,count(o.id) as count" +
                " FROM " +
                " wlyy_doctor d " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.`code` = ds.doctor LEFT JOIN wlyy_door_service_order o on o.doctor = d.code and o.`status` in (2,3,4) " +
                " base.base_doctor d " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.id = ds.doctor " +
                " LEFT JOIN wlyy_door_service_order o on o.doctor = d.id and o.`status` in (2,3,4) " +
                " WHERE d.status = 1" +
                " AND d.level <> 11" +
                " AND d.hospital = '{hospital}' " +
@ -1912,8 +1893,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
        String countSql = "SELECT  " +
                "   count(d.id)  " +
                " FROM  " +
                "   wlyy_doctor d  " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.`code` = ds.doctor " +
                "   base.base_doctor d  " +
                " LEFT JOIN wlyy_door_doctor_status ds ON d.id = ds.doctor " +
                " WHERE d.status = 1" +
                " AND d.level <> 4" +
                " AND d.hospital = '{hospital}' "+
@ -1930,14 +1911,8 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
            sqlResultlist = jdbcTemplate.queryForList(finalSql);
            if (sqlResultlist!=null&&sqlResultlist.size()!=0){
                for (Map<String,Object> map:sqlResultlist){
/*                    BaseDoctorDO doctor = doctorDao.findById(map.get("doctor").toString());
                    BaseOrgDO hospital1 = hospitalDao.findByCode(doctor.getHospital());
                    if (doctor.getPosition()==null||doctor.getPosition()==""){
                        map.put("position",hospital1.getPosition());
                    }else {
                        map.put("position",doctor.getPosition());
                    }*/
                    map.put("position","117.13,36.18");
                    BaseOrgDO hospital1 = hospitalDao.findByCode(hospital);
                    map.put("position",hospital1.getLongitude()+","+hospital1.getLatitude());
                }
            }
            logger.info("服务医生人员sql:"+finalSql);
@ -2560,16 +2535,22 @@ public class WlyyDoorServiceOrderService extends BaseJpaService<WlyyDoorServiceO
    public List<Map<String, Object>> getDoorPatientList(String teamCode, String doctor, String patientName, Integer page, Integer pageSize) {
        int start = 0 == page ? page++ : (page - 1) * pageSize;
        int end = 0 == pageSize ? 10 : pageSize;
        String sql = "select DISTINCT patient,name,openid,idcard,mobile,town,townName,address from (SELECT s.patient,s.`name`,s.openid,s.idcard, s.mobile,h.town,h.town_name townName, p.address,a.create_time createTime from wlyy_sign_family s, wlyy_door_service_application a ,dm_hospital h,wlyy_patient p " +
                "WHERE s.admin_team_code = " + teamCode + " AND ( s.doctor = '" + doctor + "' OR s.doctor_health = '" + doctor + "') and s.`status`= 1 and s.expenses_status=1 and a.`status` =2 " +
                "and s.patient = a.patient and s.hospital = h.code and s.patient = p.code and p.status = 1 and (p.archive_status is null or p.archive_status != 2) ";
        if(StringUtils.isNotBlank(patientName)){
            sql += "and s.`name` LIKE '%" + patientName + "%' ";
        String sql = "select DISTINCT patient,name,openid,idcard,mobile,town,townName,address from ( ";
        if("1".equals(isApplication)){
            sql += "SELECT s.patient,s.`name`,s.openid,s.idcard, s.mobile,h.town,h.town_name townName, p.address,a.create_time createTime from wlyy_sign_family s, wlyy_door_service_application a ,dm_hospital h,wlyy_patient p " +
                    "WHERE s.admin_team_code = " + teamCode + " AND ( s.doctor = '" + doctor + "' OR s.doctor_health = '" + doctor + "') and s.`status`= 1 and s.expenses_status=1 and a.`status` =2 " +
                    "and s.patient = a.patient and s.hospital = h.code and s.patient = p.code and p.status = 1 and (p.archive_status is null or p.archive_status != 2)";
            if(StringUtils.isNotBlank(patientName)){
                sql += "and s.`name` LIKE '%" + patientName + "%' ";
            }
            sql += " union ";
        }
        sql += " union SELECT s.patient,s.`name`,s.openid,s.idcard, s.mobile,h.town,h.town_name townName, p.address,r.create_time createTime from wlyy_sign_family s, wlyy_door_service_order r ,dm_hospital h,wlyy_patient p " +
        sql += " SELECT s.patient,s.`name`,s.openid,s.idcard, s.mobile,h.town_code town,h.town_name townName, p.address,r.create_time createTime from wlyy_sign_family s, wlyy_door_service_order r ,base.base_org h,base.base_patient p " +
        "WHERE s.admin_team_code = " + teamCode + " AND ( s.doctor = '" + doctor + "' OR s.doctor_health = '" + doctor + "') and s.`status`= 1 and s.expenses_status=1 and s.doctor = '" + doctor + "' " +
                "and r.patient = s.patient and s.hospital = h.code and s.patient = p.code and p.status = 1 and (p.archive_status is null or p.archive_status != 2) ";
                "and r.patient = s.patient and s.hospital = h.code and s.patient = p.id and p.patient_status = 1 ";
        if(StringUtils.isNotBlank(patientName)){
            sql += "and s.`name` LIKE '%" + patientName + "%' ";
        }

+ 30 - 1
svr/svr-door-serivce/src/main/resource/application.yml

@ -130,6 +130,23 @@ hospital:
  TargetSysCode: S01
demo:
  flag: false
express:
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000101
  sf_check_word: EDSAFWFAQWyjt8099
pay:
  flag: true
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
# 系统配置
systemSetting:
  isApplication: 0 # 是否需要资质申请 1需要 0 不需要
---
spring:
  profiles: jwtest
@ -265,4 +282,16 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
demo:
  flag: false
  flag: false
express:
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000101
  sf_check_word: EDSAFWFAQWyjt8099
pay:
  flag: true
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat