微信后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

245 lines
7.2 KiB

package com.ynxbd.common.bean;
import com.ynxbd.common.bean.enums.HCardTypeEnum;
import com.ynxbd.common.helper.common.ParamHelper;
import com.ynxbd.wx.wxfactory.AesWxHelper;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.apache.commons.lang3.ObjectUtils;
import java.io.Serializable;
/**
* @Author wsq
* @Date 2020/9/25 14:09
* @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public class Patient implements Serializable {
private static final long serialVersionUID = 9966666612123151L;
private Integer id;
private String unionId;
private String enUnionId;
// 唯一id
private String openid;
private String enOpenId;
// 患者id
private String patientId;
private String enPatientId;
private String name;
private String sex;
private String age;
// 证件号码
private String idCardNo;
private String enCardNo;
private String showCardNo;
private String birthday;
// 电话
private String tel;
private String enTel;
private String showTel;
private String address;
private String bindDate;
private String hisTransNo;
private String nation;
//
private String fatherName;
private String fatherIdCardNo;
private String fatherTel;
private String fatherEnTel;
private String fatherEnIdCardNo;
private String motherName;
private String motherIdCardNo;
private String motherTel;
private String motherEnTel;
private String motherEnIdCardNo;
private String uuid;
//
private String healthCardId;
// 证件类型,电子健康卡
private String cardType;
// 区
private String county;
// 支付宝认证令牌
private String accessToken;
//
private String accessCode;
//
private String updateTime;
// 自己
private Boolean isMyself;
// 是否默认
private Boolean isDefault;
// 删除状态
private Integer deletedState;
// 地区编码
private String areaCode;
// 地区
private String areaAddress;
// 表内唯一ID
private String uniqueId;
// 医共体子公众号的AppId
private String hospAppId;
private String enHospAppId;
// 医共体主体认证id
private String gmcOpenId;
private String enGmcOpenId;
// 记录非医共体绑定的HIS患者id
private String hisPatientId;
// 医共体患者唯一id
private String gmcUniqueId;
// 是否为医共体绑定[1:是]
private Integer gmcBindState;
// HIS[BindingFlag:值为1时,说明患者尚未绑定或建档]
private String bindingFlag;
private HCardTypeEnum cardTypeEnum;
// HIS绑定
public boolean hasHisBind() {
return "1".equals(this.bindingFlag);
}
// 清除监护人信息
public void clearGuardianData() {
this.fatherName = null;
this.fatherIdCardNo = null;
this.fatherTel = null;
//
this.motherName = null;
this.motherIdCardNo = null;
this.motherTel = null;
}
/**
* 数据过滤
*
* @param isClearCardNoAndTel 是否清除证件号和电话
*/
public void filterData(boolean isClearCardNoAndTel) {
boolean noneCardNo = ObjectUtils.isEmpty(this.idCardNo); // 无证件号
// 患者ID
this.enPatientId = AesWxHelper.encode(this.patientId, true);
// 电话
this.showTel = ParamHelper.hideTel(this.tel);
this.enTel = AesWxHelper.encode(this.tel, true);
if (noneCardNo) { // 无证绑定数据显示过滤
this.fatherEnTel = AesWxHelper.encode(this.fatherTel, true);
this.fatherEnIdCardNo = AesWxHelper.encode(this.fatherIdCardNo, true);
this.fatherIdCardNo = ParamHelper.hideIdCardNo(this.fatherIdCardNo);
this.fatherTel = ParamHelper.hideTel(this.fatherTel);
this.motherEnTel = AesWxHelper.encode(this.motherTel, true);
this.motherEnIdCardNo = AesWxHelper.encode(this.motherIdCardNo, true);
this.motherIdCardNo = ParamHelper.hideIdCardNo(this.motherIdCardNo);
this.motherTel = ParamHelper.hideTel(this.motherTel);
} else {
// 身份证过滤
this.idCardNo = this.idCardNo.toUpperCase();
this.showCardNo = ParamHelper.hideIdCardNo(this.idCardNo);
this.enCardNo = AesWxHelper.encode(this.idCardNo, true);
}
if (this.cardType == null) {
this.cardType = noneCardNo ? HCardTypeEnum.NO_CARD.WX_CODE : HCardTypeEnum._01.WX_CODE;
}
if (isClearCardNoAndTel) {
this.tel = null;
this.idCardNo = null;
}
}
private boolean equalsData(String data1, String data2) {
if (data1 == null && data2 == null) {
return true;
}
return data1 != null && data1.equals(data2);
}
private boolean equalsData(Boolean data1, Boolean data2) {
if (data1 == null && data2 == null) {
return true;
}
return data1 != null && data1.equals(data2);
}
private boolean equalsLog(String log) {
// System.out.println("[信息变动]" + log);
return false;
}
public boolean equalsPatient(Patient copy) {
if (copy == null) {
return false;
}
if (!equalsData(this.idCardNo, copy.getIdCardNo())) {
return equalsLog("idCardNo");
}
if (ObjectUtils.isEmpty(this.cardType)) {
this.cardType = (ObjectUtils.isEmpty(this.idCardNo) || this.idCardNo.length() >= 32) ? HCardTypeEnum.NO_CARD.WX_CODE : HCardTypeEnum._01.WX_CODE;
}
if (ObjectUtils.isEmpty(copy.getCardType())) {
copy.setCardType((ObjectUtils.isEmpty(copy.getIdCardNo()) || copy.getIdCardNo().length() >= 32) ? HCardTypeEnum.NO_CARD.WX_CODE : HCardTypeEnum._01.WX_CODE);
}
if (!equalsData(this.cardType, copy.getCardType())) {
return equalsLog("cardType");
}
if (!equalsData(this.name, copy.getName())) {
return equalsLog("name");
}
if (!equalsData(this.birthday, copy.getBirthday())) {
return equalsLog("birthday");
}
if (!equalsData(this.sex, copy.getSex())) {
return equalsLog("sex");
}
if (!equalsData(this.nation, copy.getNation())) {
return equalsLog("nation");
}
if (!equalsData(this.tel, copy.getTel())) {
return equalsLog("tel");
}
if (!equalsData(this.areaCode, copy.getAreaCode())) {
return equalsLog("areaCode");
}
if (!equalsData(this.address, copy.getAddress())) {
return equalsLog("address");
}
if (!equalsData(this.isMyself, copy.getIsMyself())) {
return equalsLog("isMyself");
}
if (!equalsData(this.isDefault, copy.getIsDefault())) {
return equalsLog("isDefault");
}
return true;
}
}