parent
6772f8942a
commit
949b63c5bb
14 changed files with 927 additions and 154 deletions
@ -0,0 +1,35 @@ |
|||||||
|
package com.ynxbd.push.entity.enums; |
||||||
|
|
||||||
|
import org.springframework.util.ObjectUtils; |
||||||
|
|
||||||
|
public enum HisApiEnum { |
||||||
|
// 数字后缀为[_参数个数][__编号(模板名称相同,参数个数相同,但参数名称不一致)]
|
||||||
|
reg_success_04__001("reg_success_04__001", "预约挂号成功通知", "就诊人、就诊科室、预约时间、就诊地点"), |
||||||
|
payment_end_04__001("payment_end_04__001", "缴费完成通知", "就诊人、缴费时间、缴费金额、治疗地点"), |
||||||
|
payment_remind_04__001("payment_remind_04__001", "缴费提醒", "患者姓名、开单时间、缴费项目、金额"), |
||||||
|
report_notice_05__001("report_notice_05__001", "检验检查报告通知", "就诊卡号、就诊人、单号、检查时间、项目名称"), |
||||||
|
work_order_remind_02__001("work_order_remind_02__001", "工单处理提醒", "提交时间、工单名称"), |
||||||
|
; |
||||||
|
|
||||||
|
public final String CODE; |
||||||
|
public final String TITLE; |
||||||
|
public final String KEYWORD; |
||||||
|
|
||||||
|
HisApiEnum(String CODE, String TITLE, String KEYWORD) { |
||||||
|
this.CODE = CODE; |
||||||
|
this.TITLE = TITLE; |
||||||
|
this.KEYWORD = KEYWORD; |
||||||
|
} |
||||||
|
|
||||||
|
public static HisApiEnum toEnum(String code) { |
||||||
|
if (ObjectUtils.isEmpty(code)) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
for (HisApiEnum item : HisApiEnum.values()) { |
||||||
|
if (code.equals(item.CODE)) { |
||||||
|
return item; |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,159 @@ |
|||||||
|
package com.ynxbd.push.entity.enums; |
||||||
|
|
||||||
|
|
||||||
|
import lombok.ToString; |
||||||
|
import org.springframework.util.ObjectUtils; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 枚举:类目模板消息参数值内容限制说明 |
||||||
|
*/ |
||||||
|
@ToString |
||||||
|
public enum MsgParamEnum { |
||||||
|
|
||||||
|
THING(20, "thing", "【事物】可汉字、数字、字母或符号组合"), |
||||||
|
|
||||||
|
CHARACTER_STRING(32, "character_string", "【字符串】可数字、字母或符号组合"), |
||||||
|
TIME(32, "time", "【时间】24小时制时间格式(支持+年月日),支持填时间段,两个时间点之间用“~”符号连接【例如:15:01,或:2019年10月1日 15:01】"), |
||||||
|
AMOUNT(32, "amount", "【金额】1个币种符号+12位以内纯数字,可带小数,结尾可带“元” 可带小数"), |
||||||
|
PHONE_NUMBER(17, "phone_number", "【电话】(数字、符号) 电话号码,例:+86-0766-66888866"), |
||||||
|
CAR_NUMBER(8, "car_number", "【车牌】第一位与最后一位可为汉字,其余为字母或数字 例:车牌号码:粤A8Z888挂"), |
||||||
|
CONST(20, "const", "【常量】超过无法下发注:需枚举(需将内容提交平台审核,审核通过可下发)只能下发审核通过的字符串和空串"), |
||||||
|
|
||||||
|
// 锁定的参数名-----------------------
|
||||||
|
URL(1024, "url", "跳转链接"), |
||||||
|
TEMPLATE_ID(100, "template_id", "跳转链接"), |
||||||
|
TIP(200, "tip", "模板类型"), |
||||||
|
TITLE(200, "title", "模板标题"), |
||||||
|
; |
||||||
|
|
||||||
|
// 字符串限制长度
|
||||||
|
public final int LENGTH; |
||||||
|
// code开头
|
||||||
|
public final String CODE; |
||||||
|
// 备注说明
|
||||||
|
public final String REMARK; |
||||||
|
|
||||||
|
MsgParamEnum(int LENGTH, String CODE, String REMARK) { |
||||||
|
this.LENGTH = LENGTH; |
||||||
|
this.CODE = CODE; |
||||||
|
this.REMARK = REMARK; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取参数 |
||||||
|
* |
||||||
|
* @param paramsMap 参数集 |
||||||
|
* @param key 参数key |
||||||
|
* @param canNull 可以为空 |
||||||
|
*/ |
||||||
|
public String getStrValue(Map<String, String> paramsMap, String key, boolean canNull) throws Exception { |
||||||
|
if (ObjectUtils.isEmpty(key)) { |
||||||
|
throw new Exception("参数key缺失"); |
||||||
|
} |
||||||
|
String value = paramsMap.get(key); |
||||||
|
// 可以为空
|
||||||
|
if (canNull) { |
||||||
|
if (ObjectUtils.isEmpty(value)) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (ObjectUtils.isEmpty(value)) { |
||||||
|
throw new Exception(key + "参数为空"); |
||||||
|
} |
||||||
|
} |
||||||
|
// 判断长度是否合法
|
||||||
|
if (value.length() > LENGTH) { |
||||||
|
throw new Exception(key + "参数长度过长"); |
||||||
|
} |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取参数 |
||||||
|
* |
||||||
|
* @param paramsMap 参数集 |
||||||
|
* @param key 参数key |
||||||
|
*/ |
||||||
|
public Map<String, String> getMapValue(Map<String, String> paramsMap, String key) throws Exception { |
||||||
|
return getMapValue(paramsMap, key, false, null); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取参数 |
||||||
|
* |
||||||
|
* @param paramsMap 参数集 |
||||||
|
* @param key 参数key |
||||||
|
* @param color 颜色 |
||||||
|
*/ |
||||||
|
public Map<String, String> getMapValue(Map<String, String> paramsMap, String key, String color) throws Exception { |
||||||
|
return getMapValue(paramsMap, key, false, color); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取参数 |
||||||
|
* |
||||||
|
* @param paramsMap 参数集 |
||||||
|
* @param key 参数key |
||||||
|
* @param canNull 是否可以为空 |
||||||
|
*/ |
||||||
|
public Map<String, String> getMapValue(Map<String, String> paramsMap, String key, boolean canNull, String color) throws Exception { |
||||||
|
if (ObjectUtils.isEmpty(key)) { |
||||||
|
throw new Exception("参数key缺失"); |
||||||
|
} |
||||||
|
Map<String, String> keyMap = new HashMap<>(); |
||||||
|
String value = getStrValue(paramsMap, key, canNull); |
||||||
|
keyMap.put("value", value); |
||||||
|
if (!ObjectUtils.isEmpty(color)) { |
||||||
|
keyMap.put("color", color); |
||||||
|
} |
||||||
|
return keyMap; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 组织成key |
||||||
|
*/ |
||||||
|
public String toKey(String keyNum) throws Exception { |
||||||
|
if (ObjectUtils.isEmpty(keyNum)) { |
||||||
|
throw new Exception("keyNum为空"); |
||||||
|
} |
||||||
|
return CODE + keyNum; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 模板参数组装 |
||||||
|
* |
||||||
|
* @param paramsMap 入参map |
||||||
|
* @param tempData 模板 |
||||||
|
* @param paramName 参数名称 |
||||||
|
* @param keyNum key的编号(如:time21,入参就为21) |
||||||
|
*/ |
||||||
|
public void put(Map<String, String> paramsMap, Map<String, Object> tempData, String paramName, Integer keyNum) throws Exception { |
||||||
|
put(paramsMap, tempData, paramName, keyNum, false, null); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 模板参数组装 |
||||||
|
* |
||||||
|
* @param paramsMap 入参map |
||||||
|
* @param tempData 模板 |
||||||
|
* @param paramName 参数名称 |
||||||
|
* @param keyNum key的编号(如:time21,入参就为21) |
||||||
|
* @param canNull 是否可以为空 |
||||||
|
* @param color 颜色 |
||||||
|
*/ |
||||||
|
public void put(Map<String, String> paramsMap, Map<String, Object> tempData, String paramName, Integer keyNum, boolean canNull, String color) throws Exception { |
||||||
|
if (keyNum == null) { |
||||||
|
throw new Exception("keyNum is null"); |
||||||
|
} |
||||||
|
String keyNumStr = String.valueOf(keyNum); |
||||||
|
tempData.put(this.toKey(keyNumStr), this.getMapValue(paramsMap, paramName, canNull, color)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
package com.ynxbd.push.entity.tencent; |
||||||
|
|
||||||
|
import lombok.*; |
||||||
|
import lombok.experimental.Tolerate; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Builder |
||||||
|
@ToString |
||||||
|
public class SendTemplate { |
||||||
|
private String title; |
||||||
|
public String message_id; |
||||||
|
public String code; |
||||||
|
|
||||||
|
public String template_id; |
||||||
|
|
||||||
|
private String template_name; |
||||||
|
|
||||||
|
private String touser; |
||||||
|
|
||||||
|
private String url; |
||||||
|
|
||||||
|
private String appId; |
||||||
|
|
||||||
|
private String pagePath; |
||||||
|
|
||||||
|
private String messageType; |
||||||
|
|
||||||
|
private int count; |
||||||
|
|
||||||
|
private Map<String, Object> data; |
||||||
|
|
||||||
|
@Tolerate |
||||||
|
SendTemplate() { |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,81 @@ |
|||||||
|
package com.ynxbd.push.helper; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import org.springframework.util.ObjectUtils; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* map转换工具类 |
||||||
|
*/ |
||||||
|
public class MapHelper { |
||||||
|
|
||||||
|
/** |
||||||
|
* obj类型map转str类型map |
||||||
|
* |
||||||
|
* @param objMap obj类型map |
||||||
|
* @return str类型map |
||||||
|
*/ |
||||||
|
public static Map<String, String> objMapToStrMap(Map<String, Object> objMap) { |
||||||
|
Map<String, String> strMap = new HashMap<>(); |
||||||
|
for (Map.Entry<String, Object> item : objMap.entrySet()) { |
||||||
|
String key = item.getKey(); |
||||||
|
if (ObjectUtils.isEmpty(key)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
Object value = item.getValue(); |
||||||
|
if (ObjectUtils.isEmpty(value)) { |
||||||
|
strMap.put(key, null); |
||||||
|
continue; |
||||||
|
} |
||||||
|
if (value instanceof Map) { |
||||||
|
strMap.put(key, JSONObject.toJSONString(value)); |
||||||
|
} else { |
||||||
|
strMap.put(key, value.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
return strMap; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* str类型map转obj类型map |
||||||
|
* |
||||||
|
* @param strMap str类型map |
||||||
|
* @return obj类型map |
||||||
|
*/ |
||||||
|
public static Map<String, Object> strMapToObjMap(Map<String, String> strMap) { |
||||||
|
Map<String, Object> objMap = new HashMap<>(); |
||||||
|
for (Map.Entry<String, String> item : strMap.entrySet()) { |
||||||
|
String key = item.getKey(); |
||||||
|
if (key == null) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
String value = item.getValue(); |
||||||
|
if (value == null) { |
||||||
|
objMap.put(key, ""); |
||||||
|
} else { |
||||||
|
objMap.put(key, getJsonVal(value)); |
||||||
|
} |
||||||
|
} |
||||||
|
return objMap; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取Json值 |
||||||
|
* |
||||||
|
* @param value 值 |
||||||
|
* @return Object |
||||||
|
*/ |
||||||
|
public static Object getJsonVal(String value) { |
||||||
|
if (ObjectUtils.isEmpty(value)) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
try { |
||||||
|
return JSONObject.parse(value); |
||||||
|
} catch (Exception e) { |
||||||
|
return ""; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,281 @@ |
|||||||
|
package com.ynxbd.push.service; |
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.ynxbd.push.entity.enums.HisApiEnum; |
||||||
|
import com.ynxbd.push.entity.enums.MsgParamEnum; |
||||||
|
import com.ynxbd.push.entity.response.ResponseResult; |
||||||
|
import com.ynxbd.push.entity.type.MessageTypeEnum; |
||||||
|
import com.ynxbd.push.helper.DesEncryptHelper; |
||||||
|
import com.ynxbd.push.httpRequest.tencent.WeChatDataRequest; |
||||||
|
import com.ynxbd.push.rabbit.send.RabbitSender; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.util.ObjectUtils; |
||||||
|
import weixin.popular.bean.message.MessageSendResult; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@Service |
||||||
|
public class HisUniversalService { |
||||||
|
@Autowired |
||||||
|
private RabbitSender rabbitSender; |
||||||
|
|
||||||
|
|
||||||
|
public MessageSendResult hisUniversal(Map<String, String> paramsMap) { |
||||||
|
String callNo = paramsMap.get("callNo"); |
||||||
|
HisApiEnum hisApiEnum = HisApiEnum.toEnum(callNo); |
||||||
|
if (hisApiEnum == null) { |
||||||
|
return ResponseResult.CALL_NO_IS_NOT_FIND.toMessResult(); |
||||||
|
} |
||||||
|
|
||||||
|
log.info("[{}]推送开始...", hisApiEnum.TITLE); |
||||||
|
String templateId = WeChatDataRequest.getTemplateId(hisApiEnum.TITLE); |
||||||
|
if (ObjectUtils.isEmpty(templateId)) { |
||||||
|
return ResponseResult.TEMPLATE_ID_IS_NOT_FIND.toMessResult(); |
||||||
|
} |
||||||
|
|
||||||
|
switch (hisApiEnum) { |
||||||
|
case payment_end_04__001: |
||||||
|
return payment_end_04__001(paramsMap, templateId, hisApiEnum.TITLE); |
||||||
|
|
||||||
|
case payment_remind_04__001: |
||||||
|
return payment_remind_04__001(paramsMap, templateId, hisApiEnum.TITLE); |
||||||
|
|
||||||
|
case reg_success_04__001: |
||||||
|
return reg_success_04__001(paramsMap, templateId, hisApiEnum.TITLE); |
||||||
|
|
||||||
|
case report_notice_05__001: |
||||||
|
return report_notice_05__001(paramsMap, templateId, hisApiEnum.TITLE); |
||||||
|
|
||||||
|
case work_order_remind_02__001: |
||||||
|
return work_order_remind_02__001(paramsMap, templateId, hisApiEnum.TITLE); |
||||||
|
} |
||||||
|
return ResponseResult.CALL_NO_IS_NOT_FIND.toMessResult(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 创建一个data模板 |
||||||
|
* |
||||||
|
* @param paramsMap 入参map |
||||||
|
* @param templateId 模板ID |
||||||
|
*/ |
||||||
|
public Map<String, Object> createTemplate(Map<String, String> paramsMap, String templateId, String title) throws Exception { |
||||||
|
String organizeName = paramsMap.get("organizeName"); |
||||||
|
if (ObjectUtils.isEmpty(organizeName)) { |
||||||
|
throw new Exception("组织机构代码为空"); |
||||||
|
} |
||||||
|
organizeName = DesEncryptHelper.deCode(organizeName); |
||||||
|
if (organizeName.equals("error:null")) { |
||||||
|
throw new Exception("组织机构代码为空 organizeName=" + organizeName); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String, Object> tempData = new HashMap<>(); |
||||||
|
// 页面路径[入参url]
|
||||||
|
String url = paramsMap.get("url"); |
||||||
|
tempData.put(MsgParamEnum.URL.CODE, ObjectUtils.isEmpty(url) ? "" : url); |
||||||
|
// tip
|
||||||
|
tempData.put(MsgParamEnum.TIP.CODE, MessageTypeEnum.COMMON.CODE); |
||||||
|
// 模板ID
|
||||||
|
tempData.put(MsgParamEnum.TEMPLATE_ID.CODE, templateId); |
||||||
|
tempData.put(MsgParamEnum.TITLE.CODE, title); |
||||||
|
|
||||||
|
String patientId = paramsMap.get("patientId"); |
||||||
|
String doctorCode = paramsMap.get("doctorCode"); |
||||||
|
String cardNo = paramsMap.get("cardNo"); |
||||||
|
String openId = paramsMap.get("openId"); |
||||||
|
if (ObjectUtils.isEmpty(patientId) && ObjectUtils.isEmpty(doctorCode) && ObjectUtils.isEmpty(cardNo)) { |
||||||
|
throw new Exception("查询信息的参数缺失"); |
||||||
|
} |
||||||
|
|
||||||
|
if (!ObjectUtils.isEmpty(patientId)) { |
||||||
|
tempData.put("patientId", patientId); |
||||||
|
} |
||||||
|
if (!ObjectUtils.isEmpty(doctorCode)) { |
||||||
|
tempData.put("doctorCode", doctorCode); |
||||||
|
} |
||||||
|
|
||||||
|
if (!ObjectUtils.isEmpty(cardNo)) { |
||||||
|
tempData.put("cardNo", cardNo); |
||||||
|
} |
||||||
|
return tempData; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 缴费完成通知(就诊人、缴费时间、缴费金额、治疗地点) |
||||||
|
* |
||||||
|
* @param paramsMap 参数集 |
||||||
|
* @return MessageSendResult |
||||||
|
*/ |
||||||
|
public MessageSendResult payment_end_04__001(Map<String, String> paramsMap, String templateId, String title) { |
||||||
|
try { |
||||||
|
Map<String, Object> tempData = createTemplate(paramsMap, templateId, title); |
||||||
|
// 就诊人
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "patientName", 1); |
||||||
|
// 缴费时间
|
||||||
|
MsgParamEnum.TIME.put(paramsMap, tempData, "time", 4); |
||||||
|
// 缴费金额
|
||||||
|
MsgParamEnum.AMOUNT.put(paramsMap, tempData, "money", 3); |
||||||
|
// 治疗地点
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "address", 17); |
||||||
|
|
||||||
|
rabbitSender.sendByTip(tempData); |
||||||
|
return ResponseResult.JOIN_QUEUE.toMessResult(); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage()); |
||||||
|
return ResponseResult.PARAMETER_IS_NULL.toMessResult(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 缴费提醒(患者姓名、开单时间、缴费项目、金额) |
||||||
|
* |
||||||
|
* @param paramsMap |
||||||
|
* @param templateId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private MessageSendResult payment_remind_04__001(Map<String, String> paramsMap, String templateId, String title) { |
||||||
|
try { |
||||||
|
Map<String, Object> tempData = createTemplate(paramsMap, templateId, title); |
||||||
|
// 患者姓名
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "patientName", 14); |
||||||
|
// 开单时间
|
||||||
|
MsgParamEnum.TIME.put(paramsMap, tempData, "time", 17); |
||||||
|
// 缴费项目
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "projectName", 10); |
||||||
|
// 金额
|
||||||
|
MsgParamEnum.AMOUNT.put(paramsMap, tempData, "money", 3); |
||||||
|
|
||||||
|
rabbitSender.sendByTip(tempData); |
||||||
|
return ResponseResult.JOIN_QUEUE.toMessResult(); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage()); |
||||||
|
return ResponseResult.PARAMETER_IS_NULL.toMessResult(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 预约挂号成功通知(就诊人、就诊科室、预约时间、就诊地点) |
||||||
|
* |
||||||
|
* @param paramsMap |
||||||
|
* @param templateId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private MessageSendResult reg_success_04__001(Map<String, String> paramsMap, String templateId, String title) { |
||||||
|
try { |
||||||
|
Map<String, Object> tempData = createTemplate(paramsMap, templateId, title); |
||||||
|
// 就诊人
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "patientName", 28); |
||||||
|
// 就诊科室
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "deptName", 22); |
||||||
|
// 预约时间
|
||||||
|
MsgParamEnum.TIME.put(paramsMap, tempData, "time", 21); |
||||||
|
// 就诊地点
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "address", 6); |
||||||
|
|
||||||
|
rabbitSender.sendByTip(tempData); |
||||||
|
return ResponseResult.JOIN_QUEUE.toMessResult(); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage()); |
||||||
|
return ResponseResult.PARAMETER_IS_NULL.toMessResult(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 检验检查报告通知(就诊卡号、就诊人、单号、检查时间、项目) |
||||||
|
* |
||||||
|
* @param paramsMap |
||||||
|
* @param templateId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private MessageSendResult report_notice_05__001(Map<String, String> paramsMap, String templateId, String title) { |
||||||
|
try { |
||||||
|
Map<String, Object> tempData = createTemplate(paramsMap, templateId, title); |
||||||
|
// 就诊卡号
|
||||||
|
MsgParamEnum.CHARACTER_STRING.put(paramsMap, tempData, "cardNo", 12); |
||||||
|
// 就诊人
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "patientName", 3); |
||||||
|
// 单号
|
||||||
|
MsgParamEnum.CHARACTER_STRING.put(paramsMap, tempData, "orderNo", 9); |
||||||
|
// 检查时间
|
||||||
|
MsgParamEnum.TIME.put(paramsMap, tempData, "time", 14); |
||||||
|
// 项目名称
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "projectName", 5); |
||||||
|
|
||||||
|
rabbitSender.sendByTip(tempData); |
||||||
|
return ResponseResult.JOIN_QUEUE.toMessResult(); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage()); |
||||||
|
return ResponseResult.PARAMETER_IS_NULL.toMessResult(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 工单处理提醒(就诊卡号、就诊人、单号、检查时间、项目名称 ) |
||||||
|
* |
||||||
|
* @param paramsMap |
||||||
|
* @param templateId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private MessageSendResult work_order_remind_02__001(Map<String, String> paramsMap, String templateId, String title) { |
||||||
|
try { |
||||||
|
Map<String, Object> tempData = createTemplate(paramsMap, templateId, title); |
||||||
|
// 提交时间
|
||||||
|
MsgParamEnum.TIME.put(paramsMap, tempData, "time", 13); |
||||||
|
// 工单名称
|
||||||
|
MsgParamEnum.THING.put(paramsMap, tempData, "projectName", 16); |
||||||
|
|
||||||
|
rabbitSender.sendByTip(tempData); |
||||||
|
return ResponseResult.JOIN_QUEUE.toMessResult(); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage()); |
||||||
|
return ResponseResult.PARAMETER_IS_NULL.toMessResult(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) { |
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
map.put("a", 1); |
||||||
|
map.put("b", "2"); |
||||||
|
map.put("c", new HashMap<String, String>() {{ |
||||||
|
put("d", "1"); |
||||||
|
}}); |
||||||
|
|
||||||
|
log.info(JSONObject.toJSONString(map)); |
||||||
|
Map<String, String> map2 = new HashMap<>(); |
||||||
|
for (Map.Entry<String, Object> item : map.entrySet()) { |
||||||
|
String key = item.getKey(); |
||||||
|
Object value = item.getValue(); |
||||||
|
if (value == null) { |
||||||
|
map2.put(item.getKey(), null); |
||||||
|
break; |
||||||
|
} |
||||||
|
if (value instanceof Map) { |
||||||
|
map2.put(key, JSONObject.toJSONString(value)); |
||||||
|
} else { |
||||||
|
map2.put(key, String.valueOf(value)); |
||||||
|
} |
||||||
|
} |
||||||
|
log.info(JSONObject.toJSONString(map2)); |
||||||
|
|
||||||
|
map = new HashMap<>(); |
||||||
|
for (Map.Entry<String, String> item : map2.entrySet()) { |
||||||
|
String key = item.getKey(); |
||||||
|
String value = item.getValue(); |
||||||
|
if (value == null) { |
||||||
|
map.put(item.getKey(), null); |
||||||
|
break; |
||||||
|
} |
||||||
|
map.put(key, JSONObject.parse(value)); |
||||||
|
} |
||||||
|
log.info(JSONObject.toJSONString(map)); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue