mirror of
https://gitee.com/republicline/rax-remote-v2.git
synced 2025-08-24 04:04:57 +08:00
parent
291fa4efa5
commit
07ec8d5b3b
13
db/pig.sql
13
db/pig.sql
|
@ -1229,10 +1229,10 @@ CREATE TABLE `sys_hospital`
|
|||
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`start_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`end_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`status` bit(1) NULL DEFAULT NULL,
|
||||
`status` char(1) NULL DEFAULT NULL,
|
||||
`domain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`create_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`deleted` bit(1) NULL DEFAULT NULL,
|
||||
`del_flag` bit(1) NULL DEFAULT NULL,
|
||||
`update_time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`province` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
`city` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL,
|
||||
|
@ -1291,4 +1291,13 @@ CREATE TABLE `sys_message_user`
|
|||
`read_flag` bit(1) NULL DEFAULT 0 COMMENT '是否已读'
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for sys_hospital_manager
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `sys_hospital_manager`;
|
||||
CREATE TABLE `sys_hospital_manager` (
|
||||
`hospital_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
`user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
|
|
@ -23,6 +23,15 @@ public class HospitalDTO {
|
|||
private String city;
|
||||
|
||||
@Schema(description = "状态,正常 0, 冻结 1")
|
||||
private Boolean status;
|
||||
private String status;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@Schema(description = "域名")
|
||||
private String domain;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
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 com.baomidou.mybatisplus.annotation.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Data
|
||||
@Schema(description = "医院信息")
|
||||
public class SysHospital {
|
||||
|
@ -19,33 +15,37 @@ public class SysHospital {
|
|||
private Long id;
|
||||
|
||||
@Schema(description = "医院名称")
|
||||
@NotNull(message = "医院名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "编码")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
private Timestamp startTime;
|
||||
private String startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
private Timestamp endTime;
|
||||
private String endTime;
|
||||
|
||||
@Schema(description = "状态,正常 0, 冻结 1")
|
||||
private Boolean status;
|
||||
@NotNull(message = "状态不能为空")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "域名")
|
||||
private String domain;
|
||||
|
||||
@Schema(description = "是否删除")
|
||||
private Boolean deleted;
|
||||
@TableLogic
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Boolean delFlag;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Timestamp createTime;
|
||||
private String createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Timestamp updateTime;
|
||||
private String updateTime;
|
||||
|
||||
@Schema(description = "医院所在省")
|
||||
private String province;
|
||||
|
|
|
@ -46,6 +46,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 通过ID查询字典信息
|
||||
*
|
||||
* @param id ID
|
||||
* @return 字典信息
|
||||
*/
|
||||
|
@ -56,6 +57,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 查询字典信息
|
||||
*
|
||||
* @param query 查询信息
|
||||
* @return 字典信息
|
||||
*/
|
||||
|
@ -66,6 +68,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 分页查询字典信息
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 分页对象
|
||||
*/
|
||||
|
@ -77,8 +80,20 @@ public class SysDictController {
|
|||
.like(StrUtil.isNotBlank(sysDict.getDictType()), SysDict::getDictType, sysDict.getDictType())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询字典信息
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/tree")
|
||||
public R getDictList(@ParameterObject Page page, @ParameterObject SysDict sysDict) {
|
||||
return R.ok(sysDictService.getDictPage(page, sysDict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字典类型查找字典
|
||||
*
|
||||
* @param type 类型
|
||||
* @return 同类型字典
|
||||
*/
|
||||
|
@ -90,6 +105,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 添加字典
|
||||
*
|
||||
* @param sysDict 字典信息
|
||||
* @return success、false
|
||||
*/
|
||||
|
@ -103,6 +119,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 删除字典,并且清除字典缓存
|
||||
*
|
||||
* @param ids ID
|
||||
* @return R
|
||||
*/
|
||||
|
@ -116,6 +133,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 修改字典
|
||||
*
|
||||
* @param sysDict 字典信息
|
||||
* @return success/false
|
||||
*/
|
||||
|
@ -128,6 +146,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param name 名称或者字典项
|
||||
* @return
|
||||
*/
|
||||
|
@ -141,6 +160,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param sysDictItem 字典项
|
||||
* @return
|
||||
|
@ -152,6 +172,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 通过id查询字典项
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
|
@ -162,6 +183,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 查询字典项详情
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @return R
|
||||
*/
|
||||
|
@ -172,6 +194,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 新增字典项
|
||||
*
|
||||
* @param sysDictItem 字典项
|
||||
* @return R
|
||||
*/
|
||||
|
@ -184,6 +207,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 修改字典项
|
||||
*
|
||||
* @param sysDictItem 字典项
|
||||
* @return R
|
||||
*/
|
||||
|
@ -195,6 +219,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 通过id删除字典项
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
|
@ -206,6 +231,7 @@ public class SysDictController {
|
|||
|
||||
/**
|
||||
* 同步缓存字典
|
||||
*
|
||||
* @return R
|
||||
*/
|
||||
@SysLog("同步字典")
|
||||
|
|
|
@ -10,6 +10,7 @@ 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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -33,10 +34,10 @@ public class SysHospitalController {
|
|||
}
|
||||
|
||||
@SysLog(value = "医院信息删除")
|
||||
@PostMapping("/deleteHospitalById")
|
||||
@PostMapping("/deleteHospitalByIds")
|
||||
@Operation(description = "根据id删除医院信息", summary = "根据id删除医院信息")
|
||||
R<Boolean> deleteHospitalById(String id) {
|
||||
return sysHospitalService.deleteHospitalById(id);
|
||||
R<Boolean> deleteHospitalById(String[] ids) {
|
||||
return sysHospitalService.deleteHospitalByIds(ids);
|
||||
}
|
||||
|
||||
@SysLog(value = "医院信息修改")
|
||||
|
@ -64,4 +65,27 @@ public class SysHospitalController {
|
|||
R<List> getHospitalList(String name) {
|
||||
return sysHospitalService.getHospitalList(name);
|
||||
}
|
||||
|
||||
@PostMapping("/getMyHospitalList")
|
||||
@Operation(description = "获取我的医院列表", summary = "获取我的医院列表")
|
||||
R getMyHospitalList() {
|
||||
List myHospitalList = sysHospitalService.getMyHospitalList();
|
||||
return R.ok(myHospitalList);
|
||||
}
|
||||
|
||||
@SysLog(value = "添加医院管理员")
|
||||
@PostMapping("/saveHospitalManager")
|
||||
@Operation(description = "添加医院管理员", summary = "添加医院管理员")
|
||||
@PreAuthorize("@pms.hasPermission('sys_user_del')")
|
||||
R saveHospitalManager(String userId, String hospitalId) {
|
||||
boolean status = sysHospitalService.saveHospitalManager(userId, hospitalId);
|
||||
return R.ok(status);
|
||||
}
|
||||
|
||||
@PostMapping("/getHospitalManager")
|
||||
@Operation(description = "获取医院管理员", summary = "获取医院呢管理员")
|
||||
R getHospitalManager(String hospitalId) {
|
||||
List list = sysHospitalService.getHospitalManager(hospitalId);
|
||||
return R.ok(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,4 +209,11 @@ public class SysUserController {
|
|||
return userService.modifyPw(userDto);
|
||||
}
|
||||
|
||||
@PostMapping("/getUserListByHospital")
|
||||
@Operation(description = "获取某个医院下的用户", summary = "获取某个医院下的用户")
|
||||
public R getUserListByHospital(String hospitalId) {
|
||||
List userList = userService.getUserListByHospital(hospitalId);
|
||||
return R.ok(userList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@ package com.rax.admin.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rax.admin.api.entity.SysDictItem;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 字典项
|
||||
|
@ -12,5 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
|
||||
|
||||
List<Map> getDictItemList(@Param("dictId") Long dictId);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@ package com.rax.admin.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.rax.admin.api.entity.SysDict;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -14,5 +18,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||
List<Map> getDictPage(@Param("limit") Long limit, @Param("offset") Long offset, @Param("name") String name);
|
||||
|
||||
Integer getDictTotal(@Param("name") String name);
|
||||
}
|
||||
|
|
|
@ -7,10 +7,19 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface SysHospitalMapper extends BaseMapper<SysHospital> {
|
||||
List<HospitalDTO> getHospitalList(@Param("limit") Long limit, @Param("offset") Long offset, @Param("name") String name);
|
||||
|
||||
Integer getHospitalTotal();
|
||||
|
||||
boolean deleteByIds(@Param("ids") String[] ids);
|
||||
|
||||
boolean insertHospitalManager(@Param("hospitalId") String hospitalId, @Param("userId") String userId);
|
||||
|
||||
boolean delHospitalManager(@Param("hospitalId") String hospitalId);
|
||||
|
||||
List<Map> getHospitalManager(@Param("hospitalId") String hospitalId);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -53,4 +54,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
|||
*/
|
||||
List<UserVO> selectVoList(@Param("query") UserDTO userDTO);
|
||||
|
||||
List<Map> getUserListByHospital(@Param("hospitalId") String hospitalId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +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.SysDict;
|
||||
import com.rax.common.core.util.R;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 字典表
|
||||
*
|
||||
|
@ -32,4 +35,6 @@ public interface SysDictService extends IService<SysDict> {
|
|||
*/
|
||||
R syncDictCache();
|
||||
|
||||
Map getDictPage(Page page, SysDict sysDict);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,16 +13,68 @@ import java.util.Map;
|
|||
*/
|
||||
public interface SysHospitalService extends IService<SysHospital> {
|
||||
|
||||
/**
|
||||
* 根据id获取医院信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
R<SysHospital> getHospitalById(String id);
|
||||
|
||||
R<Boolean> deleteHospitalById(String id);
|
||||
/**
|
||||
* 根据id删除医院信息
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
R<Boolean> deleteHospitalByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 更新医院信息
|
||||
* @param hospitalDTO
|
||||
* @return
|
||||
*/
|
||||
R<Boolean> updateHospital(HospitalDTO hospitalDTO);
|
||||
|
||||
/**
|
||||
* 添加医院信息
|
||||
* @param hospitalDTO
|
||||
* @return
|
||||
*/
|
||||
R<Boolean> saveHospital(HospitalDTO hospitalDTO);
|
||||
|
||||
/**
|
||||
* 获取医院分页列表
|
||||
* @param name
|
||||
* @param offset
|
||||
* @param limit
|
||||
* @return
|
||||
*/
|
||||
R<Map> getHospitalList(String name, long offset, long limit);
|
||||
|
||||
/**
|
||||
* 获取医院列表
|
||||
* @param name 医院名,用于搜索
|
||||
* @return
|
||||
*/
|
||||
R<List> getHospitalList(String name);
|
||||
|
||||
/**
|
||||
* 获取我的医院列表
|
||||
* @return
|
||||
*/
|
||||
List getMyHospitalList();
|
||||
|
||||
/**
|
||||
* 添加医院管理员
|
||||
* @param userId
|
||||
* @param hospitalId
|
||||
*/
|
||||
boolean saveHospitalManager(String userId, String hospitalId);
|
||||
|
||||
/**
|
||||
* 获取医院管理人员
|
||||
* @param hospitalId
|
||||
* @return
|
||||
*/
|
||||
List getHospitalManager(String hospitalId);
|
||||
|
||||
}
|
||||
|
|
|
@ -119,4 +119,6 @@ public interface SysUserService extends IService<SysUser> {
|
|||
*/
|
||||
R modifyPw(UserDTO userDto);
|
||||
|
||||
List getUserListByHospital(String hospitalId);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.rax.admin.service.impl;
|
|||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rax.admin.api.entity.SysDict;
|
||||
import com.rax.admin.api.entity.SysDictItem;
|
||||
|
@ -18,7 +19,9 @@ import org.springframework.cache.annotation.CacheEvict;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -82,4 +85,17 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getDictPage(Page page, SysDict sysDict) {
|
||||
Map result = new HashMap();
|
||||
List<Map> dictPage = baseMapper.getDictPage(page.getSize(), page.getCurrent(), sysDict.getDescription());
|
||||
Integer dictTotal = baseMapper.getDictTotal(sysDict.getDescription());
|
||||
result.put("total", dictTotal);
|
||||
result.put("records", dictPage);
|
||||
for (Map dict : dictPage) {
|
||||
List<Map> dictItemList = dictItemMapper.getDictItemList((Long) dict.get("id"));
|
||||
dict.put("children", dictItemList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
package com.rax.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.rax.admin.api.dto.HospitalDTO;
|
||||
import com.rax.admin.api.entity.SysHospital;
|
||||
import com.rax.admin.api.entity.SysRole;
|
||||
import com.rax.admin.mapper.SysHospitalMapper;
|
||||
import com.rax.admin.service.SysHospitalService;
|
||||
import com.rax.admin.service.SysRoleService;
|
||||
import com.rax.common.core.util.R;
|
||||
import com.rax.common.security.service.RaxUser;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
|
@ -19,17 +24,23 @@ import java.util.Map;
|
|||
@Service
|
||||
public class SysHospitalServiceImpl extends ServiceImpl<SysHospitalMapper, SysHospital> implements SysHospitalService {
|
||||
|
||||
// 管理员角色可以获取过个医院列表,用,分割
|
||||
private final static String ADMIN_ROLE_CODE = "ROLE_ADMIN";
|
||||
|
||||
@Autowired
|
||||
private SysHospitalMapper sysHospitalMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleService roleService;
|
||||
|
||||
public R<SysHospital> getHospitalById(String id) {
|
||||
SysHospital sysHospital = getById(id);
|
||||
return R.ok(sysHospital);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> deleteHospitalById(String id) {
|
||||
boolean status = removeById(id);
|
||||
public R<Boolean> deleteHospitalByIds(String[] ids) {
|
||||
boolean status = sysHospitalMapper.deleteByIds(ids);
|
||||
return R.ok(status);
|
||||
}
|
||||
|
||||
|
@ -45,6 +56,8 @@ public class SysHospitalServiceImpl extends ServiceImpl<SysHospitalMapper, SysHo
|
|||
public R<Boolean> saveHospital(HospitalDTO hospitalDTO) {
|
||||
SysHospital sysHospital = new SysHospital();
|
||||
BeanUtils.copyProperties(hospitalDTO, sysHospital);
|
||||
sysHospital.setCreateTime(DateUtil.now());
|
||||
sysHospital.setDelFlag(false);
|
||||
boolean status = save(sysHospital);
|
||||
return R.ok(status);
|
||||
}
|
||||
|
@ -55,7 +68,7 @@ public class SysHospitalServiceImpl extends ServiceImpl<SysHospitalMapper, SysHo
|
|||
Integer hospitalTotal = sysHospitalMapper.getHospitalTotal();
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("count", hospitalTotal);
|
||||
result.put("total", hospitalTotal);
|
||||
result.put("list", hospitalList);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
@ -66,12 +79,49 @@ public class SysHospitalServiceImpl extends ServiceImpl<SysHospitalMapper, SysHo
|
|||
if (StringUtils.hasText(name)) {
|
||||
queryWrapper.checkSqlInjection().like("name", name);
|
||||
}
|
||||
queryWrapper.eq("deleted", 0);
|
||||
queryWrapper.eq("del_flag", 0);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
String [] columns = {"id", "name", "code", "status", "domain", "province", "city"};
|
||||
String[] columns = {"id", "name", "code", "status", "domain", "province", "city"};
|
||||
queryWrapper.select(columns);
|
||||
|
||||
List sysHospitals = sysHospitalMapper.selectMaps(queryWrapper);
|
||||
return R.ok(sysHospitals);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getMyHospitalList() {
|
||||
RaxUser raxUser = (RaxUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
List<SysRole> roleList = roleService.findRolesByUserId(raxUser.getId());
|
||||
List<SysRole> adminRoleList = roleList.stream().filter(predicate -> ADMIN_ROLE_CODE.contains(predicate.getRoleCode())).toList();
|
||||
List sysHospitals = null;
|
||||
if (!adminRoleList.isEmpty()) {
|
||||
QueryWrapper<SysHospital> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("del_flag", 0);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
queryWrapper.select(new String[]{"id", "name", "code", "status", "domain", "province", "city"});
|
||||
sysHospitals = sysHospitalMapper.selectMaps(queryWrapper);
|
||||
} else {
|
||||
QueryWrapper<SysHospital> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("id", raxUser.getHospitalId());
|
||||
queryWrapper.eq("del_flag", 0);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
queryWrapper.select(new String[]{"id", "name", "code", "status", "domain", "province", "city"});
|
||||
sysHospitals = sysHospitalMapper.selectMaps(queryWrapper);
|
||||
}
|
||||
return sysHospitals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveHospitalManager(String userId, String hospitalId) {
|
||||
boolean status = true;
|
||||
sysHospitalMapper.delHospitalManager(hospitalId);
|
||||
if (StringUtils.hasText(userId)) {
|
||||
status = sysHospitalMapper.insertHospitalManager(hospitalId, userId);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
public List getHospitalManager(String hospitalId) {
|
||||
return sysHospitalMapper.getHospitalManager(hospitalId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,6 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||
|
||||
@Override
|
||||
public R deleteMessage(String ids) {
|
||||
List<String> idList = Arrays.asList(ids.split(StrUtil.COMMA));
|
||||
ids = ids.replace(",", "','");
|
||||
return R.ok(this.baseMapper.deleteMessage(ids));
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
|
||||
private final static String PASSWD_PATTERN = "^(?=.*\\d)(?=.*[a-zA-Z])(?=.*[^\\da-zA-Z\\s]).{9,15}$";
|
||||
|
||||
private final SysUserMapper userMapper;
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
*
|
||||
|
@ -489,4 +491,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getUserListByHospital(String hospitalId) {
|
||||
List list = userMapper.getUserListByHospital(hospitalId);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?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.rax.admin.mapper.SysDictItemMapper">
|
||||
<select id="getDictItemList" resultType="map">
|
||||
select id, dict_id "dictId", label, item_value "value", dict_type "dictType",
|
||||
description, sort_order "sortOrder", remarks
|
||||
from sys_dict_item
|
||||
where del_flag = 0 and dict_id = #{dictId} ORDER BY sort_order asc, create_time desc;
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,25 @@
|
|||
<?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.rax.admin.mapper.SysDictMapper">
|
||||
<sql id="pageSQL">
|
||||
from sys_dict
|
||||
where del_flag = 0
|
||||
<if test="name != null and name != ''">
|
||||
<bind name="bindName" value="'%' + name + '%'"/>
|
||||
and description like #{bindName}
|
||||
</if>
|
||||
</sql>
|
||||
<select id="getDictPage" resultType="map">
|
||||
select id, dict_type "dictType", description, remarks, system_flag "systemFlag"
|
||||
|
||||
<include refid="pageSQL"/>
|
||||
|
||||
ORDER BY create_time desc
|
||||
limit #{offset},#{limit};
|
||||
</select>
|
||||
|
||||
<select id="getDictTotal" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
<include refid="pageSQL"/>
|
||||
</select>
|
||||
</mapper>
|
|
@ -7,6 +7,9 @@
|
|||
code,
|
||||
status,
|
||||
province,
|
||||
start_time "startTime",
|
||||
end_time "endTime",
|
||||
domain,
|
||||
city
|
||||
</sql>
|
||||
|
||||
|
@ -14,7 +17,7 @@
|
|||
|
||||
FROM sys_hospital
|
||||
|
||||
WHERE deleted = 0
|
||||
WHERE del_flag = 0
|
||||
|
||||
<if test="name != null and name != ''">
|
||||
<bind name="bindName" value="'%' + name + '%'"/>
|
||||
|
@ -39,5 +42,31 @@
|
|||
<include refid="hospitalSelectSQL"/>
|
||||
</select>
|
||||
|
||||
<update id="deleteByIds">
|
||||
update sys_hospital set del_flag = 1
|
||||
where
|
||||
<if test="ids != null and ids.length != 0">
|
||||
<foreach item="item" index="index" collection="ids"
|
||||
open="id in (" separator="," close=")" nullable="false">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<delete id="delHospitalManager">
|
||||
DELETE FROM sys_hospital_manager where hospital_id = #{hospitalId};
|
||||
</delete>
|
||||
|
||||
<insert id="insertHospitalManager">
|
||||
INSERT INTO sys_hospital_manager VALUES (#{hospitalId}, #{userId});
|
||||
</insert>
|
||||
|
||||
<select id="getHospitalManager" resultType="map">
|
||||
select u.user_id "id", u.name, u.phone
|
||||
from sys_hospital_manager hm
|
||||
left join sys_user u
|
||||
on u.user_id = hm.user_id
|
||||
where u.del_flag = 0 and hm.hospital_id = #{hospitalId};
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -177,4 +177,10 @@
|
|||
ORDER BY u.create_time DESC
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getUserListByHospital" resultType="map">
|
||||
SELECT user_id "id", name, hospital_id "hospitalId", phone
|
||||
FROM sys_user
|
||||
WHERE del_flag = 0 AND hospital_id = #{hospitalId} ORDER BY create_time DESC;
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -16,6 +16,9 @@ import org.springframework.web.socket.WebSocketSession;
|
|||
import java.net.URLDecoder;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 生命体征和标志位信息
|
||||
*/
|
||||
public class MedicineHandler implements WebSocketHandler {
|
||||
|
||||
@Resource
|
||||
|
@ -26,7 +29,6 @@ public class MedicineHandler implements WebSocketHandler {
|
|||
|
||||
@Override
|
||||
public void afterConnectionEstablished(WebSocketSession session) throws Exception {
|
||||
session.getPrincipal();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.rax.vital.medicine.controller;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rax.common.core.util.R;
|
||||
import com.rax.vital.medicine.service.DoctorMedicineService;
|
||||
import com.rax.vital.medicine.service.VitalSignsService;
|
||||
import com.rax.vital.timer.VitalSignTimer;
|
||||
import com.rax.vital.util.DatabaseNameUtil;
|
||||
|
@ -41,7 +42,10 @@ public class MedicineController {
|
|||
private OAuth2AuthorizationService authorizationService;
|
||||
|
||||
@Autowired
|
||||
VitalSignsService vitalSignsService;
|
||||
private VitalSignsService vitalSignsService;
|
||||
|
||||
@Autowired
|
||||
private DoctorMedicineService doctorMedicineService;
|
||||
|
||||
@MessageMapping("/getSurgeryData")
|
||||
public void doctorMedicine(MessageHeaders messageHeaders, String body) {
|
||||
|
@ -91,4 +95,9 @@ public class MedicineController {
|
|||
String databaseName = DatabaseNameUtil.encrypt(patientName) + "_" + DatabaseNameUtil.encrypt(idNum) + "_" + date;
|
||||
return vitalSignsService.getPatientInfo(databaseName);
|
||||
}
|
||||
|
||||
@PostMapping("/getDatabaseList")
|
||||
public R getDatabaseList() {
|
||||
return vitalSignsService.getDatabaseList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,6 @@ public interface VitalSignsService {
|
|||
List<Map> getVitalSignsList(Connection connection);
|
||||
|
||||
R getPatientInfo(String databaseName);
|
||||
|
||||
R getDatabaseList();
|
||||
}
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
package com.rax.vital.medicine.service.impl;
|
||||
|
||||
import com.mongodb.ConnectionString;
|
||||
import com.mongodb.MongoClientSettings;
|
||||
import com.mongodb.client.MongoClient;
|
||||
import com.mongodb.client.MongoClients;
|
||||
import com.mongodb.client.MongoIterable;
|
||||
import com.rax.common.core.util.R;
|
||||
import com.rax.vital.datasource.MongoDBSource;
|
||||
import com.rax.vital.medicine.service.VitalSignsService;
|
||||
import com.rax.vital.timer.VitalSignTimer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.bson.Document;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.mongodb.SpringDataMongoDB;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Criteria;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -23,6 +25,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 生命体征数据
|
||||
|
@ -43,6 +46,9 @@ public class VitalSignServiceImpl implements VitalSignsService {
|
|||
@Value("${vital-sign.mongodb.password}")
|
||||
private String mongoPassword;
|
||||
|
||||
@Value("${vital-sign.except-database}")
|
||||
private String exceptDatabase;
|
||||
|
||||
/**
|
||||
* 获取生命体征最新一条数据
|
||||
*
|
||||
|
@ -115,4 +121,17 @@ public class VitalSignServiceImpl implements VitalSignsService {
|
|||
mongoDBSource.close();
|
||||
return R.ok(vitalList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getDatabaseList() {
|
||||
MongoClientSettings.Builder mongoBuilder = MongoClientSettings.builder();
|
||||
// mongodb://账户:密码@ip:端口/?authSource=admin
|
||||
String connectionUrl = "mongodb://" + mongoUsername + ":" + mongoPassword + "@" + mongoDBHost + "/" + "?authSource=admin";
|
||||
mongoBuilder.applyConnectionString(new ConnectionString(connectionUrl));
|
||||
MongoClient mongoClient = MongoClients.create(mongoBuilder.build(), SpringDataMongoDB.driverInformation());
|
||||
MongoIterable<String> databaseNames = mongoClient.listDatabaseNames();
|
||||
for (String database: databaseNames) {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user