Compare commits

...

No commits in common. "master" and "6262807fdef12ea8fb1178f09c609d94de77974b" have entirely different histories.

36 changed files with 354 additions and 862 deletions

4
.idea/.gitignore vendored
View File

@ -1,7 +1,7 @@
# Default ignored files # 默认忽略的文件
/shelf/ /shelf/
/workspace.xml /workspace.xml
# Editor-based HTTP Client requests # 基于编辑器的 HTTP 客户端请求
/httpRequests/ /httpRequests/
# Datasource local storage ignored files # Datasource local storage ignored files
/dataSources/ /dataSources/

View File

@ -1,10 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ADDITIONAL_TAGS" value="Dis" />
</inspection_tool>
</profile>
</component>

View File

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="lombok.Data" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager"> <component name="MavenProjectsManager">
<option name="originalFiles"> <option name="originalFiles">
@ -12,11 +8,5 @@
</list> </list>
</option> </option>
</component> </component>
<component name="PWA"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
<option name="enabled" value="true" />
<option name="wasEnabledAtLeastOnce" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17 (2)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project> </project>

View File

@ -17,11 +17,9 @@
<artifactId>health-common-core</artifactId> <artifactId>health-common-core</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.health</groupId> <groupId>org.projectlombok</groupId>
<artifactId>health-common-security</artifactId> <artifactId>lombok</artifactId>
<version>3.6.6</version>
</dependency> </dependency>
</dependencies> </dependencies>
<repositories> <repositories>
@ -31,7 +29,6 @@
<url>http://10.100.1.7:8081/repository/maven-public/</url> <url>http://10.100.1.7:8081/repository/maven-public/</url>
</repository> </repository>
</repositories> </repositories>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>dragon-release</id> <id>dragon-release</id>
@ -40,4 +37,5 @@
</repository> </repository>
</distributionManagement> </distributionManagement>
</project> </project>

View File

@ -1,46 +0,0 @@
package com.health.consultation.common.domain;
import lombok.Data;
/**
*
*
* @author Administrator
*/
@Data
public class Chatrecord {
/**
* ID
*/
private String id;
/**
* ID
*/
private String historyChatRecordId;
/**
*
*/
private String doctorChatTimestamp;
/**
*
*/
private String doctorText;
/**
*
*/
private String patientChatTimestamp;
/**
*
*/
private String patientText;
/**
*
*/
private String status;
}

View File

@ -1,56 +0,0 @@
package com.health.consultation.common.domain;
import lombok.Data;
/**
* @author : [Administrator]
* @version : [v1.0]
* @description : []
* @createTime : [2023/10/26 15:58]
* @updateUser : [Administrator]
* @updateTime : [2023/10/26 15:58]
* @updateRemark : []
*/
@Data
public class Inquiry {
/**
* ID
*/
private String id;
/**
* ID
*/
private String doctorId;
/**
* ID
*/
private String patientId;
/**
*
*/
private String patientAvatar;
/**
*
*/
private String lastConsultationTime;
/**
*
*/
private String lastChatRecord;
/**
* ID
*/
private String historyChatRecordId;
/**
*
*/
private String inquiryStatus;
}

View File

@ -1,13 +0,0 @@
package com.health.consultation.common.domain.req;
import lombok.Data;
@Data
public class ReqDoctorMsg {
private String id;
private String msg;
/**
* id
*/
private String hid;
}

View File

@ -1,21 +0,0 @@
package com.health.consultation.common.domain.req;
import lombok.Data;
/**
* @author Administrator
*/
@Data
public class RequestDoctor {
private String id;
/**
*
*/
private String name;
/**
*
*/
private String JobsId;
}

View File

@ -1,17 +0,0 @@
package com.health.consultation.common.domain.resp;
import lombok.Data;
/**
*
*
* @author Administrator
*/
@Data
public class Consultation {
private String role;
private String text;
private String historyChatRecordId;
}

View File

@ -1,20 +0,0 @@
package com.health.consultation.common.domain.resp;
import lombok.Data;
/**
*
*
* @author Administrator
*/
@Data
public class HistoryDoctor {
private String id;//聊天记录ID唯一标识符
private String sessionId;//聊天会话ID
private String senderId;//发送者ID
private String receiverId;//接收者ID
private String message;//聊天消息内容
private String timestamp;//消息发送时间戳
}

View File

@ -1,32 +0,0 @@
package com.health.consultation.common.utils;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* @author : [Administrator]
* @version : [v1.0]
* @description : []
* @createTime : [2023/10/26 20:37]
* @updateUser : [Administrator]
* @updateTime : [2023/10/26 20:37]
* @updateRemark : []
*/
public class FormatConversionUtils {
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern ("yyyyMMddHHmmss");
public static String formatDateTimeToString (LocalDate datetime) {
return datetime.format (FORMATTER);
}
public static LocalDate timeDateFormatter (String dateString) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern ("yyyyMMddHHmmss");
LocalDate date = LocalDate.parse (dateString, formatter);
return date;
}
}

View File

@ -0,0 +1,15 @@
package com.health.consultation.domain.resp;
import lombok.Data;
/**
*
*
* @author Administrator
*/
@Data
public class Department {
private String id;
}

View File

@ -32,82 +32,17 @@
</repository> </repository>
</distributionManagement> </distributionManagement>
<dependencies> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.health</groupId> <groupId>com.health</groupId>
<artifactId>health-consultation-common</artifactId> <artifactId>health-consultation-common</artifactId>
<version>3.6.3</version> <version>3.6.3</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.20</version>
</dependency>
<dependency>
<dependency> <groupId>org.eclipse.paho</groupId>
<groupId>com.health</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<artifactId>base-system-common</artifactId> <version>1.2.5</version>
</dependency> </dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.health</groupId>
<artifactId>health-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.health</groupId>
<artifactId>health-common-datascope</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>com.taobao.arthas</groupId>
<artifactId>arthas-client</artifactId>
<version>3.6.7</version>
</dependency>
</dependencies> </dependencies>

View File

@ -0,0 +1,14 @@
package com.health.consultation;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Administrator
*/
@SpringBootApplication
public class ConMain {
public static void main(String[] args) {
SpringApplication.run(ConMain.class,args);
}
}

View File

@ -0,0 +1,46 @@
package com.health.consultation.config;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallbackExtended;
import org.eclipse.paho.client.mqttv3.MqttMessage;
public class Callback implements MqttCallbackExtended {
/**
*
* @param b
* @param s
*/
@Override
public void connectComplete(boolean b, String s) {
}
/**
*
* @param throwable
*/
@Override
public void connectionLost(Throwable throwable) {
}
/**
*
* @param s
* @param mqttMessage mqtt
* @throws Exception
*/
@Override
public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
}
/**
*
* @param iMqttDeliveryToken
*/
@Override
public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) {
}
}

View File

@ -0,0 +1,66 @@
package com.health.consultation.config;
import lombok.Data;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.springframework.context.annotation.Configuration;
/**
* mqtt
* @author Administrator
*/
@Configuration
@Data
public class MQTTConnect {
private String broker;
private String username;
private String password;
private MqttClient client;
public void setBroker(String broker) {
this.broker = broker;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public MqttClient connect() throws MqttException {
client = new MqttClient(broker, MqttClient.generateClientId(), new MemoryPersistence());
MqttConnectOptions options = new MqttConnectOptions();
options.setUserName(username);
options.setPassword(password.toCharArray());
options.setConnectionTimeout(60);
options.setKeepAliveInterval(60);
return client;
}
public void disconnect() throws MqttException {
if (client != null && client.isConnected()) {
client.disconnect();
client.close();
}
}
public void publishMessage(String topic, String content, int qos) throws MqttException {
MqttMessage message = new MqttMessage(content.getBytes());
message.setQos(qos);
client.publish(topic, message);
}
public void subscribeTopic(String topic, IMqttMessageListener listener) throws MqttException {
client.subscribe(topic, listener);
}
}

View File

@ -0,0 +1,71 @@
package com.health.consultation.controller;
import com.health.common.core.domain.Result;
import com.health.consultation.domain.resp.Department;
import com.health.consultation.service.ConService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author Administrator
*/
@RestController
@RequestMapping("/consultation")
public class ConController {
@Autowired
ConService conService;
/**getDepartmentList()
* @return
*/
public Result getDepartmentList(){
List<Department> departmentList = conService.getDepartmentList();
return Result.success(departmentList);
}
//获取医生列表接口getDoctorListByDepartment(String departmentId, String sortType)
//获取医生详情接口getDoctorDetails(String doctorId)
//获取医生评价接口getDoctorReviews(String doctorId)
//获取医生关注状态接口getDoctorFollowStatus(String userId, String doctorId)
//关注医生接口followDoctor(String userId, String doctorId)
//取消关注医生接口unfollowDoctor(String userId, String doctorId)
//发送礼物接口sendGift(String userId, String doctorId, String giftType)
//获取用户咨询状态接口getUserConsultationStatus(String userId)
//发起咨询接口startConsultation(String userId, String doctorId)
//结束咨询接口endConsultation(String userId)
//获取聊天记录接口getChatRecords(String userId, String doctorId)
//发送聊天消息接口sendChatMessage(String userId, String doctorId, Message message)
}

View File

@ -0,0 +1,35 @@
package com.health.consultation.layer;
import com.health.consultation.config.MQTTConnect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
/**
* @author Administrator
*/
@Component
public class MqttListener implements ApplicationListener<ContextRefreshedEvent> {
private MQTTConnect server;
@Autowired
public void MQTTListener(MQTTConnect server) {
this.server = server;
}
public MqttListener(MQTTConnect server) {
this.server = server;
}
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
}
}

View File

@ -0,0 +1,17 @@
package com.health.consultation.mapper;
import com.health.consultation.domain.resp.Department;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ConMapper {
/**
* @return
*/
List<Department> getDepartmentList();
}

View File

@ -1,29 +0,0 @@
package com.health.consultation.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author Administrator
*/
@EnableFeignClients
@SpringBootApplication
public class ConsultationsMain {
public static void main (String[] args) {
SpringApplication.run (ConsultationsMain.class, args);
System.out.println ("模块启动成功" +
"1" +
"2" +
"3" +
"4" +
"5" +
"6" +
"7" +
"8" +
"9" +
"0" +
"-" +
"=");
}
}

View File

@ -1,17 +0,0 @@
package com.health.consultation.server.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* @author Administrator
*/
@Configuration
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExporter () {
return new ServerEndpointExporter ();
}
}

View File

@ -1,86 +0,0 @@
package com.health.consultation.server.controller;
import com.alibaba.fastjson2.JSONObject;
import com.health.common.core.domain.Result;
import com.health.consultation.common.domain.req.ReqDoctorMsg;
import com.health.consultation.common.domain.resp.Consultation;
import com.health.consultation.common.domain.resp.HistoryDoctor;
import com.health.consultation.server.service.InquiryService;
import com.health.consultation.server.service.WebSocketServer;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author Administrator
* @Dis
*/
@RestController
@RequestMapping ("/iQL")
public class InquiryController {
@Autowired
InquiryService inquiryService;
@Autowired
WebSocketServer webSocketServer;
/**
* doctor
*
* @return Consultation
*/
@PostMapping ("/inquiries")
public Result<List<Consultation>> getDoctorInquiries () {
List<Consultation> list = inquiryService.getDoctorInquiries ();
return Result.success (list);
}
/**
* @param userId
*
* @return com.health.common.core.domain.Result<java.util.List < com.health.consultation.common.domain.resp.HistoryDoctor>>
*
* @author zhn
* @description //患者咨询医生
* @createTime ${Date} ${Time}
**/
@PostMapping ("/setUpConsultation")
public Result<List<HistoryDoctor>> setUpConsultation (String userId) {
return inquiryService.setUpConsultation (userId);
}
@PostMapping ("/chat")
public Result setMsgDoctor (@RequestBody ReqDoctorMsg reqDoctorMsg) {
try {
webSocketServer.sendMessage (JSONObject.toJSONString (reqDoctorMsg.getMsg ()), Long.valueOf (reqDoctorMsg.getHid ()));
return inquiryService.setMsgDoctor (reqDoctorMsg);
}
catch (Exception e) {
e.printStackTrace ();
return Result.error ();
}
}
@Data
@Accessors (chain = true)
public static class WebsocketResponse {
private String userId;
private String userName;
private int age;
}
}

View File

@ -1,40 +0,0 @@
package com.health.consultation.server.mapper;
import com.health.consultation.common.domain.Chatrecord;
import com.health.consultation.common.domain.resp.Consultation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author : [Administrator]
* @version : [v1.0]
* @description : []
* @createTime : [2023/10/26 16:26]
* @updateUser : [Administrator]
* @updateTime : [2023/10/26 16:26]
* @updateRemark : []
*/
@Mapper
public interface InquiryMapper {
/**
* @param doctorId
*
* @return java.util.List<com.health.consultation.common.domain.resp.Consultation>
*
* @author zhn
* @description //TODO
* @createTime ${Date} ${Time}
**/
List<Consultation> getDoctorInquiries (@Param ("doctorId") String doctorId);
int setUpConsultation (@Param ("doctorId") String doctorId, @Param ("userId") String userId);
List<Chatrecord> viewTheChatLog (@Param ("userId") String userId);
}

View File

@ -1,40 +0,0 @@
package com.health.consultation.server.service;
import com.health.common.core.domain.Result;
import com.health.consultation.common.domain.req.ReqDoctorMsg;
import com.health.consultation.common.domain.resp.Consultation;
import com.health.consultation.common.domain.resp.HistoryDoctor;
import java.util.List;
/**
* @author Administrator
*/
public interface InquiryService {
/**
*
*
* @return List<Consultation>
*/
List<Consultation> getDoctorInquiries ();
/**
* idlist
*
* @param userId
*
* @return
*/
Result<List<HistoryDoctor>> setUpConsultation (String userId);
/**
*
*
* @param reqDoctorMsg
*
* @return
*/
Result setMsgDoctor (ReqDoctorMsg reqDoctorMsg);
}

View File

@ -1,152 +0,0 @@
package com.health.consultation.server.service;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
/**
* @author Administrator
*/
@Log4j2
@Component
@ServerEndpoint ("/webSocket/1")
public class WebSocketServer {
/**
* 线list
*/
private final static List<Session> SESSIONS = Collections.synchronizedList (new ArrayList<> ());
private static int onlineCount = 0;
private static CopyOnWriteArraySet<WebSocketServer> webSocketSet = new CopyOnWriteArraySet<> ();
/**
* concurrent线setMyWebSocket
*/
private static ConcurrentHashMap<String, WebSocketServer> webSocketMap = new ConcurrentHashMap ();
private Session session;
private String userId;
/**
*
*
* @return
*/
public static synchronized int getOnlineCount () {
return onlineCount;
}
@OnOpen
public void onOpen (Session session, @PathParam ("userId") String userId) {
this.session = session;
this.userId = userId;
SESSIONS.add (session);
if (webSocketMap.containsKey (userId)) {
webSocketMap.remove (userId);
webSocketMap.put (userId, this);
}
else {
webSocketMap.put (userId, this);
addOnlineCount ();
}
// log.info("【websocket消息】有新的连接, 总数:{}", webSocketSet.size());
log.info ("[连接ID:{}] 建立连接, 当前连接数:{}", this.userId, webSocketMap.size ());
}
/**
*
*/
public static synchronized void addOnlineCount () {
WebSocketServer.onlineCount++;
}
/**
*
*/
@OnClose
public void onClose () {
webSocketSet.remove (this);
if (webSocketMap.containsKey (userId)) {
webSocketMap.remove (userId);
subOnlineCount ();
}
// log.info("【websocket消息】连接断开, 总数:{}", webSocketSet.size());
log.info ("[连接ID:{}] 断开连接, 当前连接数:{}", userId, webSocketMap.size ());
}
/**
*
*/
public static synchronized void subOnlineCount () {
WebSocketServer.onlineCount--;
}
/**
*
*
* @param session
* @param error
*/
@OnError
public void onError (Session session, Throwable error) {
log.info ("[连接ID:{}] 错误原因:{}", this.userId, error.getMessage ());
error.printStackTrace ();
}
/**
*
*
* @param message
*/
@OnMessage
public void onMessage (String message) {
// log.info("【websocket消息】收到客户端发来的消息:{}", message);
log.info ("[连接ID:{}] 收到消息:{}", this.userId, message);
}
/**
*
*
* @param message
* @param userId
*/
public void sendMessage (String message, Long userId) {
WebSocketServer webSocketServer = webSocketMap.get (String.valueOf (userId));
if (webSocketServer != null) {
log.info ("【websocket消息】推送消息, message={}", message);
try {
webSocketServer.session.getBasicRemote ().sendText (message);
}
catch (Exception e) {
e.printStackTrace ();
log.error ("[连接ID:{}] 发送消息失败, 消息:{}", this.userId, message, e);
}
}
}
/**
*
*
* @param message
*/
public void sendMassMessage (String message) {
try {
for (Session session : SESSIONS) {
if (session.isOpen ()) {
session.getBasicRemote ().sendText (message);
log.info ("[连接ID:{}] 发送消息:{}", session.getRequestParameterMap ().get ("userId"), message);
}
}
}
catch (Exception e) {
e.printStackTrace ();
}
}
}

View File

@ -1,90 +0,0 @@
package com.health.consultation.server.service.impl;
import com.health.common.core.domain.Result;
import com.health.common.redis.service.RedisService;
import com.health.consultation.common.domain.Chatrecord;
import com.health.consultation.common.domain.req.ReqDoctorMsg;
import com.health.consultation.common.domain.resp.Consultation;
import com.health.consultation.common.domain.resp.HistoryDoctor;
import com.health.consultation.server.mapper.InquiryMapper;
import com.health.consultation.server.service.InquiryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Administrator
*/
@Service
public class InquiryServiceImpl implements InquiryService {
@Autowired
InquiryMapper inquiryMapper;
@Autowired
RedisService redisService;
/**
*
*
* @return List<Consultation>
*/
@Override
public List<Consultation> getDoctorInquiries () {
//获取请求的医生信息(携带科室+个人信息+权限信息)
List<Consultation> cacheList = redisService.getCacheList ("1chat");
for (Consultation consultation : cacheList) {
}
String doctorId = "";
if (cacheList.isEmpty ()) {
List<Consultation> list = inquiryMapper.getDoctorInquiries (doctorId);
redisService.setCacheList ("1chat", list);
return list;
}
return cacheList;
}
/**
* idlist
*
* @param userId
*
* @return
*/
@Override
public Result<List<HistoryDoctor>> setUpConsultation (String userId) {
//对医生角色权限判断,没权限直接返回提示入驻
String doctorId = "1";
//查看咨询列表是否有这个患者(redis查询)
List<Chatrecord> list = inquiryMapper.viewTheChatLog (userId);
if (list.isEmpty ()) {
//没有就添加到咨询列表(mysql=>redis添加redis的key:医生名+患者id+患者名)
int i = inquiryMapper.setUpConsultation (doctorId, userId);
}
//有就返回最后聊天的记录+结束时间(redis取值)
// Todo 扣除患者h币+
return null;
}
/**
*
*
* @param reqDoctorMsg
*
* @return
*/
@Override
public Result setMsgDoctor (ReqDoctorMsg reqDoctorMsg) {
// TODO 聊天记录存到mysql=>到redis
return Result.success ();
}
}

View File

@ -0,0 +1,22 @@
package com.health.consultation.service;
import com.health.consultation.domain.resp.Department;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Administrator
*/
public interface ConService {
/**
*
* getDepartmentList()
* @return List<Department>
*/
List<Department> getDepartmentList();
}

View File

@ -0,0 +1,55 @@
package com.health.consultation.service.impl;
import com.health.consultation.domain.resp.Department;
import com.health.consultation.mapper.ConMapper;
import com.health.consultation.service.ConService;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
*
* @author Administrator
*/
@Service
public class ConServiceImpl implements ConService {
@Autowired
ConMapper conMapper;
@Autowired
MqttClient mqttClient;
/**
* getDepartmentList()
*
* @return List<Department>
*/
@Override
public List<Department> getDepartmentList() {
List<Department> list= conMapper.getDepartmentList();
return list;
}
}

View File

@ -1,8 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,5 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
</profile>
</component>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="FormatOnSaveOptions">
<option name="myRunOnSave" value="true" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="OptimizeOnSaveOptions">
<option name="myRunOnSave" value="true" />
</component>
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/resources.iml" filepath="$PROJECT_DIR$/.idea/resources.iml" />
</modules>
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../.." vcs="Git" />
</component>
</project>

View File

@ -1,29 +0,0 @@
# Tomcat
server:
port: 8083
# Spring
spring:
application:
# 应用名称
name: health-consultation-server
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 10.100.1.5:8848
config:
# 配置中心地址
server-addr: 10.100.1.5:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.health.consultation.server.mapper.InquiryMapper">
<sql id="doctor">
select *
from inquiry
</sql>
<update id="setUpConsultation">
INSERT INTO `health-consultation`.`inquiry` (`doctor_id`, `patient_id`)
VALUES (#{doctorId}, #{userId});
</update>
<update id="viewTheChatLog">
</update>
<select id="getDoctorInquiries" resultType="com.health.consultation.common.domain.resp.Consultation">
SELECT c.role,
c.text,
c.history_chat_record_id
FROM inquiry i
LEFT JOIN ChatRecord c ON i.history_chat_record_id = c.history_chat_record_id
WHERE c.role IS NOT NULL
AND c.role &lt;&gt; ''
AND i.doctor_id = '1'
</select>
</mapper>

View File

@ -4,6 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.health</groupId>
<artifactId>health-consultation-service</artifactId> <artifactId>health-consultation-service</artifactId>
<version>3.6.3</version> <version>3.6.3</version>
<packaging>pom</packaging> <packaging>pom</packaging>
@ -17,13 +18,11 @@
<artifactId>health-modules</artifactId> <artifactId>health-modules</artifactId>
<version>3.6.3</version> <version>3.6.3</version>
</parent> </parent>
<properties> <properties>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
<id>dragon-public</id> <id>dragon-public</id>
@ -31,7 +30,6 @@
<url>http://10.100.1.7:8081/repository/maven-public/</url> <url>http://10.100.1.7:8081/repository/maven-public/</url>
</repository> </repository>
</repositories> </repositories>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>dragon-release</id> <id>dragon-release</id>
@ -39,5 +37,4 @@
<url>http://10.100.1.7:8081/repository/maven-releases/</url> <url>http://10.100.1.7:8081/repository/maven-releases/</url>
</repository> </repository>
</distributionManagement> </distributionManagement>
</project> </project>