Bladeren bron

Merge branch 'dev' of wujunjie/patient-co-management into dev

lyr 8 jaren geleden
bovenliggende
commit
afc6b464f3

+ 40 - 40
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/address/City.java

@ -7,51 +7,51 @@ import javax.persistence.Table;
/**
 * 城市信息對象
 * @author George
 *
 * @author George
 */
@Entity
@Table(name = "dm_city")
public class City extends IdEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 366338400555505599L;
	
	// 省編碼
	private String province;
	// 城市編碼
	private String code;
	// 城市名稱
	private String name;
	public City() {
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
    /**
     *
     */
    private static final long serialVersionUID = 366338400555505599L;
    // 省編碼
    private String province;
    // 城市編碼
    private String code;
    // 城市名稱
    private String name;
    public City() {
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

+ 450 - 448
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/SignFamily.java

@ -11,458 +11,460 @@ import com.yihu.wlyy.entity.IdEntity;
/**
 * 家庭签约
 *
 * @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已到期,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已退费】
	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;//缴费时间
	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;
	}
	@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;
	}
	@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 + '\'' +
				'}';
	}
	public Date getExpensesTime() {
		return expensesTime;
	}
	public void setExpensesTime(Date expensesTime) {
		this.expensesTime = expensesTime;
	}
    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已到期,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已退费】
    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;//缴费时间
    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;
    }
    @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;
    }
    @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 + '\'' +
                '}';
    }
    public Date getExpensesTime() {
        return expensesTime;
    }
    public void setExpensesTime(Date expensesTime) {
        this.expensesTime = expensesTime;
    }
}

+ 128 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -18,6 +18,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.web.BaseController;
import org.apache.commons.beanutils.converters.CalendarConverter;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.type.descriptor.sql.JdbcTypeFamilyInformation;
@ -35,6 +36,8 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static javafx.scene.input.KeyCode.X;
/**
 * 患者标签信息服务
 * <p>
@ -1526,7 +1529,132 @@ public class SignPatientLabelInfoService extends BaseService {
        return reArray;
    }
    /**
     * 医生端查询
     * @param filter
     * @return
     */
    public JSONObject search(String filter,String doctorCode){
        Map<String,JSONObject> teams = new HashMap<>();
        Map<String,JSONObject> patients = new HashMap<>();
        String reg = "^(\\d{6})(19|20)(\\d{2})(1[0-2]|0[1-9])(0[1-9]|[1-2][0-9]|3[0-1])(\\d{3})(\\d|X|x)?$";
        Pattern pattern1 = Pattern.compile(reg); //粗略的校验
        Matcher matcher = pattern1.matcher(filter);
        if(matcher.matches()){
//            身份证校验通过
            String sql = "select" +
                    " p. CODE," +
                    " p. NAME ," +
                    " p.idcard," +
                    " p.sex," +
                    " f.id," +
                    " f.type," +
                    " f.doctor," +
                    " f.doctor_health," +
                    " f.admin_team_code," +
                    " t.id teamCode," +
                    " t.`name` teamName" +
                    " from" +
                    " wlyy_patient p" +
                    " LEFT JOIN wlyy_sign_family f ON p.CODE = f.patient" +
                    " LEFT JOIN wlyy_admin_team t ON f.admin_team_code = t.id" +
                    " where" +
                    " p. idcard = ? AND (f.id IS NULL || f.status > 0)";
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql,filter);
            for (Map<String, Object> p : list) {
                JSONObject pJson = new JSONObject();
                pJson.put("code", p.get("code"));
                pJson.put("name", p.get("name") != null ? p.get("name") : "");
                pJson.put("idcard", p.get("idcard"));
                pJson.put("sex", p.get("sex") != null ? p.get("sex") : "");
                pJson.put("age", p.get("idcard") != null ? IdCardUtil.getAgeForIdcard(String.valueOf(p.get("idcard"))) : "");
                pJson.put("photo", p.get("photo") != null ? p.get("photo") : "");
                pJson.put("id",p.get("id")!=null? p.get("id"):"");
                pJson.put("doctor",p.get("doctor")!=null? p.get("doctor"):"");
                pJson.put("doctorHealth",p.get("doctor_health")!=null? p.get("doctor_health"):"");
                if(p.get("id")!=null && (doctorCode.equals(pJson.get("doctor"))||doctorCode.equals(pJson.get("doctorHealth")))){
                    if(p.get("teamCode") != null && StringUtils.isNotEmpty(p.get("teamCode").toString())) {
                        JSONObject team = teams.get(p.get("teamCode").toString());
                        if (team == null) {
                            team = new JSONObject();
                            team.put("teamCode", p.get("teamCode"));
                            team.put("teamName", p.get("teamName"));
                            JSONArray pArray = new JSONArray();
                            pArray.put(pJson);
                            team.put("patients", pArray);
                            teams.put(p.get("teamCode").toString(), team);
                        } else {
                            JSONArray pArray = team.getJSONArray("patients");
                            pArray.put(pJson);
                        }
                    }
                }  else {
                    patients.put(p.get("code").toString(), pJson);
                }
            }
        }else {
            String sql = "select" +
                    " p. CODE," +
                    " p. NAME," +
                    " p.idcard," +
                    " p.sex," +
                    " f.id," +
                    " f.type," +
                    " f.doctor," +
                    " f.doctor_health," +
                    " f.admin_team_code," +
                    " t.id teamCode," +
                    " t.`name` teamName" +
                    " from" +
                    " wlyy_patient p" +
                    " LEFT JOIN wlyy_sign_family f ON p.CODE = f.patient" +
                    " LEFT JOIN wlyy_admin_team t ON f.admin_team_code = t.id" +
                    " where" +
                    " p. name = ? AND (f.id IS NULL || f.status > 0)";
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, filter);
            for (Map<String, Object> p : list) {
                JSONObject pJson = new JSONObject();
                pJson.put("code", p.get("code"));
                pJson.put("name", p.get("name") != null ? p.get("name") : "");
                pJson.put("idcard", p.get("idcard"));
                pJson.put("sex", p.get("sex") != null ? p.get("sex") : "");
                pJson.put("age", p.get("idcard") != null ? IdCardUtil.getAgeForIdcard(String.valueOf(p.get("idcard"))) : "");
                pJson.put("photo", p.get("photo") != null ? p.get("photo") : "");
                pJson.put("id",p.get("id")!=null? p.get("id"):"");
                pJson.put("doctor",p.get("doctor")!=null? p.get("doctor"):"");
                pJson.put("doctorHealth",p.get("doctor_health")!=null? p.get("doctor_health"):"");
                if(p.get("id")!=null && (doctorCode.equals(pJson.get("doctor"))||doctorCode.equals(pJson.get("doctorHealth")))){
                    if(p.get("teamCode") != null && StringUtils.isNotEmpty(p.get("teamCode").toString())) {
                        JSONObject team = teams.get(p.get("teamCode").toString());
                        if (team == null) {
                            team = new JSONObject();
                            team.put("teamCode", p.get("teamCode"));
                            team.put("teamName", p.get("teamName"));
                            JSONArray pArray = new JSONArray();
                            pArray.put(pJson);
                            team.put("patients", pArray);
                            teams.put(p.get("teamCode").toString(), team);
                        } else {
                            JSONArray pArray = team.getJSONArray("patients");
                            pArray.put(pJson);
                        }
                    }
                }  else {
                    patients.put(p.get("code").toString(), pJson);
                }
            }
        }
        JSONObject result = new JSONObject();
        result.put("teams",teams.values());
        result.put("patients",patients.values());
        return result;
    }
    /**
     * 添加居民到某个标签
     *

+ 16 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -26,6 +26,22 @@ public class SignPatientLabelInfoController extends BaseController {
    @Autowired
    SignPatientLabelInfoService labelInfoService;
    @RequestMapping(value="toList",method = RequestMethod.GET)
    @ResponseBody
    public String search(@RequestParam String str){
        try {
            if (StringUtils.isEmpty(str)) {
                return error(-1, "居民不能为空");
            }
            JSONObject temp = labelInfoService.search(str,getUID());
            return write(200, "查询成功", "data", temp);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
//        return labelInfoService.search(str,getUID());
    }
    /**
     * 查询居民信息
     *