|
|
|
|
package com.ynxbd.common.action;
|
|
|
|
|
|
|
|
|
|
import com.ynxbd.common.action.base.BaseAction;
|
|
|
|
|
import com.ynxbd.common.bean.his.HisAuthAgent;
|
|
|
|
|
import com.ynxbd.common.dao.his.HisAuthAgentDao;
|
|
|
|
|
import com.ynxbd.common.helper.common.ParamHelper;
|
|
|
|
|
import com.ynxbd.common.result.Result;
|
|
|
|
|
import com.ynxbd.common.result.ResultEnum;
|
|
|
|
|
import com.ynxbd.wx.wxfactory.AesWxHelper;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
import org.apache.struts2.convention.annotation.Action;
|
|
|
|
|
import org.apache.struts2.convention.annotation.Namespace;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
// 授权委托人
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Namespace("/authAgent")
|
|
|
|
|
public class AuthAgentAction extends BaseAction {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Action("getAuthAgent")
|
|
|
|
|
public Result getAuthAgent(String treatNum, Integer treatType, String itemNo) {
|
|
|
|
|
try {
|
|
|
|
|
treatNum = decodeReqString(treatNum);
|
|
|
|
|
log.info("[委托人信息]查询 treatNum={}, treatType={}", treatNum, treatType);
|
|
|
|
|
if (!ObjectUtils.isEmpty(itemNo)) {
|
|
|
|
|
itemNo = decodeReqString(itemNo);
|
|
|
|
|
if (itemNo == null) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_INVALID);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<HisAuthAgent> dataList = new HisAuthAgentDao().queryAuthAgent(treatNum, treatType);
|
|
|
|
|
|
|
|
|
|
boolean hasItemNo = !ObjectUtils.isEmpty(itemNo);
|
|
|
|
|
if (hasItemNo) {
|
|
|
|
|
String finalItemNo = itemNo;
|
|
|
|
|
dataList = dataList.stream().filter(o -> finalItemNo.equals(o.getItemNo())).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
for (HisAuthAgent item : dataList) {
|
|
|
|
|
item.setEnItemNo(AesWxHelper.encode(item.getItemNo()));
|
|
|
|
|
item.setEnPersonId(AesWxHelper.encode(item.getPersonId()));
|
|
|
|
|
item.setEnPersonTel(AesWxHelper.encode(item.getPersonTel()));
|
|
|
|
|
item.setShowPersonId(ParamHelper.hideIdCardNo(item.getPersonId()));
|
|
|
|
|
item.setShowPersonTel(ParamHelper.hidTel(item.getPersonTel()));
|
|
|
|
|
|
|
|
|
|
item.setPersonId(null);
|
|
|
|
|
item.setPersonTel(null);
|
|
|
|
|
}
|
|
|
|
|
return Result.success(dataList);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Action("addAuthAgent")
|
|
|
|
|
public Result addAuthAgent(String openid, String treatNum, Integer treatType, String personName, String personSex, String personTel, String personId, String relationship, Integer personAge, String personAddress) {
|
|
|
|
|
try {
|
|
|
|
|
treatNum = decodeReqString(treatNum);
|
|
|
|
|
log.info("[委托人信息]添加 treatNum={}, treatType={}, personName={}, personSex={}, relationship={}", treatNum, treatType, personName, personSex, relationship);
|
|
|
|
|
new HisAuthAgentDao().addAuthAgent(treatNum, treatType, personName, personSex, personTel, personId, relationship, personAge, personAddress);
|
|
|
|
|
return Result.success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Action("updateAuthAgent")
|
|
|
|
|
public Result updateAuthAgent(String openid, String itemNo, String personName, String personSex, String personTel, String personId, String relationship, String personAge, String personAddress, String enPersonTel, String enPersonId) {
|
|
|
|
|
try {
|
|
|
|
|
if (personId == null || personTel == null || enPersonTel == null || enPersonId == null) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_INVALID);
|
|
|
|
|
}
|
|
|
|
|
itemNo = decodeReqString(itemNo);
|
|
|
|
|
log.info("[委托人信息]添加 itemNo={},personName={}, personSex={}, relationship={}, enPersonTel={}, enPersonId={}", itemNo, personName, personSex, relationship, enPersonTel, enPersonId);
|
|
|
|
|
if (personId.contains("*")) { // 数据没有变化
|
|
|
|
|
personId = decodeReqString(enPersonId);
|
|
|
|
|
}
|
|
|
|
|
if (personTel.contains("*")) {
|
|
|
|
|
personTel = decodeReqString(enPersonTel);
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtils.isEmpty(personId) || ObjectUtils.isEmpty(personTel) || ObjectUtils.isEmpty(itemNo)) {
|
|
|
|
|
return Result.error(ResultEnum.PARAM_IS_INVALID);
|
|
|
|
|
}
|
|
|
|
|
new HisAuthAgentDao().updateAuthAgent(itemNo, personName, personSex, personTel, personId, relationship, personAge, personAddress);
|
|
|
|
|
return Result.success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Action("delAuthAgent")
|
|
|
|
|
public Result delAuthAgent(String itemNo, String openid) {
|
|
|
|
|
try {
|
|
|
|
|
itemNo = decodeReqString(itemNo);
|
|
|
|
|
log.info("[委托人信息]修改 itemNo={}", itemNo);
|
|
|
|
|
new HisAuthAgentDao().delAuthAgent(itemNo);
|
|
|
|
|
return Result.success();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
return Result.error(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|