|
@ -137,27 +137,28 @@ public class WeiXinTagUtil {
|
|
|
*/
|
|
|
public String addTagWithOpenid(String openid, String hospital, String patient, String patientName) {
|
|
|
try {
|
|
|
if (!StringUtils.isEmpty(hospital)) {
|
|
|
String town = hospital.substring(0, 6);
|
|
|
//根据机构获取tagId
|
|
|
WechatTag tagId = wechatTagDao.findByTownCode(town);
|
|
|
if (tagId != null) {
|
|
|
if (StringUtils.isEmpty(openid)) {
|
|
|
saveLog(openid, patient, patientName, null, 1, "签约表openid是为空");
|
|
|
} else {
|
|
|
String resultStr = addTagWithOpenid(openid, tagId.getTagId(), patient, patientName);
|
|
|
saveLog(openid, patient, patientName, tagId, 1, resultStr);
|
|
|
//更新患者表
|
|
|
patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.yes.getValue());
|
|
|
return resultStr;
|
|
|
}
|
|
|
} else {
|
|
|
saveLog(openid, patient, patientName, null, 1, "wx_tag中不存在区是" + town + "的标签");
|
|
|
}
|
|
|
} else {
|
|
|
String str = null;
|
|
|
if (StringUtils.isEmpty(hospital)) {
|
|
|
saveLog(openid, patient, patientName, null, 1, "签约表机构是为空");
|
|
|
return str;
|
|
|
}
|
|
|
return null;
|
|
|
if (StringUtils.isEmpty(openid)) {
|
|
|
saveLog(openid, patient, patientName, null, 1, "签约表openid是为空");
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
String town = hospital.substring(0, 6);
|
|
|
//根据机构获取tagId
|
|
|
WechatTag tagId = wechatTagDao.findByTownCode(town);
|
|
|
if (tagId != null) {
|
|
|
str = addTagWithOpenid(openid, tagId.getTagId(), patient, patientName);
|
|
|
saveLog(openid, patient, patientName, tagId, 1, str);
|
|
|
} else {
|
|
|
saveLog(openid, patient, patientName, null, 1, "wx_tag中不存在区是" + town + "的标签");
|
|
|
}
|
|
|
//更新患者表
|
|
|
patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.yes.getValue());
|
|
|
return str;
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
return null;
|
|
@ -197,28 +198,30 @@ public class WeiXinTagUtil {
|
|
|
* @return
|
|
|
*/
|
|
|
public String deleteTagWithOpenid(String openid, String hospital, String patient, String patientName) {
|
|
|
String str = null;
|
|
|
try {
|
|
|
if (!StringUtils.isEmpty(hospital)) {
|
|
|
String town = hospital.substring(0, 6);
|
|
|
//根据机构获取tagId
|
|
|
WechatTag tagId = wechatTagDao.findByTownCode(town);
|
|
|
if (tagId != null) {
|
|
|
if (StringUtils.isEmpty(openid)) {
|
|
|
saveLog(openid, patient, patientName, null, 2, "签约表openid是为空");
|
|
|
} else {
|
|
|
String str = deleteTagWithOpenid(openid, tagId.getTagId());
|
|
|
saveLog(openid, patient, patientName, tagId, 2, str);
|
|
|
//更新患者表
|
|
|
patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.no.getValue());
|
|
|
return str;
|
|
|
}
|
|
|
} else {
|
|
|
saveLog(openid, patient, patientName, null, 2, "wx_tag中不存在区是" + town + "的标签");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(hospital)) {
|
|
|
saveLog(openid, patient, patientName, null, 1, "签约表机构是为空");
|
|
|
return str;
|
|
|
}
|
|
|
if (StringUtils.isEmpty(openid)) {
|
|
|
saveLog(openid, patient, patientName, null, 1, "签约表openid是为空");
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
String town = hospital.substring(0, 6);
|
|
|
//根据机构获取tagId
|
|
|
WechatTag tagId = wechatTagDao.findByTownCode(town);
|
|
|
if (tagId != null) {
|
|
|
str = deleteTagWithOpenid(openid, tagId.getTagId());
|
|
|
saveLog(openid, patient, patientName, tagId, 2, str);
|
|
|
//更新患者表
|
|
|
return str;
|
|
|
} else {
|
|
|
saveLog(openid, patient, patientName, null, 2, "签约表机构是为空");
|
|
|
saveLog(openid, patient, patientName, null, 2, "wx_tag中不存在区是" + town + "的标签");
|
|
|
}
|
|
|
return null;
|
|
|
patientDao.updateIsWXTagByCode(patient, Patient.isWchatTage.no.getValue());
|
|
|
return str;
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage());
|
|
|
return null;
|