Merge remote-tracking branch 'origin/dev_gy_0920' into dev_gy_0920

This commit is contained in:
HaoWang 2023-10-27 11:08:24 +08:00
commit 96102e95cd
41 changed files with 1362 additions and 89 deletions

View File

@ -86,6 +86,14 @@
<artifactId>xinelu-familydoctor</artifactId>
</dependency>
<!-- 德州市居民码SM3Hmac算法 -->
<dependency>
<groupId>com.tzwy</groupId>
<artifactId>hmac</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/resources/lib/hmac-1.0.jar</systemPath>
</dependency>
</dependencies>
<build>

View File

@ -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<PageInfo<MessageVo>> 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<MessageVo> 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<String> noticDel(@PathVariable String messageNo) {
chatRecordService.del(messageNo);
return R.ok();
}
}

View File

@ -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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> headerParams(String message) {
Map<String, Object> 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;
}
}

View File

@ -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<PageInfo<ResidentServiceApplyVo>> performanceBookingList(@RequestBody ApplyQuery query) {
@ -191,5 +200,4 @@ public class FDController {
}
return R.ok();
}
}

View File

@ -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=
}
}

View File

@ -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

Binary file not shown.

View File

@ -40,6 +40,11 @@ public class MessageTemplate {
*/
private String msgType;
/**
* 消息类型(文字/图片)
*/
private String messageType;
/**
* 发送时间
* */

View File

@ -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;
}

View File

@ -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
*/

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)));
}

View File

@ -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)));
}

View File

@ -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)));
}

View File

@ -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()

View File

@ -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<String> deleteMegs(@RequestBody List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return R.fail("请选择要删除的消息!");
}
return chatRecordService.deleteMegs(ids) > 0 ? R.ok("删除成功") : R.fail("删除失败");
}
}

View File

@ -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;
}

View File

@ -14,7 +14,7 @@ import lombok.Data;
@ApiModel("标记为已读传输对象")
public class MarkReadDto {
@ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询")
@ApiModelProperty("消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知")
private String messageCategory;
@ApiModelProperty("绑定编号")

View File

@ -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<String> crowdNoList;
}

View File

@ -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:全部人群)")

View File

@ -18,6 +18,15 @@ public interface ChatRecordMapper {
List<MessageVo> selectMegVoList(MessageSearchDto messageDto);
/**
* @Author mengkuiliang
* @Description
* @Date 2023-10-25 025 15:25
* @Param [bindingNo, doctorNo]
* @return com.xinelu.applet.vo.chatrecord.MessageCenterVo
**/
List<MessageVo> 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<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
List<ChatRecord> 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<Long> ids);
/**
* @Author mengkuiliang
* @Description 查询健康知识推送列表
* @Date 2023-10-25 025 11:27
* @Param [messageDto]
* @return java.lang.Object
**/
List<MessageVo> 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);
}

View File

@ -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);
}

View File

@ -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<ChatRecord> selectChatRecordList(ChatRecord chatRecord);
List<ChatRecord> 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<MessageCenterVo> getMegVoList(MessageSearchDto messageDto);
/**
* @Author mengkuiliang
* @Description 获取指定类型的消息记录
* @Date 2023-10-25 025 15:22
* @Param [messageDto]
* @return java.util.List<com.xinelu.applet.vo.chatrecord.MessageVo>
**/
List<MessageVo> getMegList(MessageSearchDto messageDto);
Integer deleteMegs(List<Long> ids);
/**
* @Author mengkuiliang
* @Description 查询健康知识推送列表
* @Date 2023-10-25 025 11:24
* @Param [messageDto]
* @return com.github.pagehelper.PageInfo<MessageVo>
**/
PageInfo<MessageVo> 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);
}

View File

@ -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<com.xinelu.applet.vo.chatrecord.MessageVo>
**/
@Override
public List<MessageVo> 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<Long> ids) {
return chatRecordMapper.deleteMegs(ids);
}
/**
* @Author mengkuiliang
* @Description 查询健康知识推送列表
* @Date 2023-10-25 025 11:24
* @Param [messageDto]
* @return com.github.pagehelper.PageInfo<com.xinelu.applet.vo.chatrecord.MessageVo>
**/
@Override
public PageInfo<MessageVo> 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);
}
}

View File

@ -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<String, MessageValueEntity> 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<String, MessageValueEntity> 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<String, Object> 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<String, Object> 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<String, TemplateData> 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);
}
}
}
}

View File

@ -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<String, String> 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("账号或密码错误!");
}

View File

@ -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:全部人群)")

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -34,6 +34,8 @@
message_no,
message_category,
consultation_id,
crowds,
crowds_name,
sender_id,
sender_name,
send_time,
@ -55,7 +57,7 @@
<sql id="Message_Vo_List">
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
<include refid="Message_Vo_List"/>
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})
<if test="messageCategory != null">
and message_category = #{messageCategory}
</if>
@ -76,6 +78,42 @@
order by send_time desc
</select>
<select id="selectMegList" resultType="com.xinelu.applet.vo.chatrecord.MessageVo">
select <include refid="Message_Vo_List"/>
from chat_record
where del_flag = '0' and message_category = #{messageCategory}
<!-- 查询居民注册之后的通知消息 -->
<if test="bindingTime != null">
and send_time &gt;= #{bindingTime}
</if>
<choose>
<!-- 健康推送 -->
<when test="messageCategory == 2">
and recipient_id is null
<!-- 查询适用人群的通知消息 -->
<if test="crowdNoList != null and crowdNoList.size() > 0">
and (
<foreach collection="crowdNoList" item="no" open="(" separator="or" close=")">
FIND_IN_SET(#{no},crowds)
</foreach>
or crowds = '0')
</if>
<!-- 查询签约医生的通知 -->
and sender_id = #{senderId}
</when>
<!-- 通知公告 -->
<when test="messageCategory == 1">
and recipient_id is null
</when>
<!-- 消息通知 -->
<when test="messageCategory == 4">
and recipient_id = #{recipientId}
</when>
</choose>
order by send_time desc
</select>
<select id="selectOneChatRecord" parameterType="java.lang.String"
resultType="com.xinelu.applet.vo.chatrecord.MessageCenterVo">
select message_category,
@ -89,7 +127,7 @@
recipient_id,
recipient_name
from chat_record
where del_flag = '0'
where del_flag = 0
and message_category = '3'
and ((sender_id = #{bindingNo} and recipient_id = #{doctorNo})
or (sender_id = #{doctorNo} and recipient_id = #{bindingNo}))
@ -98,7 +136,7 @@
<select id="selectChatRecordList" parameterType="ChatRecord" resultMap="ChatRecordResult">
<include refid="selectChatRecordVo"/>
where del_flag = '0'
where del_flag = 0
and consultation_id = #{consultationId}
and (
(sender_id = #{senderId} and recipient_id = #{recipientId})
@ -117,12 +155,71 @@
where id = #{id}
</select>
<!-- 查询健康知识推送列表 -->
<select id="getNoticList" resultType="com.xinelu.applet.vo.chatrecord.MessageVo">
<include refid="selectChatRecordVo"></include>
where del_flag = '0' and sender_id = #{senderId}
<choose>
<when test="messageCategory != null and messageCategory != ''">
and message_category = #{messageCategory}
</when>
<otherwise>
and message_category in ('1', '2')
</otherwise>
</choose>
<if test="startDate != null">
and send_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and send_time &lt;= #{endDate}
</if>
<if test="crowdNoList != null and crowdNoList.size() > 0">
and (
<foreach collection="crowdNoList" item="no" open="(" separator="or" close=")">
FIND_IN_SET(#{no},crowds)
</foreach>)
</if>
order by send_time desc
</select>
<!-- 查询消息详情 -->
<select id="getByNo" resultType="com.xinelu.applet.vo.chatrecord.MessageVo">
select cr.id,
cr.message_no,
cr.message_category,
cr.consultation_id,
cr.crowds,
cr.crowds_name,
cr.sender_id,
cr.sender_name,
cr.send_time,
cr.recipient_id,
cr.recipient_name,
cr.message_type,
cr.title,
cr.content,
cr.content_id,
cr.read_status,
cr.read_time,
cr.del_flag,
cr.create_by,
cr.create_time,
cr.update_by,
cr.update_time,
p.person_code sender_no
from chat_record cr
left join hospital_person_info p on p.id = cr.sender_id
where cr.message_no = #{messageNo}
</select>
<insert id="insertChatRecord" parameterType="ChatRecord" useGeneratedKeys="true"
keyProperty="id">
insert into chat_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="messageCategory != null">message_category,
</if>
<if test="messageNo != null">message_no,
</if>
<if test="consultationId != null">consultation_id,
</if>
<if test="crowds != null">crowds,
@ -165,6 +262,8 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="messageCategory != null">#{messageCategory},
</if>
<if test="messageNo != null">#{messageNo},
</if>
<if test="consultationId != null">#{consultationId},
</if>
<if test="crowds != null">#{crowds},
@ -218,7 +317,7 @@
<if test="crowds != null">crowds =
#{crowds},
</if>
<if test="crowdsName != null">crowds_name
<if test="crowdsName != null">crowds_name =
#{crowdsName},
</if>
<if test="senderId != null">sender_id =
@ -283,7 +382,33 @@
read_time = #{readTime},
</if>
</trim>
where del_flag = '0' and read_status = '0' and recipient_id = #{recipientId}
where del_flag = 0 and read_status = '0' and recipient_id = #{recipientId}
</update>
<!-- 更新通知 -->
<update id="updateChatRecordOfNo">
update chat_record
<set>
<if test="messageCategory != null">message_category = #{messageCategory},</if>
<if test="consultationId != null">consultation_id = #{consultationId},</if>
<if test="crowds != null">crowds = #{crowds},</if>
<if test="crowdsName != null">crowds_name = #{crowdsName},</if>
<if test="senderId != null">sender_id = #{senderId},</if>
<if test="senderName != null and senderName != ''">sender_name = #{senderName},</if>
<if test="sendTime != null">send_time = #{sendTime},</if>
<if test="recipientId != null">recipient_id = #{recipientId},</if>
<if test="recipientName != null and recipientName != ''">recipient_name = #{recipientName},</if>
<if test="messageType != null">message_type = #{messageType},</if>
<if test="title != null">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="contentId != null">content_id = #{contentId},</if>
<if test="readStatus != null">read_status = #{readStatus},</if>
<if test="readTime != null">read_time = #{readTime},</if>
<if test="delFlag != null">del_flag =#{delFlag},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</set>
where message_no = #{messageNo}
</update>
<delete id="deleteChatRecordById" parameterType="Long">
@ -298,4 +423,22 @@
#{id}
</foreach>
</delete>
<!-- 删除通知 -->
<delete id="del">
delete from chat_record where message_no = #{messageNo}
</delete>
<update id="deleteMegs">
update chat_record set del_flag = 1
<where>
<if test="ids != null">
id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</update>
</mapper>

View File

@ -69,6 +69,8 @@
ci.doctor_name,
ci.problem_description,
ci.create_time,
(SELECT content FROM chat_record cr WHERE cr.consultation_id = ci.id ORDER BY create_time DESC LIMIT 1) as content,
(SELECT message_type FROM chat_record cr WHERE cr.consultation_id = ci.id ORDER BY create_time DESC LIMIT 1) as messageType,
(SELECT COUNT(cr.id) FROM chat_record cr WHERE cr.consultation_id = ci.id AND read_status = '0'
<if test="patientId != null ">
and sender_id= ci.doctor_id

View File

@ -4,9 +4,9 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinelu.applet.mapper.newapp.NewAppLoginMapper">
<select id="login" resultType="int">
<select id="login" resultType="com.xinelu.applet.vo.newapp.LoginStatusVo">
select
count(1)
count(1) count, status,id
from hospital_person_info
<where>
<if test="personAccount != null">

View File

@ -81,7 +81,7 @@ public class HospitalPersonInfoController extends BaseController {
* 获取健康咨询-科室人员信息详细信息
*/
@ApiOperation("获取健康咨询-科室人员信息详细信息")
@PreAuthorize("@ss.hasPermi('system:hospitalPerson:query')")
//@PreAuthorize("@ss.hasPermi('system:hospitalPerson:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(hospitalPersonInfoService.selectHospitalPersonInfoById(id));

View File

@ -34,6 +34,11 @@ public class ChatRecord extends BaseEntity implements Serializable {
*/
private Long id;
/**
* 消息业务主键
*/
private String messageNo;
/**
* 消息类别 1:通知公告,2:健康推送,3:在线咨询 4:消息通知
*/

View File

@ -85,6 +85,8 @@ public class HospitalPersonInfo extends BaseDomain implements Serializable {
@NotBlank(message = "科室人员地址不能为空!", groups = {Insert.class, Update.class})
@Length(max = 300, message = "科室人员地址不能超过300位", groups = {Insert.class, Update.class})
private String personAddress;
/**性别*/
private String sex;
/**
* 身份证号

View File

@ -140,10 +140,14 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService {
result.put("receiveName", registerVo.getPatientName());
result.put("text1", body.getHospitalName());
result.put("text2", (body.getProjectName().length() >= 17? (body.getProjectName().substring(0, 17) + "..."): body.getProjectName()));
result.put("text3", body.getProjectName());
result.put("sendTitle", "筛查预约");
result.put("sendTime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date()));
result.put("busType", "10");
result.put("sendContent", registerVo.getPatientName() + "预约筛查成功");
result.put("messageType", "5");
result.put("messageCategory", "4");
result.put("cardNo", registerVo.getCardNo());
}
return result;
}

View File

@ -118,6 +118,15 @@ public class ConsultationInfoVO extends BaseEntity implements Serializable {
*/
private String medicalRecord;
/**
* 最近一次内容
*/
private String content;
/**
* 内容类型
*/
private String messageType;
/**
* 是否删除标识,0:否,1:是
*/
@ -152,6 +161,8 @@ public class ConsultationInfoVO extends BaseEntity implements Serializable {
.append("medicalRecord", getMedicalRecord())
.append("delFlag", getDelFlag())
.append("messageCount", getMessageCount())
.append("content", getContent())
.append("messageType", getMessageType())
.toString();
}
}

View File

@ -35,12 +35,15 @@
<result property="personName" column="person_name"/>
<result property="personPhone" column="person_phone"/>
<result property="personAddress" column="person_address"/>
<result property="sex" column="sex"/>
<result property="cardNo" column="card_no"/>
<result property="academicTitle" column="academic_title"/>
<result property="consultingFee" column="consulting_fee"/>
<result property="personIntroduce" column="person_introduce"/>
<result property="personSort" column="person_sort"/>
<result property="personPictureUrl" column="person_picture_url"/>
<result property="personAccount" column="person_account"/>
<result property="personPassword" column="person_password"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
@ -206,12 +209,15 @@
hpi.person_name,
hpi.person_phone,
hpi.person_address,
hpi.sex,
hpi.card_no,
hpi.academic_title,
hpi.consulting_fee,
hpi.person_introduce,
hpi.person_sort,
hpi.person_picture_url,
hpi.person_account,
hpi.person_password,
hpi.create_by,
hpi.create_time,
hpi.update_by,

View File

@ -563,7 +563,9 @@
birth_date,
personal_wechat_code_url,
disabling_condition,
disabling_reason
disabling_reason,
city_code,
binding_time
FROM patient_info
WHERE id = #{id}
and del_flag = 0