mirror of
https://gitee.com/republicline/rax-remote-v2.git
synced 2025-08-24 04:04:57 +08:00
parent
70f8041d47
commit
a7e0026e79
|
@ -55,18 +55,23 @@ public class RaxUser extends User implements OAuth2AuthenticatedPrincipal {
|
|||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private final Long deptId;
|
||||
|
||||
@Getter
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private final Long hospitalId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Getter
|
||||
private final String phone;
|
||||
|
||||
public RaxUser(Long id, Long deptId, String username, String password, String phone, boolean enabled,
|
||||
public RaxUser(Long id, Long deptId, Long hospitalId, String username, String password, String phone, boolean enabled,
|
||||
boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked,
|
||||
Collection<? extends GrantedAuthority> authorities) {
|
||||
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
|
||||
this.id = id;
|
||||
this.deptId = deptId;
|
||||
this.hospitalId = hospitalId;
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public interface RaxUserDetailsService extends UserDetailsService, Ordered {
|
|||
SysUser user = info.getSysUser();
|
||||
|
||||
// 构造security用户
|
||||
return new RaxUser(user.getUserId(), user.getDeptId(), user.getUsername(),
|
||||
return new RaxUser(user.getUserId(), user.getDeptId(), user.getHospitalId(), user.getUsername(),
|
||||
SecurityConstants.BCRYPT + user.getPassword(), user.getPhone(), true, true, true,
|
||||
StrUtil.equals(user.getLockFlag(), CommonConstants.STATUS_NORMAL), authorities);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ import com.rax.common.core.util.R;
|
|||
import com.rax.common.log.annotation.SysLog;
|
||||
import com.rax.dailyplan.dto.DailyPlanDTO;
|
||||
import com.rax.dailyplan.service.DailyPlanService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
@RestController
|
||||
@RequestMapping("/dailyPlan")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
@Tag(description = "dailyPlan", name = "日常计划模块")
|
||||
public class DailyPlanController {
|
||||
|
||||
@Autowired
|
||||
|
@ -19,27 +22,32 @@ public class DailyPlanController {
|
|||
|
||||
@SysLog("添加更新日常计划")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
@Operation(summary = "添加更新日常计划", description = "添加更新日常计划")
|
||||
public R saveOrUpdate(DailyPlanDTO dailyPlanDTO) {
|
||||
return dailyPlanService.saveOrUpdate(dailyPlanDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/getListByDate")
|
||||
@Operation(summary = "根据日期获取列表", description = "根据日期获取列表")
|
||||
public R getListByDate(String date) {
|
||||
return dailyPlanService.getListByDate(date);
|
||||
}
|
||||
|
||||
@SysLog("日常计划删除")
|
||||
@PostMapping("/deleteById")
|
||||
@Operation(summary = "日常计划删除", description = "日常计划删除")
|
||||
public R deleteById(String id) {
|
||||
return dailyPlanService.deleteById(id);
|
||||
}
|
||||
|
||||
@PostMapping("/getPlanDateList")
|
||||
@Operation(summary = "根据开始和结束时间获取有计划的日期列表", description = "根据开始和结束时间获取有计划的日期列表")
|
||||
public R getPlanDateList(String startDate, String endDate) {
|
||||
return dailyPlanService.getPlanDateList(startDate, endDate);
|
||||
}
|
||||
|
||||
@PostMapping("/getTodoCountByDate")
|
||||
@Operation(summary = "根据日期获取待办总数", description = "根据日期获取待办总数")
|
||||
public R getTodoCountByDate(String date) {
|
||||
return dailyPlanService.getTodoCountByDate(date);
|
||||
}
|
||||
|
|
17
db/pig.sql
17
db/pig.sql
|
@ -1264,5 +1264,22 @@ CREATE TABLE `sys_daily_plan`
|
|||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
|
||||
|
||||
DROP TABLE IF EXISTS `sys_message`;
|
||||
CREATE TABLE `sys_message`
|
||||
(
|
||||
`id` bigint NOT NULL COMMENT '主键',
|
||||
`category` varchar(800) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '消息类型',
|
||||
`hospital` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '医院名称',ssss
|
||||
`message` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '消息内容',
|
||||
`href` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '跳转链接',
|
||||
`hotspots` bit(1) NULL DEFAULT 0 COMMENT '是否热点',
|
||||
`del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '删除标记,0未删除,1已删除',
|
||||
`creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '所属人',
|
||||
`receiver` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '接收人',
|
||||
`create_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
|
||||
|
||||
SET
|
||||
FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package com.rax.admin.api.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -19,11 +23,15 @@ public class SysMessage {
|
|||
BULLETIN
|
||||
}
|
||||
|
||||
@Schema(description = "消息类型")
|
||||
private Category category;
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@Schema(description = "id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "医院名称")
|
||||
private String history;
|
||||
@Schema(description = "消息类型")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "医院id")
|
||||
private Long hospital;
|
||||
|
||||
@Schema(description = "消息内容")
|
||||
private String message;
|
||||
|
@ -34,9 +42,20 @@ public class SysMessage {
|
|||
@Schema(description = "是否热点")
|
||||
private Boolean hotspots;
|
||||
|
||||
@Schema(description = "组织权限")
|
||||
private String organizationPer;
|
||||
@Schema(description = "删除")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String delFlag;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private Long creator;
|
||||
|
||||
@Schema(description = "接收人")
|
||||
private String receiver;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@Schema(description = "可见组织")
|
||||
private String organization;
|
||||
}
|
||||
|
|
|
@ -148,6 +148,6 @@ public class SysUser implements Serializable {
|
|||
private String sex;
|
||||
|
||||
@Schema(description = "医院")
|
||||
private String hospitalId;
|
||||
private Long hospitalId;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.rax.admin.api.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "系统消息")
|
||||
public class SysMessageVO {
|
||||
|
||||
@Schema(description = "接收人")
|
||||
private String receiver;
|
||||
|
||||
@Schema(description = "消息类型")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "消息内容")
|
||||
private String message;
|
||||
|
||||
@Schema(description = "跳转链接")
|
||||
private String href;
|
||||
|
||||
@Schema(description = "是否热点")
|
||||
private Boolean hotspots;
|
||||
}
|
|
@ -4,6 +4,8 @@ import com.rax.admin.api.dto.HospitalDTO;
|
|||
import com.rax.admin.api.entity.SysHospital;
|
||||
import com.rax.admin.service.SysHospitalService;
|
||||
import com.rax.common.core.util.R;
|
||||
import com.rax.common.log.annotation.SysLog;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -25,31 +27,40 @@ public class SysHospitalController {
|
|||
private SysHospitalService sysHospitalService;
|
||||
|
||||
@PostMapping("/getHospitalById")
|
||||
@Operation(description = "根据id获取医院信息", summary = "根据id获取医院信息")
|
||||
R<SysHospital> getHospitalById(String id) {
|
||||
return sysHospitalService.getHospitalById(id);
|
||||
}
|
||||
|
||||
@SysLog(value = "医院信息删除")
|
||||
@PostMapping("/deleteHospitalById")
|
||||
@Operation(description = "根据id删除医院信息", summary = "根据id删除医院信息")
|
||||
R<Boolean> deleteHospitalById(String id) {
|
||||
return sysHospitalService.deleteHospitalById(id);
|
||||
}
|
||||
|
||||
@SysLog(value = "医院信息修改")
|
||||
@PostMapping("/updateHospital")
|
||||
@Operation(description = "医院信息修改", summary = "医院信息修改")
|
||||
R<Boolean> updateHospital(HospitalDTO hospitalDTO) {
|
||||
return sysHospitalService.updateHospital(hospitalDTO);
|
||||
}
|
||||
|
||||
@SysLog(value = "新建医院信息")
|
||||
@PostMapping("/saveHospital")
|
||||
@Operation(description = "新建医院信息", summary = "新建医院信息")
|
||||
R<Boolean> saveHospital(HospitalDTO hospitalDTO) {
|
||||
return sysHospitalService.saveHospital(hospitalDTO);
|
||||
}
|
||||
|
||||
@PostMapping("/getHospitalPage")
|
||||
@Operation(description = "根据分页获取医院信息", summary = "根据分页获取医院信息")
|
||||
R<Map> getHospitalPage(String name, long offset, long limit) {
|
||||
return sysHospitalService.getHospitalList(name, offset, limit);
|
||||
}
|
||||
|
||||
@PostMapping("/getHospitalList")
|
||||
@Operation(description = "根据获取医院列表", summary = "根据获取医院列表")
|
||||
R<List> getHospitalList(String name) {
|
||||
return sysHospitalService.getHospitalList(name);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.rax.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.rax.admin.api.entity.SysMessage;
|
||||
import com.rax.admin.api.vo.SysMessageVO;
|
||||
import com.rax.admin.service.SysMessageService;
|
||||
import com.rax.common.core.util.R;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/sysMessage")
|
||||
@Tag(description = "系统消息", name = "系统消息")
|
||||
public class SysMessageController {
|
||||
|
||||
@Autowired
|
||||
private SysMessageService sysMessageService;
|
||||
|
||||
@PostMapping("/save")
|
||||
public R save(SysMessageVO sysMessageVO) {
|
||||
return sysMessageService.saveMessage(sysMessageVO);
|
||||
}
|
||||
|
||||
@PostMapping("/page")
|
||||
public R page(Page page, SysMessageVO sysMessageVO) {
|
||||
return R.ok(sysMessageService.page(page, Wrappers.<SysMessage>lambdaQuery()
|
||||
.eq(StringUtils.hasText(sysMessageVO.getCategory()),
|
||||
SysMessage::getCategory,
|
||||
sysMessageVO.getCategory())
|
||||
.like(StringUtils.hasText(sysMessageVO.getMessage()),
|
||||
SysMessage::getMessage,
|
||||
sysMessageVO.getMessage())));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.rax.admin.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rax.admin.api.entity.SysMessage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysMessageMapper extends BaseMapper<SysMessage> {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.rax.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.rax.admin.api.entity.SysMessage;
|
||||
import com.rax.admin.api.vo.SysMessageVO;
|
||||
import com.rax.common.core.util.R;
|
||||
|
||||
public interface SysMessageService extends IService<SysMessage> {
|
||||
|
||||
R saveMessage(SysMessageVO sysMessageVO);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.rax.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rax.admin.api.entity.SysMessage;
|
||||
import com.rax.admin.api.vo.SysMessageVO;
|
||||
import com.rax.admin.mapper.SysMessageMapper;
|
||||
import com.rax.admin.service.SysMessageService;
|
||||
import com.rax.common.core.util.R;
|
||||
import com.rax.common.security.service.RaxUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMessage> implements SysMessageService {
|
||||
|
||||
@Override
|
||||
public R saveMessage(SysMessageVO sysMessageVO) {
|
||||
SysMessage sysMessage = new SysMessage();
|
||||
BeanUtils.copyProperties(sysMessageVO, sysMessage);
|
||||
RaxUser raxUser = (RaxUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
sysMessage.setCreator(raxUser.getId());
|
||||
sysMessage.setHospital(raxUser.getHospitalId());
|
||||
sysMessage.setCreateTime(DateUtil.now());
|
||||
sysMessage.setUpdateTime(DateUtil.now());
|
||||
boolean status = save(sysMessage);
|
||||
return R.ok(status);
|
||||
}
|
||||
}
|
|
@ -43,6 +43,7 @@ public class WebSocketConfig implements WebSocketConfigurer {
|
|||
return new AddMedicineHandler();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public WebSocketHandler machineHandler() {
|
||||
return new MachineFeedbackHandler();
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ public class VitalSignTimer {
|
|||
|
||||
private static final Map<String, WebSocketSession> machineSessionMap = new ConcurrentHashMap<>();
|
||||
|
||||
private static final Map<String , String> machineDatabaseSessionMap = new ConcurrentHashMap<>();
|
||||
private static final Map<String, String> machineDatabaseSessionMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 根据当前用户和患者数据库进行查询生命体征和用药信息并推送,数据库类型是MongoDB
|
||||
|
@ -334,9 +334,16 @@ public class VitalSignTimer {
|
|||
if (machineDatabaseSessionMap.containsKey(database)) {
|
||||
String sessionId = machineDatabaseSessionMap.get(database);
|
||||
WebSocketSession machineSession = machineSessionMap.get(sessionId);
|
||||
if (machineSession != null) {
|
||||
result.put(medicine, value);
|
||||
result.put("flag", flag);
|
||||
machineSession.sendMessage(new TextMessage(result.toJSONString().getBytes()));
|
||||
} else {
|
||||
result.put("flag", flag);
|
||||
result.put("msg", "设备端未连接");
|
||||
result.put("status", 1);
|
||||
session.sendMessage(new TextMessage(result.toJSONString().getBytes()));
|
||||
}
|
||||
} else {
|
||||
result.put("flag", flag);
|
||||
result.put("medicine", medicine);
|
||||
|
|
Loading…
Reference in New Issue
Block a user