diff --git a/xinelu-admin/pom.xml b/xinelu-admin/pom.xml
index e5f351f..c2752b0 100644
--- a/xinelu-admin/pom.xml
+++ b/xinelu-admin/pom.xml
@@ -86,6 +86,14 @@
xinelu-familydoctor
+
+
+ com.tzwy
+ hmac
+ 1.0
+ system
+ ${basedir}/src/main/resources/lib/hmac-1.0.jar
+
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
index a7a287a..3d9148d 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
@@ -1,21 +1,33 @@
package com.xinelu.web.controller.applet;
import com.alibaba.fastjson2.JSONObject;
+import com.github.pagehelper.PageInfo;
+import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
+import com.xinelu.applet.dto.chatrecord.MessageSearchDto;
+import com.xinelu.applet.service.chatRecord.IChatRecordService;
import com.xinelu.applet.service.messagepush.MessagePushService;
+import com.xinelu.applet.vo.chatrecord.MessageVo;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
+import com.xinelu.common.exception.ServiceException;
import com.xinelu.familydoctor.applet.pojo.body.MessagePushBody;
import com.xinelu.familydoctor.applet.pojo.dto.FDMessageDto;
import com.xinelu.familydoctor.applet.pojo.vo.SignInfoDataVo;
import com.xinelu.framework.config.AsyncExecutorConfig;
+import com.xinelu.manage.domain.chatRecord.ChatRecord;
+import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo;
+import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
+import java.util.Date;
/**
* @Author mengkuiliang
@@ -32,6 +44,10 @@ public class FdMessageController extends BaseController {
private MessagePushService messagePushService;
@Resource
private AsyncExecutorConfig asyncExecutorConfig;
+ @Resource
+ private IChatRecordService chatRecordService;
+ @Resource
+ private IHospitalPersonInfoService hospitalPersonInfoService;
@ApiOperation(value = "家医推送订阅消息", notes = "向接收方推送订阅消息")
@PostMapping("/push")
@@ -77,4 +93,59 @@ public class FdMessageController extends BaseController {
System.out.println("执行成功");
return R.ok();
}
+
+
+ @ApiOperation("查询通知推送列表-家医PC端")
+ @PostMapping("/getNoticList")
+ public R> getNoticList(@RequestBody MessageSearchDto messageDto) {
+ if (StringUtils.isBlank(messageDto.getSenderNo())) {
+ return R.fail("发送人编号不能为空");
+ }
+ return R.ok(chatRecordService.getNoticList(messageDto));
+ }
+
+ @ApiOperation("查询通知详情-PC端")
+ @GetMapping("/getNoticDetail/{messageNo}")
+ public R getNoticDetail(@PathVariable String messageNo) {
+ return R.ok(chatRecordService.getNoticDetail(messageNo));
+ }
+
+ @ApiOperation(value = "保存通知-PC端", notes = "健康推送和通知公告消息通知")
+ @PostMapping("/noticeSave")
+ @Transactional
+ public R> noticeSave(@RequestBody ChatRecordDTO message) {
+ // 根据发送人编号查询家医用户信息
+ HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(message.getSenderNo(), null);
+ if(hospitalPersonInfo == null) {
+ throw new ServiceException("未查询到医生信息");
+ }
+ if(StringUtils.isBlank(message.getMessageNo())) {
+ message.setSendTime(new Date());
+ message.setSenderId(hospitalPersonInfo.getId());
+ message.setSenderName(hospitalPersonInfo.getPersonName());
+ chatRecordService.insertChatRecord(message);
+ } else {
+ MessageVo messageVo = chatRecordService.getNoticDetail(message.getMessageNo());
+ if(messageVo != null) {
+ ChatRecord entity = new ChatRecord();
+ BeanUtils.copyProperties(messageVo, entity);
+ entity.setMessageType(message.getMessageType());
+ entity.setContent(message.getContent());
+ entity.setCrowds(message.getCrowds());
+ entity.setCrowdsName(message.getCrowdsName());
+ entity.setTitle(message.getTitle());
+ entity.setUpdateTime(new Date());
+ entity.setUpdateBy(message.getSenderNo());
+ chatRecordService.updateChatRecordOfNo(entity);
+ }
+ }
+ return R.ok();
+ }
+
+ @ApiOperation("删除通知-家医PC端")
+ @GetMapping("/noticDel/{messageNo}")
+ public R noticDel(@PathVariable String messageNo) {
+ chatRecordService.del(messageNo);
+ return R.ok();
+ }
}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/DzsCodeController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/DzsCodeController.java
new file mode 100644
index 0000000..c131fe3
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/DzsCodeController.java
@@ -0,0 +1,352 @@
+package com.xinelu.web.controller.fd;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.R;
+import com.xinelu.common.exception.ServiceException;
+import com.xinelu.common.utils.DateUtils;
+import com.xinelu.common.utils.http.HttpService;
+import com.xinelu.common.utils.http.SslUtils;
+import com.xinelu.familydoctor.applet.pojo.body.DzsCodeBody;
+import com.xinelu.familydoctor.applet.pojo.query.DzsCodeQuery;
+import com.xinelu.web.controller.fd.utils.DzsCodeSign;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Api(tags = "德州市居民码控制器(爱山东APP)")
+@Slf4j
+@RestController
+@RequestMapping("/applet/fd/dzs/code")
+public class DzsCodeController extends BaseController {
+
+ @Resource
+ private HttpService httpService;
+ @Value("${dzsCode.appid}")
+ private String appid;
+ @Value("${dzsCode.appSecret}")
+ private String appSecret;
+ @Value("${dzsCode.url}")
+ private String url;
+ @Value("${dzsCode.mutualUrl}")
+ private String mutualUrl;
+ @Value("${dzsCode.isSecret}")
+ private String isSecret;
+ @Value("${dzsCode.isWhole}")
+ private String isWhole;
+ @Value("${dzsCode.institutionCode}")
+ private String institutionCode;
+ @Value("${dzsCode.useCityCode}")
+ private String useCityCode;
+ @Value("${dzsCode.businessStepCode}")
+ private String businessStepCode;
+
+ @ApiOperation(value = "居民码注册接口")
+ @GetMapping("/register")
+ public R> register(DzsCodeBody body) {
+ try {
+ JSONObject bodyParams = registerBody(body);
+ String message = "";
+ // 0:明文 1:加密
+ if (isSecret.equals("1")) {
+ message = DzsCodeSign.makeSign(appSecret, bodyParams.toJSONString());
+ } else {
+ message = bodyParams.toJSONString();
+ }
+ Map headerMap = headerParams(message);
+ // 0:明文 1:加密
+ JSONObject requestBody = new JSONObject();
+ requestBody.put("message", message);
+ SslUtils.ignoreSsl();
+ JSONObject resultObj = httpService.post(url + "/register", headerMap, requestBody);
+ log.info("居民码注册接口响应:{}", resultObj);
+ if (!resultObj.containsKey("code") || !resultObj.getString("code").equals("200")) {
+ if (resultObj.containsKey("msg") && !StringUtils.isBlank(resultObj.getString("msg"))) {
+ return R.fail(resultObj.getString("msg"));
+ }
+ return R.fail("接口异常");
+ }
+ if (resultObj.containsKey("data")) {
+ return R.ok(resultObj.get("data"));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ServiceException(e.getMessage());
+ }
+ return R.ok();
+ }
+
+ @ApiOperation(value = "居民码查询接口")
+ @GetMapping("/analysis")
+ public R> query(DzsCodeQuery queryBody) {
+ try {
+ JSONObject bodyParams;
+ switch (queryBody.getInterfaceName()) {
+ // 是否已注册
+ case "isReg":
+ bodyParams = isRegBody(queryBody.getCardType(), queryBody.getCardNo());
+ break;
+ // 根据UID获取码值
+ case "getCodeByUid":
+ bodyParams = getCodeByUidBody(queryBody.getUid());
+ break;
+ // 根据证件获取居民码
+ case "getCodeByCard":
+ bodyParams = getCodeByCardBody(queryBody.getCardType(), queryBody.getCardNo());
+ break;
+ // 解析二维码
+ case "parsingCode":
+ bodyParams = parsingCodeBody(queryBody.getQrCode());
+ break;
+ // 获取用户信息
+ case "getUserInfo":
+ bodyParams = getUserInfoBody(queryBody.getJmmCode());
+ break;
+ default:
+ return R.fail("参数无效");
+ }
+ String message = "";
+ // 0:明文 1:加密
+ if (isSecret.equals("1")) {
+ message = DzsCodeSign.makeSign(appSecret, bodyParams.toJSONString());
+ } else {
+ message = bodyParams.toJSONString();
+ }
+ Map headerMap = headerParams(message);
+ // 0:明文 1:加密
+ JSONObject requestBody = new JSONObject();
+ requestBody.put("message", message);
+ SslUtils.ignoreSsl();
+ JSONObject resultObj = httpService.post(url + "/" + queryBody.getInterfaceName(), headerMap, requestBody);
+ log.info("居民码{}接口响应:{}", queryBody.getInterfaceName(), resultObj);
+ if (!resultObj.containsKey("code") || !resultObj.getString("code").equals("200")) {
+ if (resultObj.containsKey("msg") && !StringUtils.isBlank(resultObj.getString("msg"))) {
+ return R.fail(resultObj.getString("msg"));
+ }
+ return R.fail("接口异常");
+ }
+ if (resultObj.containsKey("data")) {
+ return R.ok(resultObj.getJSONObject("data"));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ServiceException(e.getMessage());
+ }
+ return R.ok();
+ }
+
+ @ApiOperation(value = "多码互认接口")
+ @PostMapping("/mutualDiscern")
+ public R> mutualDiscern(@RequestBody DzsCodeBody body) {
+ // 请求参数示例:
+ // {
+ // "qrCode":"SDQR0000001A00010001371400011667058654613299203000169828216216982822221410ff8de0b234bdf8a92932e36173578789c4099bf3606c4c1e3e175a91a5ac754434bd767e4155ffdf095dc8a096714d4b86e535231efbb5383e9fd4cd13f2"
+ // }
+ if(body == null || StringUtils.isBlank(body.getQrCode())) {
+ return R.fail("请求参数无效");
+ }
+ try {
+ JSONObject bodyParams = mutualDiscernBody(body.getQrCode());
+ Map headerMap;
+ SslUtils.ignoreSsl();
+ String message = "";
+ JSONObject resultObj;
+ // 0:明文 1:加密
+ if (isSecret.equals("1")) {
+ message = DzsCodeSign.makeSign(appSecret, bodyParams.toJSONString());
+ headerMap = headerParams(message);
+ resultObj = httpService.post(mutualUrl + "/mutualDiscern", headerMap, message);
+ } else {
+ headerMap = headerParams(bodyParams.toJSONString());
+ resultObj = httpService.post(mutualUrl + "/mutualDiscern", headerMap, bodyParams);
+ }
+ log.info("居民码多码互认接口响应:{}", resultObj);
+ if (!resultObj.containsKey("code") || !resultObj.getString("code").equals("200")) {
+ if (resultObj.containsKey("msg") && !StringUtils.isBlank(resultObj.getString("msg"))) {
+ if (resultObj.containsKey("detail") && !StringUtils.isBlank(resultObj.getString("detail"))) {
+ return R.fail(resultObj.getString("msg") + "->" + resultObj.getString("detail"));
+ } else {
+ return R.fail(resultObj.getString("msg"));
+ }
+ }
+ return R.fail("接口异常");
+ }
+ if (resultObj.containsKey("data")) {
+ return R.ok(resultObj.getJSONObject("data"));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ServiceException(e.getMessage());
+ }
+ return R.ok();
+ }
+
+ /**
+ * 设置请求header参数 参数都是必填的
+ */
+ private Map headerParams(String message) {
+ Map headMap = new HashMap<>();
+ // 客户端生成的安全随机码
+ String nonceStr = DzsCodeSign.getRandomString(10);
+ // 当前时间(yyyyMMddHHmmss)
+ String time = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
+ // 根据appid、nonceStr、time和(message),经过HMAC算法计算的值
+ String str = appid + "&" + time + "&" + nonceStr;
+ if (isWhole.equals("1")) {
+ str += message;
+ }
+ System.out.println("签名字符串:" + str);
+
+ // 应用ID
+ headMap.put("appid", appid);
+ headMap.put("nonceStr", nonceStr);
+ headMap.put("time", time);
+ headMap.put("sign", DzsCodeSign.makeSign(appSecret, str));
+ headMap.put("isSecret", isSecret);
+ headMap.put("isWhole", isWhole);
+ return headMap;
+ }
+
+ /**
+ * 设置body参数 - 判断是否已注册居民码
+ */
+ private JSONObject isRegBody(String cardType, String cardNo) {
+ JSONObject jsonObject = new JSONObject();
+ // 证件类型 必
+ jsonObject.put("cardType", cardType);
+ // 证件编号 必
+ jsonObject.put("cardNo", cardNo);
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 用户注册
+ */
+ private JSONObject registerBody(DzsCodeBody body) {
+ JSONObject jsonObject = new JSONObject();
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 根据UID获取居民码
+ */
+ private JSONObject getCodeByUidBody(String uid) {
+ JSONObject jsonObject = new JSONObject();
+ // 居民码UID 必
+ jsonObject.put("uid", uid);
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 根据证件获取居民码
+ */
+ private JSONObject getCodeByCardBody(String cardType, String cardNo) {
+ JSONObject jsonObject = new JSONObject();
+ // 证件类型 必
+ jsonObject.put("cardType", cardType);
+ // 证件编号 必
+ jsonObject.put("cardNo", cardNo);
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 解析二维码
+ */
+ private JSONObject parsingCodeBody(String qrCode) {
+ JSONObject jsonObject = new JSONObject();
+ // 必
+ jsonObject.put("QrCode", qrCode);
+ // 机构编码 必
+ jsonObject.put("institutionCode", institutionCode);
+ // 终端类型(0人工、1自助)必
+ jsonObject.put("channelCode", "0");
+ // 业务环节 必
+ jsonObject.put("businessStepCode", businessStepCode);
+ // 用码时间 yyyy-MM-dd HH:mm:ss 必
+ jsonObject.put("useTime", DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
+ // 返回值类型(对接时添加,后台的 二维码解析返回值类型)必
+ jsonObject.put("returnValueType", "01");
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 获取用户信息
+ */
+ private JSONObject getUserInfoBody(String jmmCode) {
+ JSONObject jsonObject = new JSONObject();
+ // 省居民码授权码 必
+ jsonObject.put("jmmCode", jmmCode);
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 多码互认 二维码识读
+ */
+ private JSONObject mutualDiscernBody(String qrCode) {
+ JSONObject jsonObject = new JSONObject();
+ // 必
+ jsonObject.put("QrCode", qrCode);
+ // 城市编码 必
+ jsonObject.put("useCityCode", useCityCode);
+ // 机构编码 必
+ jsonObject.put("institutionCode", institutionCode);
+ // 终端类型(0人工、1自助)必
+ jsonObject.put("channelCode", "0");
+ // 业务环节(接口方提供) 必
+ jsonObject.put("businessStepCode", businessStepCode);
+ // 用卡时间 yyyy-MM-dd HH:mm:ss 必
+ jsonObject.put("useTime", DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
+ // 返回值类型(对接时添加,后台的 二维码解析返回值类型)必
+ jsonObject.put("returnValueType", "01");
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码 (市辖区:371401 德城区:371402 陵城区:371403 宁津县:371422 庆云县:371423 临邑县:371424 齐河县:371425 平原县:371426 夏津县:371427 武城县:371428 乐陵市:371481 禹城市:371482 天衢新区:371471)
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java
index 89003bf..535617d 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java
@@ -3,6 +3,10 @@ package com.xinelu.web.controller.fd;
import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
+import com.xinelu.applet.dto.chatrecord.MessageSearchDto;
+import com.xinelu.applet.service.chatRecord.IChatRecordService;
+import com.xinelu.applet.vo.chatrecord.MessageVo;
import com.xinelu.common.core.domain.R;
import com.xinelu.familydoctor.applet.pojo.body.ApprovalBody;
import com.xinelu.familydoctor.applet.pojo.body.SyncHospitalPersonInfoBody;
@@ -13,6 +17,7 @@ import com.xinelu.familydoctor.applet.pojo.vo.ResidentSignApplyVo;
import com.xinelu.familydoctor.applet.service.IResidentRescindApplyService;
import com.xinelu.familydoctor.applet.service.IResidentServiceAppletService;
import com.xinelu.familydoctor.applet.service.IResidentSignAppletService;
+import com.xinelu.manage.domain.chatRecord.ChatRecord;
import com.xinelu.manage.domain.hospitalinfo.HospitalInfo;
import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo;
import com.xinelu.manage.service.hospitalinfo.IHospitalInfoService;
@@ -23,6 +28,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -45,6 +53,7 @@ public class FDController {
@Resource
private IHospitalInfoService hospitalInfoService;
+
@ApiOperation("服务申请列表")
@PostMapping("/performanceBooking/list")
public R> performanceBookingList(@RequestBody ApplyQuery query) {
@@ -191,5 +200,4 @@ public class FDController {
}
return R.ok();
}
-
}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/utils/DzsCodeSign.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/utils/DzsCodeSign.java
new file mode 100644
index 0000000..2b07e79
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/utils/DzsCodeSign.java
@@ -0,0 +1,98 @@
+package com.xinelu.web.controller.fd.utils;
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.util.HexUtil;
+import com.tzwy.hmac.sm3.utils.Sm3HmacUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.UnsupportedEncodingException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+/**
+ * @Author mengkuiliang
+ * @Description 德州市居民码签名工具类
+ * @Date 2023-06-08 16:45
+ * @Param
+ * @return
+ **/
+@Slf4j
+@Component
+public class DzsCodeSign {
+
+ /**
+ * @return java.lang.String
+ * @Author mengkuiliang
+ * @Description 生成签名
+ * @Date 2023-06-08 16:40
+ * @Param [appId, appSecret, isWhole]
+ **/
+ public static String createSign(String appId, String appSecret, String isWhole, String message) {
+ SimpleDateFormat formater = new SimpleDateFormat("yyyyMMddHHmmss");
+ String str;
+ if(isWhole.equals("0")) {
+ str = appId + "&" + formater.format(new Date()) + "&" + getRandomString(10);
+ } else {
+ // message前边没有 &
+ str = appId + "&" + formater.format(new Date()) + "&" + getRandomString(10) + message;
+ }
+ System.out.println("签名字符串:" + str);
+ return makeSign(appSecret, str);
+ }
+
+ /**
+ * @return boolean
+ * @Author mengkuiliang
+ * @Description 验证签名
+ * @Date 2023-06-08 16:43
+ * @Param [str, appSecret, sign]
+ **/
+ public static boolean verifySign(String str, String appSecret, String sign) {
+ String signS = makeSign(appSecret, str);
+ return signS.equals(sign);
+ }
+
+ /**
+ * 生成指定长度的随机字符串
+ */
+ public static String getRandomString(int length) {
+ String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ Random random = new Random();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < length; i++) {
+ int number = random.nextInt(62);
+ sb.append(str.charAt(number));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 生成签名
+ */
+ public static String makeSign(String appSecret, String str) {
+ try {
+ byte[] sm3Sign = Sm3HmacUtils.calcMac(HexUtil.decodeHex(appSecret), str.getBytes("UTF-8"));
+ return Base64.encode(sm3Sign);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static void main(String[] args) throws UnsupportedEncodingException {
+
+ String appSecret = "74cb380c19b5448da4d7a1ef505089c4";
+ String appid = "lhw8570wl9zojyou6zv6";
+// String time = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
+ String time = "20230609165045";
+// String nonceStr = DzsCodeSign.getRandomString(10);
+ String nonceStr = "8EqtkddxC2";
+ String str = appid + "&" + time + "&" + nonceStr;
+ String signS = makeSign(appSecret, str);
+ System.out.println(signS);
+
+ // JAlMiqpak3hwtTa+OzlWPcTuE2sSwn+F/I0j5/Cu3Mg=
+ }
+}
diff --git a/xinelu-admin/src/main/resources/application.yml b/xinelu-admin/src/main/resources/application.yml
index 05c60c8..479d194 100644
--- a/xinelu-admin/src/main/resources/application.yml
+++ b/xinelu-admin/src/main/resources/application.yml
@@ -249,8 +249,8 @@ xss:
# 家医配置
fd:
- dy: http://192.168.124.6:8001/fd/mp
- dz: http://192.168.124.6:8001/fd/mp
+ dz: http://8.131.93.145:54089/fd/mp
+ dy: http://8.131.93.145:54089/fd/mp
# 签约附近的机构多少公里内 <=0时不限制
distance: 0
@@ -316,3 +316,22 @@ logistics-config:
e-business-id: 1781371
api-key: 998b273d-c926-4659-a9d5-ae0613782d70
express-bird-url: https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx
+
+# 德州市鲁通码接口配置
+dzsCode:
+ appid: lhw8570wl9zojyou6zv6
+ appSecret: 74cb380c19b5448da4d7a1ef505089c4
+ # 接口服务
+ url: https://dsjj.dezhou.gov.cn/dzjmm/code
+ # 多码互认
+ mutualUrl: https://dsjj.dezhou.gov.cn/dzjmm/mutual
+ # 传输数据是否要加密(0:否1:是)
+ isSecret: 0
+ # 是否校验完整性(0:否1:是) 当为1时:sign的生成入参包括message
+ isWhole: 0
+ # 机构编码
+ institutionCode: 1137140000440159XP
+ # 城市编码 德州市
+ useCityCode: 371400
+ # 业务场景
+ businessStepCode: 302
diff --git a/xinelu-admin/src/main/resources/lib/hmac-1.0.jar b/xinelu-admin/src/main/resources/lib/hmac-1.0.jar
new file mode 100644
index 0000000..492272f
Binary files /dev/null and b/xinelu-admin/src/main/resources/lib/hmac-1.0.jar differ
diff --git a/xinelu-common/src/main/java/com/xinelu/common/core/dto/MessageTemplate.java b/xinelu-common/src/main/java/com/xinelu/common/core/dto/MessageTemplate.java
index f5a80de..2d2b08e 100644
--- a/xinelu-common/src/main/java/com/xinelu/common/core/dto/MessageTemplate.java
+++ b/xinelu-common/src/main/java/com/xinelu/common/core/dto/MessageTemplate.java
@@ -40,6 +40,11 @@ public class MessageTemplate {
*/
private String msgType;
+ /**
+ * 消息类型(文字/图片)
+ */
+ private String messageType;
+
/**
* 发送时间
* */
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/DzsCodeBody.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/DzsCodeBody.java
new file mode 100644
index 0000000..47cf84e
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/DzsCodeBody.java
@@ -0,0 +1,66 @@
+package com.xinelu.familydoctor.applet.pojo.body;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author mengkuiliang
+ * @Description 德州市居民码请求对象
+ * @Date 2023-06-09 9:45
+ * @Param
+ * @return
+ **/
+@Data
+@ApiModel("德州市居民码请求对象")
+public class DzsCodeBody {
+
+ @ApiModelProperty(value = "二维码信息")
+ private String qrCode;
+
+ @ApiModelProperty(value = "姓名", required = true)
+ private String name;
+
+ @ApiModelProperty(value = "证件类型", required = true)
+ private String cardType;
+
+ @ApiModelProperty(value = "证件号码", required = true)
+ private String cardNo;
+
+ @ApiModelProperty(value = "电话号码", required = true)
+ private String phone;
+
+ @ApiModelProperty(value = "民族 (01:汉族 02:蒙古族 03:回族 04:藏族 05:维吾尔族 06:苗族 07:彝族 08:壮族 09:布依族 10:朝鲜族 11:满族 12:侗族 13:瑶族 14:白族 15:土家族 16:哈尼族 17:哈萨克族 18:傣族 19:黎族 20:傈僳族 21:佤族 22:畲族 23:高山族 24:拉祜族 25:水族 26:东乡族 27:纳西族 28:景颇族 29:柯尔柯孜族 30:土族 31:达尔族 32:仫佬族 33:羌族 34:布朗族 35:撒拉族 36:毛南族 37:仡佬族 38:锡伯族 39:阿昌族 40:普米族 41:塔吉克族 42:怒族 43:乌孜别克族 44:俄罗斯族 45:鄂温克族 46:德昂族 47:保安族 48:裕固族 49:京族 50:塔塔尔族 51:独龙族 52:鄂伦春族 53:赫哲族 54:门巴族 55:珞巴族 56:基诺族 97:其他未识别的民族)", required = true)
+ private String nation;
+
+ @ApiModelProperty(value = "性别 (1:男 2:女 9:未说明性别 )", required = true)
+ private String sex;
+
+ @ApiModelProperty(value = "注册途径(11:APP 12:微信公众帐号 13:支付宝服务号 21:自助机 31:窗口 41:批量处理)", required = true)
+ private String regChannel;
+
+ @ApiModelProperty(value = "注册模式(1线上、2线下)", required = true)
+ private String regMode;
+
+ @ApiModelProperty(value = "个人审核材料上传地址(身份证时可空;非身份证时必填)")
+ private String path;
+
+ @ApiModelProperty(value = "绑卡类型(对接时添加,后台字典的 证件类型--可绑定证)")
+ private String bindCardType;
+
+ @ApiModelProperty(value = "绑卡卡号")
+ private String bindCardNo;
+
+ @ApiModelProperty(value = "出生年月(yyyyMM 证件类型是身份证时可空,非身份证时必填)")
+ private String birthday;
+
+ @ApiModelProperty(value = "地区编码")
+ private String addressAreaCode;
+
+ @ApiModelProperty(value = "用户uid(调用省居民码接口返回)", required = true)
+ private String uid;
+
+ @ApiModelProperty(value = "用户id(调用省居民码接口返回)", required = true)
+ private String qcUserId;
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java
index 6374006..9313ae6 100644
--- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/body/MessagePushBody.java
@@ -15,12 +15,24 @@ import lombok.Data;
@ApiModel(value = "消息推送请求对象")
public class MessagePushBody {
+ /**
+ * 消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知
+ */
+ @ApiModelProperty(value = "消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
+ private String messageCategory;
+
/**
* 业务类型(1: 默认 9:申请 10:用药提醒通知)
*/
@ApiModelProperty(value = "务类型(1: 家医默认通知 10:申请通知 9:用药提醒通知)")
private String busType;
+ /**
+ * 身份证号
+ */
+ @ApiModelProperty(value = "cardNo")
+ private String cardNo;
+
/**
* openid
*/
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java
index f9532ce..5919e50 100644
--- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/dto/FDMessageDto.java
@@ -1,6 +1,6 @@
package com.xinelu.familydoctor.applet.pojo.dto;
-import com.xinelu.familydoctor.applet.pojo.dto.FDMessageExtentDto;
+import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,7 +16,7 @@ import lombok.Data;
@Data
public class FDMessageDto extends FDMessageExtentDto {
- @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询")
+ @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
private String messageCategory;
@ApiModelProperty("通知适用人群(0:全部人群)")
@@ -60,4 +60,7 @@ public class FDMessageDto extends FDMessageExtentDto {
@ApiModelProperty(value = "模版类型(MessageTemplateType枚举)", required = true)
private String templateType;
+
+ @ApiModelProperty("消息记录对象")
+ ChatRecordDTO chatRecord;
}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/query/DzsCodeQuery.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/query/DzsCodeQuery.java
new file mode 100644
index 0000000..57f35e9
--- /dev/null
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/pojo/query/DzsCodeQuery.java
@@ -0,0 +1,36 @@
+package com.xinelu.familydoctor.applet.pojo.query;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @Author mengkuiliang
+ * @Description 德州市居民码查询对象
+ * @Date 2023-06-09 9:45
+ * @Param
+ * @return
+ **/
+@Data
+@ApiModel("德州市居民码查询对象")
+public class DzsCodeQuery {
+
+ @ApiModelProperty(value = "接口名称(判断是否已注册居民码:isReg; 居民码用户注册:register; 根据UID获取居民码:getCodeByUid; 解析居民码二维码:parsingCode; 根据证件获取居民码:getCodeByCard; 获取用户信息:getUserInfo;)", required = true)
+ String interfaceName;
+
+ @ApiModelProperty("省居民码授权码")
+ String jmmCode;
+
+ @ApiModelProperty("用户标识")
+ String uid;
+
+ @ApiModelProperty("证件类型(01:居民身份证; 03: 外国护照; 06: 港澳居民来往内地通行证; 07: 台湾居民来往内地通行证;)")
+ String cardType;
+
+ @ApiModelProperty("证件号")
+ String cardNo;
+
+ @ApiModelProperty("二维码")
+ String qrCode;
+
+}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java
index 9ec3cfa..c71e69f 100644
--- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentRescindApplyServiceImpl.java
@@ -81,13 +81,16 @@ public class ResidentRescindApplyServiceImpl implements IResidentRescindApplySer
residentRescindApplyMapper.insert(entity);
MessagePushBody messagePushBody = new MessagePushBody();
+ messagePushBody.setMessageCategory("4");
messagePushBody.setBusType("10");
messagePushBody.setOpenid(patientInfo.getOpenid());
messagePushBody.setReceiveName(patientInfo.getPatientName());
messagePushBody.setText1(body.getOrgName());
messagePushBody.setText2("解约申请");
+ messagePushBody.setSendTitle("解约申请");
messagePushBody.setSendTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date()));
messagePushBody.setSendContent(patientInfo.getPatientName() + "已提交申请");
+ messagePushBody.setCardNo(body.getIdentity());
messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(messagePushBody)));
}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java
index 47da88e..5ddcdb6 100644
--- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentServiceApplyServiceImpl.java
@@ -96,13 +96,17 @@ public class ResidentServiceApplyServiceImpl implements IResidentServiceAppletSe
residentServiceApplyMapper.insert(entity);
MessagePushBody messagePushBody = new MessagePushBody();
+ messagePushBody.setMessageCategory("4");
messagePushBody.setBusType("10");
messagePushBody.setOpenid(patientInfo.getOpenid());
messagePushBody.setReceiveName(patientInfo.getPatientName());
messagePushBody.setText1(body.getOrgName());
messagePushBody.setText2(body.getFormName().length() >= 20? body.getFormName().substring(0,17) + "...": body.getFormName());
+ messagePushBody.setText3(body.getFormName());
+ messagePushBody.setSendTitle("服务预约");
messagePushBody.setSendTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date()));
messagePushBody.setSendContent(patientInfo.getPatientName() + "已提交服务申请");
+ messagePushBody.setCardNo(body.getIdentity());
messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(messagePushBody)));
}
diff --git a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java
index 11150a3..b230a87 100644
--- a/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java
+++ b/xinelu-familydoctor/src/main/java/com/xinelu/familydoctor/applet/service/impl/ResidentSignApplyServiceImpl.java
@@ -98,13 +98,16 @@ public class ResidentSignApplyServiceImpl implements IResidentSignAppletService
residentSignApplyMapper.insert(entity);
MessagePushBody messagePushBody = new MessagePushBody();
+ messagePushBody.setMessageCategory("4");
messagePushBody.setBusType("10");
messagePushBody.setOpenid(patientInfo.getOpenid());
messagePushBody.setReceiveName(body.getResidentName());
messagePushBody.setText1(body.getOrgName());
messagePushBody.setText2("签约申请");
+ messagePushBody.setSendTitle("签约申请");
messagePushBody.setSendTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date()));
messagePushBody.setSendContent(body.getResidentName() + "已提交申请");
+ messagePushBody.setCardNo(body.getIdentity());
messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(messagePushBody)));
}
diff --git a/xinelu-framework/src/main/java/com/xinelu/framework/config/SecurityConfig.java b/xinelu-framework/src/main/java/com/xinelu/framework/config/SecurityConfig.java
index 23f6341..77ba019 100644
--- a/xinelu-framework/src/main/java/com/xinelu/framework/config/SecurityConfig.java
+++ b/xinelu-framework/src/main/java/com/xinelu/framework/config/SecurityConfig.java
@@ -112,7 +112,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
- .antMatchers("/login", "/register", "/captchaImage","/newapp/login/appLogin").anonymous()
+ .antMatchers("/login", "/register", "/captchaImage","/newapp/login/appLogin","/system/hospitalPerson/*").anonymous()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java
index c6ddbea..81c117c 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/controller/chatrecord/ChatRecordController.java
@@ -4,20 +4,25 @@ import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
import com.xinelu.applet.dto.chatrecord.MessageSearchDto;
import com.xinelu.applet.service.chatRecord.IChatRecordService;
import com.xinelu.applet.vo.chatrecord.MessageCenterVo;
+import com.xinelu.applet.vo.chatrecord.MessageVo;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.R;
+import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
+import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.socket.WebSocketUtils;
import com.xinelu.manage.domain.chatRecord.ChatRecord;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@@ -33,6 +38,7 @@ import org.springframework.web.multipart.MultipartFile;
* @author wanghao
* @create 2023/9/26 0026
*/
+@Api(tags = "消息控制器")
@RestController
@RequestMapping("/nurseApplet/chatRecord")
public class ChatRecordController extends BaseController {
@@ -62,7 +68,8 @@ public class ChatRecordController extends BaseController {
@PostMapping("/sendMessage")
@Transactional
public AjaxResult sendMessage(@RequestBody ChatRecordDTO chatRecordDTO) {
- if (chatRecordService.insertChatRecord(chatRecordDTO) > 0) {
+ chatRecordDTO.setMessageCategory("3");
+ if (chatRecordService.insertChatRecord(chatRecordDTO) > 0) {
// 判断接收人是否在线
if (WebSocketUtils.clients.get(chatRecordDTO.getRecipientId().toString()) == null) {
return AjaxResult.success();
@@ -96,4 +103,26 @@ public class ChatRecordController extends BaseController {
}
return R.ok(chatRecordService.getMegVoList(messageDto));
}
+
+ @ApiOperation(value = "获取指定类型的消息记录", notes = "1:通知公告 2:健康推送 4:消息通知")
+ @GetMapping("/getMegList")
+ public TableDataInfo getMegList(MessageSearchDto messageDto) {
+ if (messageDto.getPatientId() == null) {
+ throw new ServiceException("居民业务主键不能为空");
+ }
+ if (StringUtils.isBlank(messageDto.getMessageCategory())) {
+ throw new ServiceException("消息类型不能为空");
+ }
+ startPage();
+ return getDataTable(chatRecordService.getMegList(messageDto));
+ }
+
+ @ApiOperation("删除消息")
+ @GetMapping("/deleteMegs")
+ public R deleteMegs(@RequestBody List ids) {
+ if (CollectionUtils.isEmpty(ids)) {
+ return R.fail("请选择要删除的消息!");
+ }
+ return chatRecordService.deleteMegs(ids) > 0 ? R.ok("删除成功") : R.fail("删除失败");
+ }
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java
index dd681ca..f39a037 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/ChatRecordDTO.java
@@ -2,6 +2,7 @@ package com.xinelu.applet.dto.chatrecord;
import com.xinelu.common.core.domain.BaseEntity;
import com.xinelu.common.custominterface.Insert;
+import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.sf.jsqlparser.statement.update.Update;
import org.hibernate.validator.constraints.Length;
@@ -21,6 +22,9 @@ public class ChatRecordDTO extends BaseEntity implements Serializable {
private static final long serialVersionUID = -3911806583514536587L;
+ @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
+ private String messageCategory;
+
/**
* 聊天记录业务主键(问诊表id)
*/
@@ -28,12 +32,23 @@ public class ChatRecordDTO extends BaseEntity implements Serializable {
@NotNull(message = "聊天记录业务主键不能为空", groups = {Insert.class})
private Long consultationId;
+ /**
+ * 消息业务主键
+ */
+ @NotNull(message = "消息业务主键", groups = {Insert.class})
+ private String messageNo;
+
/**
* 发送人
*/
@NotNull(message = "发送人信息不能为空", groups = {Insert.class})
private Long senderId;
+ /**
+ * 发送人(家医医生编号)
+ */
+ private String senderNo;
+
/**
* 发送人姓名
*/
@@ -62,7 +77,6 @@ public class ChatRecordDTO extends BaseEntity implements Serializable {
@NotNull(message = "消息类型不能为空", groups = {Insert.class})
private String messageType;
-
/**
* 消息内容,图片内容时内容为:图片路径
*/
@@ -70,5 +84,15 @@ public class ChatRecordDTO extends BaseEntity implements Serializable {
@Length(max = 400, message = "消息内容不能超过18位", groups = {Insert.class, Update.class})
private String content;
+ /**
+ * 标题
+ */
+ private String title;
+
+ @ApiModelProperty("通知适用人群(0:全部人群)")
+ private String crowds;
+
+ @ApiModelProperty("通知适用人群名称")
+ private String crowdsName;
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java
index a56809c..08a910e 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MarkReadDto.java
@@ -14,7 +14,7 @@ import lombok.Data;
@ApiModel("标记为已读传输对象")
public class MarkReadDto {
- @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询")
+ @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
private String messageCategory;
@ApiModelProperty("绑定编号")
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java
index f585b5b..c63a489 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/chatrecord/MessageSearchDto.java
@@ -14,18 +14,21 @@ import lombok.Data;
@Data
public class MessageSearchDto {
- @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询")
+ @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
private String messageCategory;
@ApiModelProperty("通知适用人群(0:全部人群)")
private String crowds;
@ApiModelProperty(value = "居民注册业务主键")
- private String bindingNo;
+ private Long patientId;
@ApiModelProperty("发送人编号")
private Long senderId;
+ @ApiModelProperty("发送人编号(家医医生编号)")
+ private String senderNo;
+
@ApiModelProperty("接收人编号")
private Long recipientId;
@@ -47,6 +50,17 @@ public class MessageSearchDto {
@ApiModelProperty(value = "居民绑定时间", hidden = true)
private Date bindingTime;
+ /**
+ * 页码
+ */
+ @ApiModelProperty(value = "页码")
+ private Integer pageNum = 1;
+ /**
+ * 每页大小
+ */
+ @ApiModelProperty(value = "每页大小")
+ private Integer pageSize = 15;
+
@ApiModelProperty(value = "通知适用人群编号集合", hidden = true)
private List crowdNoList;
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java
index c8f6f6f..8885af9 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/dto/messagepush/FDMessagePushDto.java
@@ -18,7 +18,7 @@ public class FDMessagePushDto extends FDMessageExtentDto{
@ApiModelProperty("业务主键")
private String messageNo;
- @ApiModelProperty(value = "消息类别 1:通知公告,2:健康推送,3:在线咨询", required = true)
+ @ApiModelProperty(value = "消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知", required = true)
private String messageCategory;
@ApiModelProperty("通知适用人群(0:全部人群)")
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java
index ecee67c..68551d2 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/chatrecord/ChatRecordMapper.java
@@ -18,6 +18,15 @@ public interface ChatRecordMapper {
List selectMegVoList(MessageSearchDto messageDto);
+ /**
+ * @Author mengkuiliang
+ * @Description
+ * @Date 2023-10-25 025 15:25
+ * @Param [bindingNo, doctorNo]
+ * @return com.xinelu.applet.vo.chatrecord.MessageCenterVo
+ **/
+ List selectMegList(MessageSearchDto messageDto);
+
MessageCenterVo selectOneChatRecord(@Param("bindingNo")Long bindingNo, @Param("doctorNo")Long doctorNo);
/**
* 查询图文咨询-聊天记录
@@ -25,7 +34,7 @@ public interface ChatRecordMapper {
* @param id 图文咨询-聊天记录主键
* @return 图文咨询-聊天记录
*/
- public ChatRecord selectChatRecordById(Long id);
+ ChatRecord selectChatRecordById(Long id);
/**
* 查询图文咨询-聊天记录列表
@@ -33,7 +42,7 @@ public interface ChatRecordMapper {
* @param chatRecord 图文咨询-聊天记录
* @return 图文咨询-聊天记录集合
*/
- public List selectChatRecordList(ChatRecord chatRecord);
+ List selectChatRecordList(ChatRecord chatRecord);
/**
* 新增图文咨询-聊天记录
@@ -41,7 +50,7 @@ public interface ChatRecordMapper {
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
- public int insertChatRecord(ChatRecord chatRecord);
+ int insertChatRecord(ChatRecord chatRecord);
/**
* 修改图文咨询-聊天记录
@@ -49,7 +58,7 @@ public interface ChatRecordMapper {
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
- public int updateChatRecord(ChatRecord chatRecord);
+ int updateChatRecord(ChatRecord chatRecord);
/**
* 删除图文咨询-聊天记录
@@ -57,7 +66,7 @@ public interface ChatRecordMapper {
* @param id 图文咨询-聊天记录主键
* @return 结果
*/
- public int deleteChatRecordById(Long id);
+ int deleteChatRecordById(Long id);
/**
* 批量删除图文咨询-聊天记录
@@ -65,7 +74,46 @@ public interface ChatRecordMapper {
* @param ids 需要删除的数据主键集合
* @return 结果
*/
- public int deleteChatRecordByIds(Long[] ids);
+ int deleteChatRecordByIds(Long[] ids);
Integer updateReadStatus(MarkReadDto markReadDto);
+
+ int deleteMegs(@Param("ids") List ids);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 查询健康知识推送列表
+ * @Date 2023-10-25 025 11:27
+ * @Param [messageDto]
+ * @return java.lang.Object
+ **/
+ List getNoticList(MessageSearchDto messageDto);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 查询消息详情
+ * @Date 2023-10-25 025 11:45
+ * @Param [messageNo]
+ * @return com.xinelu.applet.vo.chatrecord.MessageVo
+ **/
+ MessageVo getByNo(String messageNo);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 删除通知
+ * @Date 2023-10-25 025 13:15
+ * @Param [messageNo]
+ * @return void
+ **/
+ void del(String messageNo);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 更新通知
+ * @Date 2023-10-25 025 14:05
+ * @Param [entity]
+ * @return void
+ **/
+ void updateChatRecordOfNo(ChatRecord entity);
+
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/newapp/NewAppLoginMapper.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/newapp/NewAppLoginMapper.java
index 9a2319c..7495127 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/newapp/NewAppLoginMapper.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/mapper/newapp/NewAppLoginMapper.java
@@ -1,5 +1,6 @@
package com.xinelu.applet.mapper.newapp;
+import com.xinelu.applet.vo.newapp.LoginStatusVo;
import org.apache.ibatis.annotations.Param;
public interface NewAppLoginMapper {
@@ -10,5 +11,5 @@ public interface NewAppLoginMapper {
* @param personPassword
* @return
*/
- int login(@Param("personAccount") String personAccount, @Param("personPassword") String personPassword);
+ LoginStatusVo login(@Param("personAccount") String personAccount, @Param("personPassword") String personPassword);
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java
index 4d2d1c0..77fbc76 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/IChatRecordService.java
@@ -1,8 +1,10 @@
package com.xinelu.applet.service.chatRecord;
+import com.github.pagehelper.PageInfo;
import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
import com.xinelu.applet.dto.chatrecord.MessageSearchDto;
import com.xinelu.applet.vo.chatrecord.MessageCenterVo;
+import com.xinelu.applet.vo.chatrecord.MessageVo;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.file.InvalidExtensionException;
import com.xinelu.manage.domain.chatRecord.ChatRecord;
@@ -24,7 +26,7 @@ public interface IChatRecordService {
* @param id 图文咨询-聊天记录主键
* @return 图文咨询-聊天记录
*/
- public ChatRecord selectChatRecordById(Long id);
+ ChatRecord selectChatRecordById(Long id);
/**
* 查询图文咨询-聊天记录列表
@@ -32,7 +34,7 @@ public interface IChatRecordService {
* @param chatRecord 图文咨询-聊天记录
* @return 图文咨询-聊天记录集合
*/
- public List selectChatRecordList(ChatRecord chatRecord);
+ List selectChatRecordList(ChatRecord chatRecord);
/**
* 新增图文咨询-聊天记录
@@ -40,7 +42,7 @@ public interface IChatRecordService {
* @param chatRecordDTO 图文咨询-聊天记录
* @return 结果
*/
- public int insertChatRecord(ChatRecordDTO chatRecordDTO);
+ int insertChatRecord(ChatRecordDTO chatRecordDTO);
Boolean sendMessage(ChatRecordDTO chatRecordDTO);
@@ -50,7 +52,7 @@ public interface IChatRecordService {
* @param chatRecord 图文咨询-聊天记录
* @return 结果
*/
- public int updateChatRecord(ChatRecord chatRecord);
+ int updateChatRecord(ChatRecord chatRecord);
/**
* 批量删除图文咨询-聊天记录
@@ -58,7 +60,7 @@ public interface IChatRecordService {
* @param ids 需要删除的图文咨询-聊天记录主键集合
* @return 结果
*/
- public int deleteChatRecordByIds(Long[] ids);
+ int deleteChatRecordByIds(Long[] ids);
/**
* 删除图文咨询-聊天记录信息
@@ -66,7 +68,7 @@ public interface IChatRecordService {
* @param id 图文咨询-聊天记录主键
* @return 结果
*/
- public int deleteChatRecordById(Long id);
+ int deleteChatRecordById(Long id);
/**
@@ -75,7 +77,56 @@ public interface IChatRecordService {
* @param multipartFile,consultationId 文件,问诊id
* @return 结果
*/
- public AjaxResult uploadChatRecordFile(MultipartFile multipartFile, Long consultationId) throws IOException, InvalidExtensionException;
+ AjaxResult uploadChatRecordFile(MultipartFile multipartFile, Long consultationId) throws IOException, InvalidExtensionException;
List getMegVoList(MessageSearchDto messageDto);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 获取指定类型的消息记录
+ * @Date 2023-10-25 025 15:22
+ * @Param [messageDto]
+ * @return java.util.List
+ **/
+ List getMegList(MessageSearchDto messageDto);
+
+
+ Integer deleteMegs(List ids);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 查询健康知识推送列表
+ * @Date 2023-10-25 025 11:24
+ * @Param [messageDto]
+ * @return com.github.pagehelper.PageInfo
+ **/
+ PageInfo getNoticList(MessageSearchDto messageDto);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 查询健康知识推送详情
+ * @Date 2023-02-18 14:58
+ * @Param [messageNo]
+ * @return java.lang.Object
+ **/
+ MessageVo getNoticDetail(String messageNo);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 删除通知
+ * @Date 2023-10-25 025 13:15
+ * @Param [messageNo]
+ * @return void
+ **/
+ void del(String messageNo);
+
+ /**
+ * @Author mengkuiliang
+ * @Description 更新通知
+ * @Date 2023-10-25 025 14:04
+ * @Param [entity]
+ * @return void
+ **/
+ void updateChatRecordOfNo(ChatRecord entity);
+
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java
index 489826a..83363db 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/chatRecord/impl/ChatRecordServiceImpl.java
@@ -1,5 +1,8 @@
package com.xinelu.applet.service.chatRecord.impl;
+import com.alibaba.fastjson2.JSONObject;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
import com.xinelu.applet.dto.chatrecord.MessageSearchDto;
import com.xinelu.applet.mapper.chatrecord.ChatRecordMapper;
@@ -8,6 +11,7 @@ import com.xinelu.applet.vo.chatrecord.MessageCenterVo;
import com.xinelu.applet.vo.chatrecord.MessageVo;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.core.domain.AjaxResult;
+import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.dto.MessageTemplate;
import com.xinelu.common.enums.MessageContentType;
import com.xinelu.common.exception.ServiceException;
@@ -17,14 +21,20 @@ import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.file.FileUploadUtils;
import com.xinelu.common.utils.file.MimeTypeUtils;
+import com.xinelu.common.utils.http.HttpService;
+import com.xinelu.common.utils.spring.SpringUtils;
+import com.xinelu.common.utils.uuid.IdUtils;
import com.xinelu.manage.domain.chatRecord.ChatRecord;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.time.ZoneId;
+import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
+
+import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo;
+import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
+import com.xinelu.manage.service.patientinfo.IPatientInfoService;
+import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -42,6 +52,12 @@ public class ChatRecordServiceImpl implements IChatRecordService {
private ChatRecordMapper chatRecordMapper;
@Resource
private XinELuConfig xinYiLuConfig;
+ @Resource
+ private IHospitalPersonInfoService hospitalPersonInfoService;
+ @Resource
+ private IPatientInfoService patientInfoService;
+ @Resource
+ private HttpService httpService;
/**
* 查询图文咨询-聊天记录
@@ -76,6 +92,10 @@ public class ChatRecordServiceImpl implements IChatRecordService {
chatRecord.setCreateTime(DateUtils.getNowDate());
ChatRecord record = new ChatRecord();
BeanUtils.copyBeanProp(record, chatRecord);
+ record.setMessageNo(IdUtils.fastSimpleUUID());
+ record.setReadStatus("0");
+ record.setSendTime(new Date());
+ record.setDelFlag(0);
return chatRecordMapper.insertChatRecord(record);
}
@@ -87,6 +107,7 @@ public class ChatRecordServiceImpl implements IChatRecordService {
msg.setFromKey(chatRecord.getSenderId().toString());
msg.setToKey(chatRecord.getRecipientId().toString());
msg.setMsgType(MessageContentType.CHAT.name());
+ msg.setMessageType(chatRecord.getMessageType());
msg.setSendTime(chatRecord.getSendTime());
return WebSocketUtils.sendMessage(chatRecord.getRecipientId().toString(), msg);
}
@@ -209,4 +230,111 @@ public class ChatRecordServiceImpl implements IChatRecordService {
return messageCenterVos;
}
+
+ /**
+ * @Author mengkuiliang
+ * @Description 获取指定类型的消息记录
+ * @Date 2023-10-25 025 15:21
+ * @Param [messageDto]
+ * @return java.util.List
+ **/
+ @Override
+ public List getMegList(MessageSearchDto messageDto) {
+ // 获取注册信息
+ PatientInfoVO patientInfo = patientInfoService.selectPatientInfoById(messageDto.getPatientId());
+ if (patientInfo == null) {
+ throw new ServiceException("未查询到注册信息");
+ }
+ String bindTimeStr = String.valueOf(patientInfo.getBindingTime().getYear()) + String.valueOf(patientInfo.getBindingTime().getMonthValue()) + String.valueOf(patientInfo.getBindingTime().getDayOfMonth()) + String.valueOf(patientInfo.getBindingTime().getHour()) + String.valueOf(patientInfo.getBindingTime().getMinute()) + String.valueOf(patientInfo.getBindingTime().getSecond());
+ messageDto.setBindingTime(DateUtils.parseDate(bindTimeStr));
+
+ // 通知公告
+ if(messageDto.getMessageCategory().equals("1")) {
+ return chatRecordMapper.selectMegList(messageDto);
+ // 健康推送
+ } else if(messageDto.getMessageCategory().equals("2")) {
+ String result = (String) httpService.get(SpringUtils.getFdUrl(patientInfo.getCityCode()) + "/resident/signinfo/detail/" + patientInfo.getCardNo(), null, String.class);
+ JSONObject jsonObject = JSONObject.parseObject(result);
+ if (!"1".equals(jsonObject.get("code"))) {
+ throw new ServiceException(jsonObject.get("msg").toString());
+ }
+ if (!jsonObject.containsKey("data") || jsonObject.get("data") == null) {
+ throw new ServiceException("未查询到签约信息");
+ }
+ JSONObject signInfoObject = jsonObject.getJSONObject("data");
+ HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(signInfoObject.getString("userNo"), null);
+ if (hospitalPersonInfo == null) {
+ throw new ServiceException("未查询到医生信息");
+ }
+ messageDto.setSenderId(hospitalPersonInfo.getId());
+ messageDto.setCrowdNoList(Arrays.asList(signInfoObject.getString("crowdsNo").split(",")));
+ return chatRecordMapper.selectMegList(messageDto);
+ // 消息通知
+ } else if(messageDto.getMessageCategory().equals("4")) {
+ messageDto.setRecipientId(patientInfo.getId());
+ return chatRecordMapper.selectMegList(messageDto);
+ } else {
+ return new ArrayList<>();
+ }
+ }
+
+ @Override public Integer deleteMegs(List ids) {
+ return chatRecordMapper.deleteMegs(ids);
+ }
+
+ /**
+ * @Author mengkuiliang
+ * @Description 查询健康知识推送列表
+ * @Date 2023-10-25 025 11:24
+ * @Param [messageDto]
+ * @return com.github.pagehelper.PageInfo
+ **/
+ @Override
+ public PageInfo getNoticList(MessageSearchDto messageDto) {
+ // 根据发送人编号查询家医用户信息
+ HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(messageDto.getSenderNo(), null);
+ if(hospitalPersonInfo == null) {
+ throw new ServiceException("未查询到医生信息");
+ }
+ messageDto.setSenderId(hospitalPersonInfo.getId());
+ PageHelper.startPage(messageDto.getPageNum(), messageDto.getPageSize());
+ return PageInfo.of(chatRecordMapper.getNoticList(messageDto));
+ }
+
+ /**
+ * @return com.xinelu.mp.message.pojo.vo.MessageVo
+ * @Author mengkuiliang
+ * @Description 查询消息详情
+ * @Date 2023-02-18 14:58
+ * @Param [messageNo]
+ **/
+ @Override
+ public MessageVo getNoticDetail(String messageNo) {
+ return chatRecordMapper.getByNo(messageNo);
+ }
+
+ /**
+ * @Author mengkuiliang
+ * @Description 删除通知
+ * @Date 2023-10-25 025 13:15
+ * @Param [messageNo]
+ * @return void
+ **/
+ @Override
+ public void del(String messageNo) {
+ chatRecordMapper.del(messageNo);
+ }
+
+ /**
+ * @Author mengkuiliang
+ * @Description 更新通知
+ * @Date 2023-10-25 025 14:05
+ * @Param [entity]
+ * @return void
+ **/
+ @Override
+ public void updateChatRecordOfNo(ChatRecord entity) {
+ chatRecordMapper.updateChatRecordOfNo(entity);
+ }
+
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/messagepush/Impl/MessagePushServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/messagepush/Impl/MessagePushServiceImpl.java
index bb6fd7d..f235319 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/messagepush/Impl/MessagePushServiceImpl.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/messagepush/Impl/MessagePushServiceImpl.java
@@ -2,9 +2,11 @@ package com.xinelu.applet.service.messagepush.Impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
+import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
import com.xinelu.applet.dto.messagepush.FDMessagePushDto;
import com.xinelu.applet.dto.messagepush.FDWxMegDto;
import com.xinelu.applet.dto.messagepush.TemplateData;
+import com.xinelu.applet.service.chatRecord.IChatRecordService;
import com.xinelu.applet.service.messagepush.MessagePushService;
import com.xinelu.common.config.AppletChatConfig;
import com.xinelu.common.config.AppletPageConfig;
@@ -15,6 +17,7 @@ import com.xinelu.common.enums.*;
import com.xinelu.common.utils.AppletChatUtil;
import com.xinelu.common.utils.http.HttpUtils;
import com.xinelu.common.utils.map.MapUtil;
+import com.xinelu.common.utils.uuid.IdUtils;
import com.xinelu.manage.domain.subscribemessagerecord.SubscribeMessageRecord;
import com.xinelu.manage.domain.systemsettingsinfo.SystemSettingsInfo;
import com.xinelu.manage.mapper.subscribemessagerecord.SubscribeMessageRecordMapper;
@@ -52,6 +55,8 @@ public class MessagePushServiceImpl implements MessagePushService {
private AppletPageConfig appletPageConfig;
@Resource
private IPatientInfoService patientInfoService;
+ @Resource
+ private IChatRecordService chatRecordService;
/**
* 微信消息推送url
@@ -232,50 +237,82 @@ public class MessagePushServiceImpl implements MessagePushService {
@Override
@Async("asyncThreadServiceExecutor")
public void fdApprovePush(JSONObject body) {
- AppletAccessToken appletAccessToken = AppletChatUtil.getAppletAccessToken(appletChatConfig.getAppletId(), appletChatConfig.getSecret());
- if (Objects.isNull(appletAccessToken)) {
- log.error("获取微信小程序accessToken信息失败!");
- }
- if (Objects.nonNull(appletAccessToken.getErrcode()) && appletAccessToken.getErrcode() != AppletSubscriptionMessageEnum.SUCCESS_ERRCODE.getValue()) {
- log.error("获取微信小程序accessToken信息失败,失败信息为:" + appletAccessToken.getErrmsg(), 201);
- }
- if (StringUtils.isBlank(appletAccessToken.getAccessToken())) {
- log.error("accessToken信息为空!");
- }
+ if (body.containsKey("cardNo") && !StringUtils.isBlank(body.getString("cardNo"))) {
+ PatientInfoVO patientInfo = patientInfoService.selectPatientInfoByCardNo(body.getString("cardNo"));
+ if (patientInfo == null) {
+ log.error("接收方未注册 {}", body.getString("cardNo"));
+ }
+ AppletAccessToken appletAccessToken = AppletChatUtil.getAppletAccessToken(appletChatConfig.getAppletId(), appletChatConfig.getSecret());
+ if (Objects.isNull(appletAccessToken)) {
+ log.error("获取微信小程序accessToken信息失败!");
+ }
+ if (Objects.nonNull(appletAccessToken.getErrcode()) && appletAccessToken.getErrcode() != AppletSubscriptionMessageEnum.SUCCESS_ERRCODE.getValue()) {
+ log.error("获取微信小程序accessToken信息失败,失败信息为:" + appletAccessToken.getErrmsg(), 201);
+ }
+ if (StringUtils.isBlank(appletAccessToken.getAccessToken())) {
+ log.error("accessToken信息为空!");
+ }
+ ChatRecordDTO chatRecord = new ChatRecordDTO();
+ // 查询居民注册信息
+ if(!body.containsKey("patientId") || body.getLong("patientId") == null) {
+ chatRecord.setRecipientId(patientInfo.getId());
+ } else {
+ chatRecord.setRecipientId(body.getLong("patientId"));
+ }
- //模板内容
- Map messageValueEntityMap = new LinkedHashMap<>();
- switch (body.getString("busType")) {
- // 申请
- case "10":
- messageValueEntityMap.put("name2", new MessageValueEntity(body.getString("receiveName")));
- messageValueEntityMap.put("thing6", new MessageValueEntity(body.getString("text1")));
- messageValueEntityMap.put("thing5", new MessageValueEntity(body.getString("text2")));
- messageValueEntityMap.put("thing8", new MessageValueEntity(body.getString("sendTime")));
- messageValueEntityMap.put("thing9", new MessageValueEntity(body.getString("sendContent")));
- break;
- // 用药
- case "9":
- messageValueEntityMap.put("thing1", new MessageValueEntity(body.getString("text1")));
- messageValueEntityMap.put("thing2", new MessageValueEntity(body.getString("text2")));
- messageValueEntityMap.put("time3", new MessageValueEntity(body.getString("sendTime")));
- messageValueEntityMap.put("thing4", new MessageValueEntity(body.getString("sendContent")));
- break;
- // 默认
- default:
- messageValueEntityMap.put("thing1", new MessageValueEntity(body.getString("senderName")));
- messageValueEntityMap.put("time2", new MessageValueEntity(body.getString("sendTime")));
- messageValueEntityMap.put("thing3", new MessageValueEntity(body.getString("sendContent")));
- break;
- }
+ //模板内容
+ Map messageValueEntityMap = new LinkedHashMap<>();
+ switch (body.getString("busType")) {
+ // 申请
+ case "10":
+ messageValueEntityMap.put("name2", new MessageValueEntity(body.getString("receiveName")));
+ messageValueEntityMap.put("thing6", new MessageValueEntity(body.getString("text1")));
+ messageValueEntityMap.put("thing5", new MessageValueEntity(body.getString("text2")));
+ messageValueEntityMap.put("thing8", new MessageValueEntity(body.getString("sendTime")));
+ messageValueEntityMap.put("thing9", new MessageValueEntity(body.getString("sendContent")));
+ chatRecord.setContent(body.getString("receiveName") + "在" + body.getString("text1") + "提交服务申请,服务内容:" + (body.containsKey("text3") && !StringUtils.isBlank(body.getString("text3"))? body.getString("text3"): body.getString("text2")));
+ chatRecord.setRecipientName(body.getString("receiveName"));
+ chatRecord.setSenderName(body.getString("text1"));
+ break;
+ // 用药
+ case "9":
+ messageValueEntityMap.put("thing1", new MessageValueEntity(body.getString("text1")));
+ messageValueEntityMap.put("thing2", new MessageValueEntity(body.getString("text2")));
+ messageValueEntityMap.put("time3", new MessageValueEntity(body.getString("sendTime")));
+ messageValueEntityMap.put("thing4", new MessageValueEntity(body.getString("sendContent")));
+ chatRecord.setContent(body.getString("sendContent"));
+ chatRecord.setRecipientName(body.getString("receiveName"));
+ chatRecord.setSenderName(body.getString("senderName"));
+ break;
+ // 默认
+ default:
+ messageValueEntityMap.put("thing1", new MessageValueEntity(body.getString("senderName")));
+ messageValueEntityMap.put("time2", new MessageValueEntity(body.getString("sendTime")));
+ messageValueEntityMap.put("thing3", new MessageValueEntity(body.getString("sendContent")));
+ chatRecord.setContent(body.getString("sendContent"));
+ chatRecord.setRecipientName(body.getString("receiveName"));
+ chatRecord.setSenderName(body.getString("senderName"));
+ break;
+ }
- Map paramsMap = new HashMap<>();
- paramsMap.put("touser", body.getString("openid"));
- paramsMap.put("template_id", MessageTemplateType.getFolllowupTypeByCode(body.getString("busType")).getTemplateId());
- paramsMap.put("page", appletPageConfig.getIntegralPageUrl());
- paramsMap.put("data", messageValueEntityMap);
- //发送
- this.sendPosts(appletAccessToken, paramsMap);
+ Map paramsMap = new HashMap<>();
+ paramsMap.put("touser", body.getString("openid"));
+ paramsMap.put("template_id", MessageTemplateType.getFolllowupTypeByCode(body.getString("busType")).getTemplateId());
+ paramsMap.put("page", appletPageConfig.getIntegralPageUrl());
+ paramsMap.put("data", messageValueEntityMap);
+ //发送
+ this.sendPosts(appletAccessToken, paramsMap);
+
+ // 记录通知消息
+ if(body.containsKey("messageCategory") && !StringUtils.isBlank(body.getString("messageCategory"))) {
+ chatRecord.setMessageType("1");
+ chatRecord.setTitle(body.getString("sendTitle"));
+ chatRecord.setMessageNo(IdUtils.fastSimpleUUID());
+ chatRecord.setSendTime(new Date());
+ chatRecord.setMessageCategory(body.getString("messageCategory"));
+ chatRecordService.insertChatRecord(chatRecord);
+ }
+ }
}
/**
@@ -305,8 +342,62 @@ public class MessagePushServiceImpl implements MessagePushService {
if (StringUtils.isBlank(appletAccessToken.getAccessToken())) {
log.error("accessToken信息为空!");
}
+ ChatRecordDTO chatRecord = new ChatRecordDTO();
+ // 查询居民注册信息
+ if(!req.containsKey("patientId") || req.getLong("patientId") == null) {
+ chatRecord.setRecipientId(patientInfo.getId());
+ } else {
+ chatRecord.setRecipientId(req.getLong("patientId"));
+ }
+
+ FDWxMegDto wxMegDto = new FDWxMegDto();
+ wxMegDto.setTouser(patientInfo.getOpenid());
+ wxMegDto.setTemplate_id(MessageTemplateType.getFolllowupTypeByCode(body.getTemplateType()).getTemplateId());
+ Map meg = new HashMap<>();
+ switch (body.getTemplateType()) {
+ // 用药提醒
+ case "9":
+ meg.put("thing1", new TemplateData(body.getDrugName()));
+ meg.put("thing2", new TemplateData(body.getDrugUsage()));
+ meg.put("time3", new TemplateData(body.getHandleDate()));
+ meg.put("thing4", new TemplateData((!StringUtils.isBlank(body.getRecipientName())? body.getRecipientName(): "") + body.getContent()));
+ break;
+ // 筛查预约成功
+ case "10":
+ meg.put("name2", new TemplateData(body.getRecipientName()));
+ meg.put("thing5", new TemplateData(body.getApplyContent()));
+ meg.put("thing6", new TemplateData(body.getHospitalName()));
+ meg.put("thing8", new TemplateData(body.getHandleDate()));
+ meg.put("thing9", new TemplateData(body.getContent()));
+ break;
+ // 家庭医生消息通知
+ default:
+ meg.put("thing1", new TemplateData(body.getDoctorName()));
+ meg.put("time2", new TemplateData(body.getSendTime()));
+ meg.put("thing3", new TemplateData(body.getContent()));
+ break;
+ }
+ wxMegDto.setPage(MessageTypePath.getPathByType(body.getMessageType()).getPath() + (StringUtils.isBlank(body.getContentId()) ? "" : body.getContentId()));
+ wxMegDto.setData(meg);
+
//发送
- this.sendPosts(appletAccessToken, MapUtil.object2Map(getTemplate(body, patientInfo.getOpenid())));
+ this.sendPosts(appletAccessToken, MapUtil.object2Map(wxMegDto));
+
+ // 记录通知消息
+ if(req.containsKey("messageCategory") && !StringUtils.isBlank(req.getString("messageCategory")) && req.containsKey("chatRecord")) {
+ ChatRecordDTO chat = req.getJSONObject("chatRecord").toJavaObject(ChatRecordDTO.class);
+ if(chat != null) {
+ chatRecord.setMessageType("1");
+ chatRecord.setMessageNo(IdUtils.fastSimpleUUID());
+ chatRecord.setSendTime(new Date());
+ chatRecord.setTitle(chat.getTitle());
+ chatRecord.setContent(chat.getContent());
+ chatRecord.setSenderName(chat.getSenderName());
+ chatRecord.setRecipientName(patientInfo.getPatientName());
+ chatRecord.setMessageCategory(req.getString("messageCategory"));
+ chatRecordService.insertChatRecord(chatRecord);
+ }
+ }
}
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/newapp/impl/NewAppLoginServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/newapp/impl/NewAppLoginServiceImpl.java
index 353cd6c..1574c12 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/newapp/impl/NewAppLoginServiceImpl.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/newapp/impl/NewAppLoginServiceImpl.java
@@ -2,9 +2,11 @@ package com.xinelu.applet.service.newapp.impl;
import com.xinelu.applet.mapper.newapp.NewAppLoginMapper;
import com.xinelu.applet.service.newapp.NewAppLoginService;
+import com.xinelu.applet.vo.newapp.LoginStatusVo;
import com.xinelu.common.core.domain.AjaxResult;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
+import java.util.HashMap;
@Service
public class NewAppLoginServiceImpl implements NewAppLoginService {
@@ -20,9 +22,13 @@ public class NewAppLoginServiceImpl implements NewAppLoginService {
*/
@Override
public AjaxResult login(String personAccount, String personPassword) {
- int count = newAppLoginMapper.login(personAccount, personPassword);
- if (count>0){
- return AjaxResult.success("登录成功!");
+ LoginStatusVo loginStatusVo = newAppLoginMapper.login(personAccount, personPassword);
+ HashMap hashMap = new HashMap<>();
+ if (loginStatusVo.getCount()>0){
+ hashMap.put("status",loginStatusVo.getStatus());
+ hashMap.put("id",loginStatusVo.getId()+"");
+ hashMap.put("str","登录成功!");
+ return AjaxResult.success(hashMap);
}else {
return AjaxResult.error("账号或密码错误!");
}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java
index 4cdbb0f..dda4074 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageCenterVo.java
@@ -15,7 +15,7 @@ import lombok.Data;
@Data
public class MessageCenterVo {
- @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询")
+ @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
private String messageCategory;
@ApiModelProperty("通知适用人群(0:全部人群)")
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java
index b01cca9..a5a401e 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/chatrecord/MessageVo.java
@@ -18,7 +18,7 @@ public class MessageVo {
@ApiModelProperty("业务主键")
private String messageNo;
- @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询")
+ @ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
private String messageCategory;
@ApiModelProperty("通知适用人群(0:全部人群)")
@@ -30,6 +30,9 @@ public class MessageVo {
@ApiModelProperty("发送人编号")
private Long senderId;
+ @ApiModelProperty("发送人编号(家医医生编号)")
+ private String senderNo;
+
@ApiModelProperty("发送人姓名")
private String senderName;
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/newapp/LoginStatusVo.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/newapp/LoginStatusVo.java
new file mode 100644
index 0000000..13eb8a1
--- /dev/null
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/newapp/LoginStatusVo.java
@@ -0,0 +1,14 @@
+package com.xinelu.applet.vo.newapp;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class LoginStatusVo implements Serializable {
+
+ private Integer count;
+ private Integer id;
+ //1:家医医生 2:泉医医生 3:专病医生
+ private String status;
+
+}
diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/nurseapplogin/AppLoginVO.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/nurseapplogin/AppLoginVO.java
index ab3ecc5..42b3630 100644
--- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/nurseapplogin/AppLoginVO.java
+++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/vo/nurseapplogin/AppLoginVO.java
@@ -13,6 +13,7 @@ import java.io.Serializable;
@Data
public class AppLoginVO implements Serializable {
private static final long serialVersionUID = 1820130502268738492L;
+
/**
* 返回提示信息
*/
@@ -42,4 +43,4 @@ public class AppLoginVO implements Serializable {
* 用户手机号
*/
private String phone;
-}
+}
\ No newline at end of file
diff --git a/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml b/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml
index e5172b4..7ef99ca 100644
--- a/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml
+++ b/xinelu-nurse-applet/src/main/resources/mapper/applet/chatrecord/ChatRecordMapper.xml
@@ -34,6 +34,8 @@
message_no,
message_category,
consultation_id,
+ crowds,
+ crowds_name,
sender_id,
sender_name,
send_time,
@@ -55,7 +57,7 @@
message_no
- ,message_category,crowds,crowds_name,sender_id,
+ ,message_category,crowds,crowds_name,sender_id,crowds,crowds_name,
sender_name,send_time,recipient_id,
recipient_name,message_type,title,content,content_id,
read_status
@@ -66,7 +68,7 @@
select
from chat_record
- where del_flag = '0' and (recipient_id = #{recipientId} or sender_id = #{recipientId})
+ where del_flag = 0 and (recipient_id = #{recipientId} or sender_id = #{recipientId})
and message_category = #{messageCategory}
@@ -76,6 +78,42 @@
order by send_time desc
+
+
+