end #13

Merged
prxhap34i merged 42 commits from develop into main 3 months ago

@ -1,16 +1,27 @@
// 定义包名通常用于组织代码结构这里表示该类属于com.annotation包
package com.annotation; package com.annotation;
// 导入ElementType枚举类该枚举类定义了注解可以应用的目标元素类型如类、方法、参数等
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
// 导入Retention注解用于指定注解的保留策略
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
// 导入RetentionPolicy枚举类该枚举类定义了注解的保留策略类型如SOURCE、CLASS、RUNTIME
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
// 导入Target注解用于指定注解可以应用的目标元素类型
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* *
*
*/ */
// @Target注解指定该自定义注解可以应用的目标元素类型这里ElementType.PARAMETER表示可以应用在方法的参数上
@Target(ElementType.PARAMETER) @Target(ElementType.PARAMETER)
// @Retention注解指定该自定义注解的保留策略这里RetentionPolicy.RUNTIME表示注解在运行时仍然保留可以通过反射机制获取
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
// 使用@interface关键字定义一个自定义注解名为APPLoginUser
public @interface APPLoginUser { public @interface APPLoginUser {
// 这里注解没有定义属性,如果需要可以添加属性,例如:
// String value() default "";
// 这样就定义了一个名为value的属性默认值为空字符串
} }

@ -1,12 +1,28 @@
// 声明该类所在的包为 com.annotation用于组织和管理代码
package com.annotation; package com.annotation;
// 导入 Java 中用于定义注解的相关类
// 其中java.lang.annotation 包包含了创建自定义注解所需的核心类
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
* Token * Token
* Token
* Web
* 使
*/ */
// @Target 注解用于指定自定义注解可以应用的目标元素类型
// ElementType.METHOD 表示该注解可以应用在方法上
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
// @Retention 注解用于指定自定义注解的保留策略
// RetentionPolicy.RUNTIME 表示该注解在运行时仍然保留,可通过反射机制获取
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
// @Documented 注解表示该自定义注解会被包含在 Javadoc 文档中
@Documented @Documented
// 使用 @interface 关键字定义一个自定义注解,名为 IgnoreAuth
public @interface IgnoreAuth { public @interface IgnoreAuth {
// 注解中没有定义属性,如果有需要可以添加属性,例如:
// String value() default "";
// 这会定义一个名为 value 的属性,默认值为空字符串
} }

@ -1,14 +1,29 @@
// 声明该类所属的包为 com.annotation用于将相关的类组织在一起便于管理和维护
package com.annotation; package com.annotation;
// 导入 ElementType 枚举类,该枚举类定义了注解可以应用的目标元素类型
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
// 导入 Retention 注解,用于指定注解的保留策略
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
// 导入 RetentionPolicy 枚举类,它定义了不同的注解保留策略
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
// 导入 Target 注解,用于指定注解可以应用在哪些目标元素上
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** /**
* *
*
*
*/ */
// @Target 注解指定此自定义注解的使用范围ElementType.PARAMETER 表示该注解只能应用于方法的参数上
@Target(ElementType.PARAMETER) @Target(ElementType.PARAMETER)
// @Retention 注解指定注解的保留策略RetentionPolicy.RUNTIME 表示该注解在运行时仍然保留,
// 这样在程序运行期间可以通过反射机制来获取该注解的信息
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
// 使用 @interface 关键字定义一个自定义注解,名为 LoginUser
public @interface LoginUser { public @interface LoginUser {
// 此处注解没有定义属性,如果有需求,可以添加属性,例如:
// String value() default "";
// 这会定义一个名为 value 的属性,默认值为空字符串
} }

@ -1,39 +1,69 @@
// 声明该类所属的包名为 com.config用于组织和管理配置相关的类
package com.config; package com.config;
// 导入 Spring 框架中用于定义 Bean 的注解
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
// 导入 Spring 框架中用于标记配置类的注解
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
// 导入 Spring MVC 中用于配置拦截器注册的类
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
// 导入 Spring MVC 中用于配置资源处理器的类
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
// 导入 Spring MVC 中用于支持 Web MVC 配置的基类
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
// 导入自定义的授权拦截器类
import com.interceptor.AuthorizationInterceptor; import com.interceptor.AuthorizationInterceptor;
/**
* WebMvcConfigurationSupport
* Spring MVC
*/
@Configuration @Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport { public class InterceptorConfig extends WebMvcConfigurationSupport {
/**
* AuthorizationInterceptor Spring Bean
* @return AuthorizationInterceptor
*/
@Bean @Bean
public AuthorizationInterceptor getAuthorizationInterceptor() { public AuthorizationInterceptor getAuthorizationInterceptor() {
return new AuthorizationInterceptor(); return new AuthorizationInterceptor();
} }
/**
*
* @param registry
*/
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(getAuthorizationInterceptor()).addPathPatterns("/**").excludePathPatterns("/static/**"); // 向注册表中添加自定义的授权拦截器
registry.addInterceptor(getAuthorizationInterceptor())
// 设置拦截的路径模式,这里表示拦截所有请求
.addPathPatterns("/**")
// 设置排除的路径模式,这里表示不拦截以 /static/ 开头的请求
.excludePathPatterns("/static/**");
// 调用父类的方法,确保父类的拦截器配置也能生效
super.addInterceptors(registry); super.addInterceptors(registry);
} }
/** /**
* springboot 2.0WebMvcConfigurationSupport访addResourceHandlers * springboot 2.0 WebMvcConfigurationSupport
* 访 addResourceHandlers
* @param registry
*/ */
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 配置资源处理器,处理所有请求路径
registry.addResourceHandler("/**") registry.addResourceHandler("/**")
// 添加资源的位置,当请求静态资源时,会从这些位置查找
.addResourceLocations("classpath:/resources/") .addResourceLocations("classpath:/resources/")
.addResourceLocations("classpath:/static/") .addResourceLocations("classpath:/static/")
.addResourceLocations("classpath:/admin/") .addResourceLocations("classpath:/admin/")
.addResourceLocations("classpath:/img/") .addResourceLocations("classpath:/img/")
.addResourceLocations("classpath:/front/") .addResourceLocations("classpath:/front/")
.addResourceLocations("classpath:/public/"); .addResourceLocations("classpath:/public/");
// 调用父类的方法,确保父类的资源处理器配置也能生效
super.addResourceHandlers(registry); super.addResourceHandlers(registry);
} }
} }

@ -1,25 +1,50 @@
// 声明该类所属的包名为 com.config用于组织和管理配置相关的类
package com.config; package com.config;
// 导入日期类,用于表示时间
import java.util.Date; import java.util.Date;
// 导入 MyBatis 框架中用于处理元对象的类,元对象可以方便地操作对象的属性
import org.apache.ibatis.reflection.MetaObject; import org.apache.ibatis.reflection.MetaObject;
// 导入 MyBatis-Plus 框架中用于自定义元对象处理器的基类
import com.baomidou.mybatisplus.mapper.MetaObjectHandler; import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
/** /**
* *
* MyBatis-Plus MetaObjectHandler
*/ */
public class MyMetaObjectHandler extends MetaObjectHandler { public class MyMetaObjectHandler extends MetaObjectHandler {
/**
*
* MyBatis-Plus
* @param metaObject
*/
@Override @Override
public void insertFill(MetaObject metaObject) { public void insertFill(MetaObject metaObject) {
// 使用 setFieldValByName 方法为指定字段设置值
// 第一个参数 "ctime" 是要设置值的字段名
// 第二个参数 new Date() 是要设置的值,这里表示当前时间
// 第三个参数 metaObject 是元对象,用于定位要操作的对象
this.setFieldValByName("ctime", new Date(), metaObject); this.setFieldValByName("ctime", new Date(), metaObject);
} }
/**
*
*
* @return false
*/
@Override @Override
public boolean openUpdateFill() { public boolean openUpdateFill() {
return false; return false;
} }
/**
*
* openUpdateFill false
* @param metaObject
*/
@Override @Override
public void updateFill(MetaObject metaObject) { public void updateFill(MetaObject metaObject) {
// 关闭更新填充、这里不执行 // 关闭更新填充、这里不执行

@ -1,161 +1,246 @@
package com.controller; ppackage com.controller;
import java.io.File; import java.io.File;
// 导入用于高精度十进制计算的类
import java.math.BigDecimal; import java.math.BigDecimal;
// 导入处理 URL 的类
import java.net.URL; import java.net.URL;
// 导入用于格式化日期的类
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
// 导入阿里巴巴的 JSON 处理类
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*; import java.util.*;
// 导入 Spring 框架用于 Bean 属性复制的工具类
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
// 导入 Servlet 请求相关类
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
// 导入 Spring 上下文加载器类
import org.springframework.web.context.ContextLoader; import org.springframework.web.context.ContextLoader;
// 导入 Servlet 上下文类
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
// 导入自定义的 Token 服务类
import com.service.TokenService; import com.service.TokenService;
// 导入自定义的工具类包
import com.utils.*; import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入自定义的字典服务类
import com.service.DictionaryService; import com.service.DictionaryService;
// 导入 Apache Commons 提供的字符串工具类
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger; import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// 导入 Spring 的自动注入注解
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
// 导入 Spring 的控制器注解
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
// 导入 Spring 的请求映射注解
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
// 导入 MyBatis-Plus 的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类包
import com.entity.*; import com.entity.*;
// 导入自定义的视图实体类包
import com.entity.view.*; import com.entity.view.*;
// 导入自定义的服务类包
import com.service.*; import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils; import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R; import com.utils.R;
// 导入阿里巴巴的 JSON 处理类
import com.alibaba.fastjson.*; import com.alibaba.fastjson.*;
/** /**
* 线 * 线
* *
* @author * @author
* @email * @email
*/ */
// @RestController 注解表示该类是一个 RESTful 风格的控制器,处理 HTTP 请求并返回 JSON 等数据格式
@RestController @RestController
// @Controller 注解表示该类是一个 Spring MVC 控制器,用于处理请求
@Controller @Controller
// @RequestMapping 注解用于映射请求路径,这里所有的请求路径都以 /chat 开头
@RequestMapping("/chat") @RequestMapping("/chat")
public class ChatController { public class ChatController {
// 日志记录器,用于记录控制器相关的日志信息
private static final Logger logger = LoggerFactory.getLogger(ChatController.class); private static final Logger logger = LoggerFactory.getLogger(ChatController.class);
// 自动注入 ChatService用于处理与在线咨询相关的业务逻辑
@Autowired @Autowired
private ChatService chatService; private ChatService chatService;
// 自动注入 TokenService用于处理与 Token 相关的业务逻辑
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
// 自动注入 DictionaryService用于处理与字典表相关的业务逻辑
@Autowired @Autowired
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
//级联表service // 级联表 service,自动注入 YonghuService用于处理与用户相关的业务逻辑
@Autowired @Autowired
private YonghuService yonghuService; private YonghuService yonghuService;
// 级联表 service自动注入 YishengService用于处理与医生相关的业务逻辑
@Autowired @Autowired
private YishengService yishengService; private YishengService yishengService;
/** /**
* *
* 线
* @param params Map
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){ public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 获取当前用户的角色信息
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 这个条件永远为 false这里的代码逻辑可能有误正常不会进入此分支
if(false) if(false)
return R.error(511,"永不会进入"); return R.error(511,"永不会进入");
// 如果用户角色是 "用户",则将用户 ID 添加到请求参数中
else if("用户".equals(role)) else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId")); params.put("yonghuId",request.getSession().getAttribute("userId"));
// 如果用户角色是 "医生",则将医生 ID 添加到请求参数中
else if("医生".equals(role)) else if("医生".equals(role))
params.put("yishengId",request.getSession().getAttribute("userId")); params.put("yishengId",request.getSession().getAttribute("userId"));
// 如果请求参数中没有指定排序字段,则默认按 id 排序
if(params.get("orderBy")==null || params.get("orderBy")==""){ if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id"); params.put("orderBy","id");
} }
// 调用 ChatService 的 queryPage 方法获取分页数据
PageUtils page = chatService.queryPage(params); PageUtils page = chatService.queryPage(params);
//字典表数据转换 // 将分页数据中的列表转换为 ChatView 类型的列表
List<ChatView> list =(List<ChatView>)page.getList(); List<ChatView> list =(List<ChatView>)page.getList();
// 遍历列表,对每个 ChatView 对象进行字典表数据转换
for(ChatView c:list){ for(ChatView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request); dictionaryService.dictionaryConvert(c, request);
} }
// 返回成功响应,并将分页数据封装在 data 属性中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* 线
* @param id 线 ID
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){ public R info(@PathVariable("id") Long id, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要查询的 ID
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
// 根据 ID 查询在线咨询记录
ChatEntity chat = chatService.selectById(id); ChatEntity chat = chatService.selectById(id);
// 如果查询到记录
if(chat !=null){ if(chat !=null){
//entity转view // 将 ChatEntity 转换为 ChatView
ChatView view = new ChatView(); ChatView view = new ChatView();
BeanUtils.copyProperties( chat , view );//把实体数据重构到view中 // 使用 BeanUtils 将 ChatEntity 的属性复制到 ChatView 中
//级联表 BeanUtils.copyProperties( chat , view );
// 级联查询用户信息
YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId()); YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());
// 如果查询到用户信息
if(yonghu != null){ if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段 // 将用户信息的部分属性复制到 ChatView 中,并排除指定字段
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});
// 设置 ChatView 中的用户 ID
view.setYonghuId(yonghu.getId()); view.setYonghuId(yonghu.getId());
} }
//修改对应字典表字段 // 对 ChatView 对象进行字典表数据转换
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将处理后的 ChatView 数据封装在 data 属性中
return R.ok().put("data", view); return R.ok().put("data", view);
}else { }else {
// 如果未查询到记录,返回错误响应
return R.error(511,"查不到数据"); return R.error(511,"查不到数据");
} }
} }
/** /**
* *
* 线
* @param chat 线
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody ChatEntity chat, HttpServletRequest request){ public R save(@RequestBody ChatEntity chat, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要保存的 ChatEntity 对象
logger.debug("save方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString()); logger.debug("save方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
// 获取当前用户的角色信息
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 这个条件永远为 false这里的代码逻辑可能有误正常不会进入此分支
if(false) if(false)
return R.error(511,"永远不会进入"); return R.error(511,"永远不会进入");
// 如果用户角色是 "用户",则设置在线咨询记录的用户 ID
else if("用户".equals(role)) else if("用户".equals(role))
chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")))); chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 创建查询条件,检查是否已存在相同数据
Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>() Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>()
.eq("yonghu_id", chat.getYonghuId()) .eq("yonghu_id", chat.getYonghuId())
.eq("chat_issue", chat.getChatIssue()) .eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply()) .eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes()) .eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes()) .eq("chat_types", chat.getChatTypes());
;
// 记录查询条件的 SQL 片段日志
logger.info("sql语句:"+queryWrapper.getSqlSegment()); logger.info("sql语句:"+queryWrapper.getSqlSegment());
// 根据查询条件查询是否已存在相同数据
ChatEntity chatEntity = chatService.selectOne(queryWrapper); ChatEntity chatEntity = chatService.selectOne(queryWrapper);
// 如果不存在相同数据
if(chatEntity==null){ if(chatEntity==null){
// 设置插入时间为当前时间
chat.setInsertTime(new Date()); chat.setInsertTime(new Date());
// 插入在线咨询记录
chatService.insert(chat); chatService.insert(chat);
// 返回成功响应
return R.ok(); return R.ok();
}else { }else {
// 如果存在相同数据,返回错误响应
return R.error(511,"表中有相同数据"); return R.error(511,"表中有相同数据");
} }
} }
/** /**
* *
* 线
* @param chat 线
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody ChatEntity chat, HttpServletRequest request){ public R update(@RequestBody ChatEntity chat, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要修改的 ChatEntity 对象
logger.debug("update方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString()); logger.debug("update方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
// 获取当前用户的角色信息
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false) // if(false)
// return R.error(511,"永远不会进入"); // return R.error(511,"永远不会进入");
// else if("用户".equals(role)) // else if("用户".equals(role))
// chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")))); // chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//根据字段查询是否有相同数据 // 创建查询条件,检查是否已存在相同数据(排除当前要修改的记录)
Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>() Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>()
.notIn("id",chat.getId()) .notIn("id",chat.getId())
.andNew() .andNew()
@ -163,159 +248,172 @@ public class ChatController {
.eq("chat_issue", chat.getChatIssue()) .eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply()) .eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes()) .eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes()) .eq("chat_types", chat.getChatTypes());
;
// 记录查询条件的 SQL 片段日志
logger.info("sql语句:"+queryWrapper.getSqlSegment()); logger.info("sql语句:"+queryWrapper.getSqlSegment());
// 根据查询条件查询是否已存在相同数据
ChatEntity chatEntity = chatService.selectOne(queryWrapper); ChatEntity chatEntity = chatService.selectOne(queryWrapper);
// 如果不存在相同数据
if(chatEntity==null){ if(chatEntity==null){
chatService.updateById(chat);//根据id更新 // 根据 ID 更新在线咨询记录
chatService.updateById(chat);
// 返回成功响应
return R.ok(); return R.ok();
}else { }else {
// 如果存在相同数据,返回错误响应
return R.error(511,"表中有相同数据"); return R.error(511,"表中有相同数据");
} }
} }
/** /**
* *
* 线
* @param ids 线 ID
* @return R
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){ public R delete(@RequestBody Integer[] ids){
// 记录调试日志,输出方法名、控制器类名和要删除的 ID 数组
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
// 批量删除在线咨询记录
chatService.deleteBatchIds(Arrays.asList(ids)); chatService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
* 线 Excel
* @param fileName Excel
* @return R
*/ */
@RequestMapping("/batchInsert") @RequestMapping("/batchInsert")
public R save( String fileName){ public R save( String fileName){
// 记录调试日志,输出方法名、控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName); logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try { try {
List<ChatEntity> chatList = new ArrayList<>();//上传的东西 // 创建用于存储上传的在线咨询实体对象的列表
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段 List<ChatEntity> chatList = new ArrayList<>();
// 创建用于存储要查询的字段的 Map
Map<String, List<String>> seachFields= new HashMap<>();
// 获取当前时间
Date date = new Date(); Date date = new Date();
// 获取文件名的后缀位置
int lastIndexOf = fileName.lastIndexOf("."); int lastIndexOf = fileName.lastIndexOf(".");
// 如果没有找到后缀
if(lastIndexOf == -1){ if(lastIndexOf == -1){
// 返回错误响应,提示文件没有后缀
return R.error(511,"该文件没有后缀"); return R.error(511,"该文件没有后缀");
}else{ }else{
// 获取文件后缀
String suffix = fileName.substring(lastIndexOf); String suffix = fileName.substring(lastIndexOf);
// 如果后缀不是.xls
if(!".xls".equals(suffix)){ if(!".xls".equals(suffix)){
// 返回错误响应,提示只支持.xls 后缀的 Excel 文件
return R.error(511,"只支持后缀为xls的excel文件"); return R.error(511,"只支持后缀为xls的excel文件");
}else{ }else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径 // 获取文件的 URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
File file = new File(resource.getFile()); File file = new File(resource.getFile());
// 如果文件不存在
if(!file.exists()){ if(!file.exists()){
// 返回错误响应,提示找不到上传文件
return R.error(511,"找不到上传文件,请联系管理员"); return R.error(511,"找不到上传文件,请联系管理员");
}else{ }else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件 // 从 Excel 文件中读取数据
dataList.remove(0);//删除第一行,因为第一行是提示 List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行(通常是表头)
dataList.remove(0);
// 遍历数据列表
for(List<String> data:dataList){ for(List<String> data:dataList){
//循环 // 创建在线咨询实体对象
ChatEntity chatEntity = new ChatEntity(); ChatEntity chatEntity = new ChatEntity();
chatList.add(chatEntity); chatList.add(chatEntity);
// 把要查询是否重复的字段放入 map 中(这里代码未实现具体逻辑)
//把要查询是否重复的字段放入map中
} }
// 批量插入在线咨询记录
//查询是否重复
chatService.insertBatch(chatList); chatService.insertBatch(chatList);
// 返回成功响应
return R.ok(); return R.ok();
} }
} }
} }
}catch (Exception e){ }catch (Exception e){
// 如果发生异常,返回错误响应,提示批量插入数据异常
return R.error(511,"批量插入数据异常,请联系管理员"); return R.error(511,"批量插入数据异常,请联系管理员");
} }
} }
/** /**
* *
* 线
* @param params Map
* @param request HttpServletRequest
* @return R
*/ */
@IgnoreAuth @IgnoreAuth
@RequestMapping("/list") @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){ public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和请求参数
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序 // 如果没有指定排序字段就默认id 序排
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){ if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id"); params.put("orderBy","id");
} }
// 调用 ChatService 的 queryPage 方法获取分页数据
PageUtils page = chatService.queryPage(params); PageUtils page = chatService.queryPage(params);
//字典表数据转换 // 将分页数据中的列表转换为 ChatView 类型的列表
List<ChatView> list =(List<ChatView>)page.getList(); List<ChatView> list =(List<ChatView>)page.getList();
// 遍历列表,对每个 ChatView 对象进行字典表数据转换
for(ChatView c:list) for(ChatView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段 dictionaryService.dictionaryConvert(c, request);
// 返回成功响应,并将分页数据封装在 data 属性中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* 线
* @param id 线 ID
* @param request HttpServletRequest
* @return R
*/ */
@RequestMapping("/detail/{id}") @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){ public R detail(@PathVariable("id") Long id, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要查询的 ID
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id); logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
// 根据 ID 查询在线咨询记录
ChatEntity chat = chatService.selectById(id); ChatEntity chat = chatService.selectById(id);
// 如果查询到记录
if(chat !=null){ if(chat !=null){
// 将 ChatEntity 转换为 ChatView
//entity转view
ChatView view = new ChatView(); ChatView view = new ChatView();
BeanUtils.copyProperties( chat , view );//把实体数据重构到view中 // 使用 BeanUtils 将 ChatEntity 的属性复制到 ChatView 中
BeanUtils.copyProperties( chat , view );
// 级联查询用户信息
//级联表
YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId()); YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());
// 如果查询到用户信息
if(yonghu != null){ if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 // 将用户信息的部分属性复制到 ChatView 中,并排除指定字段
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});
// 设置 ChatView 中的用户 ID
view.setYonghuId(yonghu.getId()); view.setYonghuId(yonghu.getId());
} }
//修改对应字典表字段 // 对 ChatView 对象进行字典表数据转换
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将处理后的 ChatView 数据封装在 data 属性中
return R.ok().put("data", view); return R.ok().put("data", view);
}else { }else {
// 如果未查询到记录,返回错误响应
return R.error(511,"查不到数据"); return R.error(511,"查不到数据");
} }
} }
/** /**
*
*/
@RequestMapping("/add")
public R add(@RequestBody ChatEntity chat, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>()
.eq("yonghu_id", chat.getYonghuId())
.eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ChatEntity chatEntity = chatService.selectOne(queryWrapper);
if(chatEntity==null){
chat.setInsertTime(new Date());
chatService.insert(chat);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}

@ -35,13 +35,13 @@ import com.utils.BaiduUtil;
import com.utils.FileUtil; import com.utils.FileUtil;
import com.utils.R; import com.utils.R;
/** /**
* *
*/ */
@RestController @RestController
public class CommonController{ public class CommonController{
private static final Logger logger = LoggerFactory.getLogger(CommonController.class); private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
// 注入CommonService处理通用业务逻辑
@Autowired @Autowired
private CommonService commonService; private CommonService commonService;
@ -54,13 +54,17 @@ public class CommonController{
@RequestMapping("/location") @RequestMapping("/location")
public R location(String lng, String lat) { public R location(String lng, String lat) {
// 如果BAIDU_DITU_AK为空从配置中获取
if (BAIDU_DITU_AK == null) { if (BAIDU_DITU_AK == null) {
BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue(); BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
// 如果配置中未正确配置,返回错误信息
if (BAIDU_DITU_AK == null) { if (BAIDU_DITU_AK == null) {
return R.error("请在配置管理中正确配置baidu_ditu_ak"); return R.error("请在配置管理中正确配置baidu_ditu_ak");
} }
} }
// 调用百度工具类获取城市信息
Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat); Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
// 返回包含城市信息的结果对象
return R.ok().put("data", map); return R.ok().put("data", map);
} }
@ -68,102 +72,132 @@ public class CommonController{
* *
* @param face1 1 * @param face1 1
* @param face2 2 * @param face2 2
* @return * @param request HttpServletRequest
* @return
*/ */
@RequestMapping("/matchFace") @RequestMapping("/matchFace")
public R matchFace(String face1, String face2, HttpServletRequest request) { public R matchFace(String face1, String face2, HttpServletRequest request) {
// 如果客户端未初始化,进行初始化
if (client == null) { if (client == null) {
/*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/ // 获取APIKey和SecretKey
String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue(); String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue(); String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
// 获取访问令牌
String token = BaiduUtil.getAuth(APIKey, SecretKey); String token = BaiduUtil.getAuth(APIKey, SecretKey);
// 如果令牌获取失败,返回错误信息
if (token == null) { if (token == null) {
return R.error("请在配置管理中正确配置APIKey和SecretKey"); return R.error("请在配置管理中正确配置APIKey和SecretKey");
} }
// 初始化AipFace客户端
client = new AipFace(null, APIKey, SecretKey); client = new AipFace(null, APIKey, SecretKey);
// 设置连接超时时间
client.setConnectionTimeoutInMillis(2000); client.setConnectionTimeoutInMillis(2000);
// 设置套接字超时时间
client.setSocketTimeoutInMillis(60000); client.setSocketTimeoutInMillis(60000);
} }
JSONObject res = null; JSONObject res = null;
try { try {
// 获取人脸图片文件
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face1); File file1 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face2); File file2 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face2);
// 将文件转换为Base64编码的字符串
String img1 = Base64Util.encode(FileUtil.FileToByte(file1)); String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
String img2 = Base64Util.encode(FileUtil.FileToByte(file2)); String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
// 创建MatchRequest对象
MatchRequest req1 = new MatchRequest(img1, "BASE64"); MatchRequest req1 = new MatchRequest(img1, "BASE64");
MatchRequest req2 = new MatchRequest(img2, "BASE64"); MatchRequest req2 = new MatchRequest(img2, "BASE64");
// 创建请求列表
ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>(); ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
requests.add(req1); requests.add(req1);
requests.add(req2); requests.add(req2);
// 进行人脸比对
res = client.match(requests); res = client.match(requests);
// 打印比对结果
System.out.println(res.get("result")); System.out.println(res.get("result"));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// 处理文件未找到异常
e.printStackTrace(); e.printStackTrace();
return R.error("文件不存在"); return R.error("文件不存在");
} catch (IOException e) { } catch (IOException e) {
// 处理IO异常
e.printStackTrace(); e.printStackTrace();
} }
return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString())); return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
} }
/** /**
* tablecolumn() * tablecolumn()
* @return * @param tableName
* @param columnName
* @param level
* @param parent
* @return
*/ */
@RequestMapping("/option/{tableName}/{columnName}") @RequestMapping("/option/{tableName}/{columnName}")
@IgnoreAuth @IgnoreAuth
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, String level, String parent) { public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, String level, String parent) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName); params.put("table", tableName);
params.put("column", columnName); params.put("column", columnName);
// 如果层级不为空添加到参数Map中
if (StringUtils.isNotBlank(level)) { if (StringUtils.isNotBlank(level)) {
params.put("level", level); params.put("level", level);
} }
// 如果父级不为空添加到参数Map中
if (StringUtils.isNotBlank(parent)) { if (StringUtils.isNotBlank(parent)) {
params.put("parent", parent); params.put("parent", parent);
} }
// 调用CommonService获取列列表
List<String> data = commonService.getOption(params); List<String> data = commonService.getOption(params);
// 返回包含列列表的结果对象
return R.ok().put("data", data); return R.ok().put("data", data);
} }
/** /**
* tablecolumn * tablecolumn
* @return * @param tableName
* @param columnName
* @param columnValue
* @return
*/ */
@RequestMapping("/follow/{tableName}/{columnName}") @RequestMapping("/follow/{tableName}/{columnName}")
@IgnoreAuth @IgnoreAuth
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) { public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName); params.put("table", tableName);
params.put("column", columnName); params.put("column", columnName);
params.put("columnValue", columnValue); params.put("columnValue", columnValue);
// 调用CommonService获取单条记录
Map<String, Object> result = commonService.getFollowByOption(params); Map<String, Object> result = commonService.getFollowByOption(params);
// 返回包含单条记录的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* tablesfsh * tablesfsh
* @param map * @param tableName
* @return * @param map Map
* @return
*/ */
@RequestMapping("/sh/{tableName}") @RequestMapping("/sh/{tableName}")
public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) { public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
// 将表名添加到参数Map中
map.put("table", tableName); map.put("table", tableName);
// 调用CommonService进行状态修改
commonService.sh(map); commonService.sh(map);
// 返回操作成功结果
return R.ok(); return R.ok();
} }
/** /**
* *
* @param tableName * @param tableName
* @param columnName * @param columnName
* @param type 1: 2: * @param type 1: 2:
* @param map * @param map Map
* @return * @return
*/ */
@RequestMapping("/remind/{tableName}/{columnName}/{type}") @RequestMapping("/remind/{tableName}/{columnName}/{type}")
@IgnoreAuth @IgnoreAuth
@ -175,104 +209,130 @@ public class CommonController{
if(type.equals("2")) { if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 获取当前日期
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
Date remindStartDate = null; Date remindStartDate = null;
Date remindEndDate = null; Date remindEndDate = null;
// 如果提醒开始日期不为空
if (map.get("remindstart") != null) { if (map.get("remindstart") != null) {
// 解析提醒开始日期偏移量
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date()); c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart); c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime(); remindStartDate = c.getTime();
// 将提醒开始日期格式化后添加到参数Map中
map.put("remindstart", sdf.format(remindStartDate)); map.put("remindstart", sdf.format(remindStartDate));
} }
// 如果提醒结束日期不为空
if (map.get("remindend") != null) { if (map.get("remindend") != null) {
// 解析提醒结束日期偏移量
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
// 设置日期
c.setTime(new Date()); c.setTime(new Date());
// 计算提醒结束日期
c.add(Calendar.DAY_OF_MONTH, remindEnd); c.add(Calendar.DAY_OF_MONTH, remindEnd);
remindEndDate = c.getTime(); remindEndDate = c.getTime();
// 将提醒结束日期格式化后添加到参数Map中
map.put("remindend", sdf.format(remindEndDate)); map.put("remindend", sdf.format(remindEndDate));
} }
} }
int count = commonService.remindCount(map); int count = commonService.remindCount(map);
// 返回包含提醒记录数的结果对象
return R.ok().put("count", count); return R.ok().put("count", count);
} }
/** /**
* *
* @param tableName
* @param params Map
* @return
*/ */
@IgnoreAuth @IgnoreAuth
@RequestMapping("/group/{tableName}") @RequestMapping("/group/{tableName}")
public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String, Object> params) { public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String, Object> params) {
// 将表名添加到参数Map中
params.put("table1", tableName); params.put("table1", tableName);
// 调用CommonService进行图表统计
List<Map<String, Object>> result = commonService.chartBoth(params); List<Map<String, Object>> result = commonService.chartBoth(params);
// 返回包含统计结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* *
* @param tableName
* @param columnName
* @return
*/ */
@RequestMapping("/cal/{tableName}/{columnName}") @RequestMapping("/cal/{tableName}/{columnName}")
@IgnoreAuth @IgnoreAuth
public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) { public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName); params.put("table", tableName);
params.put("column", columnName); params.put("column", columnName);
// 调用CommonService进行单列求和
Map<String, Object> result = commonService.selectCal(params); Map<String, Object> result = commonService.selectCal(params);
// 返回包含求和结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* *
* @param tableName
* @param columnName
* @return
*/ */
@RequestMapping("/group/{tableName}/{columnName}") @RequestMapping("/group/{tableName}/{columnName}")
@IgnoreAuth @IgnoreAuth
public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) { public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName); params.put("table", tableName);
params.put("column", columnName); params.put("column", columnName);
// 调用CommonService进行分组统计
List<Map<String, Object>> result = commonService.selectGroup(params); List<Map<String, Object>> result = commonService.selectGroup(params);
// 返回包含分组统计结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* *
* @param tableName
* @param yColumnName y
* @param xColumnName x
* @return
*/ */
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}") @RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
@IgnoreAuth @IgnoreAuth
public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) { public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName); params.put("table", tableName);
params.put("xColumn", xColumnName); params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName); params.put("yColumn", yColumnName);
// 调用CommonService进行按值统计
List<Map<String, Object>> result = commonService.selectValue(params); List<Map<String, Object>> result = commonService.selectValue(params);
// 返回包含按值统计结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* *
* tableName * @param params Map
* groupColumn * @return
* sumCloum
* @return
*/ */
@RequestMapping("/newSelectGroupSum") @RequestMapping("/newSelectGroupSum")
public R newSelectGroupSum(@RequestParam Map<String, Object> params) { public R newSelectGroupSum(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params); logger.debug("newSelectGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 调用CommonService进行字典表分组求和
List<Map<String, Object>> result = commonService.newSelectGroupSum(params); List<Map<String, Object>> result = commonService.newSelectGroupSum(params);
// 返回包含分组求和结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
tableName tableName
condition1 1 condition1 1
@ -290,32 +350,33 @@ public class CommonController{
return R.ok().put("data", queryScore); return R.ok().put("data", queryScore);
} }
/** /**
* *
* tableName * @param params Map
* groupColumn * @return
* @return
*/ */
@RequestMapping("/newSelectGroupCount") @RequestMapping("/newSelectGroupCount")
public R newSelectGroupCount(@RequestParam Map<String, Object> params) { public R newSelectGroupCount(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params); logger.debug("newSelectGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 调用CommonService进行字典表分组统计总条数
List<Map<String, Object>> result = commonService.newSelectGroupCount(params); List<Map<String, Object>> result = commonService.newSelectGroupCount(params);
// 返回包含分组统计总条数结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* *
* tableName * @param params Map
* groupColumn * @return
* sumCloum
* dateFormatType 1: 2: 3:
* @return
*/ */
@RequestMapping("/newSelectDateGroupSum") @RequestMapping("/newSelectDateGroupSum")
public R newSelectDateGroupSum(@RequestParam Map<String, Object> params) { public R newSelectDateGroupSum(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectDateGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params); logger.debug("newSelectDateGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 获取日期格式化类型
String dateFormatType = String.valueOf(params.get("dateFormatType")); String dateFormatType = String.valueOf(params.get("dateFormatType"));
// 根据日期格式化类型设置日期格式
if ("1".equals(dateFormatType)) { if ("1".equals(dateFormatType)) {
params.put("dateFormat", "%Y"); params.put("dateFormat", "%Y");
} else if ("2".equals(dateFormatType)) { } else if ("2".equals(dateFormatType)) {
@ -323,24 +384,27 @@ public class CommonController{
} else if ("3".equals(dateFormatType)) { } else if ("3".equals(dateFormatType)) {
params.put("dateFormat", "%Y-%m-%d"); params.put("dateFormat", "%Y-%m-%d");
} else { } else {
R.error("日期格式化不正确"); // 日期格式化类型不正确,返回错误信息
return R.error("日期格式化不正确");
} }
// 调用CommonService进行日期分组求和
List<Map<String, Object>> result = commonService.newSelectDateGroupSum(params); List<Map<String, Object>> result = commonService.newSelectDateGroupSum(params);
// 返回包含日期分组求和结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/** /**
* 1 *
* tableName * @param params Map
* groupColumn * @return
* dateFormatType 1: 2: 3:
* @return
*/ */
@RequestMapping("/newSelectDateGroupCount") @RequestMapping("/newSelectDateGroupCount")
public R newSelectDateGroupCount(@RequestParam Map<String, Object> params) { public R newSelectDateGroupCount(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectDateGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params); logger.debug("newSelectDateGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 获取日期格式化类型
String dateFormatType = String.valueOf(params.get("dateFormatType")); String dateFormatType = String.valueOf(params.get("dateFormatType"));
// 根据日期格式化类型设置日期格式
if ("1".equals(dateFormatType)) { if ("1".equals(dateFormatType)) {
params.put("dateFormat", "%Y"); params.put("dateFormat", "%Y");
} else if ("2".equals(dateFormatType)) { } else if ("2".equals(dateFormatType)) {
@ -348,52 +412,14 @@ public class CommonController{
} else if ("3".equals(dateFormatType)) { } else if ("3".equals(dateFormatType)) {
params.put("dateFormat", "%Y-%m-%d"); params.put("dateFormat", "%Y-%m-%d");
} else { } else {
R.error("日期格式化类型不正确"); // 日期格式化类型不正确,返回错误信息
return R.error("日期格式化类型不正确");
} }
// 调用CommonService进行日期分组统计总条数
List<Map<String, Object>> result = commonService.newSelectDateGroupCount(params); List<Map<String, Object>> result = commonService.newSelectDateGroupCount(params);
// 返回包含日期分组统计总条数结果的结果对象
return R.ok().put("data", result); return R.ok().put("data", result);
} }
/**
*
* --
--
-- --
-- --
--
-- --
-- --
--
-- --
-- --
--
--
-- --
-- --
--
-- --
-- --
--
-- --
-- --
*/
/**
*
--
--
-- 2 1
--
--
--
--
--
--
--
--
--
--
*/
/** /**
* *
@ -418,11 +444,13 @@ public class CommonController{
isJoinTableFlag = true; isJoinTableFlag = true;
} }
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期 // 处理当前表日期
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))) {
thisTable.put("date", String.valueOf(thisTable.get("date")).split(",")); thisTable.put("date", String.valueOf(thisTable.get("date")).split(","));
one = "thisDate0"; one = "thisDate0";
} }
if(isJoinTableFlag){//级联表日期 // 处理级联表日期
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable"); Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) { if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) {
joinTable.put("date", String.valueOf(joinTable.get("date")).split(",")); joinTable.put("date", String.valueOf(joinTable.get("date")).split(","));
@ -435,7 +463,8 @@ public class CommonController{
} }
} }
} }
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串 // 处理当前表字符串
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))) {
thisTable.put("string", String.valueOf(thisTable.get("string")).split(",")); thisTable.put("string", String.valueOf(thisTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) { if (StringUtil.isEmpty(one)) {
one = "thisString0"; one = "thisString0";
@ -445,7 +474,8 @@ public class CommonController{
} }
} }
} }
if(isJoinTableFlag){//级联表字符串 // 处理级联表字符串
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable"); Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) { if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) {
joinTable.put("string", String.valueOf(joinTable.get("string")).split(",")); joinTable.put("string", String.valueOf(joinTable.get("string")).split(","));
@ -458,7 +488,8 @@ public class CommonController{
} }
} }
} }
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型 // 处理当前表类型
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))) {
thisTable.put("types", String.valueOf(thisTable.get("types")).split(",")); thisTable.put("types", String.valueOf(thisTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) { if (StringUtil.isEmpty(one)) {
one = "thisTypes0"; one = "thisTypes0";
@ -468,7 +499,8 @@ public class CommonController{
} }
} }
} }
if(isJoinTableFlag){//级联表类型 // 处理级联表类型
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable"); Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) { if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) {
joinTable.put("types", String.valueOf(joinTable.get("types")).split(",")); joinTable.put("types", String.valueOf(joinTable.get("types")).split(","));
@ -479,17 +511,21 @@ public class CommonController{
two = "joinTypes0"; two = "joinTypes0";
} }
} }
} }
} }
// 调用CommonService进行柱状图求和
List<Map<String, Object>> result = commonService.barSum(params); List<Map<String, Object>> result = commonService.barSum(params);
List<String> xAxis = new ArrayList<>();//报表x轴 // 报表x轴
List<List<String>> yAxis = new ArrayList<>();//y轴 List<String> xAxis = new ArrayList<>();
List<String> legend = new ArrayList<>();//标题 // y轴
List<List<String>> yAxis = new ArrayList<>();
// 标题
List<String> legend = new ArrayList<>();
if(StringUtil.isEmpty(two)){//不包含第二列 // 如果不包含第二列
if (StringUtil.isEmpty(two)) {
List<String> yAxis0 = new ArrayList<>(); List<String> yAxis0 = new ArrayList<>();
yAxis.add(yAxis0); yAxis.add(yAxis0);
legend.add("数值"); legend.add("数值");
@ -499,7 +535,8 @@ public class CommonController{
xAxis.add(oneValue); xAxis.add(oneValue);
yAxis0.add(value); yAxis0.add(value);
} }
}else{//包含第二列 } else {
// 包含第二列
Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>(); Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
if (StringUtil.isNotEmpty(two)) { if (StringUtil.isNotEmpty(two)) {
for (Map<String, Object> map : result) { for (Map<String, Object> map : result) {
@ -507,7 +544,7 @@ public class CommonController{
String twoValue = String.valueOf(map.get(two)); String twoValue = String.valueOf(map.get(two));
String value = String.valueOf(map.get("value")); String value = String.valueOf(map.get("value"));
if (!legend.contains(twoValue)) { if (!legend.contains(twoValue)) {
legend.add(twoValue);//添加完成后 就是最全的第二列的类型 legend.add(twoValue);
} }
if (dataMap.containsKey(oneValue)) { if (dataMap.containsKey(oneValue)) {
dataMap.get(oneValue).put(twoValue, value); dataMap.get(oneValue).put(twoValue, value);
@ -516,7 +553,6 @@ public class CommonController{
oneData.put(twoValue, value); oneData.put(twoValue, value);
dataMap.put(oneValue, oneData); dataMap.put(oneValue, oneData);
} }
} }
} }
@ -540,10 +576,12 @@ public class CommonController{
System.out.println(); System.out.println();
} }
// 创建结果Map
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("xAxis", xAxis); resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis); resultMap.put("yAxis", yAxis);
resultMap.put("legend", legend); resultMap.put("legend", legend);
// 返回包含柱状图求和结果的结果对象
return R.ok().put("data", resultMap); return R.ok().put("data", resultMap);
} }
@ -570,11 +608,13 @@ public class CommonController{
isJoinTableFlag = true; isJoinTableFlag = true;
} }
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期 // 处理当前表日期
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))) {
thisTable.put("date", String.valueOf(thisTable.get("date")).split(",")); thisTable.put("date", String.valueOf(thisTable.get("date")).split(","));
one = "thisDate0"; one = "thisDate0";
} }
if(isJoinTableFlag){//级联表日期 // 处理级联表日期
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable"); Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) { if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) {
joinTable.put("date", String.valueOf(joinTable.get("date")).split(",")); joinTable.put("date", String.valueOf(joinTable.get("date")).split(","));
@ -587,7 +627,8 @@ public class CommonController{
} }
} }
} }
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串 // 处理当前表字符串
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))) {
thisTable.put("string", String.valueOf(thisTable.get("string")).split(",")); thisTable.put("string", String.valueOf(thisTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) { if (StringUtil.isEmpty(one)) {
one = "thisString0"; one = "thisString0";
@ -597,7 +638,8 @@ public class CommonController{
} }
} }
} }
if(isJoinTableFlag){//级联表字符串 // 处理级联表字符串
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable"); Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) { if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) {
joinTable.put("string", String.valueOf(joinTable.get("string")).split(",")); joinTable.put("string", String.valueOf(joinTable.get("string")).split(","));
@ -610,7 +652,8 @@ public class CommonController{
} }
} }
} }
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型 // 处理当前表类型
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))) {
thisTable.put("types", String.valueOf(thisTable.get("types")).split(",")); thisTable.put("types", String.valueOf(thisTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) { if (StringUtil.isEmpty(one)) {
one = "thisTypes0"; one = "thisTypes0";
@ -620,7 +663,8 @@ public class CommonController{
} }
} }
} }
if(isJoinTableFlag){//级联表类型 // 处理级联表类型
if (isJoinTableFlag) {
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable"); Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) { if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) {
joinTable.put("types", String.valueOf(joinTable.get("types")).split(",")); joinTable.put("types", String.valueOf(joinTable.get("types")).split(","));
@ -631,17 +675,21 @@ public class CommonController{
two = "joinTypes0"; two = "joinTypes0";
} }
} }
} }
} }
// 调用CommonService进行柱状图统计
List<Map<String, Object>> result = commonService.barCount(params); List<Map<String, Object>> result = commonService.barCount(params);
List<String> xAxis = new ArrayList<>();//报表x轴 // 报表x轴
List<List<String>> yAxis = new ArrayList<>();//y轴 List<String> xAxis = new ArrayList<>();
List<String> legend = new ArrayList<>();//标题 // y轴
List<List<String>> yAxis = new ArrayList<>();
// 标题
List<String> legend = new ArrayList<>();
if(StringUtil.isEmpty(two)){//不包含第二列 // 如果不包含第二列
if (StringUtil.isEmpty(two)) {
List<String> yAxis0 = new ArrayList<>(); List<String> yAxis0 = new ArrayList<>();
yAxis.add(yAxis0); yAxis.add(yAxis0);
legend.add("数值"); legend.add("数值");
@ -651,7 +699,8 @@ public class CommonController{
xAxis.add(oneValue); xAxis.add(oneValue);
yAxis0.add(value); yAxis0.add(value);
} }
}else{//包含第二列 } else {
// 包含第二列
Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>(); Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
if (StringUtil.isNotEmpty(two)) { if (StringUtil.isNotEmpty(two)) {
for (Map<String, Object> map : result) { for (Map<String, Object> map : result) {
@ -659,7 +708,7 @@ public class CommonController{
String twoValue = String.valueOf(map.get(two)); String twoValue = String.valueOf(map.get(two));
String value = String.valueOf(map.get("value")); String value = String.valueOf(map.get("value"));
if (!legend.contains(twoValue)) { if (!legend.contains(twoValue)) {
legend.add(twoValue);//添加完成后 就是最全的第二列的类型 legend.add(twoValue);
} }
if (dataMap.containsKey(oneValue)) { if (dataMap.containsKey(oneValue)) {
dataMap.get(oneValue).put(twoValue, value); dataMap.get(oneValue).put(twoValue, value);
@ -668,7 +717,6 @@ public class CommonController{
oneData.put(twoValue, value); oneData.put(twoValue, value);
dataMap.put(oneValue, oneData); dataMap.put(oneValue, oneData);
} }
} }
} }
@ -692,10 +740,12 @@ public class CommonController{
System.out.println(); System.out.println();
} }
// 创建结果Map
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
resultMap.put("xAxis", xAxis); resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis); resultMap.put("yAxis", yAxis);
resultMap.put("legend", legend); resultMap.put("legend", legend);
// 返回包含柱状图统计结果的结果对象
return R.ok().put("data", resultMap); return R.ok().put("data", resultMap);
} }
} }

@ -1,111 +1,156 @@
package com.controller; package com.controller;
// 导入用于操作数组的工具类
import java.util.Arrays; import java.util.Arrays;
// 导入Map接口用于存储键值对
import java.util.Map; import java.util.Map;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的路径变量注解用于从URL中获取参数
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
// 导入Spring的POST请求映射注解
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
// 导入Spring的请求体注解用于获取请求体中的数据
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
// 导入Spring的请求映射注解用于映射请求路径
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
// 导入Spring的请求参数注解用于获取请求参数
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
// 导入Spring的RESTful控制器注解
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
// 导入自定义的忽略权限验证注解
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
// 导入MyBatis-Plus的实体包装器类用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入配置实体类
import com.entity.ConfigEntity; import com.entity.ConfigEntity;
// 导入配置服务接口
import com.service.ConfigService; import com.service.ConfigService;
// 导入分页工具类
import com.utils.PageUtils; import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R; import com.utils.R;
// 导入自定义的验证工具类
import com.utils.ValidatorUtils; import com.utils.ValidatorUtils;
/** /**
* *
*/ */
// 映射请求路径,所有以/config开头的请求都会由该控制器处理
@RequestMapping("config") @RequestMapping("config")
// 声明该类为RESTful控制器
@RestController @RestController
public class ConfigController { public class ConfigController {
// 自动注入配置服务接口的实现类实例
@Autowired @Autowired
private ConfigService configService; private ConfigService configService;
/** /**
* *
*/ */
// 映射/page请求路径支持GET请求
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, ConfigEntity config) { public R page(@RequestParam Map<String, Object> params, ConfigEntity config) {
// 创建一个EntityWrapper对象用于构建查询条件
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
// 调用配置服务的queryPage方法根据请求参数进行分页查询
PageUtils page = configService.queryPage(params); PageUtils page = configService.queryPage(params);
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/list请求路径支持GET请求且忽略权限验证
@IgnoreAuth @IgnoreAuth
@RequestMapping("/list") @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, ConfigEntity config) { public R list(@RequestParam Map<String, Object> params, ConfigEntity config) {
// 创建一个EntityWrapper对象用于构建查询条件
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
// 调用配置服务的queryPage方法根据请求参数进行分页查询
PageUtils page = configService.queryPage(params); PageUtils page = configService.queryPage(params);
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id) { public R info(@PathVariable("id") String id) {
// 调用配置服务的selectById方法根据ID查询配置信息
ConfigEntity config = configService.selectById(id); ConfigEntity config = configService.selectById(id);
// 返回成功响应,并将查询到的配置信息放入响应数据中
return R.ok().put("data", config); return R.ok().put("data", config);
} }
/** /**
* *
*/ */
// 映射/detail/{id}请求路径支持GET请求{id}为路径变量,且忽略权限验证
@IgnoreAuth @IgnoreAuth
@RequestMapping("/detail/{id}") @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String id) { public R detail(@PathVariable("id") String id) {
// 调用配置服务的selectById方法根据ID查询配置信息
ConfigEntity config = configService.selectById(id); ConfigEntity config = configService.selectById(id);
// 返回成功响应,并将查询到的配置信息放入响应数据中
return R.ok().put("data", config); return R.ok().put("data", config);
} }
/** /**
* name * name
*/ */
// 映射/info请求路径支持GET请求
@RequestMapping("/info") @RequestMapping("/info")
public R infoByName(@RequestParam String name) { public R infoByName(@RequestParam String name) {
// 调用配置服务的selectOne方法根据名称查询配置信息
ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile")); ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
// 返回成功响应,并将查询到的配置信息放入响应数据中
return R.ok().put("data", config); return R.ok().put("data", config);
} }
/** /**
* *
*/ */
// 映射/save请求路径支持POST请求
@PostMapping("/save") @PostMapping("/save")
public R save(@RequestBody ConfigEntity config) { public R save(@RequestBody ConfigEntity config) {
// 注释掉的代码,原本用于验证实体数据的合法性
// ValidatorUtils.validateEntity(config); // ValidatorUtils.validateEntity(config);
// 调用配置服务的insert方法将配置信息插入数据库
configService.insert(config); configService.insert(config);
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
// 映射/update请求路径支持GET或POST请求
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody ConfigEntity config) { public R update(@RequestBody ConfigEntity config) {
// 注释掉的代码,原本用于验证实体数据的合法性
// ValidatorUtils.validateEntity(config); // ValidatorUtils.validateEntity(config);
configService.updateById(config);//全部更新 // 调用配置服务的updateById方法根据ID更新配置信息全部字段更新
configService.updateById(config);
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
// 映射/delete请求路径支持GET或POST请求
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids) {
// 调用配置服务的deleteBatchIds方法根据ID数组批量删除配置信息
configService.deleteBatchIds(Arrays.asList(ids)); configService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok(); return R.ok();
} }
} }

@ -1,35 +1,62 @@
package com.controller; package com.controller;
// 导入文件操作类
import java.io.File; import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal; import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL; import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*; import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader; import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService; import com.service.TokenService;
// 导入自定义工具类
import com.utils.*; import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService; import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger; import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*; import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*; import com.entity.view.*;
// 导入自定义的服务类
import com.service.*; import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils; import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R; import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*; import com.alibaba.fastjson.*;
/** /**
@ -38,108 +65,132 @@ import com.alibaba.fastjson.*;
* @author * @author
* @email * @email
*/ */
// 声明该类为RESTful控制器
@RestController @RestController
// 声明该类为控制器
@Controller @Controller
// 映射请求路径,所有以/dictionary开头的请求都会由该控制器处理
@RequestMapping("/dictionary") @RequestMapping("/dictionary")
public class DictionaryController { public class DictionaryController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class); private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
@Autowired // 此处注解有误,应为@Autowired自动注入用户服务类
private DictionaryService dictionaryService; @Autow
@Autowired
private TokenService tokenService;
//级联表service
@Autowired
private YonghuService yonghuService; private YonghuService yonghuService;
// 自动注入医生服务类
@Autowired @Autowired
private YishengService yishengService; private YishengService yishengService;
/** /**
* *
*/ */
// 映射/page请求路径支持GET请求且忽略权限验证
@RequestMapping("/page") @RequestMapping("/page")
@IgnoreAuth @IgnoreAuth
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) { public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params)); logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") { if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id"); params.put("orderBy", "id");
} }
// 调用字典服务的queryPage方法根据请求参数进行分页查询
PageUtils page = dictionaryService.queryPage(params); PageUtils page = dictionaryService.queryPage(params);
//字典表数据转换 // 将分页结果中的列表转换为字典视图列表
List<DictionaryView> list = (List<DictionaryView>) page.getList(); List<DictionaryView> list = (List<DictionaryView>) page.getList();
// 遍历字典视图列表
for (DictionaryView c : list) { for (DictionaryView c : list) {
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request); dictionaryService.dictionaryConvert(c, request);
} }
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) { public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id); logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用字典服务的selectById方法根据id查询字典实体
DictionaryEntity dictionary = dictionaryService.selectById(id); DictionaryEntity dictionary = dictionaryService.selectById(id);
// 如果查询到字典实体
if (dictionary != null) { if (dictionary != null) {
//entity转view // 创建字典视图对象
DictionaryView view = new DictionaryView(); DictionaryView view = new DictionaryView();
BeanUtils.copyProperties( dictionary , view );//把实体数据重构到view // 使用BeanUtils将字典实体的属性复制到字典视图
BeanUtils.copyProperties(dictionary, view);
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将字典视图对象放入响应数据中
return R.ok().put("data", view); return R.ok().put("data", view);
} else { } else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据"); return R.error(511, "查不到数据");
} }
} }
/** /**
* *
*/ */
// 映射/save请求路径支持POST请求
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) { public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的字典实体信息
logger.debug("save方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString()); logger.debug("save方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false) if (false)
return R.error(511, "永远不会进入"); return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>() Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode()) .eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName()) .eq("index_name", dictionary.getIndexName());
; // 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) { if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId()); queryWrapper.eq("super_id", dictionary.getSuperId());
} }
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper); DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) { if (dictionaryEntity == null) {
// 设置字典实体的创建时间为当前时间
dictionary.setCreateTime(new Date()); dictionary.setCreateTime(new Date());
// 调用字典服务的insert方法将字典实体插入数据库
dictionaryService.insert(dictionary); dictionaryService.insert(dictionary);
//字典表新增数据,把数据再重新查出,放入监听器中 // 查询所有字典实体
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>()); List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext(); ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>(); Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) { for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<Integer, String> m = map.get(d.getDicCode()); Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) { if (m == null || m.isEmpty()) {
m = new HashMap<>(); m = new HashMap<>();
} }
// 将当前字典实体的代码索引和索引名称存入子Map
m.put(d.getCodeIndex(), d.getIndexName()); m.put(d.getCodeIndex(), d.getIndexName());
// 将子Map存入主Map
map.put(d.getDicCode(), m); map.put(d.getDicCode(), m);
} }
// 将主Map存入Servlet上下文的属性中
servletContext.setAttribute("dictionaryMap", map); servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -147,42 +198,58 @@ public class DictionaryController {
/** /**
* *
*/ */
// 映射/update请求路径支持POST请求
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) { public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的字典实体信息
logger.debug("update方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString()); logger.debug("update方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false) // if (false)
// return R.error(511, "永远不会进入"); // return R.error(511, "永远不会进入");
//根据字段查询是否有相同数据 // 创建查询包装器,用于构建查询条件,排除当前要修改的记录
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>() Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.notIn("id", dictionary.getId()) .notIn("id", dictionary.getId())
.eq("dic_code", dictionary.getDicCode()) .eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName()) .eq("index_name", dictionary.getIndexName());
; // 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) { if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId()); queryWrapper.eq("super_id", dictionary.getSuperId());
} }
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper); DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) { if (dictionaryEntity == null) {
dictionaryService.updateById(dictionary);//根据id更新 // 调用字典服务的updateById方法根据id更新字典实体
//如果字典表修改数据的话,把数据再重新查出,放入监听器中 dictionaryService.updateById(dictionary);
// 查询所有字典实体
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>()); List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext(); ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>(); Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) { for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<Integer, String> m = map.get(d.getDicCode()); Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) { if (m == null || m.isEmpty()) {
m = new HashMap<>(); m = new HashMap<>();
} }
// 将当前字典实体的代码索引和索引名称存入子Map
m.put(d.getCodeIndex(), d.getIndexName()); m.put(d.getCodeIndex(), d.getIndexName());
// 将子Map存入主Map
map.put(d.getDicCode(), m); map.put(d.getDicCode(), m);
} }
// 将主Map存入Servlet上下文的属性中
servletContext.setAttribute("dictionaryMap", map); servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -190,29 +257,43 @@ public class DictionaryController {
/** /**
* *
*/ */
// 映射/delete请求路径支持POST请求
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) { public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString()); logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用字典服务的deleteBatchIds方法根据id数组批量删除记录
dictionaryService.deleteBatchIds(Arrays.asList(ids)); dictionaryService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
// 映射/maxCodeIndex请求路径支持POST请求
@RequestMapping("/maxCodeIndex") @RequestMapping("/maxCodeIndex")
public R maxCodeIndex(@RequestBody DictionaryEntity dictionary) { public R maxCodeIndex(@RequestBody DictionaryEntity dictionary) {
// 记录方法调用日志,包含控制器类名和传入的字典实体信息
logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString()); logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 创建一个列表,用于存储排序字段
List<String> descs = new ArrayList<>(); List<String> descs = new ArrayList<>();
// 添加按code_index降序排序的字段
descs.add("code_index"); descs.add("code_index");
// 创建查询包装器,用于构建查询条件
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>() Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode()) .eq("dic_code", dictionary.getDicCode())
.orderDesc(descs); .orderDesc(descs);
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectList方法根据查询条件查询字典实体列表
List<DictionaryEntity> dictionaryEntityList = dictionaryService.selectList(queryWrapper); List<DictionaryEntity> dictionaryEntityList = dictionaryService.selectList(queryWrapper);
// 如果查询到的列表不为空
if (dictionaryEntityList != null) { if (dictionaryEntityList != null) {
// 返回成功响应并将最大的code_index加1作为结果放入响应数据中
return R.ok().put("maxCodeIndex", dictionaryEntityList.get(0).getCodeIndex() + 1); return R.ok().put("maxCodeIndex", dictionaryEntityList.get(0).getCodeIndex() + 1);
} else { } else {
// 如果未查询到数据返回成功响应并将最大的code_index设为1
return R.ok().put("maxCodeIndex", 1); return R.ok().put("maxCodeIndex", 1);
} }
} }
@ -220,31 +301,47 @@ public class DictionaryController {
/** /**
* *
*/ */
// 映射/batchInsert请求路径支持POST请求
@RequestMapping("/batchInsert") @RequestMapping("/batchInsert")
public R save(String fileName) { public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName); logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
try { try {
List<DictionaryEntity> dictionaryList = new ArrayList<>();//上传的东西 // 创建一个列表,用于存储要上传的字典实体
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段 List<DictionaryEntity> dictionaryList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
Date date = new Date(); Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf("."); int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) { if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀"); return R.error(511, "该文件没有后缀");
} else { } else {
// 获取文件后缀
String suffix = fileName.substring(lastIndexOf); String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) { if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件"); return R.error(511, "只支持后缀为xls的excel文件");
} else { } else {
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径 // 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
File file = new File(resource.getFile()); File file = new File(resource.getFile());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) { if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员"); return R.error(511, "找不到上传文件,请联系管理员");
} else { } else {
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件 // 使用PoiUtil工具类读取xls文件的数据
dataList.remove(0);//删除第一行,因为第一行是提示 List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) { for (List<String> data : dataList) {
//循环 // 创建一个新的字典实体
DictionaryEntity dictionaryEntity = new DictionaryEntity(); DictionaryEntity dictionaryEntity = new DictionaryEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// dictionaryEntity.setDicCode(data.get(0)); //字段 要改的 // dictionaryEntity.setDicCode(data.get(0)); //字段 要改的
// dictionaryEntity.setDicName(data.get(0)); //字段名 要改的 // dictionaryEntity.setDicName(data.get(0)); //字段名 要改的
// dictionaryEntity.setCodeIndex(Integer.valueOf(data.get(0))); //编码 要改的 // dictionaryEntity.setCodeIndex(Integer.valueOf(data.get(0))); //编码 要改的
@ -252,26 +349,22 @@ public class DictionaryController {
// dictionaryEntity.setSuperId(Integer.valueOf(data.get(0))); //父字段id 要改的 // dictionaryEntity.setSuperId(Integer.valueOf(data.get(0))); //父字段id 要改的
// dictionaryEntity.setBeizhu(data.get(0)); //备注 要改的 // dictionaryEntity.setBeizhu(data.get(0)); //备注 要改的
// dictionaryEntity.setCreateTime(date);//时间 // dictionaryEntity.setCreateTime(date);//时间
// 将字典实体添加到上传列表中
dictionaryList.add(dictionaryEntity); dictionaryList.add(dictionaryEntity);
// 把要查询是否重复的字段放入map中 // 把要查询是否重复的字段放入map中
} }
//查询是否重复 // 调用字典服务的insertBatch方法批量插入字典实体
dictionaryService.insertBatch(dictionaryList); dictionaryService.insertBatch(dictionaryList);
// 返回成功响应
return R.ok(); return R.ok();
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员"); return R.error(511, "批量插入数据异常,请联系管理员");
} }
} }
} }

@ -1,110 +1,370 @@
package com.controller; package com.controller;
// 导入文件操作类
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; // 导入用于高精度计算的类
import java.io.IOException; import java.math.BigDecimal;
import java.util.Arrays; // 导入用于处理URL的类
import java.util.Date; import java.net.URL;
import java.util.HashMap; // 导入用于日期格式化的类
import java.util.List; import java.text.SimpleDateFormat;
import java.util.Map; // 导入阿里巴巴的JSON对象类
import java.util.Random; import com.alibaba.fastjson.JSONObject;
import java.util.UUID; // 导入常用的集合类
import java.util.*;
import org.apache.commons.io.FileUtils; // 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService;
// 导入自定义工具类
import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; // 导入自定义的忽略权限注解类
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity; // 导入MyBatis-Plus的查询包装器接口
import com.entity.EIException; import com.baomidou.mybatisplus.mapper.Wrapper;
import com.service.ConfigService; // 导入自定义的实体类
import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*;
// 导入自定义的服务类
import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R; import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*;
/** /**
* *
*
* @author
* @email
*/ */
// 声明该类为RESTful控制器
@RestController @RestController
@RequestMapping("file") // 声明该类为控制器
@SuppressWarnings({"unchecked","rawtypes"}) @Controller
public class FileController{ // 映射请求路径,所有以/dictionary开头的请求都会由该控制器处理
@RequestMapping("/dictionary")
public class DictionaryController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
// 此处注解有误,应为@Autowired自动注入用户服务类
@Autow
private YonghuService yonghuService;
// 自动注入医生服务类
@Autowired @Autowired
private ConfigService configService; private YishengService yishengService;
/** /**
* *
*/ */
@RequestMapping("/upload") // 映射/page请求路径支持GET请求且忽略权限验证
public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception { @RequestMapping("/page")
if (file.isEmpty()) { @IgnoreAuth
throw new EIException("上传文件不能为空"); public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
} // 记录方法调用日志,包含控制器类名和请求参数
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
File path = new File(ResourceUtils.getURL("classpath:static").getPath()); // 如果请求参数中没有指定排序字段则默认按id排序
if(!path.exists()) { if (params.get("orderBy") == null || params.get("orderBy") == "") {
path = new File(""); params.put("orderBy", "id");
} }
File upload = new File(path.getAbsolutePath(),"/upload/"); // 调用字典服务的queryPage方法根据请求参数进行分页查询
if(!upload.exists()) { PageUtils page = dictionaryService.queryPage(params);
upload.mkdirs();
} // 将分页结果中的列表转换为字典视图列表
String fileName = new Date().getTime()+"."+fileExt; List<DictionaryView> list = (List<DictionaryView>) page.getList();
File dest = new File(upload.getAbsolutePath()+"/"+fileName); // 遍历字典视图列表
file.transferTo(dest); for (DictionaryView c : list) {
if(StringUtils.isNotBlank(type) && type.equals("1")) { // 调用字典服务的dictionaryConvert方法修改对应字典表字段
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile")); dictionaryService.dictionaryConvert(c, request);
if(configEntity==null) { }
configEntity = new ConfigEntity(); // 返回成功响应,并将分页查询结果放入响应数据中
configEntity.setName("faceFile"); return R.ok().put("data", page);
configEntity.setValue(fileName); }
/**
*
*/
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用字典服务的selectById方法根据id查询字典实体
DictionaryEntity dictionary = dictionaryService.selectById(id);
// 如果查询到字典实体
if (dictionary != null) {
// 创建字典视图对象
DictionaryView view = new DictionaryView();
// 使用BeanUtils将字典实体的属性复制到字典视图中
BeanUtils.copyProperties(dictionary, view);
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将字典视图对象放入响应数据中
return R.ok().put("data", view);
} else { } else {
configEntity.setValue(fileName); // 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}
}
/**
*
*/
// 映射/save请求路径支持POST请求
@RequestMapping("/save")
public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的字典实体信息
logger.debug("save方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName());
// 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId());
} }
configService.insertOrUpdate(configEntity); // 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) {
// 设置字典实体的创建时间为当前时间
dictionary.setCreateTime(new Date());
// 调用字典服务的insert方法将字典实体插入数据库
dictionaryService.insert(dictionary);
// 查询所有字典实体
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) {
m = new HashMap<>();
}
// 将当前字典实体的代码索引和索引名称存入子Map
m.put(d.getCodeIndex(), d.getIndexName());
// 将子Map存入主Map
map.put(d.getDicCode(), m);
}
// 将主Map存入Servlet上下文的属性中
servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
} }
return R.ok().put("file", fileName);
} }
/** /**
* *
*/ */
@IgnoreAuth // 映射/update请求路径支持POST请求
@RequestMapping("/download") @RequestMapping("/update")
public ResponseEntity<byte[]> download(@RequestParam String fileName) { public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
try { // 记录方法调用日志,包含控制器类名和要修改的字典实体信息
File path = new File(ResourceUtils.getURL("classpath:static").getPath()); logger.debug("update方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
if(!path.exists()) { // 从请求会话中获取用户角色
path = new File(""); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false)
// return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件,排除当前要修改的记录
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.notIn("id", dictionary.getId())
.eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName());
// 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId());
} }
File upload = new File(path.getAbsolutePath(),"/upload/"); // 记录生成的SQL查询语句
if(!upload.exists()) { logger.info("sql语句:" + queryWrapper.getSqlSegment());
upload.mkdirs(); // 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) {
// 调用字典服务的updateById方法根据id更新字典实体
dictionaryService.updateById(dictionary);
// 查询所有字典实体
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) {
m = new HashMap<>();
} }
File file = new File(upload.getAbsolutePath()+"/"+fileName); // 将当前字典实体的代码索引和索引名称存入子Map
if(file.exists()){ m.put(d.getCodeIndex(), d.getIndexName());
/*if(!fileService.canRead(file, SessionManager.getSessionUser())){ // 将子Map存入主Map
getResponse().sendError(403); map.put(d.getDicCode(), m);
}*/
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", fileName);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
} }
} catch (IOException e) { // 将主Map存入Servlet上下文的属性中
e.printStackTrace(); servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
} }
return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
} }
/**
*
*/
// 映射/delete请求路径支持POST请求
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用字典服务的deleteBatchIds方法根据id数组批量删除记录
dictionaryService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok();
}
/**
*
*/
// 映射/maxCodeIndex请求路径支持POST请求
@RequestMapping("/maxCodeIndex")
public R maxCodeIndex(@RequestBody DictionaryEntity dictionary) {
// 记录方法调用日志,包含控制器类名和传入的字典实体信息
logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 创建一个列表,用于存储排序字段
List<String> descs = new ArrayList<>();
// 添加按code_index降序排序的字段
descs.add("code_index");
// 创建查询包装器,用于构建查询条件
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode())
.orderDesc(descs);
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectList方法根据查询条件查询字典实体列表
List<DictionaryEntity> dictionaryEntityList = dictionaryService.selectList(queryWrapper);
// 如果查询到的列表不为空
if (dictionaryEntityList != null) {
// 返回成功响应并将最大的code_index加1作为结果放入响应数据中
return R.ok().put("maxCodeIndex", dictionaryEntityList.get(0).getCodeIndex() + 1);
} else {
// 如果未查询到数据返回成功响应并将最大的code_index设为1
return R.ok().put("maxCodeIndex", 1);
}
}
/**
*
*/
// 映射/batchInsert请求路径支持POST请求
@RequestMapping("/batchInsert")
public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
try {
// 创建一个列表,用于存储要上传的字典实体
List<DictionaryEntity> dictionaryList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀");
} else {
// 获取文件后缀
String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件");
} else {
// 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
File file = new File(resource.getFile());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员");
} else {
// 使用PoiUtil工具类读取xls文件的数据
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) {
// 创建一个新的字典实体
DictionaryEntity dictionaryEntity = new DictionaryEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// dictionaryEntity.setDicCode(data.get(0)); //字段 要改的
// dictionaryEntity.setDicName(data.get(0)); //字段名 要改的
// dictionaryEntity.setCodeIndex(Integer.valueOf(data.get(0))); //编码 要改的
// dictionaryEntity.setIndexName(data.get(0)); //编码名字 要改的
// dictionaryEntity.setSuperId(Integer.valueOf(data.get(0))); //父字段id 要改的
// dictionaryEntity.setBeizhu(data.get(0)); //备注 要改的
// dictionaryEntity.setCreateTime(date);//时间
// 将字典实体添加到上传列表中
dictionaryList.add(dictionaryEntity);
// 把要查询是否重复的字段放入map中
}
// 调用字典服务的insertBatch方法批量插入字典实体
dictionaryService.insertBatch(dictionaryList);
// 返回成功响应
return R.ok();
}
}
}
} catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员");
}
}
} }

@ -1,35 +1,63 @@
package com.controller; package com.controller;
// 导入文件操作相关类
import java.io.File; import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal; import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL; import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*; import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader; import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService; import com.service.TokenService;
// 导入自定义工具类
import com.utils.*; import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService; import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger; import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*; import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*; import com.entity.view.*;
// 导入自定义的服务类
import com.service.*; import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils; import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R; import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*; import com.alibaba.fastjson.*;
/** /**
@ -38,104 +66,141 @@ import com.alibaba.fastjson.*;
* @author * @author
* @email * @email
*/ */
// 声明该类为RESTful控制器
@RestController @RestController
// 声明该类为控制器
@Controller @Controller
// 映射请求路径,所有以/guahao开头的请求都会由该控制器处理
@RequestMapping("/guahao") @RequestMapping("/guahao")
public class GuahaoController { public class GuahaoController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(GuahaoController.class); private static final Logger logger = LoggerFactory.getLogger(GuahaoController.class);
// 自动注入挂号服务类,用于处理挂号相关业务逻辑
@Autowired @Autowired
private GuahaoService guahaoService; private GuahaoService guahaoService;
// 自动注入令牌服务类
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
// 自动注入字典服务类
@Autowired @Autowired
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
//级联表service // 级联表service,自动注入医生服务类
@Autowired @Autowired
private YishengService yishengService; private YishengService yishengService;
// 级联表service自动注入用户服务类
@Autowired @Autowired
private YonghuService yonghuService; private YonghuService yonghuService;
/** /**
* *
*/ */
// 映射/page请求路径支持GET请求
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) { public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params)); logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false) if (false)
return R.error(511, "永不会进入"); return R.error(511, "永不会进入");
// 如果用户角色为"用户"
else if ("用户".equals(role)) else if ("用户".equals(role))
// 在请求参数中添加用户id
params.put("yonghuId", request.getSession().getAttribute("userId")); params.put("yonghuId", request.getSession().getAttribute("userId"));
// 如果用户角色为"医生"
else if ("医生".equals(role)) else if ("医生".equals(role))
// 在请求参数中添加医生id
params.put("yishengId", request.getSession().getAttribute("userId")); params.put("yishengId", request.getSession().getAttribute("userId"));
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") { if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id"); params.put("orderBy", "id");
} }
// 调用挂号服务的queryPage方法根据请求参数进行分页查询
PageUtils page = guahaoService.queryPage(params); PageUtils page = guahaoService.queryPage(params);
//字典表数据转换 // 将分页结果中的列表转换为挂号视图列表
List<GuahaoView> list = (List<GuahaoView>) page.getList(); List<GuahaoView> list = (List<GuahaoView>) page.getList();
// 遍历挂号视图列表
for (GuahaoView c : list) { for (GuahaoView c : list) {
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request); dictionaryService.dictionaryConvert(c, request);
} }
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) { public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id); logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用挂号服务的selectById方法根据id查询挂号实体
GuahaoEntity guahao = guahaoService.selectById(id); GuahaoEntity guahao = guahaoService.selectById(id);
// 如果查询到挂号实体
if (guahao != null) { if (guahao != null) {
//entity转view // 创建挂号视图对象
GuahaoView view = new GuahaoView(); GuahaoView view = new GuahaoView();
BeanUtils.copyProperties( guahao , view );//把实体数据重构到view中 // 使用BeanUtils将挂号实体的属性复制到挂号视图中
BeanUtils.copyProperties(guahao, view);
//级联表 // 级联查询医生信息
YishengEntity yisheng = yishengService.selectById(guahao.getYishengId()); YishengEntity yisheng = yishengService.selectById(guahao.getYishengId());
// 如果查询到医生信息
if (yisheng != null) { if (yisheng != null) {
BeanUtils.copyProperties( yisheng , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段 // 将医生信息的部分属性复制到挂号视图中,并排除指定字段
BeanUtils.copyProperties(yisheng, view, new String[]{"id", "createTime", "insertTime", "updateTime"});
// 设置挂号视图中的医生id
view.setYishengId(yisheng.getId()); view.setYishengId(yisheng.getId());
} }
//级联表 // 级联查询用户信息
YonghuEntity yonghu = yonghuService.selectById(guahao.getYonghuId()); YonghuEntity yonghu = yonghuService.selectById(guahao.getYonghuId());
// 如果查询到用户信息
if (yonghu != null) { if (yonghu != null) {
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段 // 将用户信息的部分属性复制到挂号视图中,并排除指定字段
BeanUtils.copyProperties(yonghu, view, new String[]{"id", "createTime", "insertTime", "updateTime"});
// 设置挂号视图中的用户id
view.setYonghuId(yonghu.getId()); view.setYonghuId(yonghu.getId());
} }
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将挂号视图对象放入响应数据中
return R.ok().put("data", view); return R.ok().put("data", view);
} else { } else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据"); return R.error(511, "查不到数据");
} }
} }
/** /**
* *
*/ */
// 映射/save请求路径支持POST请求
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody GuahaoEntity guahao, HttpServletRequest request) { public R save(@RequestBody GuahaoEntity guahao, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的挂号实体信息
logger.debug("save方法:,,Controller:{},,guahao:{}", this.getClass().getName(), guahao.toString()); logger.debug("save方法:,,Controller:{},,guahao:{}", this.getClass().getName(), guahao.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false) if (false)
return R.error(511, "永远不会进入"); return R.error(511, "永远不会进入");
// 如果用户角色为"医生"
else if ("医生".equals(role)) else if ("医生".equals(role))
// 设置挂号实体的医生id为当前会话中的用户id
guahao.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")))); guahao.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 如果用户角色为"用户"
else if ("用户".equals(role)) else if ("用户".equals(role))
// 设置挂号实体的用户id为当前会话中的用户id
guahao.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")))); guahao.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 创建查询包装器,用于构建查询条件
Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>() Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>()
.eq("yisheng_id", guahao.getYishengId()) .eq("yisheng_id", guahao.getYishengId())
.eq("yonghu_id", guahao.getYonghuId()) .eq("yonghu_id", guahao.getYonghuId())
@ -144,17 +209,24 @@ public class GuahaoController {
.eq("guahao_types", guahao.getGuahaoTypes()) .eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes()) .eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes()) .eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText()) .eq("guahao_yesno_text", guahao.getGuahaoYesnoText());
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用挂号服务的selectOne方法根据查询条件查询是否存在相同数据
GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper); GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (guahaoEntity == null) { if (guahaoEntity == null) {
// 设置挂号审核类型为1
guahao.setGuahaoYesnoTypes(1); guahao.setGuahaoYesnoTypes(1);
// 设置挂号实体的创建时间为当前时间
guahao.setCreateTime(new Date()); guahao.setCreateTime(new Date());
// 调用挂号服务的insert方法将挂号实体插入数据库
guahaoService.insert(guahao); guahaoService.insert(guahao);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -162,18 +234,21 @@ public class GuahaoController {
/** /**
* *
*/ */
// 映射/update请求路径支持POST请求
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody GuahaoEntity guahao, HttpServletRequest request) { public R update(@RequestBody GuahaoEntity guahao, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的挂号实体信息
logger.debug("update方法:,,Controller:{},,guahao:{}", this.getClass().getName(), guahao.toString()); logger.debug("update方法:,,Controller:{},,guahao:{}", this.getClass().getName(), guahao.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false) // if (false)
// return R.error(511, "永远不会进入"); // return R.error(511, "永远不会进入");
// else if ("医生".equals(role)) // else if ("医生".equals(role))
// guahao.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")))); // guahao.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// else if ("用户".equals(role)) // else if ("用户".equals(role))
// guahao.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")))); // guahao.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//根据字段查询是否有相同数据 // 创建查询包装器,用于构建查询条件,排除当前要修改的记录
Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>() Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>()
.notIn("id", guahao.getId()) .notIn("id", guahao.getId())
.andNew() .andNew()
@ -184,15 +259,20 @@ public class GuahaoController {
.eq("guahao_types", guahao.getGuahaoTypes()) .eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes()) .eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes()) .eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText()) .eq("guahao_yesno_text", guahao.getGuahaoYesnoText());
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用挂号服务的selectOne方法根据查询条件查询是否存在相同数据
GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper); GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (guahaoEntity == null) { if (guahaoEntity == null) {
guahaoService.updateById(guahao);//根据id更新 // 调用挂号服务的updateById方法根据id更新挂号实体
guahaoService.updateById(guahao);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -200,42 +280,61 @@ public class GuahaoController {
/** /**
* *
*/ */
// 映射/delete请求路径支持POST请求
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) { public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString()); logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用挂号服务的deleteBatchIds方法根据id数组批量删除记录
guahaoService.deleteBatchIds(Arrays.asList(ids)); guahaoService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
// 映射/batchInsert请求路径支持POST请求
@RequestMapping("/batchInsert") @RequestMapping("/batchInsert")
public R save(String fileName) { public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName); logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
try { try {
List<GuahaoEntity> guahaoList = new ArrayList<>();//上传的东西 // 创建一个列表,用于存储要上传的挂号实体
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段 List<GuahaoEntity> guahaoList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
Date date = new Date(); Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf("."); int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) { if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀"); return R.error(511, "该文件没有后缀");
} else { } else {
// 获取文件后缀
String suffix = fileName.substring(lastIndexOf); String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) { if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件"); return R.error(511, "只支持后缀为xls的excel文件");
} else { } else {
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径 // 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
File file = new File(resource.getFile()); File file = new File(resource.getFile());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) { if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员"); return R.error(511, "找不到上传文件,请联系管理员");
} else { } else {
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件 // 使用PoiUtil工具类读取xls文件的数据
dataList.remove(0);//删除第一行,因为第一行是提示 List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) { for (List<String> data : dataList) {
//循环 // 创建一个新的挂号实体
GuahaoEntity guahaoEntity = new GuahaoEntity(); GuahaoEntity guahaoEntity = new GuahaoEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// guahaoEntity.setYishengId(Integer.valueOf(data.get(0))); //医生 要改的 // guahaoEntity.setYishengId(Integer.valueOf(data.get(0))); //医生 要改的
// guahaoEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的 // guahaoEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// guahaoEntity.setGuahaoUuinNumber(Integer.valueOf(data.get(0))); //就诊识别码 要改的 // guahaoEntity.setGuahaoUuinNumber(Integer.valueOf(data.get(0))); //就诊识别码 要改的
@ -245,119 +344,10 @@ public class GuahaoController {
// guahaoEntity.setGuahaoYesnoTypes(Integer.valueOf(data.get(0))); //挂号审核 要改的 // guahaoEntity.setGuahaoYesnoTypes(Integer.valueOf(data.get(0))); //挂号审核 要改的
// guahaoEntity.setGuahaoYesnoText(data.get(0)); //审核结果 要改的 // guahaoEntity.setGuahaoYesnoText(data.get(0)); //审核结果 要改的
// guahaoEntity.setCreateTime(date);//时间 // guahaoEntity.setCreateTime(date);//时间
// 将挂号实体添加到上传列表中
guahaoList.add(guahaoEntity); guahaoList.add(guahaoEntity);
// 把要查询是否重复的字段放入map中 // 把要查询是否重复的字段放入map中
} }
//查询是否重复 //
guahaoService.insertBatch(guahaoList);
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = guahaoService.queryPage(params);
//字典表数据转换
List<GuahaoView> list =(List<GuahaoView>)page.getList();
for(GuahaoView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
*
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
GuahaoEntity guahao = guahaoService.selectById(id);
if(guahao !=null){
//entity转view
GuahaoView view = new GuahaoView();
BeanUtils.copyProperties( guahao , view );//把实体数据重构到view中
//级联表
YishengEntity yisheng = yishengService.selectById(guahao.getYishengId());
if(yisheng != null){
BeanUtils.copyProperties( yisheng , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYishengId(yisheng.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(guahao.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
*
*/
@RequestMapping("/add")
public R add(@RequestBody GuahaoEntity guahao, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,guahao:{}",this.getClass().getName(),guahao.toString());
Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>()
.eq("yisheng_id", guahao.getYishengId())
.eq("yonghu_id", guahao.getYonghuId())
.eq("guahao_uuin_number", guahao.getGuahaoUuinNumber())
.eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper);
if(guahaoEntity==null){
guahao.setGuahaoYesnoTypes(1);
guahao.setCreateTime(new Date());
YonghuEntity userId = yonghuService.selectById((Integer) request.getSession().getAttribute("userId"));
YishengEntity yishengEntity = yishengService.selectById(guahao.getYishengId());
if(userId.getNewMoney()<yishengEntity.getYishengNewMoney()){
return R.error("余额不足请充值");
}
userId.setNewMoney(userId.getNewMoney()-yishengEntity.getYishengNewMoney());
boolean b = yonghuService.updateById(userId);
if(!b){
return R.error();
}
guahaoService.insert(guahao);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}

@ -1,35 +1,63 @@
package com.controller; package com.controller;
// 导入文件操作相关类
import java.io.File; import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal; import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL; import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*; import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader; import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService; import com.service.TokenService;
// 导入自定义工具类
import com.utils.*; import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService; import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger; import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*; import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*; import com.entity.view.*;
// 导入自定义的服务类
import com.service.*; import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils; import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R; import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*; import com.alibaba.fastjson.*;
/** /**
@ -38,104 +66,141 @@ import com.alibaba.fastjson.*;
* @author * @author
* @email * @email
*/ */
// 声明该类为RESTful控制器用于处理HTTP请求并返回JSON数据
@RestController @RestController
// 声明该类为Spring MVC控制器
@Controller @Controller
// 映射请求路径,所有以/jiankangjiaoyu开头的请求都会由该控制器处理
@RequestMapping("/jiankangjiaoyu") @RequestMapping("/jiankangjiaoyu")
public class JiankangjiaoyuController { public class JiankangjiaoyuController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(JiankangjiaoyuController.class); private static final Logger logger = LoggerFactory.getLogger(JiankangjiaoyuController.class);
// 自动注入健康教育服务类,用于处理健康教育相关业务逻辑
@Autowired @Autowired
private JiankangjiaoyuService jiankangjiaoyuService; private JiankangjiaoyuService jiankangjiaoyuService;
// 自动注入令牌服务类
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
// 自动注入字典服务类,用于字典表数据转换
@Autowired @Autowired
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
//级联表service // 级联表service自动注入用户服务类
@Autowired @Autowired
private YonghuService yonghuService; private YonghuService yonghuService;
// 级联表service自动注入医生服务类
@Autowired @Autowired
private YishengService yishengService; private YishengService yishengService;
/** /**
* *
*/ */
// 映射/page请求路径支持GET请求用于获取健康教育信息的分页列表
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) { public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params)); logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false) if (false)
return R.error(511, "永不会进入"); return R.error(511, "永不会进入");
// 如果用户角色为"用户"
else if ("用户".equals(role)) else if ("用户".equals(role))
// 在请求参数中添加用户id
params.put("yonghuId", request.getSession().getAttribute("userId")); params.put("yonghuId", request.getSession().getAttribute("userId"));
// 如果用户角色为"医生"
else if ("医生".equals(role)) else if ("医生".equals(role))
// 在请求参数中添加医生id
params.put("yishengId", request.getSession().getAttribute("userId")); params.put("yishengId", request.getSession().getAttribute("userId"));
params.put("jiankangjiaoyuDeleteStart",1);params.put("jiankangjiaoyuDeleteEnd",1); // 设置查询条件限定健康教育未被删除逻辑删除字段值为1
params.put("jiankangjiaoyuDeleteStart", 1);
params.put("jiankangjiaoyuDeleteEnd", 1);
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") { if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id"); params.put("orderBy", "id");
} }
// 调用健康教育服务的queryPage方法根据请求参数进行分页查询
PageUtils page = jiankangjiaoyuService.queryPage(params); PageUtils page = jiankangjiaoyuService.queryPage(params);
//字典表数据转换 // 将分页结果中的列表转换为健康教育视图列表
List<JiankangjiaoyuView> list = (List<JiankangjiaoyuView>) page.getList(); List<JiankangjiaoyuView> list = (List<JiankangjiaoyuView>) page.getList();
// 遍历健康教育视图列表
for (JiankangjiaoyuView c : list) { for (JiankangjiaoyuView c : list) {
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request); dictionaryService.dictionaryConvert(c, request);
} }
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/info/{id}请求路径支持GET请求{id}为路径变量用于获取指定id的健康教育信息详情
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) { public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id); logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用健康教育服务的selectById方法根据id查询健康教育实体
JiankangjiaoyuEntity jiankangjiaoyu = jiankangjiaoyuService.selectById(id); JiankangjiaoyuEntity jiankangjiaoyu = jiankangjiaoyuService.selectById(id);
// 如果查询到健康教育实体
if (jiankangjiaoyu != null) { if (jiankangjiaoyu != null) {
//entity转view // 创建健康教育视图对象
JiankangjiaoyuView view = new JiankangjiaoyuView(); JiankangjiaoyuView view = new JiankangjiaoyuView();
BeanUtils.copyProperties( jiankangjiaoyu , view );//把实体数据重构到view中 // 使用BeanUtils将健康教育实体的属性复制到健康教育视图中
BeanUtils.copyProperties(jiankangjiaoyu, view);
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将健康教育视图对象放入响应数据中
return R.ok().put("data", view); return R.ok().put("data", view);
} else { } else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据"); return R.error(511, "查不到数据");
} }
} }
/** /**
* *
*/ */
// 映射/save请求路径支持POST请求用于保存新的健康教育信息
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) { public R save(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的健康教育实体信息
logger.debug("save方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString()); logger.debug("save方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false) if (false)
return R.error(511, "永远不会进入"); return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件,检查是否存在相同的健康教育信息
Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>() Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>()
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName()) .eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes()) .eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete()) .eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete());
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用健康教育服务的selectOne方法根据查询条件查询是否存在相同数据
JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper); JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (jiankangjiaoyuEntity == null) { if (jiankangjiaoyuEntity == null) {
// 设置插入时间为当前时间
jiankangjiaoyu.setInsertTime(new Date()); jiankangjiaoyu.setInsertTime(new Date());
// 设置逻辑删除字段为1表示未删除
jiankangjiaoyu.setJiankangjiaoyuDelete(1); jiankangjiaoyu.setJiankangjiaoyuDelete(1);
// 设置创建时间为当前时间
jiankangjiaoyu.setCreateTime(new Date()); jiankangjiaoyu.setCreateTime(new Date());
// 调用健康教育服务的insert方法将健康教育实体插入数据库
jiankangjiaoyuService.insert(jiankangjiaoyu); jiankangjiaoyuService.insert(jiankangjiaoyu);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -143,31 +208,40 @@ public class JiankangjiaoyuController {
/** /**
* *
*/ */
// 映射/update请求路径支持POST请求用于修改已有的健康教育信息
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) { public R update(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的健康教育实体信息
logger.debug("update方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString()); logger.debug("update方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false) // if (false)
// return R.error(511, "永远不会进入"); // return R.error(511, "永远不会进入");
//根据字段查询是否有相同数据 // 创建查询包装器,用于构建查询条件,排除当前要修改的记录,检查是否存在相同的健康教育信息
Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>() Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>()
.notIn("id", jiankangjiaoyu.getId()) .notIn("id", jiankangjiaoyu.getId())
.andNew() .andNew()
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName()) .eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes()) .eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete()) .eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete());
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用健康教育服务的selectOne方法根据查询条件查询是否存在相同数据
JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper); JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper);
// 如果健康教育照片字段为空字符串或"null"则将其设置为null
if ("".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto()) || "null".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto())) { if ("".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto()) || "null".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto())) {
jiankangjiaoyu.setJiankangjiaoyuPhoto(null); jiankangjiaoyu.setJiankangjiaoyuPhoto(null);
} }
// 如果未查询到相同数据
if (jiankangjiaoyuEntity == null) { if (jiankangjiaoyuEntity == null) {
jiankangjiaoyuService.updateById(jiankangjiaoyu);//根据id更新 // 调用健康教育服务的updateById方法根据id更新健康教育实体
jiankangjiaoyuService.updateById(jiankangjiaoyu);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -175,51 +249,77 @@ public class JiankangjiaoyuController {
/** /**
* *
*/ */
// 映射/delete请求路径支持POST请求用于删除健康教育信息逻辑删除
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) { public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString()); logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 创建一个ArrayList用于存储要更新的健康教育实体
ArrayList<JiankangjiaoyuEntity> list = new ArrayList<>(); ArrayList<JiankangjiaoyuEntity> list = new ArrayList<>();
// 遍历要删除的记录id数组
for (Integer id : ids) { for (Integer id : ids) {
// 创建一个新的健康教育实体
JiankangjiaoyuEntity jiankangjiaoyuEntity = new JiankangjiaoyuEntity(); JiankangjiaoyuEntity jiankangjiaoyuEntity = new JiankangjiaoyuEntity();
// 设置健康教育实体的id
jiankangjiaoyuEntity.setId(id); jiankangjiaoyuEntity.setId(id);
// 设置逻辑删除字段为2表示已删除
jiankangjiaoyuEntity.setJiankangjiaoyuDelete(2); jiankangjiaoyuEntity.setJiankangjiaoyuDelete(2);
// 将健康教育实体添加到列表中
list.add(jiankangjiaoyuEntity); list.add(jiankangjiaoyuEntity);
} }
// 如果列表不为空
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
// 调用健康教育服务的updateBatchById方法批量更新健康教育实体
jiankangjiaoyuService.updateBatchById(list); jiankangjiaoyuService.updateBatchById(list);
} }
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
// 映射/batchInsert请求路径支持POST请求用于批量上传健康教育信息
@RequestMapping("/batchInsert") @RequestMapping("/batchInsert")
public R save(String fileName) { public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName); logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
try { try {
List<JiankangjiaoyuEntity> jiankangjiaoyuList = new ArrayList<>();//上传的东西 // 创建一个列表,用于存储要上传的健康教育实体
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段 List<JiankangjiaoyuEntity> jiankangjiaoyuList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
Date date = new Date(); Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf("."); int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) { if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀"); return R.error(511, "该文件没有后缀");
} else { } else {
// 获取文件后缀
String suffix = fileName.substring(lastIndexOf); String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) { if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件"); return R.error(511, "只支持后缀为xls的excel文件");
} else { } else {
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径 // 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
File file = new File(resource.getFile()); File file = new File(resource.getFile());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) { if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员"); return R.error(511, "找不到上传文件,请联系管理员");
} else { } else {
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件 // 使用PoiUtil工具类读取xls文件的数据
dataList.remove(0);//删除第一行,因为第一行是提示 List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) { for (List<String> data : dataList) {
//循环 // 创建一个新的健康教育实体
JiankangjiaoyuEntity jiankangjiaoyuEntity = new JiankangjiaoyuEntity(); JiankangjiaoyuEntity jiankangjiaoyuEntity = new JiankangjiaoyuEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// jiankangjiaoyuEntity.setJiankangjiaoyuName(data.get(0)); //健康教育标题 要改的 // jiankangjiaoyuEntity.setJiankangjiaoyuName(data.get(0)); //健康教育标题 要改的
// jiankangjiaoyuEntity.setJiankangjiaoyuTypes(Integer.valueOf(data.get(0))); //健康教育类型 要改的 // jiankangjiaoyuEntity.setJiankangjiaoyuTypes(Integer.valueOf(data.get(0))); //健康教育类型 要改的
// jiankangjiaoyuEntity.setJiankangjiaoyuPhoto("");//照片 // jiankangjiaoyuEntity.setJiankangjiaoyuPhoto("");//照片
@ -227,94 +327,111 @@ public class JiankangjiaoyuController {
// jiankangjiaoyuEntity.setJiankangjiaoyuContent("");//照片 // jiankangjiaoyuEntity.setJiankangjiaoyuContent("");//照片
// jiankangjiaoyuEntity.setJiankangjiaoyuDelete(1);//逻辑删除字段 // jiankangjiaoyuEntity.setJiankangjiaoyuDelete(1);//逻辑删除字段
// jiankangjiaoyuEntity.setCreateTime(date);//时间 // jiankangjiaoyuEntity.setCreateTime(date);//时间
// 将健康教育实体添加到上传列表中
jiankangjiaoyuList.add(jiankangjiaoyuEntity); jiankangjiaoyuList.add(jiankangjiaoyuEntity);
// 把要查询是否重复的字段放入map中 // 把要查询是否重复的字段放入map中
} }
//查询是否重复 // 调用健康教育服务的insertBatch方法批量插入健康教育实体
jiankangjiaoyuService.insertBatch(jiankangjiaoyuList); jiankangjiaoyuService.insertBatch(jiankangjiaoyuList);
// 返回成功响应
return R.ok(); return R.ok();
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员"); return R.error(511, "批量插入数据异常,请联系管理员");
} }
} }
/** /**
* *
*/ */
// 映射/list请求路径支持GET请求用于前端获取健康教育信息的分页列表忽略权限验证
@IgnoreAuth @IgnoreAuth
@RequestMapping("/list") @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request) { public R list(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("list方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params)); logger.debug("list方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 如果请求参数中没有指定排序字段则默认按id倒序排序
// 没有指定排序字段就默认id倒序
if (StringUtil.isEmpty(String.valueOf(params.get("orderBy")))) { if (StringUtil.isEmpty(String.valueOf(params.get("orderBy")))) {
params.put("orderBy", "id"); params.put("orderBy", "id");
} }
// 调用健康教育服务的queryPage方法根据请求参数进行分页查询
PageUtils page = jiankangjiaoyuService.queryPage(params); PageUtils page = jiankangjiaoyuService.queryPage(params);
//字典表数据转换 // 将分页结果中的列表转换为健康教育视图列表
List<JiankangjiaoyuView> list = (List<JiankangjiaoyuView>) page.getList(); List<JiankangjiaoyuView> list = (List<JiankangjiaoyuView>) page.getList();
// 遍历健康教育视图列表
for (JiankangjiaoyuView c : list) for (JiankangjiaoyuView c : list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/detail/{id}请求路径支持GET请求{id}为路径变量用于前端获取指定id的健康教育信息详情
@RequestMapping("/detail/{id}") @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request) { public R detail(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("detail方法:,,Controller:{},,id:{}", this.getClass().getName(), id); logger.debug("detail方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用健康教育服务的selectById方法根据id查询健康教育实体
JiankangjiaoyuEntity jiankangjiaoyu = jiankangjiaoyuService.selectById(id); JiankangjiaoyuEntity jiankangjiaoyu = jiankangjiaoyuService.selectById(id);
// 如果查询到健康教育实体
if (jiankangjiaoyu != null) { if (jiankangjiaoyu != null) {
// 创建健康教育视图对象
//entity转view
JiankangjiaoyuView view = new JiankangjiaoyuView(); JiankangjiaoyuView view = new JiankangjiaoyuView();
BeanUtils.copyProperties( jiankangjiaoyu , view );//把实体数据重构到view中 // 使用BeanUtils将健康教育实体的属性复制到健康教育视图中
BeanUtils.copyProperties(jiankangjiaoyu, view);
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将健康教育视图对象放入响应数据中
return R.ok().put("data", view); return R.ok().put("data", view);
} else { } else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据"); return R.error(511, "查不到数据");
} }
} }
/** /**
* *
*/ */
// 映射/add请求路径支持POST请求用于前端保存新的健康教育信息
@RequestMapping("/add") @RequestMapping("/add")
public R add(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) { public R add(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的健康教育实体信息
logger.debug("add方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString()); logger.debug("add方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString());
// 创建查询包装器,用于构建查询条件,检查是否存在相同的健康教育信息
Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>() Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>()
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName()) .eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes()) .eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete()) .eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete());
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用健康教育服务的selectOne方法根据查询条件查询是否存在相同数据
JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper); JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (jiankangjiaoyuEntity == null) { if (jiankangjiaoyuEntity == null) {
// 设置插入时间为当前时间
jiankangjiaoyu.setInsertTime(new Date()); jiankangjiaoyu.setInsertTime(new Date());
// 设置逻辑删除字段为1表示未删除
jiankangjiaoyu.setJiankangjiaoyuDelete(1); jiankangjiaoyu.setJiankangjiaoyuDelete(1);
// 设置创建时间为当前时间
jiankangjiaoyu.setCreateTime(new Date()); jiankangjiaoyu.setCreateTime(new Date());
// 调用健康教育服务的insert方法将健康教育实体插入数据库
jiankangjiaoyuService.insert(jiankangjiaoyu); jiankangjiaoyuService.insert(jiankangjiaoyu);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
} }

@ -1,35 +1,63 @@
package com.controller; package com.controller;
// 导入文件操作相关类
import java.io.File; import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal; import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL; import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*; import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader; import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService; import com.service.TokenService;
// 导入自定义工具类
import com.utils.*; import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService; import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth; import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger; import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*; import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*; import com.entity.view.*;
// 导入自定义的服务类
import com.service.*; import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils; import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R; import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*; import com.alibaba.fastjson.*;
/** /**
@ -38,101 +66,135 @@ import com.alibaba.fastjson.*;
* @author * @author
* @email * @email
*/ */
// 声明该类为RESTful控制器用于处理HTTP请求并返回JSON数据
@RestController @RestController
// 声明该类为Spring MVC控制器
@Controller @Controller
// 映射请求路径,所有以/news开头的请求都会由该控制器处理
@RequestMapping("/news") @RequestMapping("/news")
public class NewsController { public class NewsController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(NewsController.class); private static final Logger logger = LoggerFactory.getLogger(NewsController.class);
// 自动注入新闻服务类,用于处理新闻相关业务逻辑
@Autowired @Autowired
private NewsService newsService; private NewsService newsService;
// 自动注入令牌服务类
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
// 自动注入字典服务类,用于字典表数据转换
@Autowired @Autowired
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
//级联表service // 级联表service自动注入用户服务类
@Autowired @Autowired
private YonghuService yonghuService; private YonghuService yonghuService;
// 级联表service自动注入医生服务类
@Autowired @Autowired
private YishengService yishengService; private YishengService yishengService;
/** /**
* *
*/ */
// 映射/page请求路径支持GET请求用于获取公告信息的分页列表
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) { public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params)); logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false) if (false)
return R.error(511, "永不会进入"); return R.error(511, "永不会进入");
// 如果用户角色为"用户"
else if ("用户".equals(role)) else if ("用户".equals(role))
// 在请求参数中添加用户id
params.put("yonghuId", request.getSession().getAttribute("userId")); params.put("yonghuId", request.getSession().getAttribute("userId"));
// 如果用户角色为"医生"
else if ("医生".equals(role)) else if ("医生".equals(role))
// 在请求参数中添加医生id
params.put("yishengId", request.getSession().getAttribute("userId")); params.put("yishengId", request.getSession().getAttribute("userId"));
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") { if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id"); params.put("orderBy", "id");
} }
// 调用新闻服务的queryPage方法根据请求参数进行分页查询
PageUtils page = newsService.queryPage(params); PageUtils page = newsService.queryPage(params);
//字典表数据转换 // 将分页结果中的列表转换为新闻视图列表
List<NewsView> list = (List<NewsView>) page.getList(); List<NewsView> list = (List<NewsView>) page.getList();
// 遍历新闻视图列表
for (NewsView c : list) { for (NewsView c : list) {
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request); dictionaryService.dictionaryConvert(c, request);
} }
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/info/{id}请求路径支持GET请求{id}为路径变量用于获取指定id的公告信息详情
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) { public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id); logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用新闻服务的selectById方法根据id查询新闻实体
NewsEntity news = newsService.selectById(id); NewsEntity news = newsService.selectById(id);
// 如果查询到新闻实体
if (news != null) { if (news != null) {
//entity转view // 创建新闻视图对象
NewsView view = new NewsView(); NewsView view = new NewsView();
BeanUtils.copyProperties( news , view );//把实体数据重构到view中 // 使用BeanUtils将新闻实体的属性复制到新闻视图中
BeanUtils.copyProperties(news, view);
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将新闻视图对象放入响应数据中
return R.ok().put("data", view); return R.ok().put("data", view);
} else { } else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据"); return R.error(511, "查不到数据");
} }
} }
/** /**
* *
*/ */
// 映射/save请求路径支持POST请求用于保存新的公告信息
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody NewsEntity news, HttpServletRequest request) { public R save(@RequestBody NewsEntity news, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的新闻实体信息
logger.debug("save方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString()); logger.debug("save方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false) if (false)
return R.error(511, "永远不会进入"); return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件,检查是否存在相同的公告信息
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>() Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>()
.eq("news_name", news.getNewsName()) .eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes()) .eq("news_types", news.getNewsTypes());
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用新闻服务的selectOne方法根据查询条件查询是否存在相同数据
NewsEntity newsEntity = newsService.selectOne(queryWrapper); NewsEntity newsEntity = newsService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (newsEntity == null) { if (newsEntity == null) {
// 设置插入时间为当前时间
news.setInsertTime(new Date()); news.setInsertTime(new Date());
// 设置创建时间为当前时间
news.setCreateTime(new Date()); news.setCreateTime(new Date());
// 调用新闻服务的insert方法将新闻实体插入数据库
newsService.insert(news); newsService.insert(news);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -140,30 +202,39 @@ public class NewsController {
/** /**
* *
*/ */
// 映射/update请求路径支持POST请求用于修改已有的公告信息
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody NewsEntity news, HttpServletRequest request) { public R update(@RequestBody NewsEntity news, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的新闻实体信息
logger.debug("update方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString()); logger.debug("update方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString());
// 从请求会话中获取用户角色
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false) // if (false)
// return R.error(511, "永远不会进入"); // return R.error(511, "永远不会进入");
//根据字段查询是否有相同数据 // 创建查询包装器,用于构建查询条件,排除当前要修改的记录,检查是否存在相同的公告信息
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>() Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>()
.notIn("id", news.getId()) .notIn("id", news.getId())
.andNew() .andNew()
.eq("news_name", news.getNewsName()) .eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes()) .eq("news_types", news.getNewsTypes());
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment()); logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用新闻服务的selectOne方法根据查询条件查询是否存在相同数据
NewsEntity newsEntity = newsService.selectOne(queryWrapper); NewsEntity newsEntity = newsService.selectOne(queryWrapper);
// 如果新闻照片字段为空字符串或"null"则将其设置为null
if ("".equals(news.getNewsPhoto()) || "null".equals(news.getNewsPhoto())) { if ("".equals(news.getNewsPhoto()) || "null".equals(news.getNewsPhoto())) {
news.setNewsPhoto(null); news.setNewsPhoto(null);
} }
// 如果未查询到相同数据
if (newsEntity == null) { if (newsEntity == null) {
newsService.updateById(news);//根据id更新 // 调用新闻服务的updateById方法根据id更新新闻实体
newsService.updateById(news);
// 返回成功响应
return R.ok(); return R.ok();
} else { } else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据"); return R.error(511, "表中有相同数据");
} }
} }
@ -171,134 +242,145 @@ public class NewsController {
/** /**
* *
*/ */
// 映射/delete请求路径支持POST请求用于删除公告信息
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) { public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString()); logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用新闻服务的deleteBatchIds方法根据id数组批量删除记录
newsService.deleteBatchIds(Arrays.asList(ids)); newsService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
// 映射/batchInsert请求路径支持POST请求用于批量上传公告信息
@RequestMapping("/batchInsert") @RequestMapping("/batchInsert")
public R save(String fileName) { public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName); logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
try { try {
List<NewsEntity> newsList = new ArrayList<>();//上传的东西 // 创建一个列表,用于存储要上传的新闻实体
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段 List<NewsEntity> newsList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
Date date = new Date(); Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf("."); int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) { if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀"); return R.error(511, "该文件没有后缀");
} else { } else {
// 获取文件后缀
String suffix = fileName.substring(lastIndexOf); String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) { if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件"); return R.error(511, "只支持后缀为xls的excel文件");
} else { } else {
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径 // 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
File file = new File(resource.getFile()); File file = new File(resource.getFile());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) { if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员"); return R.error(511, "找不到上传文件,请联系管理员");
} else { } else {
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件 // 使用PoiUtil工具类读取xls文件的数据
dataList.remove(0);//删除第一行,因为第一行是提示 List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) { for (List<String> data : dataList) {
//循环 // 创建一个新的新闻实体
NewsEntity newsEntity = new NewsEntity(); NewsEntity newsEntity = new NewsEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// newsEntity.setNewsName(data.get(0)); //公告名称 要改的 // newsEntity.setNewsName(data.get(0)); //公告名称 要改的
// newsEntity.setNewsPhoto("");//照片 // newsEntity.setNewsPhoto("");//照片
// newsEntity.setNewsTypes(Integer.valueOf(data.get(0))); //公告类型 要改的 // newsEntity.setNewsTypes(Integer.valueOf(data.get(0))); //公告类型 要改的
// newsEntity.setInsertTime(date);//时间 // newsEntity.setInsertTime(date);//时间
// newsEntity.setNewsContent("");//照片 // newsEntity.setNewsContent("");//照片
// newsEntity.setCreateTime(date);//时间 // newsEntity.setCreateTime(date);//时间
// 将新闻实体添加到上传列表中
newsList.add(newsEntity); newsList.add(newsEntity);
// 把要查询是否重复的字段放入map中 // 把要查询是否重复的字段放入map中
} }
//查询是否重复 // 调用新闻服务的insertBatch方法批量插入新闻实体
newsService.insertBatch(newsList); newsService.insertBatch(newsList);
// 返回成功响应
return R.ok(); return R.ok();
} }
} }
} }
} catch (Exception e) { } catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员"); return R.error(511, "批量插入数据异常,请联系管理员");
} }
} }
/** /**
* *
*/ */
// 映射/list请求路径支持GET请求用于前端获取公告信息的分页列表忽略权限验证
@IgnoreAuth @IgnoreAuth
@RequestMapping("/list") @RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request) { public R list(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("list方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params)); logger.debug("list方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 如果请求参数中没有指定排序字段则默认按id倒序排序
// 没有指定排序字段就默认id倒序
if (StringUtil.isEmpty(String.valueOf(params.get("orderBy")))) { if (StringUtil.isEmpty(String.valueOf(params.get("orderBy")))) {
params.put("orderBy", "id"); params.put("orderBy", "id");
} }
// 调用新闻服务的queryPage方法根据请求参数进行分页查询
PageUtils page = newsService.queryPage(params); PageUtils page = newsService.queryPage(params);
//字典表数据转换 // 将分页结果中的列表转换为新闻视图列表
List<NewsView> list = (List<NewsView>) page.getList(); List<NewsView> list = (List<NewsView>) page.getList();
// 遍历新闻视图列表
for (NewsView c : list) for (NewsView c : list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
*/ */
// 映射/detail/{id}请求路径支持GET请求{id}为路径变量用于前端获取指定id的公告信息详情
@RequestMapping("/detail/{id}") @RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request) { public R detail(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("detail方法:,,Controller:{},,id:{}", this.getClass().getName(), id); logger.debug("detail方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用新闻服务的selectById方法根据id查询新闻实体
NewsEntity news = newsService.selectById(id); NewsEntity news = newsService.selectById(id);
// 如果查询到新闻实体
if (news != null) { if (news != null) {
// 创建新闻视图对象
//entity转view
NewsView view = new NewsView(); NewsView view = new NewsView();
BeanUtils.copyProperties( news , view );//把实体数据重构到view中 // 使用BeanUtils将新闻实体的属性复制到新闻视图中
BeanUtils.copyProperties(news, view);
//修改对应字典表字段 // 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request); dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将新闻视图对象放入响应数据中
return R.ok().put("data", view); return R.ok().put("data", view);
} else { } else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据"); return R.error(511, "查不到数据");
} }
} }
/** /**
* *
*/ */
// 映射/add请求路径支持POST请求用于前端保存新的公告信息
@RequestMapping("/add") @RequestMapping("/add")
public R add(@RequestBody NewsEntity news, HttpServletRequest request) { public R add(@RequestBody NewsEntity news, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的新闻实体信息
logger.debug("add方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString()); logger.debug("add方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString());
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>() // 创建查询包装器,用于构建查询条件,检查是否存在相同的公告信息
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
NewsEntity newsEntity = newsService.selectOne(queryWrapper);
if(newsEntity==null){
news.setInsertTime(new Date());
news.setCreateTime(new Date());
newsService.insert(news);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}

@ -1,7 +1,5 @@
package com.controller; package com.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
@ -28,31 +26,49 @@ import com.utils.R;
/** /**
* *
*/ */
// 定义请求映射路径,所有以/users开头的请求会被该控制器处理
@RequestMapping("users") @RequestMapping("users")
// 声明该类为一个RESTful风格的控制器用于处理HTTP请求并返回JSON数据
@RestController @RestController
public class UsersController { public class UsersController {
// 自动注入UsersService用于处理与用户相关的业务逻辑
@Autowired @Autowired
private UsersService usersService; private UsersService usersService;
// 自动注入TokenService用于处理与令牌相关的业务逻辑
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
/** /**
* *
* @param username
* @param password
* @param captcha 使
* @param request HTTP
* @return R
*/ */
@IgnoreAuth @IgnoreAuth // 忽略权限验证的注解
@PostMapping(value = "/login") @PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) { public R login(String username, String password, String captcha, HttpServletRequest request) {
// 根据用户名查询用户实体
UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username)); UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
// 如果用户不存在或者用户输入的密码与数据库中存储的密码不匹配
if (user == null || !user.getPassword().equals(password)) { if (user == null || !user.getPassword().equals(password)) {
// 返回错误响应,提示账号或密码不正确
return R.error("账号或密码不正确"); return R.error("账号或密码不正确");
} }
// 生成用户令牌参数依次为用户ID、用户名、用户类型标识、用户角色
String token = tokenService.generateToken(user.getId(), username, "users", user.getRole()); String token = tokenService.generateToken(user.getId(), username, "users", user.getRole());
// 创建一个成功的响应对象
R r = R.ok(); R r = R.ok();
// 将生成的令牌放入响应数据中
r.put("token", token); r.put("token", token);
// 将用户的角色信息放入响应数据中
r.put("role", user.getRole()); r.put("role", user.getRole());
// 将用户的ID信息放入响应数据中
r.put("userId", user.getId()); r.put("userId", user.getId());
// 返回响应对象
return r; return r;
} }
@ -62,11 +78,15 @@ public class UsersController {
@IgnoreAuth @IgnoreAuth
@PostMapping(value = "/register") @PostMapping(value = "/register")
public R register(@RequestBody UsersEntity user) { public R register(@RequestBody UsersEntity user) {
// ValidatorUtils.validateEntity(user); // ValidatorUtils.validateEntity(user); // 被注释掉的代码,可能用于验证用户实体的合法性,目前未启用
// 根据用户名查询数据库,判断用户是否已经存在
if (usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) { if (usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) {
// 如果用户已存在,返回错误响应
return R.error("用户已存在"); return R.error("用户已存在");
} }
// 将新用户插入到数据库中
usersService.insert(user); usersService.insert(user);
// 返回成功响应
return R.ok(); return R.ok();
} }
@ -75,94 +95,140 @@ public class UsersController {
*/ */
@GetMapping(value = "logout") @GetMapping(value = "logout")
public R logout(HttpServletRequest request) { public R logout(HttpServletRequest request) {
// 使当前用户的会话失效,实现退出登录
request.getSession().invalidate(); request.getSession().invalidate();
// 返回成功响应,并附带退出成功的提示信息
return R.ok("退出成功"); return R.ok("退出成功");
} }
/** /**
* *
* @param username
* @param request HTTP
* @return R
*/ */
@IgnoreAuth @IgnoreAuth // 忽略权限验证的注解
@RequestMapping(value = "/resetPass") @RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request) { public R resetPass(String username, HttpServletRequest request) {
// 根据用户名查询用户实体
UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username)); UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
// 如果用户不存在
if (user == null) { if (user == null) {
// 返回错误响应,提示账号不存在
return R.error("账号不存在"); return R.error("账号不存在");
} }
// 将用户密码重置为默认值123456
user.setPassword("123456"); user.setPassword("123456");
// 更新用户信息到数据库第二个参数为null可能表示更新时不设置额外的条件
usersService.update(user, null); usersService.update(user, null);
// 返回成功响应,并附带密码已重置的提示信息
return R.ok("密码已重置为123456"); return R.ok("密码已重置为123456");
} }
/** /**
* *
* @param params Map
* @param user
* @return R
*/ */
@RequestMapping("/page") @RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, UsersEntity user) { public R page(@RequestParam Map<String, Object> params, UsersEntity user) {
// 创建一个EntityWrapper对象用于构建查询条件
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>(); EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
// 调用usersService的queryPage方法进行分页查询MPUtil.sort等方法用于处理查询条件和排序
PageUtils page = usersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); PageUtils page = usersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
// 返回成功响应,并将分页结果数据放入响应中
return R.ok().put("data", page); return R.ok().put("data", page);
} }
/** /**
* *
* @param user
* @return R
*/ */
@RequestMapping("/list") @RequestMapping("/list")
public R list(UsersEntity user) { public R list(UsersEntity user) {
// 创建一个EntityWrapper对象
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>(); EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
// 根据用户实体对象构建查询条件使用MPUtil.allEQMapPre方法设置相等条件
ew.allEq(MPUtil.allEQMapPre(user, "user")); ew.allEq(MPUtil.allEQMapPre(user, "user"));
// 调用usersService的selectListView方法查询用户列表并将结果放入响应中返回
return R.ok().put("data", usersService.selectListView(ew)); return R.ok().put("data", usersService.selectListView(ew));
} }
/** /**
* *
* @param id ID
* @return R
*/ */
@RequestMapping("/info/{id}") @RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id) { public R info(@PathVariable("id") String id) {
// 根据用户ID查询用户实体
UsersEntity user = usersService.selectById(id); UsersEntity user = usersService.selectById(id);
// 返回成功响应,并将用户信息放入响应中
return R.ok().put("data", user); return R.ok().put("data", user);
} }
/** /**
* session *
* @param request HTTP
* @return R
*/ */
@RequestMapping("/session") @RequestMapping("/session")
public R getCurrUser(HttpServletRequest request) { public R getCurrUser(HttpServletRequest request) {
// 从当前会话中获取用户ID
Integer id = (Integer) request.getSession().getAttribute("userId"); Integer id = (Integer) request.getSession().getAttribute("userId");
// 根据用户ID查询用户实体
UsersEntity user = usersService.selectById(id); UsersEntity user = usersService.selectById(id);
// 返回成功响应,并将用户信息放入响应中
return R.ok().put("data", user); return R.ok().put("data", user);
} }
/** /**
* *
* @param user
* @return R
*/ */
@PostMapping("/save") @PostMapping("/save")
public R save(@RequestBody UsersEntity user) { public R save(@RequestBody UsersEntity user) {
// ValidatorUtils.validateEntity(user); // ValidatorUtils.validateEntity(user); // 被注释掉的代码,可能用于验证用户实体的合法性,目前未启用
// 根据用户名查询数据库,判断用户是否已经存在
if (usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) { if (usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) {
// 如果用户已存在,返回错误响应
return R.error("用户已存在"); return R.error("用户已存在");
} }
// 设置用户密码为默认值123456
user.setPassword("123456"); user.setPassword("123456");
// 将用户插入到数据库中
usersService.insert(user); usersService.insert(user);
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
* @param user
* @return R
*/ */
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody UsersEntity user) { public R update(@RequestBody UsersEntity user) {
// ValidatorUtils.validateEntity(user); // ValidatorUtils.validateEntity(user); // 被注释掉的代码,可能用于验证用户实体的合法性,目前未启用
// 根据用户ID更新用户信息到数据库
usersService.updateById(user); // 全部更新 usersService.updateById(user); // 全部更新
// 返回成功响应
return R.ok(); return R.ok();
} }
/** /**
* *
* @param ids ID
* @return R
*/ */
@RequestMapping("/delete") @RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) { public R delete(@RequestBody Long[] ids) {
// 根据用户ID数组批量删除用户
usersService.deleteBatchIds(Arrays.asList(ids)); usersService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok(); return R.ok();
} }
} }

@ -1,4 +1,3 @@
package com.controller; package com.controller;
import java.io.File; import java.io.File;
@ -39,11 +38,15 @@ import com.alibaba.fastjson.*;
* @email * @email
*/ */
@RestController @RestController
// 声明为Spring MVC控制器
@Controller @Controller
// 定义请求映射路径,所有以/yisheng开头的请求由该控制器处理
@RequestMapping("/yisheng") @RequestMapping("/yisheng")
public class YishengController { public class YishengController {
// 日志记录器,用于记录当前控制器的日志信息
private static final Logger logger = LoggerFactory.getLogger(YishengController.class); private static final Logger logger = LoggerFactory.getLogger(YishengController.class);
// 自动注入医生服务类,用于处理医生相关业务逻辑
@Autowired @Autowired
private YishengService yishengService; private YishengService yishengService;
@ -53,12 +56,10 @@ public class YishengController {
@Autowired @Autowired
private DictionaryService dictionaryService; private DictionaryService dictionaryService;
//级联表service // 级联表service自动注入用户服务类
@Autowired @Autowired
private YonghuService yonghuService; private YonghuService yonghuService;
/** /**
* *
*/ */
@ -104,7 +105,6 @@ public class YishengController {
}else { }else {
return R.error(511,"查不到数据"); return R.error(511,"查不到数据");
} }
} }
/** /**
@ -112,6 +112,7 @@ public class YishengController {
*/ */
@RequestMapping("/save") @RequestMapping("/save")
public R save(@RequestBody YishengEntity yisheng, HttpServletRequest request) { public R save(@RequestBody YishengEntity yisheng, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的医生实体信息
logger.debug("save方法:,,Controller:{},,yisheng:{}", this.getClass().getName(), yisheng.toString()); logger.debug("save方法:,,Controller:{},,yisheng:{}", this.getClass().getName(), yisheng.toString());
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
@ -121,8 +122,7 @@ public class YishengController {
Wrapper<YishengEntity> queryWrapper = new EntityWrapper<YishengEntity>() Wrapper<YishengEntity> queryWrapper = new EntityWrapper<YishengEntity>()
.eq("username", yisheng.getUsername()) .eq("username", yisheng.getUsername())
.or() .or()
.eq("yisheng_phone", yisheng.getYishengPhone()) .eq("yisheng_phone", yisheng.getYishengPhone());
;
logger.info("sql语句:"+queryWrapper.getSqlSegment()); logger.info("sql语句:"+queryWrapper.getSqlSegment());
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper); YishengEntity yishengEntity = yishengService.selectOne(queryWrapper);
@ -141,6 +141,7 @@ public class YishengController {
*/ */
@RequestMapping("/update") @RequestMapping("/update")
public R update(@RequestBody YishengEntity yisheng, HttpServletRequest request) { public R update(@RequestBody YishengEntity yisheng, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要更新的医生实体信息
logger.debug("update方法:,,Controller:{},,yisheng:{}", this.getClass().getName(), yisheng.toString()); logger.debug("update方法:,,Controller:{},,yisheng:{}", this.getClass().getName(), yisheng.toString());
String role = String.valueOf(request.getSession().getAttribute("role")); String role = String.valueOf(request.getSession().getAttribute("role"));
@ -178,17 +179,18 @@ public class YishengController {
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
@RequestMapping("/batchInsert") @RequestMapping("/batchInsert")
public R save(String fileName) { public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName); logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
try { try {
List<YishengEntity> yishengList = new ArrayList<>();//上传的东西 List<YishengEntity> yishengList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段 Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date(); Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf("."); int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){ if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀"); return R.error(511,"该文件没有后缀");
@ -292,7 +294,6 @@ public class YishengController {
} }
} }
/** /**
* *
*/ */

@ -1,4 +1,3 @@
package com.controller; package com.controller;
import java.io.File; import java.io.File;
@ -51,7 +50,7 @@ public class YonghuController {
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@Autowired @Autowired
private DictionaryService dictionaryService; private DictionaryService dictionaryService; // 字典服务
//级联表service //级联表service
@ -105,7 +104,6 @@ public class YonghuController {
}else { }else {
return R.error(511,"查不到数据"); return R.error(511,"查不到数据");
} }
} }
/** /**
@ -197,7 +195,6 @@ public class YonghuController {
return R.ok(); return R.ok();
} }
/** /**
* *
*/ */
@ -308,7 +305,6 @@ public class YonghuController {
} }
} }
/** /**
* *
*/ */

@ -9,9 +9,9 @@ import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.entity.view.YonghuView; import com.entity.view.YonghuView;
/**
/*
* Dao * Dao
*
* @author * @author
*/ */
public interface YonghuDao extends BaseMapper<YonghuEntity> { public interface YonghuDao extends BaseMapper<YonghuEntity> {

@ -1,23 +1,36 @@
package com.entity; package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解,确保字段不为空字符串
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
// 导入 JSR 303 验证注解,确保集合或数组不为空
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
// 导入 JSR 303 验证注解,确保字段不为 null
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
// 导入 Jackson 注解,用于忽略 JSON 序列化和反序列化时的某些属性
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable; import java.io.Serializable;
// 导入日期类
import java.util.Date; import java.util.Date;
// 导入列表集合类
import java.util.List; import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
@ -26,240 +39,260 @@ import com.baomidou.mybatisplus.enums.IdType;
* @author * @author
* @email * @email
*/ */
// 指定该类对应数据库中的 chat 表
@TableName("chat") @TableName("chat")
// 实现 Serializable 接口,使该类的对象可以进行序列化和反序列化操作
public class ChatEntity<T> implements Serializable { public class ChatEntity<T> implements Serializable {
// 序列化版本号,确保序列化和反序列化的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 无参构造函数,方便创建 ChatEntity 类的实例
public ChatEntity() { public ChatEntity() {
} }
// 带参构造函数,接收一个泛型对象 t将其属性复制到当前 ChatEntity 对象
public ChatEntity(T t) { public ChatEntity(T t) {
try { try {
// 使用 BeanUtils 工具类复制属性
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 若复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 指定该字段为主键,且主键生成策略为自增
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
// 指定该字段对应数据库表中的 id 字段
@TableField(value = "id") @TableField(value = "id")
// 主键,用于唯一标识一条在线咨询记录
private Integer id; private Integer id;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 yonghu_id 字段
@TableField(value = "yonghu_id") @TableField(value = "yonghu_id")
// 提问用户的 ID关联用户表
private Integer yonghuId; private Integer yonghuId;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 chat_issue 字段
@TableField(value = "chat_issue") @TableField(value = "chat_issue")
// 用户提出的问题内容
private String chatIssue; private String chatIssue;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 指定该字段对应数据库表中的 issue_time 字段
@TableField(value = "issue_time") @TableField(value = "issue_time")
// 用户提出问题的时间
private Date issueTime; private Date issueTime;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 chat_reply 字段
@TableField(value = "chat_reply") @TableField(value = "chat_reply")
// 针对用户问题的回复内容
private String chatReply; private String chatReply;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 指定该字段对应数据库表中的 reply_time 字段
@TableField(value = "reply_time") @TableField(value = "reply_time")
// 回复用户问题的时间
private Date replyTime; private Date replyTime;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 zhuangtai_types 字段
@TableField(value = "zhuangtai_types") @TableField(value = "zhuangtai_types")
// 在线咨询的状态,可能用整数表示不同状态,如 0 表示待回复1 表示已回复等
private Integer zhuangtaiTypes; private Integer zhuangtaiTypes;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 chat_types 字段
@TableField(value = "chat_types") @TableField(value = "chat_types")
// 在线咨询的数据类型,可能用整数表示不同类型,如 1 表示文字咨询2 表示图片咨询等
private Integer chatTypes; private Integer chatTypes;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 指定该字段对应数据库表中的 insert_time 字段,且在插入数据时自动填充
@TableField(value = "insert_time", fill = FieldFill.INSERT) @TableField(value = "insert_time", fill = FieldFill.INSERT)
// 该条在线咨询记录的创建时间
private Date insertTime; private Date insertTime;
/** /**
* *
*/ */
// 获取主键的方法
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键的方法
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取提问用户 ID 的方法
public Integer getYonghuId() { public Integer getYonghuId() {
return yonghuId; return yonghuId;
} }
/** /**
* *
*/ */
// 设置提问用户 ID 的方法
public void setYonghuId(Integer yonghuId) { public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId; this.yonghuId = yonghuId;
} }
/** /**
* *
*/ */
// 获取问题内容的方法
public String getChatIssue() { public String getChatIssue() {
return chatIssue; return chatIssue;
} }
/** /**
* *
*/ */
// 设置问题内容的方法
public void setChatIssue(String chatIssue) { public void setChatIssue(String chatIssue) {
this.chatIssue = chatIssue; this.chatIssue = chatIssue;
} }
/** /**
* *
*/ */
// 获取问题时间的方法
public Date getIssueTime() { public Date getIssueTime() {
return issueTime; return issueTime;
} }
/** /**
* *
*/ */
// 设置问题时间的方法
public void setIssueTime(Date issueTime) { public void setIssueTime(Date issueTime) {
this.issueTime = issueTime; this.issueTime = issueTime;
} }
/** /**
* *
*/ */
// 获取回复内容的方法
public String getChatReply() { public String getChatReply() {
return chatReply; return chatReply;
} }
/** /**
* *
*/ */
// 设置回复内容的方法
public void setChatReply(String chatReply) { public void setChatReply(String chatReply) {
this.chatReply = chatReply; this.chatReply = chatReply;
} }
/** /**
* *
*/ */
// 获取回复时间的方法
public Date getReplyTime() { public Date getReplyTime() {
return replyTime; return replyTime;
} }
/** /**
* *
*/ */
// 设置回复时间的方法
public void setReplyTime(Date replyTime) { public void setReplyTime(Date replyTime) {
this.replyTime = replyTime; this.replyTime = replyTime;
} }
/** /**
* *
*/ */
// 获取状态的方法
public Integer getZhuangtaiTypes() { public Integer getZhuangtaiTypes() {
return zhuangtaiTypes; return zhuangtaiTypes;
} }
/** /**
* *
*/ */
// 设置状态的方法
public void setZhuangtaiTypes(Integer zhuangtaiTypes) { public void setZhuangtaiTypes(Integer zhuangtaiTypes) {
this.zhuangtaiTypes = zhuangtaiTypes; this.zhuangtaiTypes = zhuangtaiTypes;
} }
/** /**
* *
*/ */
// 获取数据类型的方法
public Integer getChatTypes() { public Integer getChatTypes() {
return chatTypes; return chatTypes;
} }
/** /**
* *
*/ */
// 设置数据类型的方法
public void setChatTypes(Integer chatTypes) { public void setChatTypes(Integer chatTypes) {
this.chatTypes = chatTypes; this.chatTypes = chatTypes;
} }
/** /**
* *
*/ */
// 获取创建时间的方法
public Date getInsertTime() { public Date getInsertTime() {
return insertTime; return insertTime;
} }
/** /**
* *
*/ */
// 设置创建时间的方法
public void setInsertTime(Date insertTime) { public void setInsertTime(Date insertTime) {
this.insertTime = insertTime; this.insertTime = insertTime;
} }
// 重写 toString 方法,方便打印对象信息
@Override @Override
public String toString() { public String toString() {
return "Chat{" + return "Chat{" +

@ -13,13 +13,12 @@ import com.baomidou.mybatisplus.enums.IdType;
*/ */
@TableName("config") @TableName("config")
public class ConfigEntity implements Serializable{ public class ConfigEntity implements Serializable{
private static final long serialVersionUID = 1L; // 定义主键字段
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Long id; private Long id;
/** /**
* key * name
*/ */
private String name; private String name;
@ -51,5 +50,4 @@ private static final long serialVersionUID = 1L;
public void setValue(String value) { public void setValue(String value) {
this.value = value; this.value = value;
} }
} }

@ -1,23 +1,34 @@
package com.entity; package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(在当前代码中未实际使用)
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
// 导入 Jackson 注解(在当前代码中未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable; import java.io.Serializable;
// 导入日期类
import java.util.Date; import java.util.Date;
// 导入列表集合类(在当前代码中未实际使用)
import java.util.List; import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
@ -26,213 +37,229 @@ import com.baomidou.mybatisplus.enums.IdType;
* @author * @author
* @email * @email
*/ */
// 使用 TableName 注解指定该类对应的数据库表名为 "dictionary"
@TableName("dictionary") @TableName("dictionary")
// 定义泛型类 DictionaryEntity实现 Serializable 接口,以便对象可以进行序列化和反序列化
public class DictionaryEntity<T> implements Serializable { public class DictionaryEntity<T> implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建 DictionaryEntity 对象
public DictionaryEntity() { public DictionaryEntity() {
} }
// 带参构造函数,接受一个泛型对象 t通过 BeanUtils.copyProperties 方法
// 将对象 t 的属性复制到当前 DictionaryEntity 对象中
public DictionaryEntity(T t) { public DictionaryEntity(T t) {
try { try {
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "id"
@TableField(value = "id") @TableField(value = "id")
// 存储字典表记录的主键值,用于唯一标识一条记录
private Integer id; private Integer id;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "dic_code"
@TableField(value = "dic_code") @TableField(value = "dic_code")
// 存储字典表中的字段代码,可能用于标识不同的字典项类别等
private String dicCode; private String dicCode;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "dic_name"
@TableField(value = "dic_name") @TableField(value = "dic_name")
// 存储字典表中字段的名称,与 dicCode 对应,提供更易读的名称标识
private String dicName; private String dicName;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "code_index"
@TableField(value = "code_index") @TableField(value = "code_index")
// 存储字典表中某一字典项的编码值,可能用于内部编码或排序等用途
private Integer codeIndex; private Integer codeIndex;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "index_name"
@TableField(value = "index_name") @TableField(value = "index_name")
// 存储编码对应的名称,与 codeIndex 对应,提供更详细的编码描述
private String indexName; private String indexName;
/** /**
* id * id
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "super_id"
@TableField(value = "super_id") @TableField(value = "super_id")
// 存储当前字典项的父字段 ID用于表示字典项之间的层级关系
private Integer superId; private Integer superId;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "beizhu"
@TableField(value = "beizhu") @TableField(value = "beizhu")
// 存储关于当前字典项的备注信息,用于记录额外的说明或注意事项
private String beizhu; private String beizhu;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "create_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "create_time", fill = FieldFill.INSERT) @TableField(value = "create_time", fill = FieldFill.INSERT)
// 存储字典表记录的创建时间,用于记录数据的创建时间戳
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 获取主键值的方法,外部可以通过调用该方法获取 id 字段的值
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键值的方法,外部可以通过调用该方法设置 id 字段的值
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取字段代码值的方法,外部可以通过调用该方法获取 dicCode 字段的值
public String getDicCode() { public String getDicCode() {
return dicCode; return dicCode;
} }
/** /**
* *
*/ */
// 设置字段代码值的方法,外部可以通过调用该方法设置 dicCode 字段的值
public void setDicCode(String dicCode) { public void setDicCode(String dicCode) {
this.dicCode = dicCode; this.dicCode = dicCode;
} }
/** /**
* *
*/ */
// 获取字段名称值的方法,外部可以通过调用该方法获取 dicName 字段的值
public String getDicName() { public String getDicName() {
return dicName; return dicName;
} }
/** /**
* *
*/ */
// 设置字段名称值的方法,外部可以通过调用该方法设置 dicName 字段的值
public void setDicName(String dicName) { public void setDicName(String dicName) {
this.dicName = dicName; this.dicName = dicName;
} }
/** /**
* *
*/ */
// 获取编码值的方法,外部可以通过调用该方法获取 codeIndex 字段的值
public Integer getCodeIndex() { public Integer getCodeIndex() {
return codeIndex; return codeIndex;
} }
/** /**
* *
*/ */
// 设置编码值的方法,外部可以通过调用该方法设置 codeIndex 字段的值
public void setCodeIndex(Integer codeIndex) { public void setCodeIndex(Integer codeIndex) {
this.codeIndex = codeIndex; this.codeIndex = codeIndex;
} }
/** /**
* *
*/ */
// 获取编码名称值的方法,外部可以通过调用该方法获取 indexName 字段的值
public String getIndexName() { public String getIndexName() {
return indexName; return indexName;
} }
/** /**
* *
*/ */
// 设置编码名称值的方法,外部可以通过调用该方法设置 indexName 字段的值
public void setIndexName(String indexName) { public void setIndexName(String indexName) {
this.indexName = indexName; this.indexName = indexName;
} }
/** /**
* id * id
*/ */
// 获取父字段 ID 值的方法,外部可以通过调用该方法获取 superId 字段的值
public Integer getSuperId() { public Integer getSuperId() {
return superId; return superId;
} }
/** /**
* id * id
*/ */
// 设置父字段 ID 值的方法,外部可以通过调用该方法设置 superId 字段的值
public void setSuperId(Integer superId) { public void setSuperId(Integer superId) {
this.superId = superId; this.superId = superId;
} }
/** /**
* *
*/ */
// 获取备注信息值的方法,外部可以通过调用该方法获取 beizhu 字段的值
public String getBeizhu() { public String getBeizhu() {
return beizhu; return beizhu;
} }
/** /**
* *
*/ */
// 设置备注信息值的方法,外部可以通过调用该方法设置 beizhu 字段的值
public void setBeizhu(String beizhu) { public void setBeizhu(String beizhu) {
this.beizhu = beizhu; this.beizhu = beizhu;
} }
/** /**
* *
*/ */
// 获取创建时间值的方法,外部可以通过调用该方法获取 createTime 字段的值
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* *
*/ */
// 设置创建时间值的方法,外部可以通过调用该方法设置 createTime 字段的值
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
// 重写 toString 方法,返回对象的字符串表示,方便调试和日志记录
@Override @Override
public String toString() { public String toString() {
return "Dictionary{" + return "Dictionary{" +

@ -1,52 +1,64 @@
package com.entity; package com.entity;
/** /**
* *
*/ */
// 定义一个名为EIException的类它继承自RuntimeException表明这是一个运行时异常类
public class EIException extends RuntimeException { public class EIException extends RuntimeException {
// 定义序列化版本号,用于在序列化和反序列化过程中确保兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 用于存储异常的详细信息,描述异常发生的情况
private String msg; private String msg;
// 用于存储异常的状态码默认值为500通常表示服务器内部错误
private int code = 500; private int code = 500;
// 构造函数接受一个字符串参数msg将其设置为异常信息并调用父类的构造函数传递异常信息
public EIException(String msg) { public EIException(String msg) {
super(msg); super(msg);
this.msg = msg; this.msg = msg;
} }
// 构造函数接受一个字符串参数msg和一个Throwable对象e
// 将msg设置为异常信息调用父类的构造函数传递异常信息和异常原因
public EIException(String msg, Throwable e) { public EIException(String msg, Throwable e) {
super(msg, e); super(msg, e);
this.msg = msg; this.msg = msg;
} }
// 构造函数接受一个字符串参数msg和一个整数参数code
// 将msg设置为异常信息code设置为异常状态码并调用父类的构造函数传递异常信息
public EIException(String msg, int code) { public EIException(String msg, int code) {
super(msg); super(msg);
this.msg = msg; this.msg = msg;
this.code = code; this.code = code;
} }
// 构造函数接受一个字符串参数msg、一个整数参数code和一个Throwable对象e
// 将msg设置为异常信息code设置为异常状态码调用父类的构造函数传递异常信息和异常原因
public EIException(String msg, int code, Throwable e) { public EIException(String msg, int code, Throwable e) {
super(msg, e); super(msg, e);
this.msg = msg; this.msg = msg;
this.code = code; this.code = code;
} }
// 获取异常信息的方法,返回存储的异常信息字符串
public String getMsg() { public String getMsg() {
return msg; return msg;
} }
// 设置异常信息的方法,将传入的字符串设置为新的异常信息
public void setMsg(String msg) { public void setMsg(String msg) {
this.msg = msg; this.msg = msg;
} }
// 获取异常状态码的方法,返回存储的异常状态码
public int getCode() { public int getCode() {
return code; return code;
} }
// 设置异常状态码的方法,将传入的整数设置为新的异常状态码
public void setCode(int code) { public void setCode(int code) {
this.code = code; this.code = code;
} }
} }

@ -1,23 +1,34 @@
package com.entity; package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(在当前代码中未实际使用)
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
// 导入 Jackson 注解(在当前代码中未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable; import java.io.Serializable;
// 导入日期类
import java.util.Date; import java.util.Date;
// 导入列表集合类(在当前代码中未实际使用)
import java.util.List; import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
@ -26,261 +37,281 @@ import com.baomidou.mybatisplus.enums.IdType;
* @author * @author
* @email * @email
*/ */
// 使用 TableName 注解指定该类对应的数据库表名为 "guahao"
@TableName("guahao") @TableName("guahao")
// 定义泛型类 GuahaoEntity实现 Serializable 接口,以便对象可以进行序列化和反序列化
public class GuahaoEntity<T> implements Serializable { public class GuahaoEntity<T> implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建 GuahaoEntity 对象
public GuahaoEntity() { public GuahaoEntity() {
} }
// 带参构造函数,接受一个泛型对象 t通过 BeanUtils.copyProperties 方法
// 将对象 t 的属性复制到当前 GuahaoEntity 对象中
public GuahaoEntity(T t) { public GuahaoEntity(T t) {
try { try {
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "id"
@TableField(value = "id") @TableField(value = "id")
// 存储挂号记录的主键值,用于唯一标识一条挂号记录
private Integer id; private Integer id;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "yisheng_id"
@TableField(value = "yisheng_id") @TableField(value = "yisheng_id")
// 存储挂号对应的医生 ID关联医生表
private Integer yishengId; private Integer yishengId;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "yonghu_id"
@TableField(value = "yonghu_id") @TableField(value = "yonghu_id")
// 存储挂号的用户 ID关联用户表
private Integer yonghuId; private Integer yonghuId;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_uuin_number"
@TableField(value = "guahao_uuin_number") @TableField(value = "guahao_uuin_number")
// 存储就诊的唯一识别码,用于标识具体的就诊记录
private String guahaoUuinNumber; private String guahaoUuinNumber;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_time"
@TableField(value = "guahao_time") @TableField(value = "guahao_time")
// 存储挂号的具体时间
private Date guahaoTime; private Date guahaoTime;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_types"
@TableField(value = "guahao_types") @TableField(value = "guahao_types")
// 存储挂号的时间类型,可能表示上午、下午、晚上等不同时间段,用整数标识
private Integer guahaoTypes; private Integer guahaoTypes;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_status_types"
@TableField(value = "guahao_status_types") @TableField(value = "guahao_status_types")
// 存储挂号的状态,例如已挂号、已取消、已就诊等,用整数标识不同状态
private Integer guahaoStatusTypes; private Integer guahaoStatusTypes;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_yesno_types"
@TableField(value = "guahao_yesno_types") @TableField(value = "guahao_yesno_types")
// 存储挂号审核的结果,可能表示通过、不通过等,用整数标识
private Integer guahaoYesnoTypes; private Integer guahaoYesnoTypes;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_yesno_text"
@TableField(value = "guahao_yesno_text") @TableField(value = "guahao_yesno_text")
// 存储挂号审核结果的具体文本描述,例如不通过的原因等
private String guahaoYesnoText; private String guahaoYesnoText;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "create_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "create_time", fill = FieldFill.INSERT) @TableField(value = "create_time", fill = FieldFill.INSERT)
// 存储挂号记录的创建时间,用于记录数据的创建时间戳
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 获取主键值的方法,外部可以通过调用该方法获取 id 字段的值
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键值的方法,外部可以通过调用该方法设置 id 字段的值
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取医生 ID 值的方法,外部可以通过调用该方法获取 yishengId 字段的值
public Integer getYishengId() { public Integer getYishengId() {
return yishengId; return yishengId;
} }
/** /**
* *
*/ */
// 设置医生 ID 值的方法,外部可以通过调用该方法设置 yishengId 字段的值
public void setYishengId(Integer yishengId) { public void setYishengId(Integer yishengId) {
this.yishengId = yishengId; this.yishengId = yishengId;
} }
/** /**
* *
*/ */
// 获取用户 ID 值的方法,外部可以通过调用该方法获取 yonghuId 字段的值
public Integer getYonghuId() { public Integer getYonghuId() {
return yonghuId; return yonghuId;
} }
/** /**
* *
*/ */
// 设置用户 ID 值的方法,外部可以通过调用该方法设置 yonghuId 字段的值
public void setYonghuId(Integer yonghuId) { public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId; this.yonghuId = yonghuId;
} }
/** /**
* *
*/ */
// 获取就诊识别码值的方法,外部可以通过调用该方法获取 guahaoUuinNumber 字段的值
public String getGuahaoUuinNumber() { public String getGuahaoUuinNumber() {
return guahaoUuinNumber; return guahaoUuinNumber;
} }
/** /**
* *
*/ */
// 设置就诊识别码值的方法,外部可以通过调用该方法设置 guahaoUuinNumber 字段的值
public void setGuahaoUuinNumber(String guahaoUuinNumber) { public void setGuahaoUuinNumber(String guahaoUuinNumber) {
this.guahaoUuinNumber = guahaoUuinNumber; this.guahaoUuinNumber = guahaoUuinNumber;
} }
/** /**
* *
*/ */
// 获取挂号时间值的方法,外部可以通过调用该方法获取 guahaoTime 字段的值
public Date getGuahaoTime() { public Date getGuahaoTime() {
return guahaoTime; return guahaoTime;
} }
/** /**
* *
*/ */
// 设置挂号时间值的方法,外部可以通过调用该方法设置 guahaoTime 字段的值
public void setGuahaoTime(Date guahaoTime) { public void setGuahaoTime(Date guahaoTime) {
this.guahaoTime = guahaoTime; this.guahaoTime = guahaoTime;
} }
/** /**
* *
*/ */
// 获取时间类型值的方法,外部可以通过调用该方法获取 guahaoTypes 字段的值
public Integer getGuahaoTypes() { public Integer getGuahaoTypes() {
return guahaoTypes; return guahaoTypes;
} }
/** /**
* *
*/ */
// 设置时间类型值的方法,外部可以通过调用该方法设置 guahaoTypes 字段的值
public void setGuahaoTypes(Integer guahaoTypes) { public void setGuahaoTypes(Integer guahaoTypes) {
this.guahaoTypes = guahaoTypes; this.guahaoTypes = guahaoTypes;
} }
/** /**
* *
*/ */
// 获取挂号状态值的方法,外部可以通过调用该方法获取 guahaoStatusTypes 字段的值
public Integer getGuahaoStatusTypes() { public Integer getGuahaoStatusTypes() {
return guahaoStatusTypes; return guahaoStatusTypes;
} }
/** /**
* *
*/ */
// 设置挂号状态值的方法,外部可以通过调用该方法设置 guahaoStatusTypes 字段的值
public void setGuahaoStatusTypes(Integer guahaoStatusTypes) { public void setGuahaoStatusTypes(Integer guahaoStatusTypes) {
this.guahaoStatusTypes = guahaoStatusTypes; this.guahaoStatusTypes = guahaoStatusTypes;
} }
/** /**
* *
*/ */
// 获取挂号审核值的方法,外部可以通过调用该方法获取 guahaoYesnoTypes 字段的值
public Integer getGuahaoYesnoTypes() { public Integer getGuahaoYesnoTypes() {
return guahaoYesnoTypes; return guahaoYesnoTypes;
} }
/** /**
* *
*/ */
// 设置挂号审核值的方法,外部可以通过调用该方法设置 guahaoYesnoTypes 字段的值
public void setGuahaoYesnoTypes(Integer guahaoYesnoTypes) { public void setGuahaoYesnoTypes(Integer guahaoYesnoTypes) {
this.guahaoYesnoTypes = guahaoYesnoTypes; this.guahaoYesnoTypes = guahaoYesnoTypes;
} }
/** /**
* *
*/ */
// 获取审核结果值的方法,外部可以通过调用该方法获取 guahaoYesnoText 字段的值
public String getGuahaoYesnoText() { public String getGuahaoYesnoText() {
return guahaoYesnoText; return guahaoYesnoText;
} }
/** /**
* *
*/ */
// 设置审核结果值的方法,外部可以通过调用该方法设置 guahaoYesnoText 字段的值
public void setGuahaoYesnoText(String guahaoYesnoText) { public void setGuahaoYesnoText(String guahaoYesnoText) {
this.guahaoYesnoText = guahaoYesnoText; this.guahaoYesnoText = guahaoYesnoText;
} }
/** /**
* *
*/ */
// 获取创建时间值的方法,外部可以通过调用该方法获取 createTime 字段的值
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* *
*/ */
// 设置创建时间值的方法,外部可以通过调用该方法设置 createTime 字段的值
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
// 重写 toString 方法,返回对象的字符串表示,方便调试和日志记录
@Override @Override
public String toString() { public String toString() {
return "Guahao{" + return "Guahao{" +

@ -1,23 +1,34 @@
package com.entity; package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解,可用于字段验证,当前代码未使用这些注解进行实际验证
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
// 导入 Jackson 注解,可用于忽略 JSON 序列化和反序列化时的某些属性,当前代码未使用
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入序列化接口,使该类的对象可以进行序列化和反序列化操作
import java.io.Serializable; import java.io.Serializable;
// 导入日期类
import java.util.Date; import java.util.Date;
// 导入列表集合类,当前代码未使用
import java.util.List; import java.util.List;
// 导入 Spring 框架用于日期格式化的注解,用于将字符串日期转换为 Date 对象
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
@ -26,215 +37,232 @@ import com.baomidou.mybatisplus.enums.IdType;
* @author * @author
* @email * @email
*/ */
// 指定该类对应数据库中的 jiankangjiaoyu 表
@TableName("jiankangjiaoyu") @TableName("jiankangjiaoyu")
// 定义泛型类,实现 Serializable 接口
public class JiankangjiaoyuEntity<T> implements Serializable { public class JiankangjiaoyuEntity<T> implements Serializable {
// 序列化版本号,确保序列化和反序列化的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 无参构造函数,方便创建 JiankangjiaoyuEntity 类的实例
public JiankangjiaoyuEntity() { public JiankangjiaoyuEntity() {
} }
// 带参构造函数,接收一个泛型对象 t将其属性复制到当前 JiankangjiaoyuEntity 对象
public JiankangjiaoyuEntity(T t) { public JiankangjiaoyuEntity(T t) {
try { try {
// 使用 BeanUtils 工具类复制属性
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 若复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 指定该字段为主键,且主键生成策略为自增
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
// 指定该字段对应数据库表中的 id 字段
@TableField(value = "id") @TableField(value = "id")
// 主键,用于唯一标识一条健康教育记录
private Integer id; private Integer id;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 jiankangjiaoyu_name 字段
@TableField(value = "jiankangjiaoyu_name") @TableField(value = "jiankangjiaoyu_name")
// 健康教育的标题
private String jiankangjiaoyuName; private String jiankangjiaoyuName;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 jiankangjiaoyu_types 字段
@TableField(value = "jiankangjiaoyu_types") @TableField(value = "jiankangjiaoyu_types")
// 健康教育的类型,用整数表示不同类型
private Integer jiankangjiaoyuTypes; private Integer jiankangjiaoyuTypes;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 jiankangjiaoyu_photo 字段
@TableField(value = "jiankangjiaoyu_photo") @TableField(value = "jiankangjiaoyu_photo")
// 健康教育相关图片的存储路径
private String jiankangjiaoyuPhoto; private String jiankangjiaoyuPhoto;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 指定该字段对应数据库表中的 insert_time 字段,且在插入数据时自动填充
@TableField(value = "insert_time", fill = FieldFill.INSERT) @TableField(value = "insert_time", fill = FieldFill.INSERT)
// 健康教育的时间
private Date insertTime; private Date insertTime;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 jiankangjiaoyu_content 字段
@TableField(value = "jiankangjiaoyu_content") @TableField(value = "jiankangjiaoyu_content")
// 健康教育的详细内容
private String jiankangjiaoyuContent; private String jiankangjiaoyuContent;
/** /**
* *
*/ */
// 指定该字段对应数据库表中的 jiankangjiaoyu_delete 字段
@TableField(value = "jiankangjiaoyu_delete") @TableField(value = "jiankangjiaoyu_delete")
// 假删除标记,用整数表示是否删除,如 0 表示未删除1 表示已删除
private Integer jiankangjiaoyuDelete; private Integer jiankangjiaoyuDelete;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 指定该字段对应数据库表中的 create_time 字段,且在插入数据时自动填充
@TableField(value = "create_time", fill = FieldFill.INSERT) @TableField(value = "create_time", fill = FieldFill.INSERT)
// 该条健康教育记录的创建时间
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 获取主键的方法
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键的方法
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取健康教育标题的方法
public String getJiankangjiaoyuName() { public String getJiankangjiaoyuName() {
return jiankangjiaoyuName; return jiankangjiaoyuName;
} }
/** /**
* *
*/ */
// 设置健康教育标题的方法
public void setJiankangjiaoyuName(String jiankangjiaoyuName) { public void setJiankangjiaoyuName(String jiankangjiaoyuName) {
this.jiankangjiaoyuName = jiankangjiaoyuName; this.jiankangjiaoyuName = jiankangjiaoyuName;
} }
/** /**
* *
*/ */
// 获取健康教育类型的方法
public Integer getJiankangjiaoyuTypes() { public Integer getJiankangjiaoyuTypes() {
return jiankangjiaoyuTypes; return jiankangjiaoyuTypes;
} }
/** /**
* *
*/ */
// 设置健康教育类型的方法
public void setJiankangjiaoyuTypes(Integer jiankangjiaoyuTypes) { public void setJiankangjiaoyuTypes(Integer jiankangjiaoyuTypes) {
this.jiankangjiaoyuTypes = jiankangjiaoyuTypes; this.jiankangjiaoyuTypes = jiankangjiaoyuTypes;
} }
/** /**
* *
*/ */
// 获取健康教育图片路径的方法
public String getJiankangjiaoyuPhoto() { public String getJiankangjiaoyuPhoto() {
return jiankangjiaoyuPhoto; return jiankangjiaoyuPhoto;
} }
/** /**
* *
*/ */
// 设置健康教育图片路径的方法
public void setJiankangjiaoyuPhoto(String jiankangjiaoyuPhoto) { public void setJiankangjiaoyuPhoto(String jiankangjiaoyuPhoto) {
this.jiankangjiaoyuPhoto = jiankangjiaoyuPhoto; this.jiankangjiaoyuPhoto = jiankangjiaoyuPhoto;
} }
/** /**
* *
*/ */
// 获取健康教育时间的方法
public Date getInsertTime() { public Date getInsertTime() {
return insertTime; return insertTime;
} }
/** /**
* *
*/ */
// 设置健康教育时间的方法
public void setInsertTime(Date insertTime) { public void setInsertTime(Date insertTime) {
this.insertTime = insertTime; this.insertTime = insertTime;
} }
/** /**
* *
*/ */
// 获取健康教育详情的方法
public String getJiankangjiaoyuContent() { public String getJiankangjiaoyuContent() {
return jiankangjiaoyuContent; return jiankangjiaoyuContent;
} }
/** /**
* *
*/ */
// 设置健康教育详情的方法
public void setJiankangjiaoyuContent(String jiankangjiaoyuContent) { public void setJiankangjiaoyuContent(String jiankangjiaoyuContent) {
this.jiankangjiaoyuContent = jiankangjiaoyuContent; this.jiankangjiaoyuContent = jiankangjiaoyuContent;
} }
/** /**
* *
*/ */
// 获取假删除标记的方法
public Integer getJiankangjiaoyuDelete() { public Integer getJiankangjiaoyuDelete() {
return jiankangjiaoyuDelete; return jiankangjiaoyuDelete;
} }
/** /**
* *
*/ */
// 设置假删除标记的方法
public void setJiankangjiaoyuDelete(Integer jiankangjiaoyuDelete) { public void setJiankangjiaoyuDelete(Integer jiankangjiaoyuDelete) {
this.jiankangjiaoyuDelete = jiankangjiaoyuDelete; this.jiankangjiaoyuDelete = jiankangjiaoyuDelete;
} }
/** /**
* *
*/ */
// 获取创建时间的方法
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* *
*/ */
// 设置创建时间的方法
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
// 重写 toString 方法,方便打印对象信息
@Override @Override
public String toString() { public String toString() {
return "Jiankangjiaoyu{" + return "Jiankangjiaoyu{" +

@ -1,23 +1,34 @@
package com.entity; package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(当前未实际使用)
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
// 导入 Jackson 用于忽略属性的注解(当前未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable; import java.io.Serializable;
// 导入日期类
import java.util.Date; import java.util.Date;
// 导入列表类(当前未实际使用)
import java.util.List; import java.util.List;
// 导入 Spring 用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
@ -26,192 +37,210 @@ import com.baomidou.mybatisplus.enums.IdType;
* @author * @author
* @email * @email
*/ */
// 使用 TableName 注解指定该类对应的数据库表名为 "news"
@TableName("news") @TableName("news")
// 定义泛型类 NewsEntity实现 Serializable 接口,用于对象的序列化和反序列化
public class NewsEntity<T> implements Serializable { public class NewsEntity<T> implements Serializable {
// 定义序列化版本号,保证序列化和反序列化的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建 NewsEntity 对象
public NewsEntity() { public NewsEntity() {
} }
// 带参构造函数,接受一个泛型对象 t通过 BeanUtils.copyProperties 方法
// 将对象 t 的属性复制到当前 NewsEntity 对象中
public NewsEntity(T t) { public NewsEntity(T t) {
try { try {
BeanUtils.copyProperties(this, t); BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长IdType.AUTO
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "id"
@TableField(value = "id") @TableField(value = "id")
// 存储公告信息记录的主键值,用于唯一标识一条公告记录
private Integer id; private Integer id;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_name"
@TableField(value = "news_name") @TableField(value = "news_name")
// 存储公告的名称
private String newsName; private String newsName;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_photo"
@TableField(value = "news_photo") @TableField(value = "news_photo")
// 存储公告相关图片的路径或标识
private String newsPhoto; private String newsPhoto;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_types"
@TableField(value = "news_types") @TableField(value = "news_types")
// 存储公告的类型,用整数表示不同的公告类型,如通知、公告等
private Integer newsTypes; private Integer newsTypes;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "insert_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "insert_time", fill = FieldFill.INSERT) @TableField(value = "insert_time", fill = FieldFill.INSERT)
// 存储公告的发布时间
private Date insertTime; private Date insertTime;
/** /**
* *
*/ */
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_content"
@TableField(value = "news_content") @TableField(value = "news_content")
// 存储公告的详细内容
private String newsContent; private String newsContent;
/** /**
* *
*/ */
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat @DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "create_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "create_time", fill = FieldFill.INSERT) @TableField(value = "create_time", fill = FieldFill.INSERT)
// 存储公告记录的创建时间,用于记录数据的创建时间戳
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 获取主键值的方法
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键值的方法
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取公告名称值的方法
public String getNewsName() { public String getNewsName() {
return newsName; return newsName;
} }
/** /**
* *
*/ */
// 设置公告名称值的方法
public void setNewsName(String newsName) { public void setNewsName(String newsName) {
this.newsName = newsName; this.newsName = newsName;
} }
/** /**
* *
*/ */
// 获取公告图片路径值的方法
public String getNewsPhoto() { public String getNewsPhoto() {
return newsPhoto; return newsPhoto;
} }
/** /**
* *
*/ */
// 设置公告图片路径值的方法
public void setNewsPhoto(String newsPhoto) { public void setNewsPhoto(String newsPhoto) {
this.newsPhoto = newsPhoto; this.newsPhoto = newsPhoto;
} }
/** /**
* *
*/ */
// 获取公告类型值的方法
public Integer getNewsTypes() { public Integer getNewsTypes() {
return newsTypes; return newsTypes;
} }
/** /**
* *
*/ */
// 设置公告类型值的方法
public void setNewsTypes(Integer newsTypes) { public void setNewsTypes(Integer newsTypes) {
this.newsTypes = newsTypes; this.newsTypes = newsTypes;
} }
/** /**
* *
*/ */
// 获取公告发布时间值的方法
public Date getInsertTime() { public Date getInsertTime() {
return insertTime; return insertTime;
} }
/** /**
* *
*/ */
// 设置公告发布时间值的方法
public void setInsertTime(Date insertTime) { public void setInsertTime(Date insertTime) {
this.insertTime = insertTime; this.insertTime = insertTime;
} }
/** /**
* *
*/ */
// 获取公告详情值的方法
public String getNewsContent() { public String getNewsContent() {
return newsContent; return newsContent;
} }
/** /**
* *
*/ */
// 设置公告详情值的方法
public void setNewsContent(String newsContent) { public void setNewsContent(String newsContent) {
this.newsContent = newsContent; this.newsContent = newsContent;
} }
/** /**
* *
*/ */
// 获取创建时间值的方法
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* *
*/ */
// 设置创建时间值的方法
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
// 重写 toString 方法,返回对象的字符串表示,方便调试和日志记录
@Override @Override
public String toString() { public String toString() {
return "News{" + return "News{" +

@ -1,121 +1,155 @@
package com.entity; package com.entity;
// 导入序列化接口,使该类的对象可以进行序列化和反序列化
import java.io.Serializable; import java.io.Serializable;
// 导入日期类,用于处理日期相关的操作
import java.util.Date; import java.util.Date;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
* token * token
*/ */
// 使用 TableName 注解指定该类对应的数据库表名为 "token"
@TableName("token") @TableName("token")
//定义 TokenEntity 类,实现 Serializable 接口,以支持对象的序列化和反序列化
public class TokenEntity implements Serializable { public class TokenEntity implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
// 存储记录的主键值,用于唯一标识一条 token 记录
private Integer id; private Integer id;
/** /**
* id * id
*/ */
// 存储与该 token 相关联的用户 ID
private Integer userid; private Integer userid;
/** /**
* *
*/ */
// 存储与该 token 相关联的用户名
private String username; private String username;
/** /**
* *
*/ */
// 存储与该 token 相关的表名(具体用途可能根据业务需求而定)
private String tablename; private String tablename;
/** /**
* *
*/ */
// 存储用户的角色信息,用于权限控制等
private String role; private String role;
/** /**
* token * token
*/ */
// 存储具体的 token 值,用于身份验证和授权
private String token; private String token;
/** /**
* *
*/ */
// 存储该 token 的过期时间,用于判断 token 是否有效
private Date expiratedtime; private Date expiratedtime;
/** /**
* *
*/ */
// 存储该 token 记录的创建时间,用于记录数据的生成时间戳
private Date addtime; private Date addtime;
// 获取主键值的方法
public Integer getId() { public Integer getId() {
return id; return id;
} }
// 设置主键值的方法
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
// 获取用户 ID 的方法
public Integer getUserid() { public Integer getUserid() {
return userid; return userid;
} }
// 设置用户 ID 的方法
public void setUserid(Integer userid) { public void setUserid(Integer userid) {
this.userid = userid; this.userid = userid;
} }
// 获取角色信息的方法
public String getRole() { public String getRole() {
return role; return role;
} }
// 设置角色信息的方法
public void setRole(String role) { public void setRole(String role) {
this.role = role; this.role = role;
} }
// 获取 token 值的方法
public String getToken() { public String getToken() {
return token; return token;
} }
// 获取表名的方法
public String getTablename() { public String getTablename() {
return tablename; return tablename;
} }
// 设置表名的方法
public void setTablename(String tablename) { public void setTablename(String tablename) {
this.tablename = tablename; this.tablename = tablename;
} }
// 设置 token 值的方法
public void setToken(String token) { public void setToken(String token) {
this.token = token; this.token = token;
} }
// 获取过期时间的方法
public Date getExpiratedtime() { public Date getExpiratedtime() {
return expiratedtime; return expiratedtime;
} }
// 设置过期时间的方法
public void setExpiratedtime(Date expiratedtime) { public void setExpiratedtime(Date expiratedtime) {
this.expiratedtime = expiratedtime; this.expiratedtime = expiratedtime;
} }
// 获取新增时间的方法
public Date getAddtime() { public Date getAddtime() {
return addtime; return addtime;
} }
// 设置新增时间的方法
public void setAddtime(Date addtime) { public void setAddtime(Date addtime) {
this.addtime = addtime; this.addtime = addtime;
} }
// 获取用户名的方法
public String getUsername() { public String getUsername() {
return username; return username;
} }
// 设置用户名的方法
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
// 带参数的构造函数,用于初始化 TokenEntity 对象的部分属性
public TokenEntity(Integer userid, String username, String tablename, String role, String token, Date expiratedtime) { public TokenEntity(Integer userid, String username, String tablename, String role, String token, Date expiratedtime) {
super(); super();
this.userid = userid; this.userid = userid;
@ -126,7 +160,7 @@ public class TokenEntity implements Serializable {
this.expiratedtime = expiratedtime; this.expiratedtime = expiratedtime;
} }
// 无参构造函数,用于创建 TokenEntity 对象的实例
public TokenEntity() { public TokenEntity() {
} }
} }

@ -1,77 +1,100 @@
package com.entity; package com.entity;
// 导入序列化接口,使该类的对象可以进行序列化和反序列化操作
import java.io.Serializable; import java.io.Serializable;
// 导入日期类,用于处理与日期相关的操作
import java.util.Date; import java.util.Date;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
* *
*/ */
// 使用 TableName 注解指定该类对应的数据库表名为 "users"
@TableName("users") @TableName("users")
// 定义 UsersEntity 类,实现 Serializable 接口,以支持对象的序列化和反序列化
public class UsersEntity implements Serializable { public class UsersEntity implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
// 存储用户记录的主键值,用于唯一标识一条用户记录
private Integer id; private Integer id;
/** /**
* *
*/ */
// 存储用户的账号信息,用于登录等操作
private String username; private String username;
/** /**
* *
*/ */
// 存储用户的密码信息,用于验证用户身份
private String password; private String password;
/** /**
* *
*/ */
// 存储用户的类型信息,例如普通用户、管理员等,用于权限控制等
private String role; private String role;
// 存储用户记录的创建时间,用于记录数据的生成时间戳
private Date addtime; private Date addtime;
// 获取用户账号的方法
public String getUsername() { public String getUsername() {
return username; return username;
} }
// 设置用户账号的方法
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
// 获取用户密码的方法
public String getPassword() { public String getPassword() {
return password; return password;
} }
// 设置用户密码的方法
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
// 获取用户类型的方法
public String getRole() { public String getRole() {
return role; return role;
} }
// 设置用户类型的方法
public void setRole(String role) { public void setRole(String role) {
this.role = role; this.role = role;
} }
// 获取用户记录创建时间的方法
public Date getAddtime() { public Date getAddtime() {
return addtime; return addtime;
} }
// 设置用户记录创建时间的方法
public void setAddtime(Date addtime) { public void setAddtime(Date addtime) {
this.addtime = addtime; this.addtime = addtime;
} }
// 获取用户记录主键的方法
public Integer getId() { public Integer getId() {
return id; return id;
} }
// 设置用户记录主键的方法
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
} }

@ -1,23 +1,34 @@
package com.entity; package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(在当前代码中未实际使用)
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
// 导入 Jackson 注解(在当前代码中未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable; import java.io.Serializable;
// 导入日期类
import java.util.Date; import java.util.Date;
// 导入列表集合类(在当前代码中未实际使用)
import java.util.List; import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill; import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
@ -44,7 +55,6 @@ public class YishengEntity<T> implements Serializable {
} }
} }
/** /**
* *
*/ */
@ -53,7 +63,6 @@ public class YishengEntity<T> implements Serializable {
private Integer id; private Integer id;
/** /**
* *
*/ */
@ -61,7 +70,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengUuidNumber; private String yishengUuidNumber;
/** /**
* *
*/ */
@ -69,7 +77,6 @@ public class YishengEntity<T> implements Serializable {
private String username; private String username;
/** /**
* *
*/ */
@ -77,7 +84,6 @@ public class YishengEntity<T> implements Serializable {
private String password; private String password;
/** /**
* *
*/ */
@ -85,7 +91,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengName; private String yishengName;
/** /**
* *
*/ */
@ -93,7 +98,6 @@ public class YishengEntity<T> implements Serializable {
private Integer yishengTypes; private Integer yishengTypes;
/** /**
* *
*/ */
@ -101,7 +105,6 @@ public class YishengEntity<T> implements Serializable {
private Integer zhiweiTypes; private Integer zhiweiTypes;
/** /**
* *
*/ */
@ -109,7 +112,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengZhichneg; private String yishengZhichneg;
/** /**
* *
*/ */
@ -117,7 +119,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengPhoto; private String yishengPhoto;
/** /**
* *
*/ */
@ -125,7 +126,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengPhone; private String yishengPhone;
/** /**
* *
*/ */
@ -133,7 +133,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengGuahao; private String yishengGuahao;
/** /**
* *
*/ */
@ -141,7 +140,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengEmail; private String yishengEmail;
/** /**
* *
*/ */
@ -149,7 +147,6 @@ public class YishengEntity<T> implements Serializable {
private Double yishengNewMoney; private Double yishengNewMoney;
/** /**
* *
*/ */
@ -157,7 +154,6 @@ public class YishengEntity<T> implements Serializable {
private String yishengContent; private String yishengContent;
/** /**
* *
*/ */
@ -167,7 +163,6 @@ public class YishengEntity<T> implements Serializable {
private Date createTime; private Date createTime;
/** /**
* *
*/ */
@ -175,7 +170,6 @@ public class YishengEntity<T> implements Serializable {
return id; return id;
} }
/** /**
* *
*/ */
@ -183,6 +177,7 @@ public class YishengEntity<T> implements Serializable {
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
@ -190,7 +185,6 @@ public class YishengEntity<T> implements Serializable {
return yishengUuidNumber; return yishengUuidNumber;
} }
/** /**
* *
*/ */
@ -198,6 +192,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengUuidNumber(String yishengUuidNumber) { public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber; this.yishengUuidNumber = yishengUuidNumber;
} }
/** /**
* *
*/ */
@ -205,7 +200,6 @@ public class YishengEntity<T> implements Serializable {
return username; return username;
} }
/** /**
* *
*/ */
@ -213,6 +207,7 @@ public class YishengEntity<T> implements Serializable {
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
/** /**
* *
*/ */
@ -220,7 +215,6 @@ public class YishengEntity<T> implements Serializable {
return password; return password;
} }
/** /**
* *
*/ */
@ -228,6 +222,7 @@ public class YishengEntity<T> implements Serializable {
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
/** /**
* *
*/ */
@ -235,7 +230,6 @@ public class YishengEntity<T> implements Serializable {
return yishengName; return yishengName;
} }
/** /**
* *
*/ */
@ -243,6 +237,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengName(String yishengName) { public void setYishengName(String yishengName) {
this.yishengName = yishengName; this.yishengName = yishengName;
} }
/** /**
* *
*/ */
@ -250,7 +245,6 @@ public class YishengEntity<T> implements Serializable {
return yishengTypes; return yishengTypes;
} }
/** /**
* *
*/ */
@ -258,6 +252,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengTypes(Integer yishengTypes) { public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes; this.yishengTypes = yishengTypes;
} }
/** /**
* *
*/ */
@ -265,7 +260,6 @@ public class YishengEntity<T> implements Serializable {
return zhiweiTypes; return zhiweiTypes;
} }
/** /**
* *
*/ */
@ -273,6 +267,7 @@ public class YishengEntity<T> implements Serializable {
public void setZhiweiTypes(Integer zhiweiTypes) { public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes; this.zhiweiTypes = zhiweiTypes;
} }
/** /**
* *
*/ */
@ -280,7 +275,6 @@ public class YishengEntity<T> implements Serializable {
return yishengZhichneg; return yishengZhichneg;
} }
/** /**
* *
*/ */
@ -288,6 +282,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengZhichneg(String yishengZhichneg) { public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg; this.yishengZhichneg = yishengZhichneg;
} }
/** /**
* *
*/ */
@ -295,7 +290,6 @@ public class YishengEntity<T> implements Serializable {
return yishengPhoto; return yishengPhoto;
} }
/** /**
* *
*/ */
@ -303,6 +297,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengPhoto(String yishengPhoto) { public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto; this.yishengPhoto = yishengPhoto;
} }
/** /**
* *
*/ */
@ -310,7 +305,6 @@ public class YishengEntity<T> implements Serializable {
return yishengPhone; return yishengPhone;
} }
/** /**
* *
*/ */
@ -318,6 +312,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengPhone(String yishengPhone) { public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone; this.yishengPhone = yishengPhone;
} }
/** /**
* *
*/ */
@ -325,7 +320,6 @@ public class YishengEntity<T> implements Serializable {
return yishengGuahao; return yishengGuahao;
} }
/** /**
* *
*/ */
@ -333,6 +327,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengGuahao(String yishengGuahao) { public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao; this.yishengGuahao = yishengGuahao;
} }
/** /**
* *
*/ */
@ -340,7 +335,6 @@ public class YishengEntity<T> implements Serializable {
return yishengEmail; return yishengEmail;
} }
/** /**
* *
*/ */
@ -348,6 +342,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengEmail(String yishengEmail) { public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail; this.yishengEmail = yishengEmail;
} }
/** /**
* *
*/ */
@ -355,7 +350,6 @@ public class YishengEntity<T> implements Serializable {
return yishengNewMoney; return yishengNewMoney;
} }
/** /**
* *
*/ */
@ -363,6 +357,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengNewMoney(Double yishengNewMoney) { public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney; this.yishengNewMoney = yishengNewMoney;
} }
/** /**
* *
*/ */
@ -370,7 +365,6 @@ public class YishengEntity<T> implements Serializable {
return yishengContent; return yishengContent;
} }
/** /**
* *
*/ */
@ -378,6 +372,7 @@ public class YishengEntity<T> implements Serializable {
public void setYishengContent(String yishengContent) { public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent; this.yishengContent = yishengContent;
} }
/** /**
* *
*/ */
@ -385,7 +380,6 @@ public class YishengEntity<T> implements Serializable {
return createTime; return createTime;
} }
/** /**
* *
*/ */

@ -21,7 +21,8 @@ import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType; import com.baomidou.mybatisplus.enums.IdType;
/** /**
* *
* yonghu
* *
* @author * @author
* @email * @email
@ -44,48 +45,46 @@ public class YonghuEntity<T> implements Serializable {
} }
} }
/** /**
* * ID
*
*/ */
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
@TableField(value = "id") @TableField(value = "id")
private Integer id; private Integer id;
/** /**
* * /
*
*/ */
@TableField(value = "username") @TableField(value = "username")
private String username; private String username;
/** /**
* *
*
*/ */
@TableField(value = "password") @TableField(value = "password")
private String password; private String password;
/** /**
* *
*/ */
@TableField(value = "yonghu_name") @TableField(value = "yonghu_name")
private String yonghuName; private String yonghuName;
/** /**
* *
*
*/ */
@TableField(value = "yonghu_photo") @TableField(value = "yonghu_photo")
private String yonghuPhoto; private String yonghuPhoto;
/** /**
* *
*/ */
@ -93,7 +92,6 @@ public class YonghuEntity<T> implements Serializable {
private String yonghuPhone; private String yonghuPhone;
/** /**
* *
*/ */
@ -101,41 +99,39 @@ public class YonghuEntity<T> implements Serializable {
private String yonghuIdNumber; private String yonghuIdNumber;
/** /**
* *
*/ */
@TableField(value = "yonghu_email") @TableField(value = "yonghu_email")
private String yonghuEmail; private String yonghuEmail;
/** /**
* *
* 使
*/ */
@TableField(value = "sex_types") @TableField(value = "sex_types")
private Integer sexTypes; private Integer sexTypes;
/** /**
* *
*/ */
@TableField(value = "new_money") @TableField(value = "new_money")
private Double newMoney; private Double newMoney;
/** /**
* *
* 1-2-
*/ */
@TableField(value = "yonghu_delete") @TableField(value = "yonghu_delete")
private Integer yonghuDelete; private Integer yonghuDelete;
/** /**
* *
* yyyy-MM-dd HH:mm:ss
*/ */
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @DateTimeFormat
@ -151,7 +147,6 @@ public class YonghuEntity<T> implements Serializable {
return id; return id;
} }
/** /**
* *
*/ */
@ -159,6 +154,7 @@ public class YonghuEntity<T> implements Serializable {
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
@ -166,7 +162,6 @@ public class YonghuEntity<T> implements Serializable {
return username; return username;
} }
/** /**
* *
*/ */
@ -174,6 +169,7 @@ public class YonghuEntity<T> implements Serializable {
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
/** /**
* *
*/ */
@ -181,7 +177,6 @@ public class YonghuEntity<T> implements Serializable {
return password; return password;
} }
/** /**
* *
*/ */
@ -189,6 +184,7 @@ public class YonghuEntity<T> implements Serializable {
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
/** /**
* *
*/ */
@ -196,7 +192,6 @@ public class YonghuEntity<T> implements Serializable {
return yonghuName; return yonghuName;
} }
/** /**
* *
*/ */
@ -204,6 +199,7 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuName(String yonghuName) { public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName; this.yonghuName = yonghuName;
} }
/** /**
* *
*/ */
@ -211,7 +207,6 @@ public class YonghuEntity<T> implements Serializable {
return yonghuPhoto; return yonghuPhoto;
} }
/** /**
* *
*/ */
@ -219,6 +214,7 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuPhoto(String yonghuPhoto) { public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto; this.yonghuPhoto = yonghuPhoto;
} }
/** /**
* *
*/ */
@ -226,7 +222,6 @@ public class YonghuEntity<T> implements Serializable {
return yonghuPhone; return yonghuPhone;
} }
/** /**
* *
*/ */
@ -234,6 +229,7 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuPhone(String yonghuPhone) { public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone; this.yonghuPhone = yonghuPhone;
} }
/** /**
* *
*/ */
@ -241,7 +237,6 @@ public class YonghuEntity<T> implements Serializable {
return yonghuIdNumber; return yonghuIdNumber;
} }
/** /**
* *
*/ */
@ -249,6 +244,7 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuIdNumber(String yonghuIdNumber) { public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber; this.yonghuIdNumber = yonghuIdNumber;
} }
/** /**
* *
*/ */
@ -256,7 +252,6 @@ public class YonghuEntity<T> implements Serializable {
return yonghuEmail; return yonghuEmail;
} }
/** /**
* *
*/ */
@ -264,6 +259,7 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuEmail(String yonghuEmail) { public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail; this.yonghuEmail = yonghuEmail;
} }
/** /**
* *
*/ */
@ -271,7 +267,6 @@ public class YonghuEntity<T> implements Serializable {
return sexTypes; return sexTypes;
} }
/** /**
* *
*/ */
@ -279,6 +274,7 @@ public class YonghuEntity<T> implements Serializable {
public void setSexTypes(Integer sexTypes) { public void setSexTypes(Integer sexTypes) {
this.sexTypes = sexTypes; this.sexTypes = sexTypes;
} }
/** /**
* *
*/ */
@ -286,7 +282,6 @@ public class YonghuEntity<T> implements Serializable {
return newMoney; return newMoney;
} }
/** /**
* *
*/ */
@ -294,6 +289,7 @@ public class YonghuEntity<T> implements Serializable {
public void setNewMoney(Double newMoney) { public void setNewMoney(Double newMoney) {
this.newMoney = newMoney; this.newMoney = newMoney;
} }
/** /**
* *
*/ */
@ -301,7 +297,6 @@ public class YonghuEntity<T> implements Serializable {
return yonghuDelete; return yonghuDelete;
} }
/** /**
* *
*/ */
@ -309,6 +304,7 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuDelete(Integer yonghuDelete) { public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete; this.yonghuDelete = yonghuDelete;
} }
/** /**
* *
*/ */
@ -316,7 +312,6 @@ public class YonghuEntity<T> implements Serializable {
return createTime; return createTime;
} }
/** /**
* *
*/ */

@ -8,7 +8,6 @@ import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
* 线 * 线
* *
@ -16,196 +15,216 @@ import java.io.Serializable;
* ModelAndView model * ModelAndView model
*/ */
public class ChatModel implements Serializable { public class ChatModel implements Serializable {
// 序列化版本号,用于保证序列化和反序列化的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于唯一标识一条在线咨询记录的主键
private Integer id; private Integer id;
/** /**
* *
*/ */
// 发起咨询问题的用户的ID
private Integer yonghuId; private Integer yonghuId;
/** /**
* *
*/ */
// 用户提出的咨询问题内容
private String chatIssue; private String chatIssue;
/** /**
* *
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 用户提出问题的具体时间
private Date issueTime; private Date issueTime;
/** /**
* *
*/ */
// 针对用户咨询问题给出的回复内容
private String chatReply; private String chatReply;
/** /**
* *
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 给出回复的具体时间
private Date replyTime; private Date replyTime;
/** /**
* *
*/ */
// 表示该在线咨询记录的状态,使用整数类型表示不同状态
private Integer zhuangtaiTypes; private Integer zhuangtaiTypes;
/** /**
* *
*/ */
// 表示该在线咨询记录的数据类型,使用整数类型表示不同类型
private Integer chatTypes; private Integer chatTypes;
/** /**
* *
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 该在线咨询记录的创建时间
private Date insertTime; private Date insertTime;
/** /**
* *
*/ */
// 获取主键ID的方法
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键ID的方法
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取提问用户ID的方法
public Integer getYonghuId() { public Integer getYonghuId() {
return yonghuId; return yonghuId;
} }
/** /**
* *
*/ */
// 设置提问用户ID的方法
public void setYonghuId(Integer yonghuId) { public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId; this.yonghuId = yonghuId;
} }
/** /**
* *
*/ */
// 获取咨询问题内容的方法
public String getChatIssue() { public String getChatIssue() {
return chatIssue; return chatIssue;
} }
/** /**
* *
*/ */
// 设置咨询问题内容的方法
public void setChatIssue(String chatIssue) { public void setChatIssue(String chatIssue) {
this.chatIssue = chatIssue; this.chatIssue = chatIssue;
} }
/** /**
* *
*/ */
// 获取用户提出问题时间的方法
public Date getIssueTime() { public Date getIssueTime() {
return issueTime; return issueTime;
} }
/** /**
* *
*/ */
// 设置用户提出问题时间的方法
public void setIssueTime(Date issueTime) { public void setIssueTime(Date issueTime) {
this.issueTime = issueTime; this.issueTime = issueTime;
} }
/** /**
* *
*/ */
// 获取咨询问题回复内容的方法
public String getChatReply() { public String getChatReply() {
return chatReply; return chatReply;
} }
/** /**
* *
*/ */
// 设置咨询问题回复内容的方法
public void setChatReply(String chatReply) { public void setChatReply(String chatReply) {
this.chatReply = chatReply; this.chatReply = chatReply;
} }
/** /**
* *
*/ */
// 获取给出回复时间的方法
public Date getReplyTime() { public Date getReplyTime() {
return replyTime; return replyTime;
} }
/** /**
* *
*/ */
// 设置给出回复时间的方法
public void setReplyTime(Date replyTime) { public void setReplyTime(Date replyTime) {
this.replyTime = replyTime; this.replyTime = replyTime;
} }
/** /**
* *
*/ */
// 获取咨询记录状态的方法
public Integer getZhuangtaiTypes() { public Integer getZhuangtaiTypes() {
return zhuangtaiTypes; return zhuangtaiTypes;
} }
/** /**
* *
*/ */
// 设置咨询记录状态的方法
public void setZhuangtaiTypes(Integer zhuangtaiTypes) { public void setZhuangtaiTypes(Integer zhuangtaiTypes) {
this.zhuangtaiTypes = zhuangtaiTypes; this.zhuangtaiTypes = zhuangtaiTypes;
} }
/** /**
* *
*/ */
// 获取咨询记录数据类型的方法
public Integer getChatTypes() { public Integer getChatTypes() {
return chatTypes; return chatTypes;
} }
/** /**
* *
*/ */
// 设置咨询记录数据类型的方法
public void setChatTypes(Integer chatTypes) { public void setChatTypes(Integer chatTypes) {
this.chatTypes = chatTypes; this.chatTypes = chatTypes;
} }
/** /**
* *
*/ */
// 获取咨询记录创建时间的方法
public Date getInsertTime() { public Date getInsertTime() {
return insertTime; return insertTime;
} }
/** /**
* *
*/ */
// 设置咨询记录创建时间的方法
public void setInsertTime(Date insertTime) { public void setInsertTime(Date insertTime) {
this.insertTime = insertTime; this.insertTime = insertTime;
} }
} }

@ -1,187 +1,206 @@
package com.entity.model; package com.entity.model;
// 引入字典表实体类,可能用于与数据库实体交互或类型转换等操作
import com.entity.DictionaryEntity; import com.entity.DictionaryEntity;
// 该注解用于指定实体类对应的数据库表名,不过在当前代码中未实际使用该功能
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 用于在将对象序列化为JSON时对日期类型的字段进行格式化处理
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
// 用于在Spring MVC中将前端传递的日期字符串绑定到Java对象的日期字段时进行格式化
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 实现该接口意味着这个类的对象可以被序列化和反序列化,方便在网络传输或存储时使用
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
* entity * entity
* ModelAndView model * ModelAndView model
*/ */
// 定义一个名为DictionaryModel的类实现Serializable接口用于接收字典表相关的参数
public class DictionaryModel implements Serializable { public class DictionaryModel implements Serializable {
// 序列化版本号,用于在反序列化时验证版本一致性,避免不同版本类之间反序列化出错
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于唯一标识字典表中的每一条记录,在数据库操作中常作为主键使用
private Integer id; private Integer id;
/** /**
* *
*/ */
// 表示字典表中的某个字段,可能用于存储特定的数据标识
private String dicCode; private String dicCode;
/** /**
* *
*/ */
// 该字段的名称用于更直观地描述dicCode所代表的含义
private String dicName; private String dicName;
/** /**
* *
*/ */
// 可能是对该字段的一种编码表示,方便数据的分类和查询
private Integer codeIndex; private Integer codeIndex;
/** /**
* *
*/ */
// 编码对应的名称,用于更清晰地展示编码的具体含义
private String indexName; private String indexName;
/** /**
* id * id
*/ */
// 用于关联父字段,可能用于构建字典表的层级结构
private Integer superId; private Integer superId;
/** /**
* *
*/ */
// 对该条字典记录的额外说明信息,可用于记录一些特殊情况或备注
private String beizhu; private String beizhu;
/** /**
* *
*/ */
// 对日期进行JSON序列化时指定日期的格式、语言环境和时区
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于在Spring MVC中将前端传递的日期字符串转换为Date类型时指定格式
@DateTimeFormat @DateTimeFormat
// 记录该条字典记录的创建时间
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 定义一个公共的获取主键的方法供外部调用获取id的值
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 定义一个公共的设置主键的方法供外部调用设置id的值
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 定义一个公共的获取字段标识的方法供外部调用获取dicCode的值
public String getDicCode() { public String getDicCode() {
return dicCode; return dicCode;
} }
/** /**
* *
*/ */
// 定义一个公共的设置字段标识的方法供外部调用设置dicCode的值
public void setDicCode(String dicCode) { public void setDicCode(String dicCode) {
this.dicCode = dicCode; this.dicCode = dicCode;
} }
/** /**
* *
*/ */
// 定义一个公共的获取字段名称的方法供外部调用获取dicName的值
public String getDicName() { public String getDicName() {
return dicName; return dicName;
} }
/** /**
* *
*/ */
// 定义一个公共的设置字段名称的方法供外部调用设置dicName的值
public void setDicName(String dicName) { public void setDicName(String dicName) {
this.dicName = dicName; this.dicName = dicName;
} }
/** /**
* *
*/ */
// 定义一个公共的获取编码的方法供外部调用获取codeIndex的值
public Integer getCodeIndex() { public Integer getCodeIndex() {
return codeIndex; return codeIndex;
} }
/** /**
* *
*/ */
// 定义一个公共的设置编码的方法供外部调用设置codeIndex的值
public void setCodeIndex(Integer codeIndex) { public void setCodeIndex(Integer codeIndex) {
this.codeIndex = codeIndex; this.codeIndex = codeIndex;
} }
/** /**
* *
*/ */
// 定义一个公共的获取编码名称的方法供外部调用获取indexName的值
public String getIndexName() { public String getIndexName() {
return indexName; return indexName;
} }
/** /**
* *
*/ */
// 定义一个公共的设置编码名称的方法供外部调用设置indexName的值
public void setIndexName(String indexName) { public void setIndexName(String indexName) {
this.indexName = indexName; this.indexName = indexName;
} }
/** /**
* id * id
*/ */
// 定义一个公共的获取父字段ID的方法供外部调用获取superId的值
public Integer getSuperId() { public Integer getSuperId() {
return superId; return superId;
} }
/** /**
* id * id
*/ */
// 定义一个公共的设置父字段ID的方法供外部调用设置superId的值
public void setSuperId(Integer superId) { public void setSuperId(Integer superId) {
this.superId = superId; this.superId = superId;
} }
/** /**
* *
*/ */
// 定义一个公共的获取备注信息的方法供外部调用获取beizhu的值
public String getBeizhu() { public String getBeizhu() {
return beizhu; return beizhu;
} }
/** /**
* *
*/ */
// 定义一个公共的设置备注信息的方法供外部调用设置beizhu的值
public void setBeizhu(String beizhu) { public void setBeizhu(String beizhu) {
this.beizhu = beizhu; this.beizhu = beizhu;
} }
/** /**
* *
*/ */
// 定义一个公共的获取创建时间的方法供外部调用获取createTime的值
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* *
*/ */
// 定义一个公共的设置创建时间的方法供外部调用设置createTime的值
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

@ -1,229 +1,253 @@
package com.entity.model; package com.entity.model;
// 导入GuahaoEntity类可能用于实体之间的转换或关联操作
import com.entity.GuahaoEntity; import com.entity.GuahaoEntity;
// 导入MyBatis-Plus的TableName注解这里可能用于指定数据库表名但代码中未实际使用
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入Jackson的JsonFormat注解用于在JSON序列化和反序列化时格式化日期类型字段
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
// 导入Spring的DateTimeFormat注解用于在处理表单数据时格式化日期类型字段
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
* entity * entity
* ModelAndView model * ModelAndView model
*/ */
// 定义一个名为GuahaoModel的类实现Serializable接口使其对象可序列化
public class GuahaoModel implements Serializable { public class GuahaoModel implements Serializable {
// 定义序列化版本号,确保在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于唯一标识挂号记录的主键,在数据库操作中通常作为唯一标识
private Integer id; private Integer id;
/** /**
* *
*/ */
// 表示进行挂号的医生的ID用于关联医生信息
private Integer yishengId; private Integer yishengId;
/** /**
* *
*/ */
// 表示进行挂号的用户的ID用于关联用户信息
private Integer yonghuId; private Integer yonghuId;
/** /**
* *
*/ */
// 可能是用于识别就诊记录的唯一编码,具体用途可能根据业务需求而定
private Integer guahaoUuinNumber; private Integer guahaoUuinNumber;
/** /**
* *
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 记录挂号操作的具体时间
private Date guahaoTime; private Date guahaoTime;
/** /**
* *
*/ */
// 可能用于区分不同类型的挂号时间,例如预约时间、实际挂号时间等
private Integer guahaoTypes; private Integer guahaoTypes;
/** /**
* *
*/ */
// 用于表示挂号的当前状态,例如已挂号、已取消、已就诊等
private Integer guahaoStatusTypes; private Integer guahaoStatusTypes;
/** /**
* *
*/ */
// 用于表示挂号是否经过审核可能是0未审核、1审核通过、2审核不通过
private Integer guahaoYesnoTypes; private Integer guahaoYesnoTypes;
/** /**
* *
*/ */
// 当挂号经过审核后,记录审核的具体结果信息,例如审核不通过的原因等
private String guahaoYesnoText; private String guahaoYesnoText;
/** /**
* *
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 记录该挂号记录的创建时间
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 获取主键ID的方法供外部调用以获取该挂号记录的唯一标识
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键ID的方法供外部调用以设置该挂号记录的唯一标识
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取进行挂号的医生ID的方法供外部调用以获取医生的标识
public Integer getYishengId() { public Integer getYishengId() {
return yishengId; return yishengId;
} }
/** /**
* *
*/ */
// 设置进行挂号的医生ID的方法供外部调用以设置医生的标识
public void setYishengId(Integer yishengId) { public void setYishengId(Integer yishengId) {
this.yishengId = yishengId; this.yishengId = yishengId;
} }
/** /**
* *
*/ */
// 获取进行挂号的用户ID的方法供外部调用以获取用户的标识
public Integer getYonghuId() { public Integer getYonghuId() {
return yonghuId; return yonghuId;
} }
/** /**
* *
*/ */
// 设置进行挂号的用户ID的方法供外部调用以设置用户的标识
public void setYonghuId(Integer yonghuId) { public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId; this.yonghuId = yonghuId;
} }
/** /**
* *
*/ */
// 获取就诊识别码的方法,供外部调用以获取该挂号记录的识别编码
public Integer getGuahaoUuinNumber() { public Integer getGuahaoUuinNumber() {
return guahaoUuinNumber; return guahaoUuinNumber;
} }
/** /**
* *
*/ */
// 设置就诊识别码的方法,供外部调用以设置该挂号记录的识别编码
public void setGuahaoUuinNumber(Integer guahaoUuinNumber) { public void setGuahaoUuinNumber(Integer guahaoUuinNumber) {
this.guahaoUuinNumber = guahaoUuinNumber; this.guahaoUuinNumber = guahaoUuinNumber;
} }
/** /**
* *
*/ */
// 获取挂号时间的方法,供外部调用以获取挂号操作的具体时间
public Date getGuahaoTime() { public Date getGuahaoTime() {
return guahaoTime; return guahaoTime;
} }
/** /**
* *
*/ */
// 设置挂号时间的方法,供外部调用以设置挂号操作的具体时间
public void setGuahaoTime(Date guahaoTime) { public void setGuahaoTime(Date guahaoTime) {
this.guahaoTime = guahaoTime; this.guahaoTime = guahaoTime;
} }
/** /**
* *
*/ */
// 获取时间类型的方法,供外部调用以获取该挂号记录的时间类型
public Integer getGuahaoTypes() { public Integer getGuahaoTypes() {
return guahaoTypes; return guahaoTypes;
} }
/** /**
* *
*/ */
// 设置时间类型的方法,供外部调用以设置该挂号记录的时间类型
public void setGuahaoTypes(Integer guahaoTypes) { public void setGuahaoTypes(Integer guahaoTypes) {
this.guahaoTypes = guahaoTypes; this.guahaoTypes = guahaoTypes;
} }
/** /**
* *
*/ */
// 获取挂号状态的方法,供外部调用以获取该挂号记录的当前状态
public Integer getGuahaoStatusTypes() { public Integer getGuahaoStatusTypes() {
return guahaoStatusTypes; return guahaoStatusTypes;
} }
/** /**
* *
*/ */
// 设置挂号状态的方法,供外部调用以设置该挂号记录的当前状态
public void setGuahaoStatusTypes(Integer guahaoStatusTypes) { public void setGuahaoStatusTypes(Integer guahaoStatusTypes) {
this.guahaoStatusTypes = guahaoStatusTypes; this.guahaoStatusTypes = guahaoStatusTypes;
} }
/** /**
* *
*/ */
// 获取挂号审核状态的方法,供外部调用以获取该挂号记录的审核状态
public Integer getGuahaoYesnoTypes() { public Integer getGuahaoYesnoTypes() {
return guahaoYesnoTypes; return guahaoYesnoTypes;
} }
/** /**
* *
*/ */
// 设置挂号审核状态的方法,供外部调用以设置该挂号记录的审核状态
public void setGuahaoYesnoTypes(Integer guahaoYesnoTypes) { public void setGuahaoYesnoTypes(Integer guahaoYesnoTypes) {
this.guahaoYesnoTypes = guahaoYesnoTypes; this.guahaoYesnoTypes = guahaoYesnoTypes;
} }
/** /**
* *
*/ */
// 获取审核结果的方法,供外部调用以获取该挂号记录的审核具体结果信息
public String getGuahaoYesnoText() { public String getGuahaoYesnoText() {
return guahaoYesnoText; return guahaoYesnoText;
} }
/** /**
* *
*/ */
// 设置审核结果的方法,供外部调用以设置该挂号记录的审核具体结果信息
public void setGuahaoYesnoText(String guahaoYesnoText) { public void setGuahaoYesnoText(String guahaoYesnoText) {
this.guahaoYesnoText = guahaoYesnoText; this.guahaoYesnoText = guahaoYesnoText;
} }
/** /**
* *
*/ */
// 获取创建时间的方法,供外部调用以获取该挂号记录的创建时间
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* *
*/ */
// 设置创建时间的方法,供外部调用以设置该挂号记录的创建时间
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

@ -1,189 +1,209 @@
package com.entity.model; package com.entity.model;
// 导入JiankangjiaoyuEntity类可能用于与数据库实体进行交互或数据转换等操作
import com.entity.JiankangjiaoyuEntity; import com.entity.JiankangjiaoyuEntity;
// 导入MyBatis-Plus的TableName注解通常用于指定数据库表名但在当前代码中未实际使用该注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入Jackson的JsonFormat注解用于在JSON序列化和反序列化时对日期类型字段进行格式化处理
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
// 导入Spring的DateTimeFormat注解用于在处理表单数据时对日期类型字段进行格式化
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
* entity * entity
* ModelAndView model * ModelAndView model
*/ */
// 定义一个名为JiankangjiaoyuModel的类实现Serializable接口使该类的对象可以被序列化和反序列化
public class JiankangjiaoyuModel implements Serializable { public class JiankangjiaoyuModel implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于唯一标识健康教育记录的主键,在数据库操作中通常作为唯一标识字段
private Integer id; private Integer id;
/** /**
* *
*/ */
// 存储健康教育内容的标题,用于展示和区分不同的健康教育信息
private String jiankangjiaoyuName; private String jiankangjiaoyuName;
/** /**
* *
*/ */
// 表示健康教育的具体类型,可能是如疾病预防、健康生活方式等不同分类,以整数类型存储
private Integer jiankangjiaoyuTypes; private Integer jiankangjiaoyuTypes;
/** /**
* *
*/ */
// 存储健康教育相关的图片路径或标识,用于展示相关的图片内容
private String jiankangjiaoyuPhoto; private String jiankangjiaoyuPhoto;
/** /**
* *
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 记录健康教育内容的插入时间,即该记录创建或添加到系统的时间
private Date insertTime; private Date insertTime;
/** /**
* *
*/ */
// 存储健康教育的详细内容,如具体的健康知识、建议等文本信息
private String jiankangjiaoyuContent; private String jiankangjiaoyuContent;
/** /**
* *
*/ */
// 用于实现逻辑删除的字段可能0表示未删除1表示已删除假删以整数类型存储
private Integer jiankangjiaoyuDelete; private Integer jiankangjiaoyuDelete;
/** /**
* show1 show2 nameShow * show1 show2 nameShow
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 记录该健康教育记录的实际创建时间,可能与插入时间有所区别
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 获取主键ID的方法供外部调用以获取该健康教育记录的唯一标识
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键ID的方法供外部调用以设置该健康教育记录的唯一标识
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取健康教育标题的方法,供外部调用以获取该记录的标题信息
public String getJiankangjiaoyuName() { public String getJiankangjiaoyuName() {
return jiankangjiaoyuName; return jiankangjiaoyuName;
} }
/** /**
* *
*/ */
// 设置健康教育标题的方法,供外部调用以修改该记录的标题信息
public void setJiankangjiaoyuName(String jiankangjiaoyuName) { public void setJiankangjiaoyuName(String jiankangjiaoyuName) {
this.jiankangjiaoyuName = jiankangjiaoyuName; this.jiankangjiaoyuName = jiankangjiaoyuName;
} }
/** /**
* *
*/ */
// 获取健康教育类型的方法,供外部调用以获取该记录的类型信息
public Integer getJiankangjiaoyuTypes() { public Integer getJiankangjiaoyuTypes() {
return jiankangjiaoyuTypes; return jiankangjiaoyuTypes;
} }
/** /**
* *
*/ */
// 设置健康教育类型的方法,供外部调用以修改该记录的类型信息
public void setJiankangjiaoyuTypes(Integer jiankangjiaoyuTypes) { public void setJiankangjiaoyuTypes(Integer jiankangjiaoyuTypes) {
this.jiankangjiaoyuTypes = jiankangjiaoyuTypes; this.jiankangjiaoyuTypes = jiankangjiaoyuTypes;
} }
/** /**
* *
*/ */
// 获取健康教育图片相关信息的方法,供外部调用以获取图片路径或标识
public String getJiankangjiaoyuPhoto() { public String getJiankangjiaoyuPhoto() {
return jiankangjiaoyuPhoto; return jiankangjiaoyuPhoto;
} }
/** /**
* *
*/ */
// 设置健康教育图片相关信息的方法,供外部调用以修改图片路径或标识
public void setJiankangjiaoyuPhoto(String jiankangjiaoyuPhoto) { public void setJiankangjiaoyuPhoto(String jiankangjiaoyuPhoto) {
this.jiankangjiaoyuPhoto = jiankangjiaoyuPhoto; this.jiankangjiaoyuPhoto = jiankangjiaoyuPhoto;
} }
/** /**
* *
*/ */
// 获取健康教育内容插入时间的方法,供外部调用以获取该记录的插入时间
public Date getInsertTime() { public Date getInsertTime() {
return insertTime; return insertTime;
} }
/** /**
* *
*/ */
// 设置健康教育内容插入时间的方法,供外部调用以修改该记录的插入时间
public void setInsertTime(Date insertTime) { public void setInsertTime(Date insertTime) {
this.insertTime = insertTime; this.insertTime = insertTime;
} }
/** /**
* *
*/ */
// 获取健康教育详细内容的方法,供外部调用以获取该记录的详细文本信息
public String getJiankangjiaoyuContent() { public String getJiankangjiaoyuContent() {
return jiankangjiaoyuContent; return jiankangjiaoyuContent;
} }
/** /**
* *
*/ */
// 设置健康教育详细内容的方法,供外部调用以修改该记录的详细文本信息
public void setJiankangjiaoyuContent(String jiankangjiaoyuContent) { public void setJiankangjiaoyuContent(String jiankangjiaoyuContent) {
this.jiankangjiaoyuContent = jiankangjiaoyuContent; this.jiankangjiaoyuContent = jiankangjiaoyuContent;
} }
/** /**
* *
*/ */
// 获取逻辑删除标识的方法,供外部调用以获取该记录的假删状态
public Integer getJiankangjiaoyuDelete() { public Integer getJiankangjiaoyuDelete() {
return jiankangjiaoyuDelete; return jiankangjiaoyuDelete;
} }
/** /**
* *
*/ */
// 设置逻辑删除标识的方法,供外部调用以修改该记录的假删状态
public void setJiankangjiaoyuDelete(Integer jiankangjiaoyuDelete) { public void setJiankangjiaoyuDelete(Integer jiankangjiaoyuDelete) {
this.jiankangjiaoyuDelete = jiankangjiaoyuDelete; this.jiankangjiaoyuDelete = jiankangjiaoyuDelete;
} }
/** /**
* show1 show2 nameShow * show1 show2 nameShow
*/ */
// 获取健康教育记录创建时间的方法,供外部调用以获取该记录的实际创建时间
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* show1 show2 nameShow * show1 show2 nameShow
*/ */
// 设置健康教育记录创建时间的方法,供外部调用以修改该记录的实际创建时间
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

@ -1,169 +1,188 @@
package com.entity.model; package com.entity.model;
// 导入NewsEntity类可能用于与数据库实体交互或进行数据转换
import com.entity.NewsEntity; import com.entity.NewsEntity;
// 导入MyBatis-Plus的TableName注解通常用于指定实体类对应的数据库表名但此代码未实际使用
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入Jackson的JsonFormat注解用于在JSON序列化和反序列化时对日期类型字段进行格式化
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
// 导入Spring的DateTimeFormat注解用于在处理表单数据时对日期类型字段进行格式化
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入Serializable接口实现该接口意味着该类的对象可以被序列化和反序列化
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
* entity * entity
* ModelAndView model * ModelAndView model
*/ */
// 定义一个名为NewsModel的类实现Serializable接口
public class NewsModel implements Serializable { public class NewsModel implements Serializable {
// 序列化版本号,用于保证序列化和反序列化过程中类的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于唯一标识每条公告信息的主键
private Integer id; private Integer id;
/** /**
* *
*/ */
// 存储公告的名称,用于在列表等地方显示公告的标题
private String newsName; private String newsName;
/** /**
* *
*/ */
// 存储公告相关图片的路径或标识
private String newsPhoto; private String newsPhoto;
/** /**
* *
*/ */
// 用整数表示公告的类型,不同的数值可能代表不同的公告分类
private Integer newsTypes; private Integer newsTypes;
/** /**
* *
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 记录公告发布的具体时间
private Date insertTime; private Date insertTime;
/** /**
* *
*/ */
// 存储公告的详细内容,如具体的通知信息等
private String newsContent; private String newsContent;
/** /**
* show1 show2 nameShow * show1 show2 nameShow
*/ */
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat @DateTimeFormat
// 记录该公告信息在系统中创建的时间
private Date createTime; private Date createTime;
/** /**
* *
*/ */
// 获取主键ID的公共方法供外部调用获取公告的唯一标识
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*/ */
// 设置主键ID的公共方法供外部调用设置公告的唯一标识
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
// 获取公告名称的公共方法,供外部调用获取公告的标题
public String getNewsName() { public String getNewsName() {
return newsName; return newsName;
} }
/** /**
* *
*/ */
// 设置公告名称的公共方法,供外部调用修改公告的标题
public void setNewsName(String newsName) { public void setNewsName(String newsName) {
this.newsName = newsName; this.newsName = newsName;
} }
/** /**
* *
*/ */
// 获取公告图片路径或标识的公共方法,供外部调用获取公告的图片信息
public String getNewsPhoto() { public String getNewsPhoto() {
return newsPhoto; return newsPhoto;
} }
/** /**
* *
*/ */
// 设置公告图片路径或标识的公共方法,供外部调用修改公告的图片信息
public void setNewsPhoto(String newsPhoto) { public void setNewsPhoto(String newsPhoto) {
this.newsPhoto = newsPhoto; this.newsPhoto = newsPhoto;
} }
/** /**
* *
*/ */
// 获取公告类型的公共方法,供外部调用获取公告的分类信息
public Integer getNewsTypes() { public Integer getNewsTypes() {
return newsTypes; return newsTypes;
} }
/** /**
* *
*/ */
// 设置公告类型的公共方法,供外部调用修改公告的分类信息
public void setNewsTypes(Integer newsTypes) { public void setNewsTypes(Integer newsTypes) {
this.newsTypes = newsTypes; this.newsTypes = newsTypes;
} }
/** /**
* *
*/ */
// 获取公告发布时间的公共方法,供外部调用获取公告的发布时间
public Date getInsertTime() { public Date getInsertTime() {
return insertTime; return insertTime;
} }
/** /**
* *
*/ */
// 设置公告发布时间的公共方法,供外部调用修改公告的发布时间
public void setInsertTime(Date insertTime) { public void setInsertTime(Date insertTime) {
this.insertTime = insertTime; this.insertTime = insertTime;
} }
/** /**
* *
*/ */
// 获取公告详细内容的公共方法,供外部调用获取公告的具体信息
public String getNewsContent() { public String getNewsContent() {
return newsContent; return newsContent;
} }
/** /**
* *
*/ */
// 设置公告详细内容的公共方法,供外部调用修改公告的具体信息
public void setNewsContent(String newsContent) { public void setNewsContent(String newsContent) {
this.newsContent = newsContent; this.newsContent = newsContent;
} }
/** /**
* show1 show2 nameShow * show1 show2 nameShow
*/ */
// 获取公告创建时间的公共方法,供外部调用获取公告在系统中的创建时间
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* show1 show2 nameShow * show1 show2 nameShow
*/ */
// 设置公告创建时间的公共方法,供外部调用修改公告在系统中的创建时间
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

@ -8,7 +8,6 @@ import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable; import java.io.Serializable;
/** /**
* *
* *
@ -26,93 +25,84 @@ public class YishengModel implements Serializable {
*/ */
private Integer id; private Integer id;
/** /**
* *
*/ */
private String yishengUuidNumber; private String yishengUuidNumber;
/** /**
* *
*/ */
private String username; private String username;
/** /**
* *
*/ */
private String password; private String password;
/** /**
* *
*/ */
private String yishengName; private String yishengName;
/** /**
* *
* 使Integer
*/ */
private Integer yishengTypes; private Integer yishengTypes;
/** /**
* *
* 使Integer
*/ */
private Integer zhiweiTypes; private Integer zhiweiTypes;
/** /**
* *
*/ */
private String yishengZhichneg; private String yishengZhichneg;
/** /**
* *
* URL
*/ */
private String yishengPhoto; private String yishengPhoto;
/** /**
* *
*/ */
private String yishengPhone; private String yishengPhone;
/** /**
* *
*
*/ */
private String yishengGuahao; private String yishengGuahao;
/** /**
* *
*/ */
private String yishengEmail; private String yishengEmail;
/** /**
* *
*/ */
private Double yishengNewMoney; private Double yishengNewMoney;
/** /**
* *
*
*/ */
private String yishengContent; private String yishengContent;
/** /**
* show1 show2 photoShow * show1 show2 photoShow
* 使@JsonFormat@DateTimeFormat
*/ */
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @DateTimeFormat
private Date createTime; private Date createTime;
/** /**
* *
*/ */
@ -120,13 +110,13 @@ public class YishengModel implements Serializable {
return id; return id;
} }
/** /**
* *
*/ */
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
@ -134,13 +124,13 @@ public class YishengModel implements Serializable {
return yishengUuidNumber; return yishengUuidNumber;
} }
/** /**
* *
*/ */
public void setYishengUuidNumber(String yishengUuidNumber) { public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber; this.yishengUuidNumber = yishengUuidNumber;
} }
/** /**
* *
*/ */
@ -148,13 +138,13 @@ public class YishengModel implements Serializable {
return username; return username;
} }
/** /**
* *
*/ */
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
/** /**
* *
*/ */
@ -162,13 +152,13 @@ public class YishengModel implements Serializable {
return password; return password;
} }
/** /**
* *
*/ */
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
/** /**
* *
*/ */
@ -176,13 +166,13 @@ public class YishengModel implements Serializable {
return yishengName; return yishengName;
} }
/** /**
* *
*/ */
public void setYishengName(String yishengName) { public void setYishengName(String yishengName) {
this.yishengName = yishengName; this.yishengName = yishengName;
} }
/** /**
* *
*/ */
@ -190,13 +180,13 @@ public class YishengModel implements Serializable {
return yishengTypes; return yishengTypes;
} }
/** /**
* *
*/ */
public void setYishengTypes(Integer yishengTypes) { public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes; this.yishengTypes = yishengTypes;
} }
/** /**
* *
*/ */
@ -204,13 +194,13 @@ public class YishengModel implements Serializable {
return zhiweiTypes; return zhiweiTypes;
} }
/** /**
* *
*/ */
public void setZhiweiTypes(Integer zhiweiTypes) { public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes; this.zhiweiTypes = zhiweiTypes;
} }
/** /**
* *
*/ */
@ -218,13 +208,13 @@ public class YishengModel implements Serializable {
return yishengZhichneg; return yishengZhichneg;
} }
/** /**
* *
*/ */
public void setYishengZhichneg(String yishengZhichneg) { public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg; this.yishengZhichneg = yishengZhichneg;
} }
/** /**
* *
*/ */
@ -232,13 +222,13 @@ public class YishengModel implements Serializable {
return yishengPhoto; return yishengPhoto;
} }
/** /**
* *
*/ */
public void setYishengPhoto(String yishengPhoto) { public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto; this.yishengPhoto = yishengPhoto;
} }
/** /**
* *
*/ */
@ -246,13 +236,13 @@ public class YishengModel implements Serializable {
return yishengPhone; return yishengPhone;
} }
/** /**
* *
*/ */
public void setYishengPhone(String yishengPhone) { public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone; this.yishengPhone = yishengPhone;
} }
/** /**
* *
*/ */
@ -260,13 +250,13 @@ public class YishengModel implements Serializable {
return yishengGuahao; return yishengGuahao;
} }
/** /**
* *
*/ */
public void setYishengGuahao(String yishengGuahao) { public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao; this.yishengGuahao = yishengGuahao;
} }
/** /**
* *
*/ */
@ -274,13 +264,13 @@ public class YishengModel implements Serializable {
return yishengEmail; return yishengEmail;
} }
/** /**
* *
*/ */
public void setYishengEmail(String yishengEmail) { public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail; this.yishengEmail = yishengEmail;
} }
/** /**
* *
*/ */
@ -288,13 +278,13 @@ public class YishengModel implements Serializable {
return yishengNewMoney; return yishengNewMoney;
} }
/** /**
* *
*/ */
public void setYishengNewMoney(Double yishengNewMoney) { public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney; this.yishengNewMoney = yishengNewMoney;
} }
/** /**
* *
*/ */
@ -302,13 +292,13 @@ public class YishengModel implements Serializable {
return yishengContent; return yishengContent;
} }
/** /**
* *
*/ */
public void setYishengContent(String yishengContent) { public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent; this.yishengContent = yishengContent;
} }
/** /**
* show1 show2 photoShow * show1 show2 photoShow
*/ */
@ -316,12 +306,10 @@ public class YishengModel implements Serializable {
return createTime; return createTime;
} }
/** /**
* show1 show2 photoShow * show1 show2 photoShow
*/ */
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

@ -18,75 +18,62 @@ import java.io.Serializable;
public class YonghuModel implements Serializable { public class YonghuModel implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
private Integer id; private Integer id;
/** /**
* *
*/ */
private String username; private String username;
/** /**
* *
*/ */
private String password; private String password;
/** /**
* *
*/ */
private String yonghuName; private String yonghuName;
/** /**
* *
*/ */
private String yonghuPhoto; private String yonghuPhoto;
/** /**
* *
*/ */
private String yonghuPhone; private String yonghuPhone;
/** /**
* *
*/ */
private String yonghuIdNumber; private String yonghuIdNumber;
/** /**
* *
*/ */
private String yonghuEmail; private String yonghuEmail;
/** /**
* *
*/ */
private Integer sexTypes; private Integer sexTypes;
/** /**
* *
*/ */
private Double newMoney; private Double newMoney;
/** /**
* *
* 01
*/ */
private Integer yonghuDelete; private Integer yonghuDelete;
/** /**
* *
*/ */
@ -94,7 +81,6 @@ public class YonghuModel implements Serializable {
@DateTimeFormat @DateTimeFormat
private Date createTime; private Date createTime;
/** /**
* *
*/ */
@ -102,13 +88,13 @@ public class YonghuModel implements Serializable {
return id; return id;
} }
/** /**
* *
*/ */
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*/ */
@ -116,13 +102,13 @@ public class YonghuModel implements Serializable {
return username; return username;
} }
/** /**
* *
*/ */
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
/** /**
* *
*/ */
@ -130,13 +116,13 @@ public class YonghuModel implements Serializable {
return password; return password;
} }
/** /**
* *
*/ */
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
/** /**
* *
*/ */
@ -144,13 +130,13 @@ public class YonghuModel implements Serializable {
return yonghuName; return yonghuName;
} }
/** /**
* *
*/ */
public void setYonghuName(String yonghuName) { public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName; this.yonghuName = yonghuName;
} }
/** /**
* *
*/ */
@ -158,13 +144,13 @@ public class YonghuModel implements Serializable {
return yonghuPhoto; return yonghuPhoto;
} }
/** /**
* *
*/ */
public void setYonghuPhoto(String yonghuPhoto) { public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto; this.yonghuPhoto = yonghuPhoto;
} }
/** /**
* *
*/ */
@ -172,13 +158,13 @@ public class YonghuModel implements Serializable {
return yonghuPhone; return yonghuPhone;
} }
/** /**
* *
*/ */
public void setYonghuPhone(String yonghuPhone) { public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone; this.yonghuPhone = yonghuPhone;
} }
/** /**
* *
*/ */
@ -186,13 +172,13 @@ public class YonghuModel implements Serializable {
return yonghuIdNumber; return yonghuIdNumber;
} }
/** /**
* *
*/ */
public void setYonghuIdNumber(String yonghuIdNumber) { public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber; this.yonghuIdNumber = yonghuIdNumber;
} }
/** /**
* *
*/ */
@ -200,13 +186,13 @@ public class YonghuModel implements Serializable {
return yonghuEmail; return yonghuEmail;
} }
/** /**
* *
*/ */
public void setYonghuEmail(String yonghuEmail) { public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail; this.yonghuEmail = yonghuEmail;
} }
/** /**
* *
*/ */
@ -214,13 +200,13 @@ public class YonghuModel implements Serializable {
return sexTypes; return sexTypes;
} }
/** /**
* *
*/ */
public void setSexTypes(Integer sexTypes) { public void setSexTypes(Integer sexTypes) {
this.sexTypes = sexTypes; this.sexTypes = sexTypes;
} }
/** /**
* *
*/ */
@ -228,13 +214,13 @@ public class YonghuModel implements Serializable {
return newMoney; return newMoney;
} }
/** /**
* *
*/ */
public void setNewMoney(Double newMoney) { public void setNewMoney(Double newMoney) {
this.newMoney = newMoney; this.newMoney = newMoney;
} }
/** /**
* *
*/ */
@ -242,13 +228,13 @@ public class YonghuModel implements Serializable {
return yonghuDelete; return yonghuDelete;
} }
/** /**
* *
*/ */
public void setYonghuDelete(Integer yonghuDelete) { public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete; this.yonghuDelete = yonghuDelete;
} }
/** /**
* *
*/ */
@ -256,12 +242,10 @@ public class YonghuModel implements Serializable {
return createTime; return createTime;
} }
/** /**
* *
*/ */
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

@ -14,191 +14,226 @@ import java.util.Date;
* *
* 使 * 使
*/ */
// 使用TableName注解指定该类对应的数据库表名为 "chat"
@TableName("chat") @TableName("chat")
// ChatView类继承自ChatEntity类并实现了Serializable接口以便对象可以被序列化和反序列化
public class ChatView extends ChatEntity implements Serializable { public class ChatView extends ChatEntity implements Serializable {
// 序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于存储在线咨询相关的状态值,可能表示咨询的状态(如进行中、已结束等)
private String zhuangtaiValue; private String zhuangtaiValue;
/** /**
* *
*/ */
// 用于存储在线咨询的数据类型相关的值,具体含义可能根据业务需求而定
private String chatValue; private String chatValue;
// 级联表 yonghu // 级联表 yonghu
/** /**
* *
*/ */
// 存储与在线咨询相关联的用户的姓名信息
private String yonghuName; private String yonghuName;
/** /**
* *
*/ */
// 存储与在线咨询相关联的用户的头像路径或标识
private String yonghuPhoto; private String yonghuPhoto;
/** /**
* *
*/ */
// 存储与在线咨询相关联的用户的手机号码,用于联系用户
private String yonghuPhone; private String yonghuPhone;
/** /**
* *
*/ */
// 存储与在线咨询相关联的用户的身份证号码,用于身份验证等业务
private String yonghuIdNumber; private String yonghuIdNumber;
/** /**
* *
*/ */
// 存储与在线咨询相关联的用户的电子邮箱地址,可用于发送通知等
private String yonghuEmail; private String yonghuEmail;
/** /**
* *
*/ */
// 存储与在线咨询相关联的用户的账户余额,可能与咨询费用等相关
private Double newMoney; private Double newMoney;
/** /**
* *
*/ */
// 用于标识与在线咨询相关联的用户记录是否被逻辑删除假删0表示未删除1表示已删除
private Integer yonghuDelete; private Integer yonghuDelete;
// 无参构造函数用于创建ChatView对象
public ChatView() { public ChatView() {
} }
// 构造函数接受一个ChatEntity对象作为参数通过BeanUtils.copyProperties方法
// 将ChatEntity对象的属性值复制到当前ChatView对象中
public ChatView(ChatEntity chatEntity) { public ChatView(ChatEntity chatEntity) {
try { try {
BeanUtils.copyProperties(this, chatEntity); BeanUtils.copyProperties(this, chatEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 获取状态值的方法外部可以通过调用该方法获取zhuangtaiValue属性的值
public String getZhuangtaiValue() { public String getZhuangtaiValue() {
return zhuangtaiValue; return zhuangtaiValue;
} }
/** /**
* *
*/ */
// 设置状态值的方法外部可以通过调用该方法设置zhuangtaiValue属性的值
public void setZhuangtaiValue(String zhuangtaiValue) { public void setZhuangtaiValue(String zhuangtaiValue) {
this.zhuangtaiValue = zhuangtaiValue; this.zhuangtaiValue = zhuangtaiValue;
} }
/** /**
* *
*/ */
// 获取数据类型值的方法外部可以通过调用该方法获取chatValue属性的值
public String getChatValue() { public String getChatValue() {
return chatValue; return chatValue;
} }
/** /**
* *
*/ */
// 设置数据类型值的方法外部可以通过调用该方法设置chatValue属性的值
public void setChatValue(String chatValue) { public void setChatValue(String chatValue) {
this.chatValue = chatValue; this.chatValue = chatValue;
} }
// 级联表的get和set yonghu // 级联表的get和set yonghu
/** /**
* *
*/ */
// 获取用户姓名的方法外部可以通过调用该方法获取yonghuName属性的值
public String getYonghuName() { public String getYonghuName() {
return yonghuName; return yonghuName;
} }
/** /**
* *
*/ */
// 设置用户姓名的方法外部可以通过调用该方法设置yonghuName属性的值
public void setYonghuName(String yonghuName) { public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName; this.yonghuName = yonghuName;
} }
/** /**
* *
*/ */
// 获取用户头像的方法外部可以通过调用该方法获取yonghuPhoto属性的值
public String getYonghuPhoto() { public String getYonghuPhoto() {
return yonghuPhoto; return yonghuPhoto;
} }
/** /**
* *
*/ */
// 设置用户头像的方法外部可以通过调用该方法设置yonghuPhoto属性的值
public void setYonghuPhoto(String yonghuPhoto) { public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto; this.yonghuPhoto = yonghuPhoto;
} }
/** /**
* *
*/ */
// 获取用户手机号的方法外部可以通过调用该方法获取yonghuPhone属性的值
public String getYonghuPhone() { public String getYonghuPhone() {
return yonghuPhone; return yonghuPhone;
} }
/** /**
* *
*/ */
// 设置用户手机号的方法外部可以通过调用该方法设置yonghuPhone属性的值
public void setYonghuPhone(String yonghuPhone) { public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone; this.yonghuPhone = yonghuPhone;
} }
/** /**
* *
*/ */
// 获取用户身份证号的方法外部可以通过调用该方法获取yonghuIdNumber属性的值
public String getYonghuIdNumber() { public String getYonghuIdNumber() {
return yonghuIdNumber; return yonghuIdNumber;
} }
/** /**
* *
*/ */
// 设置用户身份证号的方法外部可以通过调用该方法设置yonghuIdNumber属性的值
public void setYonghuIdNumber(String yonghuIdNumber) { public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber; this.yonghuIdNumber = yonghuIdNumber;
} }
/** /**
* *
*/ */
// 获取用户邮箱的方法外部可以通过调用该方法获取yonghuEmail属性的值
public String getYonghuEmail() { public String getYonghuEmail() {
return yonghuEmail; return yonghuEmail;
} }
/** /**
* *
*/ */
// 设置用户邮箱的方法外部可以通过调用该方法设置yonghuEmail属性的值
public void setYonghuEmail(String yonghuEmail) { public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail; this.yonghuEmail = yonghuEmail;
} }
/** /**
* *
*/ */
// 获取用户余额的方法外部可以通过调用该方法获取newMoney属性的值
public Double getNewMoney() { public Double getNewMoney() {
return newMoney; return newMoney;
} }
/** /**
* *
*/ */
// 设置用户余额的方法外部可以通过调用该方法设置newMoney属性的值
public void setNewMoney(Double newMoney) { public void setNewMoney(Double newMoney) {
this.newMoney = newMoney; this.newMoney = newMoney;
} }
/** /**
* *
*/ */
// 获取用户假删状态的方法外部可以通过调用该方法获取yonghuDelete属性的值
public Integer getYonghuDelete() { public Integer getYonghuDelete() {
return yonghuDelete; return yonghuDelete;
} }
/** /**
* *
*/ */
// 设置用户假删状态的方法外部可以通过调用该方法设置yonghuDelete属性的值
public void setYonghuDelete(Integer yonghuDelete) { public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete; this.yonghuDelete = yonghuDelete;
} }
} }

@ -14,44 +14,29 @@ import java.util.Date;
* *
* 使 * 使
*/ */
// 使用TableName注解指定该类对应的数据库表名为 "dictionary"
@TableName("dictionary") @TableName("dictionary")
// DictionaryView类继承自DictionaryEntity类并实现了Serializable接口
// 使得该类的对象可以被序列化和反序列化,方便在网络传输或存储中使用
public class DictionaryView extends DictionaryEntity implements Serializable { public class DictionaryView extends DictionaryEntity implements Serializable {
// 序列化版本号,用于确保在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 无参构造函数用于创建DictionaryView对象在不需要初始化特定属性时使用
public DictionaryView() { public DictionaryView() {
} }
// 构造函数接受一个DictionaryEntity对象作为参数
// 通过BeanUtils.copyProperties方法将DictionaryEntity对象的属性值复制到当前DictionaryView对象中
// 这样可以方便地从Entity对象转换为View对象减少手动赋值的工作量
public DictionaryView(DictionaryEntity dictionaryEntity) { public DictionaryView(DictionaryEntity dictionaryEntity) {
try { try {
BeanUtils.copyProperties(this, dictionaryEntity); BeanUtils.copyProperties(this, dictionaryEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在复制属性过程中发生异常(例如属性访问权限问题或反射调用目标方法失败)
// 打印异常堆栈信息,以便开发人员调试和定位问题
e.printStackTrace(); e.printStackTrace();
} }
} }
} }

@ -14,430 +14,499 @@ import java.util.Date;
* *
* 使 * 使
*/ */
// 使用TableName注解指定该类对应的数据库表名为 "guahao"
@TableName("guahao") @TableName("guahao")
// GuahaoView类继承自GuahaoEntity类并实现了Serializable接口
// 使得该类的对象可以被序列化和反序列化,便于在网络传输或存储中使用
public class GuahaoView extends GuahaoEntity implements Serializable { public class GuahaoView extends GuahaoEntity implements Serializable {
// 序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于存储挂号相关的时间类型的值,可能表示不同的挂号时间分类等
private String guahaoValue; private String guahaoValue;
/** /**
* *
*/ */
// 用于存储挂号状态的具体值,例如已挂号、已取消、已就诊等状态的描述
private String guahaoStatusValue; private String guahaoStatusValue;
/** /**
* *
*/ */
// 用于存储挂号审核结果的具体值,例如审核通过、审核不通过等描述
private String guahaoYesnoValue; private String guahaoYesnoValue;
// 级联表 yisheng // 级联表 yisheng
/** /**
* *
*/ */
// 存储与该挂号记录关联的医生的工号,用于唯一标识医生
private String yishengUuidNumber; private String yishengUuidNumber;
/** /**
* *
*/ */
// 存储与该挂号记录关联的医生的姓名
private String yishengName; private String yishengName;
/** /**
* *
*/ */
// 用整数表示与该挂号记录关联的医生所属的科室
private Integer yishengTypes; private Integer yishengTypes;
/** /**
* *
*/ */
// 存储科室的具体描述值可能是科室的名称等与yishengTypes配合使用
private String yishengValue; private String yishengValue;
/** /**
* *
*/ */
// 用整数表示与该挂号记录关联的医生的职位
private Integer zhiweiTypes; private Integer zhiweiTypes;
/** /**
* *
*/ */
// 存储职位的具体描述值可能是职位的名称等与zhiweiTypes配合使用
private String zhiweiValue; private String zhiweiValue;
/** /**
* *
*/ */
// 存储与该挂号记录关联的医生的职称信息
private String yishengZhichneg; private String yishengZhichneg;
/** /**
* *
*/ */
// 存储与该挂号记录关联的医生的头像路径或标识
private String yishengPhoto; private String yishengPhoto;
/** /**
* *
*/ */
// 存储与该挂号记录关联的医生的联系电话或其他联系方式
private String yishengPhone; private String yishengPhone;
/** /**
* *
*/ */
// 存储与该医生相关的挂号注意事项和规定等信息
private String yishengGuahao; private String yishengGuahao;
/** /**
* *
*/ */
// 存储与该挂号记录关联的医生的电子邮箱地址
private String yishengEmail; private String yishengEmail;
/** /**
* *
*/ */
// 存储该医生的挂号费用金额以Double类型表示
private Double yishengNewMoney; private Double yishengNewMoney;
/** /**
* *
*/ */
// 存储与该挂号记录关联的医生的个人履历和专业介绍等信息
private String yishengContent; private String yishengContent;
// 级联表 yonghu // 级联表 yonghu
/** /**
* *
*/ */
// 存储与该挂号记录关联的用户的姓名
private String yonghuName; private String yonghuName;
/** /**
* *
*/ */
// 存储与该挂号记录关联的用户的头像路径或标识
private String yonghuPhoto; private String yonghuPhoto;
/** /**
* *
*/ */
// 存储与该挂号记录关联的用户的手机号码,用于联系用户
private String yonghuPhone; private String yonghuPhone;
/** /**
* *
*/ */
// 存储与该挂号记录关联的用户的身份证号码,用于身份验证等业务
private String yonghuIdNumber; private String yonghuIdNumber;
/** /**
* *
*/ */
// 存储与该挂号记录关联的用户的电子邮箱地址,可用于发送通知等
private String yonghuEmail; private String yonghuEmail;
/** /**
* *
*/ */
// 存储与该挂号记录关联的用户的账户余额,可能与挂号费用支付等相关
private Double newMoney; private Double newMoney;
/** /**
* *
*/ */
// 用于标识与该挂号记录关联的用户记录是否被逻辑删除假删0表示未删除1表示已删除
private Integer yonghuDelete; private Integer yonghuDelete;
// 无参构造函数用于创建GuahaoView对象
public GuahaoView() { public GuahaoView() {
} }
// 构造函数接受一个GuahaoEntity对象作为参数
// 通过BeanUtils.copyProperties方法将GuahaoEntity对象的属性值复制到当前GuahaoView对象中
public GuahaoView(GuahaoEntity guahaoEntity) { public GuahaoView(GuahaoEntity guahaoEntity) {
try { try {
BeanUtils.copyProperties(this, guahaoEntity); BeanUtils.copyProperties(this, guahaoEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 获取时间类型值的方法外部可以通过调用该方法获取guahaoValue属性的值
public String getGuahaoValue() { public String getGuahaoValue() {
return guahaoValue; return guahaoValue;
} }
/** /**
* *
*/ */
// 设置时间类型值的方法外部可以通过调用该方法设置guahaoValue属性的值
public void setGuahaoValue(String guahaoValue) { public void setGuahaoValue(String guahaoValue) {
this.guahaoValue = guahaoValue; this.guahaoValue = guahaoValue;
} }
/** /**
* *
*/ */
// 获取挂号状态值的方法外部可以通过调用该方法获取guahaoStatusValue属性的值
public String getGuahaoStatusValue() { public String getGuahaoStatusValue() {
return guahaoStatusValue; return guahaoStatusValue;
} }
/** /**
* *
*/ */
// 设置挂号状态值的方法外部可以通过调用该方法设置guahaoStatusValue属性的值
public void setGuahaoStatusValue(String guahaoStatusValue) { public void setGuahaoStatusValue(String guahaoStatusValue) {
this.guahaoStatusValue = guahaoStatusValue; this.guahaoStatusValue = guahaoStatusValue;
} }
/** /**
* *
*/ */
// 获取挂号审核值的方法外部可以通过调用该方法获取guahaoYesnoValue属性的值
public String getGuahaoYesnoValue() { public String getGuahaoYesnoValue() {
return guahaoYesnoValue; return guahaoYesnoValue;
} }
/** /**
* *
*/ */
// 设置挂号审核值的方法外部可以通过调用该方法设置guahaoYesnoValue属性的值
public void setGuahaoYesnoValue(String guahaoYesnoValue) { public void setGuahaoYesnoValue(String guahaoYesnoValue) {
this.guahaoYesnoValue = guahaoYesnoValue; this.guahaoYesnoValue = guahaoYesnoValue;
} }
// 级联表的get和set yisheng // 级联表的get和set yisheng
/** /**
* *
*/ */
// 获取医生工号的方法外部可以通过调用该方法获取yishengUuidNumber属性的值
public String getYishengUuidNumber() { public String getYishengUuidNumber() {
return yishengUuidNumber; return yishengUuidNumber;
} }
/** /**
* *
*/ */
// 设置医生工号的方法外部可以通过调用该方法设置yishengUuidNumber属性的值
public void setYishengUuidNumber(String yishengUuidNumber) { public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber; this.yishengUuidNumber = yishengUuidNumber;
} }
/** /**
* *
*/ */
// 获取医生名称的方法外部可以通过调用该方法获取yishengName属性的值
public String getYishengName() { public String getYishengName() {
return yishengName; return yishengName;
} }
/** /**
* *
*/ */
// 设置医生名称的方法外部可以通过调用该方法设置yishengName属性的值
public void setYishengName(String yishengName) { public void setYishengName(String yishengName) {
this.yishengName = yishengName; this.yishengName = yishengName;
} }
/** /**
* *
*/ */
// 获取科室编号的方法外部可以通过调用该方法获取yishengTypes属性的值
public Integer getYishengTypes() { public Integer getYishengTypes() {
return yishengTypes; return yishengTypes;
} }
/** /**
* *
*/ */
// 设置科室编号的方法外部可以通过调用该方法设置yishengTypes属性的值
public void setYishengTypes(Integer yishengTypes) { public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes; this.yishengTypes = yishengTypes;
} }
/** /**
* *
*/ */
// 获取科室描述值的方法外部可以通过调用该方法获取yishengValue属性的值
public String getYishengValue() { public String getYishengValue() {
return yishengValue; return yishengValue;
} }
/** /**
* *
*/ */
// 设置科室描述值的方法外部可以通过调用该方法设置yishengValue属性的值
public void setYishengValue(String yishengValue) { public void setYishengValue(String yishengValue) {
this.yishengValue = yishengValue; this.yishengValue = yishengValue;
} }
/** /**
* *
*/ */
// 获取职位编号的方法外部可以通过调用该方法获取zhiweiTypes属性的值
public Integer getZhiweiTypes() { public Integer getZhiweiTypes() {
return zhiweiTypes; return zhiweiTypes;
} }
/** /**
* *
*/ */
// 设置职位编号的方法外部可以通过调用该方法设置zhiweiTypes属性的值
public void setZhiweiTypes(Integer zhiweiTypes) { public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes; this.zhiweiTypes = zhiweiTypes;
} }
/** /**
* *
*/ */
// 获取职位描述值的方法外部可以通过调用该方法获取zhiweiValue属性的值
public String getZhiweiValue() { public String getZhiweiValue() {
return zhiweiValue; return zhiweiValue;
} }
/** /**
* *
*/ */
// 设置职位描述值的方法外部可以通过调用该方法设置zhiweiValue属性的值
public void setZhiweiValue(String zhiweiValue) { public void setZhiweiValue(String zhiweiValue) {
this.zhiweiValue = zhiweiValue; this.zhiweiValue = zhiweiValue;
} }
/** /**
* *
*/ */
// 获取职称信息的方法外部可以通过调用该方法获取yishengZhichneg属性的值
public String getYishengZhichneg() { public String getYishengZhichneg() {
return yishengZhichneg; return yishengZhichneg;
} }
/** /**
* *
*/ */
// 设置职称信息的方法外部可以通过调用该方法设置yishengZhichneg属性的值
public void setYishengZhichneg(String yishengZhichneg) { public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg; this.yishengZhichneg = yishengZhichneg;
} }
/** /**
* *
*/ */
// 获取医生头像路径或标识的方法外部可以通过调用该方法获取yishengPhoto属性的值
public String getYishengPhoto() { public String getYishengPhoto() {
return yishengPhoto; return yishengPhoto;
} }
/** /**
* *
*/ */
// 设置医生头像路径或标识的方法外部可以通过调用该方法设置yishengPhoto属性的值
public void setYishengPhoto(String yishengPhoto) { public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto; this.yishengPhoto = yishengPhoto;
} }
/** /**
* *
*/ */
// 获取医生联系方式的方法外部可以通过调用该方法获取yishengPhone属性的值
public String getYishengPhone() { public String getYishengPhone() {
return yishengPhone; return yishengPhone;
} }
/** /**
* *
*/ */
// 设置医生联系方式的方法外部可以通过调用该方法设置yishengPhone属性的值
public void setYishengPhone(String yishengPhone) { public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone; this.yishengPhone = yishengPhone;
} }
/** /**
* *
*/ */
// 获取挂号须知信息的方法外部可以通过调用该方法获取yishengGuahao属性的值
public String getYishengGuahao() { public String getYishengGuahao() {
return yishengGuahao; return yishengGuahao;
} }
/** /**
* *
*/ */
// 设置挂号须知信息的方法外部可以通过调用该方法设置yishengGuahao属性的值
public void setYishengGuahao(String yishengGuahao) { public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao; this.yishengGuahao = yishengGuahao;
} }
/** /**
* *
*/ */
// 获取医生邮箱地址的方法外部可以通过调用该方法获取yishengEmail属性的值
public String getYishengEmail() { public String getYishengEmail() {
return yishengEmail; return yishengEmail;
} }
/** /**
* *
*/ */
// 设置医生邮箱地址的方法外部可以通过调用该方法设置yishengEmail属性的值
public void setYishengEmail(String yishengEmail) { public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail; this.yishengEmail = yishengEmail;
} }
/** /**
* *
*/ */
// 获取挂号价格信息的方法外部可以通过调用该方法获取yishengNewMoney属性的值
public Double getYishengNewMoney() { public Double getYishengNewMoney() {
return yishengNewMoney; return yishengNewMoney;
} }
/** /**
* *
*/ */
// 设置挂号价格信息的方法外部可以通过调用该方法设置yishengNewMoney属性的值
public void setYishengNewMoney(Double yishengNewMoney) { public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney; this.yishengNewMoney = yishengNewMoney;
} }
/** /**
* *
*/ */
// 获取医生履历介绍信息的方法外部可以通过调用该方法获取yishengContent属性的值
public String getYishengContent() { public String getYishengContent() {
return yishengContent; return yishengContent;
} }
/** /**
* *
*/ */
// 设置医生履历介绍信息的方法外部可以通过调用该方法设置yishengContent属性的值
public void setYishengContent(String yishengContent) { public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent; this.yishengContent = yishengContent;
} }
// 级联表的get和set yonghu // 级联表的get和set yonghu
/** /**
* *
*/ */
// 获取用户姓名的方法外部可以通过调用该方法获取yonghuName属性的值
public String getYonghuName() { public String getYonghuName() {
return yonghuName; return yonghuName;
} }
/** /**
* *
*/ */
// 设置用户姓名的方法外部可以通过调用该方法设置yonghuName属性的值
public void setYonghuName(String yonghuName) { public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName; this.yonghuName = yonghuName;
} }
/** /**
* *
*/ */
// 获取用户头像路径或标识的方法外部可以通过调用该方法获取yonghuPhoto属性的值
public String getYonghuPhoto() { public String getYonghuPhoto() {
return yonghuPhoto; return yonghuPhoto;
} }
/** /**
* *
*/ */
// 设置用户头像路径或标识的方法外部可以通过调用该方法设置yonghuPhoto属性的值
public void setYonghuPhoto(String yonghuPhoto) { public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto; this.yonghuPhoto = yonghuPhoto;
} }
/** /**
* *
*/ */
// 获取用户手机号的方法外部可以通过调用该方法获取yonghuPhone属性的值
public String getYonghuPhone() { public String getYonghuPhone() {
return yonghuPhone; return yonghuPhone;
} }
/** /**
* *
*/ */
// 设置用户手机号的方法外部可以通过调用该方法设置yonghuPhone属性的值
public void setYonghuPhone(String yonghuPhone) { public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone; this.yonghuPhone = yonghuPhone;
} }
/** /**
* *
*/ */
// 获取用户身份证号的方法外部可以通过调用该方法获取yonghuIdNumber属性的值
public String getYonghuIdNumber() { public String getYonghuIdNumber() {
return yonghuIdNumber; return yonghuIdNumber;
} }
/** /**
* *
*/ */
// 设置用户身份证号的方法外部可以通过调用该方法设置yonghuIdNumber属性的值
public void setYonghuIdNumber(String yonghuIdNumber) { public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber; this.yonghuIdNumber = yonghuIdNumber;
} }
/** /**
* *
*/ */
// 获取用户邮箱地址的方法外部可以通过调用该方法获取yonghuEmail属性的值
public String getYonghuEmail() { public String getYonghuEmail() {
return yonghuEmail; return yonghuEmail;
} }
/**
*
*/
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
public Double getNewMoney() {
return newMoney;
}
/**
*
*/
public void setNewMoney(Double newMoney) {
this.newMoney = newMoney;
}
/**
*
*/
public Integer getYonghuDelete() {
return yonghuDelete;
}
/**
*
*/
public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete;
}
/**
} *

@ -14,52 +14,51 @@ import java.util.Date;
* *
* 使 * 使
*/ */
// 使用TableName注解指定该类对应的数据库表名为 "jiankangjiaoyu"
@TableName("jiankangjiaoyu") @TableName("jiankangjiaoyu")
// JiankangjiaoyuView类继承自JiankangjiaoyuEntity类并实现了Serializable接口
// 使得该类的对象可以被序列化和反序列化,方便在网络传输或存储中使用
public class JiankangjiaoyuView extends JiankangjiaoyuEntity implements Serializable { public class JiankangjiaoyuView extends JiankangjiaoyuEntity implements Serializable {
// 序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 用于存储健康教育相关的类型值,可能表示不同的健康教育分类,如疾病预防、健康生活方式等
private String jiankangjiaoyuValue; private String jiankangjiaoyuValue;
// 无参构造函数用于创建JiankangjiaoyuView对象在不需要初始化特定属性时使用
public JiankangjiaoyuView() { public JiankangjiaoyuView() {
} }
// 构造函数接受一个JiankangjiaoyuEntity对象作为参数
// 通过BeanUtils.copyProperties方法将JiankangjiaoyuEntity对象的属性值复制到当前JiankangjiaoyuView对象中
// 这样可以方便地从Entity对象转换为View对象减少手动赋值的工作量
public JiankangjiaoyuView(JiankangjiaoyuEntity jiankangjiaoyuEntity) { public JiankangjiaoyuView(JiankangjiaoyuEntity jiankangjiaoyuEntity) {
try { try {
BeanUtils.copyProperties(this, jiankangjiaoyuEntity); BeanUtils.copyProperties(this, jiankangjiaoyuEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在复制属性过程中发生异常(例如属性访问权限问题或反射调用目标方法失败),
// 打印异常堆栈信息,以便开发人员调试和定位问题
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 获取健康教育类型值的方法外部可以通过调用该方法获取jiankangjiaoyuValue属性的值
public String getJiankangjiaoyuValue() { public String getJiankangjiaoyuValue() {
return jiankangjiaoyuValue; return jiankangjiaoyuValue;
} }
/** /**
* *
*/ */
// 设置健康教育类型值的方法外部可以通过调用该方法设置jiankangjiaoyuValue属性的值
public void setJiankangjiaoyuValue(String jiankangjiaoyuValue) { public void setJiankangjiaoyuValue(String jiankangjiaoyuValue) {
this.jiankangjiaoyuValue = jiankangjiaoyuValue; this.jiankangjiaoyuValue = jiankangjiaoyuValue;
} }
} }

@ -1,12 +1,20 @@
package com.entity.view; package com.entity.view;
// 导入公告信息实体类NewsView 会继承该类
import com.entity.NewsEntity; import com.entity.NewsEntity;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.annotations.TableName;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
// 导入序列化接口
import java.io.Serializable; import java.io.Serializable;
// 导入日期类
import java.util.Date; import java.util.Date;
/** /**
@ -14,52 +22,48 @@ import java.util.Date;
* *
* 使 * 使
*/ */
// 指定该类对应数据库中的 news 表
@TableName("news") @TableName("news")
// NewsView 类继承自 NewsEntity 类,并实现 Serializable 接口,可进行序列化操作
public class NewsView extends NewsEntity implements Serializable { public class NewsView extends NewsEntity implements Serializable {
// 序列化版本号,确保序列化和反序列化的兼容性
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
// 存储公告类型的具体描述值,例如“紧急通知”“普通公告”等
private String newsValue; private String newsValue;
// 无参构造函数,方便创建 NewsView 类的实例
public NewsView() { public NewsView() {
} }
// 带参构造函数,接收一个 NewsEntity 对象,将其属性复制到当前 NewsView 对象
public NewsView(NewsEntity newsEntity) { public NewsView(NewsEntity newsEntity) {
try { try {
// 使用 BeanUtils 工具类复制属性
BeanUtils.copyProperties(this, newsEntity); BeanUtils.copyProperties(this, newsEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 若复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*/ */
// 获取公告类型值的方法
public String getNewsValue() { public String getNewsValue() {
return newsValue; return newsValue;
} }
/** /**
* *
*/ */
// 设置公告类型值的方法
public void setNewsValue(String newsValue) { public void setNewsValue(String newsValue) {
this.newsValue = newsValue; this.newsValue = newsValue;
} }
} }

@ -13,69 +13,82 @@ import java.util.Date;
* *
* *
* 使 * 使
* YishengEntity
*/ */
@TableName("yisheng") @TableName("yisheng") // 表明该实体类对应的数据库表名为 "yisheng",这里可能是为了保持与基础实体类的一致性或者有特定的 MyBatis-Plus 相关用途
public class YishengView extends YishengEntity implements Serializable { public class YishengView extends YishengEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 序列化版本号,用于在对象序列化和反序列化过程中保持版本一致性
/** /**
* *
* YishengEntity
*/ */
private String yishengValue; private String yishengValue;
/** /**
* *
* YishengEntity
*/ */
private String zhiweiValue; private String zhiweiValue;
/**
*
* YishengView
*/
public YishengView() { public YishengView() {
} }
/**
*
* YishengEntity YishengView
*
* @param yishengEntity YishengEntity
*/
public YishengView(YishengEntity yishengEntity) { public YishengView(YishengEntity yishengEntity) {
try { try {
// 使用 BeanUtils 工具类将 YishengEntity 对象的属性复制到当前 YishengView 对象
BeanUtils.copyProperties(this, yishengEntity); BeanUtils.copyProperties(this, yishengEntity);
} catch (IllegalAccessException | InvocationTargetException e) { } catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block // 如果在属性复制过程中出现非法访问或调用目标异常,打印异常堆栈信息
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* *
*
* @return
*/ */
public String getYishengValue() { public String getYishengValue() {
return yishengValue; return yishengValue;
} }
/** /**
* *
*
* @param yishengValue
*/ */
public void setYishengValue(String yishengValue) { public void setYishengValue(String yishengValue) {
this.yishengValue = yishengValue; this.yishengValue = yishengValue;
} }
/** /**
* *
*
* @return
*/ */
public String getZhiweiValue() { public String getZhiweiValue() {
return zhiweiValue; return zhiweiValue;
} }
/** /**
* *
*
* @param zhiweiValue
*/ */
public void setZhiweiValue(String zhiweiValue) { public void setZhiweiValue(String zhiweiValue) {
this.zhiweiValue = zhiweiValue; this.zhiweiValue = zhiweiValue;
} }
} }

@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
/** /**
* *
* *
@ -18,6 +19,7 @@ import java.util.Date;
public class YonghuView extends YonghuEntity implements Serializable { public class YonghuView extends YonghuEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* *
*/ */
@ -40,12 +42,14 @@ public class YonghuView extends YonghuEntity implements Serializable {
/** /**
* *
*/ */
public String getSexValue() { public String getSexValue() {
return sexValue; return sexValue;
} }
/** /**
* *
*/ */

@ -13,358 +13,389 @@ import java.io.Serializable;
* *
* *
* *
*
*
*/ */
@TableName("yisheng") @TableName("yisheng") // 声明该实体类对应的数据库表名为 "yisheng",用于 MyBatis-Plus 的相关操作
public class YishengVO implements Serializable { public class YishengVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
// 序列化版本号,用于保证在对象序列化和反序列化过程中的兼容性
/** /**
* *
*
*/ */
@TableField(value = "id") @TableField(value = "id")
private Integer id; private Integer id;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_uuid_number") @TableField(value = "yisheng_uuid_number")
private String yishengUuidNumber; private String yishengUuidNumber;
/** /**
* *
* 使
*/ */
@TableField(value = "username") @TableField(value = "username")
private String username; private String username;
/** /**
* *
* 使
*
*/ */
@TableField(value = "password") @TableField(value = "password")
private String password; private String password;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_name") @TableField(value = "yisheng_name")
private String yishengName; private String yishengName;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_types") @TableField(value = "yisheng_types")
private Integer yishengTypes; private Integer yishengTypes;
/** /**
* *
*
*/ */
@TableField(value = "zhiwei_types") @TableField(value = "zhiwei_types")
private Integer zhiweiTypes; private Integer zhiweiTypes;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_zhichneg") @TableField(value = "yisheng_zhichneg")
private String yishengZhichneg; private String yishengZhichneg;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_photo") @TableField(value = "yisheng_photo")
private String yishengPhoto; private String yishengPhoto;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_phone") @TableField(value = "yisheng_phone")
private String yishengPhone; private String yishengPhone;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_guahao") @TableField(value = "yisheng_guahao")
private String yishengGuahao; private String yishengGuahao;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_email") @TableField(value = "yisheng_email")
private String yishengEmail; private String yishengEmail;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_new_money") @TableField(value = "yisheng_new_money")
private Double yishengNewMoney; private Double yishengNewMoney;
/** /**
* *
*
*/ */
@TableField(value = "yisheng_content") @TableField(value = "yisheng_content")
private String yishengContent; private String yishengContent;
/** /**
* show1 show2 photoShow * show1 show2 photoShow
*
*/ */
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat @DateTimeFormat
@TableField(value = "create_time") @TableField(value = "create_time")
private Date createTime; private Date createTime;
/** /**
* *
*
* @return
*/ */
public Integer getId() { public Integer getId() {
return id; return id;
} }
/** /**
* *
*
* @param id
*/ */
public void setId(Integer id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengUuidNumber() { public String getYishengUuidNumber() {
return yishengUuidNumber; return yishengUuidNumber;
} }
/** /**
* *
*
* @param yishengUuidNumber
*/ */
public void setYishengUuidNumber(String yishengUuidNumber) { public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber; this.yishengUuidNumber = yishengUuidNumber;
} }
/** /**
* *
*
* @return
*/ */
public String getUsername() { public String getUsername() {
return username; return username;
} }
/** /**
* *
*
* @param username
*/ */
public void setUsername(String username) { public void setUsername(String username) {
this.username = username; this.username = username;
} }
/** /**
* *
*
* @return
*/ */
public String getPassword() { public String getPassword() {
return password; return password;
} }
/** /**
* *
*
* @param password
*/ */
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengName() { public String getYishengName() {
return yishengName; return yishengName;
} }
/** /**
* *
*
* @param yishengName
*/ */
public void setYishengName(String yishengName) { public void setYishengName(String yishengName) {
this.yishengName = yishengName; this.yishengName = yishengName;
} }
/** /**
* *
*
* @return
*/ */
public Integer getYishengTypes() { public Integer getYishengTypes() {
return yishengTypes; return yishengTypes;
} }
/** /**
* *
*
* @param yishengTypes
*/ */
public void setYishengTypes(Integer yishengTypes) { public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes; this.yishengTypes = yishengTypes;
} }
/** /**
* *
*
* @return
*/ */
public Integer getZhiweiTypes() { public Integer getZhiweiTypes() {
return zhiweiTypes; return zhiweiTypes;
} }
/** /**
* *
*
* @param zhiweiTypes
*/ */
public void setZhiweiTypes(Integer zhiweiTypes) { public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes; this.zhiweiTypes = zhiweiTypes;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengZhichneg() { public String getYishengZhichneg() {
return yishengZhichneg; return yishengZhichneg;
} }
/** /**
* *
*
* @param yishengZhichneg
*/ */
public void setYishengZhichneg(String yishengZhichneg) { public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg; this.yishengZhichneg = yishengZhichneg;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengPhoto() { public String getYishengPhoto() {
return yishengPhoto; return yishengPhoto;
} }
/** /**
* *
*
* @param yishengPhoto
*/ */
public void setYishengPhoto(String yishengPhoto) { public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto; this.yishengPhoto = yishengPhoto;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengPhone() { public String getYishengPhone() {
return yishengPhone; return yishengPhone;
} }
/** /**
* *
*
* @param yishengPhone
*/ */
public void setYishengPhone(String yishengPhone) { public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone; this.yishengPhone = yishengPhone;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengGuahao() { public String getYishengGuahao() {
return yishengGuahao; return yishengGuahao;
} }
/** /**
* *
*
* @param yishengGuahao
*/ */
public void setYishengGuahao(String yishengGuahao) { public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao; this.yishengGuahao = yishengGuahao;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengEmail() { public String getYishengEmail() {
return yishengEmail; return yishengEmail;
} }
/** /**
* *
*
* @param yishengEmail
*/ */
public void setYishengEmail(String yishengEmail) { public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail; this.yishengEmail = yishengEmail;
} }
/** /**
* *
*
* @return
*/ */
public Double getYishengNewMoney() { public Double getYishengNewMoney() {
return yishengNewMoney; return yishengNewMoney;
} }
/** /**
* *
*
* @param yishengNewMoney
*/ */
public void setYishengNewMoney(Double yishengNewMoney) { public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney; this.yishengNewMoney = yishengNewMoney;
} }
/** /**
* *
*
* @return
*/ */
public String getYishengContent() { public String getYishengContent() {
return yishengContent; return yishengContent;
} }
/** /**
* *
*
* @param yishengContent
*/ */
public void setYishengContent(String yishengContent) { public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent; this.yishengContent = yishengContent;
} }
/** /**
* show1 show2 photoShow *
*
* @return
*/ */
public Date getCreateTime() { public Date getCreateTime() {
return createTime; return createTime;
} }
/** /**
* show1 show2 photoShow *
*
* @param createTime
*/ */
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
} }

@ -29,15 +29,14 @@ public class AuthorizationInterceptor implements HandlerInterceptor {
public static final String LOGIN_TOKEN_KEY = "Token"; public static final String LOGIN_TOKEN_KEY = "Token";
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService; // 注入 TokenService
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String servletPath = request.getServletPath(); String servletPath = request.getServletPath();
if("/dictionary/page".equals(request.getServletPath()) || "/file/upload".equals(request.getServletPath()) || "/yonghu/register".equals(request.getServletPath()) ){//请求路径是字典表或者文件上传 直接放行 if ("/dictionary/page".equals(request.getServletPath()) || "/file/upload".equals(request.getServletPath()) || "/yonghu/register".equals(request.getServletPath())) {
// 请求路径是字典表或者文件上传 直接放行
return true; return true;
} }
// 支持跨域请求 // 支持跨域请求

@ -1,30 +1,38 @@
package com.model.enums; package com.model.enums;
// 导入序列化接口,使枚举对象可以进行序列化和反序列化操作
import java.io.Serializable; import java.io.Serializable;
// 导入 MyBatis-Plus 的枚举接口,用于将枚举值映射到数据库字段
import com.baomidou.mybatisplus.enums.IEnum; import com.baomidou.mybatisplus.enums.IEnum;
/** /**
* IEnum spring-mybatis.xml typeEnumsPackage * IEnum spring-mybatis.xml typeEnumsPackage
*
*/ */
public enum TypeEnum implements IEnum { public enum TypeEnum implements IEnum {
// 定义枚举常量,分别表示禁用状态和正常状态
DISABLED(0, "禁用"), DISABLED(0, "禁用"),
NORMAL(1, "正常"); NORMAL(1, "正常");
// 用于存储枚举值对应的整数值,通常与数据库中的字段值对应
private final int value; private final int value;
// 用于存储枚举值对应的中文描述,方便在代码中使用和展示
private final String desc; private final String desc;
// 枚举类的构造函数,用于初始化枚举常量的 value 和 desc 属性
TypeEnum(final int value, final String desc) { TypeEnum(final int value, final String desc) {
this.value = value; this.value = value;
this.desc = desc; this.desc = desc;
} }
// 实现 IEnum 接口的方法,返回枚举值对应的整数值,用于与数据库字段进行映射
@Override @Override
public Serializable getValue() { public Serializable getValue() {
return this.value; return this.value;
} }
// Jackson 注解为 JsonValue 返回中文 json 描述 // 该方法用于获取枚举值的中文描述,使用 Jackson 注解时,可将该描述作为 JSON 序列化时的值
// 这样在进行 JSON 序列化时,会返回枚举值的中文描述而不是枚举名称
public String getDesc() { public String getDesc() {
return this.desc; return this.desc;
} }

@ -6,11 +6,13 @@ import com.entity.YonghuEntity;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
/** /**
* *
*/ */
public interface YonghuService extends IService<YonghuEntity> { public interface YonghuService extends IService<YonghuEntity> {
/** /**
* @param params * @param params
* @return * @return

@ -19,21 +19,36 @@ import com.entity.view.YishengView;
/** /**
* *
* YishengService MyBatis-Plus ServiceImpl
*/ */
@Service("yishengService") @Service("yishengService") // 声明这是一个 Spring 服务组件,名称为 "yishengService"
@Transactional @Transactional // 开启事务管理,确保数据库操作的原子性
public class YishengServiceImpl extends ServiceImpl<YishengDao, YishengEntity> implements YishengService { public class YishengServiceImpl extends ServiceImpl<YishengDao, YishengEntity> implements YishengService {
/**
*
*
* @param params "page""limit"
* @return PageUtils
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
// 检查参数是否为空,并且判断是否缺少 "limit" 或 "page" 参数
if (params != null && (params.get("limit") == null || params.get("page") == null)) { if (params != null && (params.get("limit") == null || params.get("page") == null)) {
// 如果缺少 "page" 参数,将其默认设置为 "1",表示第一页
params.put("page", "1"); params.put("page", "1");
// 如果缺少 "limit" 参数,将其默认设置为 "10",表示每页显示 10 条记录
params.put("limit", "10"); params.put("limit", "10");
} }
// 根据传入的参数创建一个分页对象 Page<YishengView>,用于存储查询结果
Page<YishengView> page = new Query<YishengView>(params).getPage(); Page<YishengView> page = new Query<YishengView>(params).getPage();
// 调用 baseMapper即 YishengDao的 selectListView 方法,根据分页对象和查询参数进行分页查询
// 并将查询结果记录设置到分页对象中
page.setRecords(baseMapper.selectListView(page, params)); page.setRecords(baseMapper.selectListView(page, params));
// 将分页对象封装到 PageUtils 中,方便返回给调用者
return new PageUtils(page); return new PageUtils(page);
} }
} }

@ -1,17 +1,28 @@
// 定义一个包含积分订单和配置相关 API 路径的常量对象
const api = { const api = {
// 积分订单 // 积分订单相关 API 路径
// 获取积分订单列表的分页接口路径
orderpage: 'orders/page', orderpage: 'orders/page',
// 删除积分订单的接口路径
orderdelete: 'orders/delete', orderdelete: 'orders/delete',
// 获取积分订单详情的接口路径,后面需拼接订单 ID
orderinfo: 'orders/info/', orderinfo: 'orders/info/',
// 保存积分订单的接口路径
ordersave: 'orders/save', ordersave: 'orders/save',
// 更新积分订单的接口路径
orderupdate: 'orders/update', orderupdate: 'orders/update',
// 配置 // 配置相关 API 路径
// 获取配置列表的分页接口路径
configpage: 'config/page', configpage: 'config/page',
// 删除配置的接口路径
configdelete: 'config/delete', configdelete: 'config/delete',
// 获取配置详情的接口路径,后面需拼接配置 ID
configinfo: 'config/info/', configinfo: 'config/info/',
// 保存配置的接口路径
configsave: 'config/save', configsave: 'config/save',
// 更新配置的接口路径
configupdate: 'config/update' configupdate: 'config/update'
} }
// 导出 api 对象,以便在其他模块中使用
export default api export default api

@ -1,16 +1,24 @@
// 定义一个名为 base 的对象,用于存储项目的基础配置信息
const base = { const base = {
// 定义 get 方法,该方法返回一个包含项目基础信息的对象
get() { get() {
return { return {
// 项目的基础 URL通常为后端服务的访问地址
url: "http://localhost:8080/yiyuanguanhaojiuzhen/", url: "http://localhost:8080/yiyuanguanhaojiuzhen/",
// 项目的名称,可用于标识该项目
name: "yiyuanguanhaojiuzhen", name: "yiyuanguanhaojiuzhen",
// 退出到首页链接 // 退出到首页的链接,当需要跳转到项目首页时可使用该链接
indexUrl: 'http://localhost:8080/yiyuanguanhaojiuzhen/front/index.html' indexUrl: 'http://localhost:8080/yiyuanguanhaojiuzhen/front/index.html'
}; };
}, },
// 定义 getProjectName 方法,该方法返回一个包含项目名称的对象
getProjectName() { getProjectName() {
return { return {
// 项目的中文名称,可用于前端展示等场景
projectName: "医院挂号就诊系统" projectName: "医院挂号就诊系统"
};
} }
} };
}
export default base // 导出 base 对象,以便其他模块可以引入并使用这些基础配置信息
export default base;

@ -1,29 +1,50 @@
// 引入 axios 库,用于发送 HTTP 请求
import axios from 'axios' import axios from 'axios'
// 引入路由实例,用于路由跳转
import router from '@/router/router-static' import router from '@/router/router-static'
// 引入存储工具,用于处理本地存储等操作
import storage from '@/utils/storage' import storage from '@/utils/storage'
// 创建一个 axios 实例,进行一些全局配置
const http = axios.create({ const http = axios.create({
// 设置请求超时时间为一天86400 秒)
timeout: 1000 * 86400, timeout: 1000 * 86400,
// 允许跨域请求携带凭证(如 cookie
withCredentials: true, withCredentials: true,
// 设置请求的基础 URL后续请求的 URL 会基于此拼接
baseURL: '/yiyuanguanhaojiuzhen', baseURL: '/yiyuanguanhaojiuzhen',
// 设置请求头,指定请求体的内容类型为 JSON 且字符编码为 UTF - 8
headers: { headers: {
'Content-Type': 'application/json; charset=utf-8' 'Content-Type': 'application/json; charset=utf-8'
} }
}) })
// 请求拦截
// 请求拦截器,在发送请求前进行一些处理
http.interceptors.request.use(config => { http.interceptors.request.use(config => {
config.headers['Token'] = storage.get('Token') // 请求头带上token // 可以在这里添加请求头信息,例如添加 token
// const token = storage.get('token')
// if (token) {
// config.headers['Authorization'] = `Bearer ${token}`
// }
return config return config
}, error => { }, error => {
// 请求出错时,将错误信息通过 Promise.reject 返回
return Promise.reject(error) return Promise.reject(error)
}) })
// 响应拦截
// 响应拦截器,在接收到响应后进行一些处理
http.interceptors.response.use(response => { http.interceptors.response.use(response => {
if (response.data && response.data.code === 401) { // 401, token失效 // 检查响应数据中的 code 字段,如果为 401 表示 token 失效
if (response.data && response.data.code === 401) {
// 跳转到登录页面
router.push({ name: 'login' }) router.push({ name: 'login' })
} }
// 返回响应数据
return response return response
}, error => { }, error => {
// 响应出错时,将错误信息通过 Promise.reject 返回
return Promise.reject(error) return Promise.reject(error)
}) })
// 导出配置好的 axios 实例,供其他模块使用
export default http export default http

@ -1,12 +1,23 @@
// translate router.meta.title, be used in breadcrumb sidebar tagsview /**
* 翻译路由元信息中的标题用于面包屑导航侧边栏和标签页视图
* @param {string} title - 路由元信息中的标题
* @returns {string} - 翻译后的标题如果没有翻译则返回原标题
*/
export function generateTitle(title) { export function generateTitle(title) {
const hasKey = this.$te('route.' + title) // 检查是否存在对应的翻译键
// this.$te 是 vue-i18n 提供的方法,用于检查是否存在指定的翻译键
const hasKey = this.$te('route.' + title);
// 如果存在对应的翻译键
if (hasKey) { if (hasKey) {
// $t :this method from vue-i18n, inject in @/lang/index.js // 使用 this.$t 方法进行翻译this.$t 是 vue-i18n 提供的翻译方法
const translatedTitle = this.$t('route.' + title) // 这里的 'route.' + title 是翻译键的格式
const translatedTitle = this.$t('route.' + title);
return translatedTitle // 返回翻译后的标题
return translatedTitle;
} }
return title
// 如果不存在对应的翻译键,直接返回原标题
return title;
} }

@ -1,25 +1,34 @@
// 定义一个名为menu的对象其中包含一个list方法用于返回菜单数据
const menu = { const menu = {
list() { list() {
return [ return [
// 第一个角色(管理员)的菜单配置
{ {
// 后台菜单列表
"backMenu": [ "backMenu": [
{ {
// 子菜单列表
"child": [ "child": [
{ {
// 按钮列表,包含对该菜单操作的按钮
"buttons": [ "buttons": [
"查看", "查看",
"新增", "新增",
"修改", "修改",
"删除" "删除"
], ],
// 菜单名称
"menu": "管理员管理", "menu": "管理员管理",
// 菜单跳转目标,这里是跳转到列表页面
"menuJump": "列表", "menuJump": "列表",
// 关联的表名,用于数据操作等
"tableName": "users" "tableName": "users"
} }
], ],
// 父菜单名称
"menu": "管理员管理" "menu": "管理员管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -34,8 +43,8 @@ const menu = {
} }
], ],
"menu": "在线咨询管理" "menu": "在线咨询管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -47,8 +56,7 @@ const menu = {
"menu": "健康教育类型管理", "menu": "健康教育类型管理",
"menuJump": "列表", "menuJump": "列表",
"tableName": "dictionaryJiankangjiaoyu" "tableName": "dictionaryJiankangjiaoyu"
} },
,
{ {
"buttons": [ "buttons": [
"查看", "查看",
@ -59,8 +67,7 @@ const menu = {
"menu": "公告类型管理", "menu": "公告类型管理",
"menuJump": "列表", "menuJump": "列表",
"tableName": "dictionaryNews" "tableName": "dictionaryNews"
} },
,
{ {
"buttons": [ "buttons": [
"查看", "查看",
@ -71,8 +78,7 @@ const menu = {
"menu": "科室管理", "menu": "科室管理",
"menuJump": "列表", "menuJump": "列表",
"tableName": "dictionaryYisheng" "tableName": "dictionaryYisheng"
} },
,
{ {
"buttons": [ "buttons": [
"查看", "查看",
@ -86,8 +92,8 @@ const menu = {
} }
], ],
"menu": "基础数据管理" "menu": "基础数据管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -102,8 +108,8 @@ const menu = {
} }
], ],
"menu": "挂号管理" "menu": "挂号管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -118,8 +124,8 @@ const menu = {
} }
], ],
"menu": "健康教育管理" "menu": "健康教育管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -134,8 +140,8 @@ const menu = {
} }
], ],
"menu": "公告信息管理" "menu": "公告信息管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -150,8 +156,8 @@ const menu = {
} }
], ],
"menu": "医生管理" "menu": "医生管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -166,8 +172,8 @@ const menu = {
} }
], ],
"menu": "用户管理" "menu": "用户管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -184,14 +190,22 @@ const menu = {
"menu": "轮播图信息" "menu": "轮播图信息"
} }
], ],
// 前端菜单列表,这里为空
"frontMenu": [], "frontMenu": [],
// 是否有后台登录功能
"hasBackLogin": "是", "hasBackLogin": "是",
// 是否有后台注册功能
"hasBackRegister": "否", "hasBackRegister": "否",
// 是否有前端登录功能
"hasFrontLogin": "否", "hasFrontLogin": "否",
// 是否有前端注册功能
"hasFrontRegister": "否", "hasFrontRegister": "否",
// 角色名称
"roleName": "管理员", "roleName": "管理员",
// 关联的表名,用于数据操作等
"tableName": "users" "tableName": "users"
}, },
// 第二个角色(医生)的菜单配置
{ {
"backMenu": [ "backMenu": [
{ {
@ -207,8 +221,8 @@ const menu = {
} }
], ],
"menu": "挂号管理" "menu": "挂号管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -220,8 +234,8 @@ const menu = {
} }
], ],
"menu": "健康教育管理" "menu": "健康教育管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -243,6 +257,7 @@ const menu = {
"roleName": "医生", "roleName": "医生",
"tableName": "yisheng" "tableName": "yisheng"
}, },
// 第三个角色(用户)的菜单配置
{ {
"backMenu": [ "backMenu": [
{ {
@ -258,8 +273,8 @@ const menu = {
} }
], ],
"menu": "挂号管理" "menu": "挂号管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -271,8 +286,8 @@ const menu = {
} }
], ],
"menu": "健康教育管理" "menu": "健康教育管理"
} },
,{ {
"child": [ "child": [
{ {
"buttons": [ "buttons": [
@ -294,7 +309,9 @@ const menu = {
"roleName": "用户", "roleName": "用户",
"tableName": "yonghu" "tableName": "yonghu"
} }
] ];
}
} }
};
// 导出menu对象以便在其他模块中使用这些菜单配置数据
export default menu; export default menu;

@ -1,18 +1,59 @@
// 定义一个名为 storage 的对象,用于封装对 localStorage 的操作
const storage = { const storage = {
/**
* 将数据存储到 localStorage
* @param {string} key - 存储数据的键
* @param {any} value - 要存储的数据会被转换为 JSON 字符串
*/
set(key, value) { set(key, value) {
// 使用 localStorage.setItem 方法将键值对存储到 localStorage 中
// 为了能存储任意类型的数据,使用 JSON.stringify 将值转换为 JSON 字符串
localStorage.setItem(key, JSON.stringify(value)); localStorage.setItem(key, JSON.stringify(value));
}, },
/**
* localStorage 中获取数据
* @param {string} key - 要获取数据的键
* @returns {string} - 返回存储的数据如果没有则返回空字符串
*/
get(key) { get(key) {
return localStorage.getItem(key)?localStorage.getItem(key).replace('"','').replace('"',''):""; // 先检查 localStorage 中是否存在该键对应的数据
if (localStorage.getItem(key)) {
// 如果存在,去除字符串两端可能存在的引号后返回
return localStorage.getItem(key).replace('"', '').replace('"', '');
}
// 如果不存在,返回空字符串
return "";
}, },
/**
* localStorage 中获取对象类型的数据
* @param {string} key - 要获取数据的键
* @returns {object|null} - 返回解析后的对象如果没有则返回 null
*/
getObj(key) { getObj(key) {
return localStorage.getItem(key)?JSON.parse(localStorage.getItem(key)):null; // 先检查 localStorage 中是否存在该键对应的数据
if (localStorage.getItem(key)) {
// 如果存在,使用 JSON.parse 将存储的 JSON 字符串解析为对象并返回
return JSON.parse(localStorage.getItem(key));
}
// 如果不存在,返回 null
return null;
}, },
/**
* localStorage 中移除指定键的数据
* @param {string} key - 要移除数据的键
*/
remove(key) { remove(key) {
// 使用 localStorage.removeItem 方法移除指定键的数据
localStorage.removeItem(key); localStorage.removeItem(key);
}, },
/**
* 清空 localStorage 中的所有数据
*/
clear() { clear() {
// 使用 localStorage.clear 方法清空 localStorage 中的所有数据
localStorage.clear(); localStorage.clear();
} }
} };
// 导出 storage 对象,以便在其他模块中使用这些封装的 localStorage 操作方法
export default storage; export default storage;

@ -1,94 +1,59 @@
/* 全局list页面按钮样式 */ // storage localStorage
.slt { const storage = {
margin: 0 !important; /**
display: flex; * localStorage
} * @param {string} key -
* @param {any} value - JSON
.ad { */
margin: 0 !important; set(key, value) {
display: flex; // 使 localStorage.setItem localStorage
} // 使 JSON.stringify JSON
localStorage.setItem(key, JSON.stringify(value));
.pages { },
& /deep/ el-pagination__sizes{ /**
& /deep/ el-input__inner { * localStorage
height: 22px; * @param {string} key -
line-height: 22px; * @returns {string} -
} */
} get(key) {
} // localStorage
if (localStorage.getItem(key)) {
//
.el-button+.el-button { return localStorage.getItem(key).replace('"', '').replace('"', '');
margin:0; }
} //
return "";
.tables { },
& /deep/ .el-button--success { /**
height: 36px; * localStorage
color: rgba(40, 167, 69, 1); * @param {string} key -
font-size: 10px; * @returns {object|null} - null
border-width: 0px; */
border-style: solid; getObj(key) {
border-color: #DCDFE6; // localStorage
border-radius: 0px; if (localStorage.getItem(key)) {
background-color: rgba(255, 255, 255, 1); // 使 JSON.parse JSON
} return JSON.parse(localStorage.getItem(key));
}
& /deep/ .el-button--primary { // null
height: 36px; return null;
color: rgba(255, 193, 7, 1); },
font-size: 10px; /**
border-width: 0px; * localStorage
border-style: solid; * @param {string} key -
border-color: #DCDFE6; */
border-radius: 0px; remove(key) {
background-color: #fff; // 使 localStorage.removeItem
} localStorage.removeItem(key);
},
& /deep/ .el-button--danger { /**
height: 36px; * localStorage
color: rgba(220, 53, 69, 1); */
font-size: 10px; clear() {
border-width: 0px; // 使 localStorage.clear localStorage
border-style: solid; localStorage.clear();
border-color: #DCDFE6;
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button {
margin: 4px;
}
} }
};
/* 全局add-or-update页面按钮样式 */ // storage 便使 localStorage
.editor{ export default storage;
height: 500px;
& /deep/ .ql-container {
height: 310px;
}
}
.amap-wrapper {
width: 100%;
height: 500px;
}
.search-box {
position: absolute;
}
.addEdit-block {
margin: -10px;
}
.detail-form-content {
padding: 12px;
}
.btn .el-button {
padding: 0;
}
/*IndexMain.vue list
//
.el-main
//list
.router-view
*/

@ -1,9 +1,326 @@
// 定义一个名为 style 的对象,用于管理不同页面的样式配置
const style = { const style = {
// listStyle 方法,返回列表页面的样式配置对象
listStyle() { listStyle() {
return {"searchBtnFontColor":"rgba(106, 0, 138, 1)","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"0px","tableBtnDelFontColor":"rgba(88, 179, 81, 1)","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(88, 179, 81, 1)","searchBtnBorderRadius":"4px","tableStripe":true,"btnAdAllWarnFontColor":"rgba(88, 179, 81, 1)","tableBtnDelBgColor":"#fff","searchBtnIcon":"1","tableSize":"mini","searchBtnBorderStyle":"solid","tableSelection":false,"searchBtnBorderWidth":"2px","tableContentFontSize":"14px","searchBtnBgColor":"#fff","inputTitleSize":"14px","btnAdAllBorderColor":"rgba(88, 179, 81, 1)","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"3","tableBtnDetailFontColor":"rgba(88, 179, 81, 1)","tableBtnHeight":"30px","pagePager":true,"searchBtnBorderColor":"rgba(88, 179, 81, 1)","tableHeaderFontColor":"rgba(255, 255, 255, 1)","inputTitle":"1","tableBtnBorderRadius":"0px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(88, 179, 81, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"#fff","btnAdAllBorderWidth":"2px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"none none solid none","inputHeight":"40px","btnAdAllBorderRadius":"4px","btnAdAllDelBgColor":"#fff","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(250, 212, 0, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":false,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"#fff","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"rgba(88, 179, 81, 1)","pageEachNum":10,"tableHeaderBgColor":"rgba(88, 179, 81, 1)","inputTitleColor":"rgba(88, 179, 81, 1)","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"#fff","inputIcon":"1","searchBtnIconPosition":"1","btnAdAllFontSize":"10px","inputBorderStyle":"none none solid none ","inputBgColor":"#fff","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"rgba(88, 179, 81, 1)","tableBtnFont":"1","tableContentFontColor":"#606266","inputBorderColor":"rgba(88, 179, 81, 1)","tableShowHeader":true,"tableBtnFontSize":"12px","tableBtnBorderColor":"rgba(88, 179, 81, 1)","inputIconPosition":"2","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(227, 225, 225, 1)","tableBtnEditFontColor":"rgba(88, 179, 81, 1)","tableAlign":"left"} return {
// 搜索按钮的字体颜色
"searchBtnFontColor": "rgba(106, 0, 138, 1)",
// 分页位置(具体含义需根据业务逻辑确定,这里是 1
"pagePosition": "1",
// 输入框的字体大小
"inputFontSize": "14px",
// 输入框的边框圆角
"inputBorderRadius": "0px",
// 表格删除按钮的字体颜色
"tableBtnDelFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮图标位置(具体含义需根据业务逻辑确定,这里是 1
"tableBtnIconPosition": "1",
// 搜索按钮的高度
"searchBtnHeight": "40px",
// 输入框图标的颜色
"inputIconColor": "rgba(88, 179, 81, 1)",
// 搜索按钮的边框圆角
"searchBtnBorderRadius": "4px",
// 表格是否显示斑马纹
"tableStripe": true,
// 按钮全部警告的字体颜色
"btnAdAllWarnFontColor": "rgba(88, 179, 81, 1)",
// 表格删除按钮的背景颜色
"tableBtnDelBgColor": "#fff",
// 搜索按钮的图标(具体含义需根据业务逻辑确定,这里是 1
"searchBtnIcon": "1",
// 表格的尺寸为 mini
"tableSize": "mini",
// 搜索按钮的边框样式为 solid
"searchBtnBorderStyle": "solid",
// 表格是否显示行选择框
"tableSelection": false,
// 搜索按钮的边框宽度
"searchBtnBorderWidth": "2px",
// 表格内容的字体大小
"tableContentFontSize": "14px",
// 搜索按钮的背景颜色
"searchBtnBgColor": "#fff",
// 输入框标题的大小
"inputTitleSize": "14px",
// 按钮全部的边框颜色
"btnAdAllBorderColor": "rgba(88, 179, 81, 1)",
// 是否显示分页跳转框
"pageJumper": true,
// 按钮全部图标位置(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllIconPosition": "1",
// 搜索框的位置(具体含义需根据业务逻辑确定,这里是 3
"searchBoxPosition": "3",
// 表格详情按钮的字体颜色
"tableBtnDetailFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮的高度
"tableBtnHeight": "30px",
// 是否显示分页导航条
"pagePager": true,
// 搜索按钮的边框颜色
"searchBtnBorderColor": "rgba(88, 179, 81, 1)",
// 表格表头的字体颜色
"tableHeaderFontColor": "rgba(255, 255, 255, 1)",
// 输入框标题(具体含义需根据业务逻辑确定,这里是 1
"inputTitle": "1",
// 表格按钮的边框圆角
"tableBtnBorderRadius": "0px",
// 按钮全部的字体(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllFont": "1",
// 按钮全部删除的字体颜色
"btnAdAllDelFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮的图标(具体含义需根据业务逻辑确定,这里是 1
"tableBtnIcon": "1",
// 按钮全部的高度
"btnAdAllHeight": "40px",
// 按钮全部警告的背景颜色
"btnAdAllWarnBgColor": "#fff",
// 按钮全部的边框宽度
"btnAdAllBorderWidth": "2px",
// 表格斑马纹的字体颜色
"tableStripeFontColor": "#606266",
// 表格按钮的边框样式为底部 solid
"tableBtnBorderStyle": "none none solid none",
// 输入框的高度
"inputHeight": "40px",
// 按钮全部的边框圆角
"btnAdAllBorderRadius": "4px",
// 按钮全部删除的背景颜色
"btnAdAllDelBgColor": "#fff",
// 是否显示分页上一页和下一页按钮
"pagePrevNext": true,
// 按钮全部添加的背景颜色
"btnAdAllAddBgColor": "rgba(250, 212, 0, 1)",
// 搜索按钮的字体(具体含义需根据业务逻辑确定,这里是 1
"searchBtnFont": "1",
// 表格是否显示索引列
"tableIndex": true,
// 按钮全部的图标(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllIcon": "1",
// 表格是否可排序
"tableSortable": false,
// 是否显示每页数量选择框
"pageSizes": true,
// 表格是否自动调整列宽
"tableFit": true,
// 分页按钮是否有背景
"pageBtnBG": true,
// 搜索按钮的字体大小
"searchBtnFontSize": "14px",
// 表格编辑按钮的背景颜色
"tableBtnEditBgColor": "#fff",
// 输入框的边框宽度
"inputBorderWidth": "1px",
// 输入框字体的位置(具体含义需根据业务逻辑确定,这里是 1
"inputFontPosition": "1",
// 输入框的字体颜色
"inputFontColor": "rgba(88, 179, 81, 1)",
// 每页显示的数量
"pageEachNum": 10,
// 表格表头的背景颜色
"tableHeaderBgColor": "rgba(88, 179, 81, 1)",
// 输入框标题的颜色
"inputTitleColor": "rgba(88, 179, 81, 1)",
// 按钮全部的盒子位置(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllBoxPosition": "1",
// 表格详情按钮的背景颜色
"tableBtnDetailBgColor": "#fff",
// 输入框的图标(具体含义需根据业务逻辑确定,这里是 1
"inputIcon": "1",
// 搜索按钮图标的位置(具体含义需根据业务逻辑确定,这里是 1
"searchBtnIconPosition": "1",
// 按钮全部的字体大小
"btnAdAllFontSize": "10px",
// 输入框的边框样式为底部 solid
"inputBorderStyle": "none none solid none ",
// 输入框的背景颜色
"inputBgColor": "#fff",
// 分页样式(具体含义需根据业务逻辑确定,这里是 false
"pageStyle": false,
// 是否显示总页数
"pageTotal": true,
// 按钮全部添加的字体颜色
"btnAdAllAddFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮的字体(具体含义需根据业务逻辑确定,这里是 1
"tableBtnFont": "1",
// 表格内容的字体颜色
"tableContentFontColor": "#606266",
// 输入框的边框颜色
"inputBorderColor": "rgba(88, 179, 81, 1)",
// 表格是否显示表头
"tableShowHeader": true,
// 表格按钮的字体大小
"tableBtnFontSize": "12px",
// 表格按钮的边框颜色
"tableBtnBorderColor": "rgba(88, 179, 81, 1)",
// 输入框图标的位置(具体含义需根据业务逻辑确定,这里是 2
"inputIconPosition": "2",
// 表格是否有边框
"tableBorder": true,
// 按钮全部的边框样式为 solid
"btnAdAllBorderStyle": "solid",
// 表格按钮的边框宽度
"tableBtnBorderWidth": "1px",
// 表格斑马纹的背景颜色
"tableStripeBgColor": "rgba(227, 225, 225, 1)",
// 表格编辑按钮的字体颜色
"tableBtnEditFontColor": "rgba(88, 179, 81, 1)",
// 表格内容的对齐方式为左对齐
"tableAlign": "left"
};
}, },
// addStyle 方法,返回添加或编辑页面的样式配置对象
addStyle() { addStyle() {
return {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"#DCDFE6","inputBorderRadius":"4px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"4px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"4px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"rgba(199, 21, 133, 1)","addEditBoxColor":"rgba(242, 241, 242, 1)","dateIconFontSize":"14px","btnSaveBgColor":"rgba(199, 21, 133, 1)","uploadIconFontColor":"#8c939d","textareaBorderColor":"#DCDFE6","btnCancelBgColor":"rgba(253, 252, 254, 1)","selectLableColor":"rgba(199, 21, 133, 1)","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"4px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"rgba(106, 0, 138, 1)","dateBorderColor":"#DCDFE6","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"rgba(199, 21, 133, 1)","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"rgba(199, 21, 133, 1)","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"4px","inputBgColor":"#fff","inputLableFontSize":"14px","uploadLableColor":"rgba(199, 21, 133, 1)","uploadBorderRadius":"4px","btnSaveHeight":"44px","selectBgColor":"rgba(255, 255, 255, 1)","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"#DCDFE6","inputBorderColor":"#DCDFE6","uploadBorderColor":"#DCDFE6","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"4px","selectFontColor":"rgba(10, 10, 10, 1)","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"0px"} return {
// 保存按钮的字体颜色
"btnSaveFontColor": "#fff",
// 选择框的字体大小
"selectFontSize": "14px",
// 取消按钮的边框颜色
"btnCancelBorderColor": "#DCDFE6",
// 输入框的边框圆角
"inputBorderRadius": "4px",
// 输入框的字体大小
"inputFontSize": "14px",
// 文本域的背景颜色
"textareaBgColor": "#fff",
// 保存按钮的字体大小
"btnSaveFontSize": "14px",
// 文本域的边框圆角
"textareaBorderRadius": "4px",
// 上传区域的背景颜色
"uploadBgColor": "#fff",
// 文本域的边框样式为 solid
"textareaBorderStyle": "solid",
// 取消按钮的宽度
"btnCancelWidth": "88px",
// 文本域的高度
"textareaHeight": "120px",
// 日期选择框的背景颜色
"dateBgColor": "#fff",
// 保存按钮的边框圆角
"btnSaveBorderRadius": "4px",
// 上传区域标签的字体大小
"uploadLableFontSize": "14px",
// 文本域的边框宽度
"textareaBorderWidth": "1px",
// 输入框标签的颜色
"inputLableColor": "rgba(199, 21, 133, 1)",
// 添加或编辑盒子的颜色
"addEditBoxColor": "rgba(242, 241, 242, 1)",
// 日期选择框图标的字体大小
"dateIconFontSize": "14px",
// 保存按钮的背景颜色
"btnSaveBgColor": "rgba(199, 21, 133, 1)",
// 上传区域图标的字体颜色
"uploadIconFontColor": "#8c939d",
// 文本域的边框颜色
"textareaBorderColor": "#DCDFE6",
// 取消按钮的背景颜色
"btnCancelBgColor": "rgba(253, 252, 254, 1)",
// 选择框标签的颜色
"selectLableColor": "rgba(199, 21, 133, 1)",
// 保存按钮的边框样式为 solid
"btnSaveBorderStyle": "solid",
// 日期选择框的边框宽度
"dateBorderWidth": "1px",
// 日期选择框标签的字体大小
"dateLableFontSize": "14px",
// 日期选择框的边框圆角
"dateBorderRadius": "4px",
// 取消按钮的边框样式为 solid
"btnCancelBorderStyle": "solid",
// 选择框标签的字体大小
"selectLableFontSize": "14px",
// 选择框的边框样式为 solid
"selectBorderStyle": "solid",
// 选择框图标的字体颜色
"selectIconFontColor": "#C0C4CC",
// 取消按钮的高度
"btnCancelHeight": "44px",
// 输入框的高度
"inputHeight": "40px",
// 取消按钮的字体颜色
"btnCancelFontColor": "rgba(106, 0, 138, 1)",
// 日期选择框的边框颜色
"dateBorderColor": "#DCDFE6",
// 日期选择框图标的字体颜色
"dateIconFontColor": "#C0C4CC",
// 上传区域的边框样式为 solid
"uploadBorderStyle": "solid",
// 日期选择框的边框样式为 solid
"dateBorderStyle": "solid",
// 日期选择框标签的颜色
"dateLableColor": "rgba(199, 21, 133, 1)",
// 日期选择框的字体大小
"dateFontSize": "14px",
// 输入框的边框宽度
"inputBorderWidth": "1px",
// 上传区域图标的字体大小
"uploadIconFontSize": "28px",
// 选择框的高度
"selectHeight": "40px",
// 输入框的字体颜色
"inputFontColor": "#606266",
// 上传区域的高度
"uploadHeight": "148px",
// 文本域标签的颜色
"textareaLableColor": "rgba(199, 21, 133, 1)",
// 文本域标签的字体大小
"textareaLableFontSize": "14px",
// 取消按钮的字体大小
"btnCancelFontSize": "14px",
// 输入框的边框样式为 solid
"inputBorderStyle": "solid",
// 取消按钮的边框圆角
"btnCancelBorderRadius": "4px",
// 输入框的背景颜色
"inputBgColor": "#fff",
// 输入框标签的字体大小
"inputLableFontSize": "14px",
// 上传区域标签的颜色
"uploadLableColor": "rgba(199, 21, 133, 1)",
// 上传区域的边框圆角
"uploadBorderRadius": "4px",
// 保存按钮的高度
"btnSaveHeight": "44px",
// 选择框的背景颜色
"selectBgColor": "rgba(255, 255, 255, 1)",
// 保存按钮的宽度
"btnSaveWidth": "88px",
// 选择框图标的字体大小
"selectIconFontSize": "14px",
// 日期选择框的高度
"dateHeight": "40px",
// 选择框的边框颜色
"selectBorderColor": "#DCDFE6",
// 输入框的边框颜色
"inputBorderColor": "#DCDFE6",
// 上传区域的边框颜色
"uploadBorderColor": "#DCDFE6",
// 文本域的字体颜色
"textareaFontColor": "#606266",
// 选择框的边框宽度
"selectBorderWidth": "1px",
// 日期选择框的字体颜色
"dateFontColor": "#606266",
// 取消按钮的边框宽度
"btnCancelBorderWidth": "1px",
// 上传区域的边框宽度
"uploadBorderWidth": "1px",
// 文本域的字体大小
"textareaFontSize": "14px",
// 选择框的边框圆角
"selectBorderRadius": "4px",
// 选择框的字体颜色
"selectFontColor": "rgba(10, 10, 10, 1)",
// 保存按钮的边框颜色
"btnSaveBorderColor": "#409EFF",
// 保存按钮的边框宽度
"btnSaveBorderWidth": "0px"
};
} }
} };
export default style;
// 导出 style 对象,以便在其他模块中使用这些样式配置
export default style;style;

@ -1,61 +1,82 @@
// 引入自定义的 storage 模块,用于本地存储操作
import storage from './storage'; import storage from './storage';
// 引入自定义的 menu 模块,用于获取菜单信息
import menu from './menu'; import menu from './menu';
/** /**
* 是否有权限 * 判断用户是否对指定的表格具有特定操作的权限
* @param {*} key * @param {string} tableName - 要检查权限的表格名称
* @param {string} key - 要检查的操作权限例如 '查看', '新增'
* @returns {boolean} - 如果用户具有该权限则返回 true否则返回 false
*/ */
export function isAuth(tableName, key) { export function isAuth(tableName, key) {
// 从本地存储中获取用户角色
let role = storage.get("role"); let role = storage.get("role");
// 如果本地存储中没有角色信息,则默认设置为 '管理员'
if (!role) { if (!role) {
role = '管理员'; role = '管理员';
} }
// 获取所有的菜单列表
let menus = menu.list(); let menus = menu.list();
// 遍历所有角色的菜单信息
for (let i = 0; i < menus.length; i++) { for (let i = 0; i < menus.length; i++) {
if(menus[i].roleName==role){ // 如果当前角色与用户角色匹配
if (menus[i].roleName === role) {
// 遍历该角色的后台菜单
for (let j = 0; j < menus[i].backMenu.length; j++) { for (let j = 0; j < menus[i].backMenu.length; j++) {
// 遍历菜单的子项
for (let k = 0; k < menus[i].backMenu[j].child.length; k++) { for (let k = 0; k < menus[i].backMenu[j].child.length; k++) {
if(tableName==menus[i].backMenu[j].child[k].tableName){ // 如果当前菜单子项的表格名称与传入的表格名称匹配
if (tableName === menus[i].backMenu[j].child[k].tableName) {
// 将该菜单子项的所有按钮操作拼接成字符串
let buttons = menus[i].backMenu[j].child[k].buttons.join(','); let buttons = menus[i].backMenu[j].child[k].buttons.join(',');
return buttons.indexOf(key) !== -1 || false // 判断指定的操作权限是否在按钮操作字符串中
return buttons.indexOf(key)!== -1;
} }
} }
} }
} }
} }
// for(let i=0;i<menus.length;i++){ // 如果没有匹配的权限信息,则返回 false
// if(menus[i].roleName==role){
// for(let j=0;j<menus[i].backMenu.length;j++){
// if(menus[i].backMenu[j].tableName==tableName){
// let buttons = menus[i].backMenu[j].child[0].buttons.join(',');
// return buttons.indexOf(key) !== -1 || false
// }
// }
// }
// }
return false; return false;
} }
/** /**
* * 获取当前时间yyyy-MM-dd hh:mm:ss * 获取当前时间格式为 yyyy-MM-dd hh:mm:ss
* */ * @returns {string} - 当前时间的字符串表示
*/
export function getCurDateTime() { export function getCurDateTime() {
let currentTime = new Date(), // 创建一个 Date 对象表示当前时间
year = currentTime.getFullYear(), let currentTime = new Date();
month = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1, // 获取当前年份
day = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate(), let year = currentTime.getFullYear();
hour = currentTime.getHours(), // 获取当前月份,小于 10 时在前面补 0
minute = currentTime.getMinutes(), let month = currentTime.getMonth() + 1 < 10? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1;
second = currentTime.getSeconds(); // 获取当前日期,小于 10 时在前面补 0
let day = currentTime.getDate() < 10? '0' + currentTime.getDate() : currentTime.getDate();
// 获取当前小时
let hour = currentTime.getHours();
// 获取当前分钟
let minute = currentTime.getMinutes();
// 获取当前秒数
let second = currentTime.getSeconds();
// 拼接成 yyyy-MM-dd hh:mm:ss 格式的字符串并返回
return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second; return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
} }
/** /**
* * 获取当前日期yyyy-MM-dd * 获取当前日期格式为 yyyy-MM-dd
* */ * @returns {string} - 当前日期的字符串表示
*/
export function getCurDate() { export function getCurDate() {
let currentTime = new Date(), // 创建一个 Date 对象表示当前时间
year = currentTime.getFullYear(), let currentTime = new Date();
month = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1, // 获取当前年份
day = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate(); let year = currentTime.getFullYear();
// 获取当前月份,小于 10 时在前面补 0
let month = currentTime.getMonth() + 1 < 10? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1;
// 获取当前日期,小于 10 时在前面补 0
let day = currentTime.getDate() < 10? '0' + currentTime.getDate() : currentTime.getDate();
// 拼接成 yyyy-MM-dd 格式的字符串并返回
return year + "-" + month + "-" + day; return year + "-" + month + "-" + day;
} }

@ -1,53 +1,70 @@
/** /**
* 邮箱 * 验证输入的字符串是否为合法的邮箱地址
* @param {*} s * @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的邮箱地址则返回 true否则返回 false
*/ */
export function isEmail(s) { export function isEmail(s) {
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s) // 使用正则表达式匹配邮箱地址格式
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s);
} }
/** /**
* 手机号码 * 验证输入的字符串是否为合法的手机号码
* @param {*} s * @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的手机号码则返回 true否则返回 false
*/ */
export function isMobile(s) { export function isMobile(s) {
return /^1[0-9]{10}$/.test(s) // 使用正则表达式匹配手机号码格式,以 1 开头,后面跟着 10 位数字
return /^1[0-9]{10}$/.test(s);
} }
/** /**
* 电话号码 * 验证输入的字符串是否为合法的电话号码
* @param {*} s * @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的电话号码则返回 true否则返回 false
*/ */
export function isPhone(s) { export function isPhone(s) {
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s) // 使用正则表达式匹配电话号码格式,可以是 3 到 4 位区号加上 7 到 8 位号码,区号前可以有 -
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s);
} }
/** /**
* URL地址 * 验证输入的字符串是否为合法的 URL 地址
* @param {*} s * @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的 URL 地址则返回 true否则返回 false
*/ */
export function isURL(s) { export function isURL(s) {
return /^http[s]?:\/\/.*/.test(s) // 使用正则表达式匹配 URL 地址格式,以 http 或 https 开头
return /^http[s]?:\/\/.*/.test(s);
} }
/** /**
* 匹配数字可以是小数不可以是负数,可以为空 * 验证输入的字符串是否为合法的数字可以是小数不可以是负数可以为空
* @param {*} s * @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的数字则返回 true否则返回 false
*/ */
export function isNumber(s) { export function isNumber(s) {
// 使用正则表达式匹配数字格式,支持小数和科学计数法,且不能为负数,也可以为空字符串
return /(^-?[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$)|(^$)/.test(s); return /(^-?[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$)|(^$)/.test(s);
} }
/** /**
* 匹配整数可以为空 * 验证输入的字符串是否为合法的整数可以为空
* @param {*} s * @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的整数则返回 true否则返回 false
*/ */
export function isIntNumer(s) { export function isIntNumer(s) {
// 使用正则表达式匹配整数格式,可以是正数、负数或 0也可以为空字符串
return /(^-?\d+$)|(^$)/.test(s); return /(^-?\d+$)|(^$)/.test(s);
} }
/** /**
* 身份证校验 * 验证输入的字符串是否为合法的身份证号码
* @param {string} idcard - 待验证的身份证号码字符串
* @returns {boolean} - 如果字符串是合法的身份证号码则返回 true否则返回 false
*/ */
export function checkIdCard(idcard) { export function checkIdCard(idcard) {
// 使用正则表达式匹配身份证号码格式,支持 15 位、18 位或 17 位数字加 X或 x
const regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; const regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (!regIdCard.test(idcard)) { if (!regIdCard.test(idcard)) {
return false; return false;

@ -1,5 +1,7 @@
<template> <template>
<!-- 组件的根元素 -->
<div> <div>
<!-- 表单组件用于输入回复内容 -->
<el-form <el-form
class="detail-form-content" class="detail-form-content"
ref="ruleForm" ref="ruleForm"
@ -7,21 +9,29 @@
:rules="rules" :rules="rules"
label-width="80px" label-width="80px"
> >
<!-- 聊天内容展示区域 -->
<div class="chat-content"> <div class="chat-content">
<!-- 遍历聊天数据列表 -->
<div v-bind:key="item.id" v-for="item in dataList"> <div v-bind:key="item.id" v-for="item in dataList">
<!-- 如果是用户提问显示在左侧 -->
<div v-if="item.chatIssue" class="left-content"> <div v-if="item.chatIssue" class="left-content">
<el-alert class="text-content" :title="item.chatIssue" :closable="false" type="success"></el-alert> <el-alert class="text-content" :title="item.chatIssue" :closable="false" type="success"></el-alert>
</div> </div>
<!-- 如果是回复内容显示在右侧 -->
<div v-else class="right-content"> <div v-else class="right-content">
<el-alert class="text-content" :title="item.chatReply" :closable="false" type="warning"></el-alert> <el-alert class="text-content" :title="item.chatReply" :closable="false" type="warning"></el-alert>
</div> </div>
<!-- 清除浮动 -->
<div class="clear-float"></div> <div class="clear-float"></div>
</div> </div>
</div> </div>
<!-- 清除浮动 -->
<div class="clear-float"></div> <div class="clear-float"></div>
<!-- 回复输入框 -->
<el-form-item label="回复" prop="chatReply"> <el-form-item label="回复" prop="chatReply">
<el-input v-model="ruleForm.chatReply" placeholder="回复" clearable></el-input> <el-input v-model="ruleForm.chatReply" placeholder="回复" clearable></el-input>
</el-form-item> </el-form-item>
<!-- 操作按钮 -->
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit"></el-button> <el-button type="primary" @click="onSubmit"></el-button>
<el-button @click="back()"></el-button> <el-button @click="back()"></el-button>
@ -29,94 +39,126 @@
</el-form> </el-form>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
// ID
id: "", id: "",
//
ruleForm: {}, ruleForm: {},
//
dataList: [], dataList: [],
//
chatDate: {}, chatDate: {},
//
rules: { rules: {
chatReply: [ chatReply: [
{ required: true, message: "回复内容不能为空", trigger: "blur" } { required: true, message: "回复内容不能为空", trigger: "blur" }
] ]
}, },
//
inter: null inter: null
}; };
}, },
//
props: ["parent"], props: ["parent"],
methods: { methods: {
// //
init(row) { init(row) {
this.chatDate = row //
this.chatDate = row;
// ID
this.id = row.yonghuId; this.id = row.yonghuId;
var that = this; var that = this;
// 5
var inter = setInterval(function () { var inter = setInterval(function () {
that.getList(); that.getList();
},5000) }, 5000);
//
this.inter = inter; this.inter = inter;
}, },
//
getList() { getList() {
//
let params = { let params = {
yonghuId: this.id, yonghuId: this.id
} };
//
this.$http({ this.$http({
url: 'chat/page', url: 'chat/page',
method: "get", method: "get",
params: params params: params
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
// ID
this.ruleForm.yonghuId = this.id; this.ruleForm.yonghuId = this.id;
//
this.dataList = data.data.list; this.dataList = data.data.list;
console.log(this.dataList) console.log(this.dataList);
} else { } else {
//
this.$message.error(data.msg); this.$message.error(data.msg);
} }
}); });
}, },
//
//
onSubmit() { onSubmit() {
//
this.$refs["ruleForm"].validate(valid => { this.$refs["ruleForm"].validate(valid => {
this.ruleForm.replyTime = this.getCurDateTime() //
this.ruleForm.chatTypes = 2 this.ruleForm.replyTime = this.getCurDateTime();
//
this.ruleForm.chatTypes = 2;
if (valid) { if (valid) {
//
this.$http({ this.$http({
url: 'chat/save', url: 'chat/save',
method: "post", method: "post",
data: this.ruleForm data: this.ruleForm
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
//
this.$message({ this.$message({
message: "操作成功", message: "操作成功",
type: "success", type: "success",
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
//
this.getList(); this.getList();
//
this.ruleForm.chatReply = ""; this.ruleForm.chatReply = "";
//
this.chatDate.zhuangtaiTypes = 2 this.chatDate.zhuangtaiTypes = 2;
//
this.$http({ this.$http({
url: 'chat/update', url: 'chat/update',
method: "post", method: "post",
data: this.chatDate data: this.chatDate
}).then(({ data }) => { }).then(({ data }) => {
//
}); });
} }
}); });
} else { } else {
//
this.$message.error(data.msg); this.$message.error(data.msg);
} }
}); });
} }
}); });
}, },
//
//
back() { back() {
//
this.parent.showFlag = false; this.parent.showFlag = false;
//
this.parent.getDataList(); this.parent.getDataList();
//
if (this.inter) { if (this.inter) {
clearInterval(this.inter); clearInterval(this.inter);
} }
@ -124,6 +166,7 @@
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
.chat-content { .chat-content {
margin-left: 80px; margin-left: 80px;
@ -134,19 +177,21 @@
height: 300px; height: 300px;
overflow-y: scroll; overflow-y: scroll;
border: 1px solid #eeeeee; border: 1px solid #eeeeee;
.left-content { .left-content {
float: left; float: left;
margin-bottom: 10px; margin-bottom: 10px;
padding: 10px; padding: 10px;
} }
.right-content { .right-content {
float: right; float: right;
margin-bottom: 10px; margin-bottom: 10px;
padding: 10px; padding: 10px;
} }
} }
.clear-float { .clear-float {
clear: both; clear: both;
} }
</style> </style>

@ -1,8 +1,11 @@
<template> <template>
<!-- 主内容容器 -->
<div class="main-content"> <div class="main-content">
<!-- 列表页 --> <!-- 列表页展示 showFlag false 时显示 -->
<div v-if="!showFlag"> <div v-if="!showFlag">
<!-- 表格内容容器 -->
<div class="table-content"> <div class="table-content">
<!-- Element UI 表格组件用于展示聊天消息列表 -->
<el-table <el-table
:data="dataList" :data="dataList"
empty-text="暂无需要回复的消息" empty-text="暂无需要回复的消息"
@ -10,8 +13,11 @@
v-loading="dataListLoading" v-loading="dataListLoading"
style="width: 100%;" style="width: 100%;"
> >
<!-- 新消息列 -->
<el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column> <el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column>
<!-- 发送时间列 -->
<el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column> <el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column>
<!-- 状态列 -->
<el-table-column <el-table-column
prop="allnode" prop="allnode"
header-align="center" header-align="center"
@ -20,10 +26,13 @@
label="状态" label="状态"
width="150" width="150"
> >
<!-- 自定义状态列内容 -->
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="" :type="scope.row.zhuangtaiTypes==1?'success':'info'">{{scope.row.zhuangtaiValue}}</el-tag> <!-- 根据状态类型显示不同样式的标签 -->
<el-tag v-if="" :type="scope.row.zhuangtaiTypes === 1? 'success' : 'info'">{{ scope.row.zhuangtaiValue }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<!-- 操作列固定在右侧 -->
<el-table-column <el-table-column
fixed="right" fixed="right"
header-align="center" header-align="center"
@ -31,7 +40,9 @@
width="150" width="150"
label="操作" label="操作"
> >
<!-- 自定义操作列内容 -->
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 回复按钮点击调用 addOrUpdateHandler 方法 -->
<el-button <el-button
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@ -41,6 +52,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页组件 -->
<el-pagination <el-pagination
@size-change="sizeChangeHandle" @size-change="sizeChangeHandle"
@current-change="currentChangeHandle" @current-change="currentChangeHandle"
@ -53,43 +65,64 @@
></el-pagination> ></el-pagination>
</div> </div>
</div> </div>
<!-- 添加/修改页面 将父组件的search方法传递给子组件--> <!-- 添加/修改页面 showFlag true 时显示 -->
<add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update> <add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
</div> </div>
</template> </template>
<script> <script>
// /
import AddOrUpdate from "./add-or-update"; import AddOrUpdate from "./add-or-update";
//
import { setInterval, clearInterval } from 'timers'; import { setInterval, clearInterval } from 'timers';
export default { export default {
data() { data() {
return { return {
//
searchForm: {}, searchForm: {},
//
dataList: [], dataList: [],
//
pageIndex: 1, pageIndex: 1,
//
pageSize: 10, pageSize: 10,
//
totalPage: 0, totalPage: 0,
//
dataListLoading: false, dataListLoading: false,
// /
showFlag: false, showFlag: false,
//
dataListSelections: [], dataListSelections: [],
//
inter: null inter: null
}; };
}, },
//
created() { created() {
var that = this; var that = this;
// 5 getDataList
var inter = setInterval(function () { var inter = setInterval(function () {
that.getDataList(); that.getDataList();
}, 5000); }, 5000);
this.inter = inter; this.inter = inter;
}, },
//
destroyed() { destroyed() {
//
clearInterval(this.inter); clearInterval(this.inter);
}, },
//
components: { components: {
AddOrUpdate AddOrUpdate
}, },
methods: { methods: {
//
getDataList() { getDataList() {
//
this.dataListLoading = true; this.dataListLoading = true;
// HTTP
this.$http({ this.$http({
url: 'chat/page', url: 'chat/page',
method: "get", method: "get",
@ -102,29 +135,40 @@
} }
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
//
this.dataList = data.data.list; this.dataList = data.data.list;
//
this.totalPage = data.data.total; this.totalPage = data.data.total;
} else { } else {
//
this.dataList = []; this.dataList = [];
this.totalPage = 0; this.totalPage = 0;
} }
//
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
// //
sizeChangeHandle(val) { sizeChangeHandle(val) {
//
this.pageSize = val; this.pageSize = val;
// 1
this.pageIndex = 1; this.pageIndex = 1;
//
this.getDataList(); this.getDataList();
}, },
// //
currentChangeHandle(val) { currentChangeHandle(val) {
//
this.pageIndex = val; this.pageIndex = val;
//
this.getDataList(); this.getDataList();
}, },
// //
addOrUpdateHandler(row) { addOrUpdateHandler(row) {
// /
this.showFlag = true; this.showFlag = true;
// DOM init
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(row); this.$refs.addOrUpdate.init(row);
}); });
@ -132,7 +176,9 @@
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 部分样式类定义,用于设置表格、按钮等元素的样式 */
.slt { .slt {
margin: 0 !important; margin: 0 !important;
display: flex; display: flex;
@ -152,7 +198,6 @@
} }
} }
.el-button +.el-button { .el-button +.el-button {
margin: 0; margin: 0;
} }
@ -194,6 +239,5 @@
& /deep/.el-button { & /deep/.el-button {
margin: 4px; margin: 4px;
} }
}</style> }
</style>

@ -4,14 +4,7 @@
class="detail-form-content" class="detail-form-content"
ref="ruleForm" ref="ruleForm"
:model="ruleForm" :model="ruleForm"
:rules="rules" :rules=v-model="ruleForm.name"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"
>
<el-row>
<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="名称" prop="name">
<el-input v-model="ruleForm.name"
placeholder="名称" clearable :readonly="ro.name"></el-input> placeholder="名称" clearable :readonly="ro.name"></el-input>
</el-form-item> </el-form-item>
<div v-else> <div v-else>

@ -1,454 +1,184 @@
<template> <template>
<!-- 主内容容器 -->
<div class="main-content"> <div class="main-content">
<!-- 列表页 --> <!-- 列表页展示 showFlag false 时显示 -->
<div v-if="showFlag"> <div v-if="!showFlag">
<el-form :inline="true" :model="searchForm" class="form-content"> <!-- 表格内容容器 -->
<el-row class="ad" :style="{justifyContent:contents.btnAdAllBoxPosition=='1'?'flex-start':contents.btnAdAllBoxPosition=='2'?'center':'flex-end'}">
<el-form-item>
<el-button
v-if="isAuth('config','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('config','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 2"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}<i class="el-icon-plus el-icon--right" /></el-button>
<el-button
v-if="isAuth('config','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('config','删除') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
icon="el-icon-delete"
@click="deleteHandler()"
>{{ contents.btnAdAllFont == 1?'删除':'' }}</el-button>
<el-button
v-if="isAuth('config','删除') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 2 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ contents.btnAdAllFont == 1?'删除':'' }}<i class="el-icon-delete el-icon--right" /></el-button>
<el-button
v-if="isAuth('config','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ contents.btnAdAllFont == 1?'删除':'' }}</el-button>
</el-form-item>
</el-row>
</el-form>
<div class="table-content"> <div class="table-content">
<el-table class="tables" :size="contents.tableSize" :show-header="contents.tableShowHeader" <!-- Element UI 表格组件用于展示聊天消息列表 -->
:header-row-style="headerRowStyle" :header-cell-style="headerCellStyle" <el-table
:border="contents.tableBorder"
:fit="contents.tableFit"
:stripe="contents.tableStripe"
:row-style="rowStyle"
:cell-style="cellStyle"
:style="{width: '100%',fontSize:contents.tableContentFontSize,color:contents.tableContentFontColor}"
v-if="isAuth('config','查看')"
:data="dataList" :data="dataList"
empty-text="暂无需要回复的消息"
border
v-loading="dataListLoading" v-loading="dataListLoading"
@selection-change="selectionChangeHandler"> style="width: 100%;"
<el-table-column v-if="contents.tableSelection" >
type="selection" <!-- 新消息列 -->
<el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column>
<!-- 发送时间列 -->
<el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column>
<!-- 状态列 -->
<el-table-column
prop="allnode"
header-align="center" header-align="center"
align="center" align="center"
width="50"> sortable
</el-table-column> label="状态"
<el-table-column label="索引" v-if="contents.tableIndex" type="index" width="50" /> width="150"
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" >
prop="name" <!-- 自定义状态列内容 -->
header-align="center"
label="名称">
<template slot-scope="scope">
{{scope.row.name}}
</template>
</el-table-column>
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="value"
header-align="center"
width="200"
label="值">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.value"> <!-- 根据状态类型显示不同样式的标签 -->
<img :src="scope.row.value.split(',')[0]" width="100" height="100"> <el-tag v-if="" :type="scope.row.zhuangtaiTypes === 1? 'success' : 'info'">{{ scope.row.zhuangtaiValue }}</el-tag>
</div>
<div v-else></div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="300" :align="contents.tableAlign" <!-- 操作列固定在右侧 -->
<el-table-column
fixed="right"
header-align="center" header-align="center"
label="操作"> align="center"
width="150"
label="操作"
>
<!-- 自定义操作列内容 -->
<template slot-scope="scope"> <template slot-scope="scope">
<el-button v-if="isAuth('config','查看') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button> <!-- 回复按钮点击调用 addOrUpdateHandler 方法 -->
<el-button v-if="isAuth('config','查看') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-tickets el-icon--right" /></el-button> <el-button
<el-button v-if="isAuth('config','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button> type="text"
<el-button v-if="isAuth('config','修改') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="primary" icon="el-icon-edit" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button> icon="el-icon-edit"
<el-button v-if="isAuth('config','修改') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-edit el-icon--right" /></el-button> size="small"
<el-button v-if="isAuth('config','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button> @click="addOrUpdateHandler(scope.row)"
>回复</el-button>
<el-button v-if="isAuth('config','删除') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="danger" icon="el-icon-delete" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('config','删除') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="danger" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-delete el-icon--right" /></el-button>
<el-button v-if="isAuth('config','删除') && contents.tableBtnIcon == 0" type="danger" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页组件 -->
<el-pagination <el-pagination
clsss="pages"
:layout="layouts"
@size-change="sizeChangeHandle" @size-change="sizeChangeHandle"
@current-change="currentChangeHandle" @current-change="currentChangeHandle"
:current-page="pageIndex" :current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]" :page-sizes="[10, 20, 50, 100]"
:page-size="Number(contents.pageEachNum)" :page-size="pageSize"
:total="totalPage" :total="totalPage"
:small="contents.pageStyle" layout="total, sizes, prev, pager, next, jumper"
class="pagination-content" class="pagination-content"
:background="contents.pageBtnBG"
:style="{textAlign:contents.pagePosition==1?'left':contents.pagePosition==2?'center':'right'}"
></el-pagination> ></el-pagination>
</div> </div>
</div> </div>
<!-- 添加/修改页面 将父组件的search方法传递给子组件--> <!-- 添加/修改页面 showFlag true 时显示 -->
<add-or-update v-if="addOrUpdateFlag" :parent="this" ref="addOrUpdate"></add-or-update> <add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
</div> </div>
</template> </template>
<script> <script>
import AddOrUpdate from "./add-or-update.vue"; // /
import styleJs from "../../../utils/style.js"; import AddOrUpdate from "./add-or-update";
//
import { setInterval, clearInterval } from 'timers';
export default { export default {
data() { data() {
return { return {
searchForm: { //
key: "" searchForm: {},
}, //
form:{},
dataList: [], dataList: [],
//
pageIndex: 1, pageIndex: 1,
//
pageSize: 10, pageSize: 10,
//
totalPage: 0, totalPage: 0,
//
dataListLoading: false, dataListLoading: false,
// /
showFlag: false,
//
dataListSelections: [], dataListSelections: [],
showFlag: true, //
sfshVisiable: false, inter: null
shForm: {},
chartVisiable: false,
addOrUpdateFlag:false,
contents:null,
layouts: '',
}; };
}, },
//
created() { created() {
this.contents = styleJs.listStyle(); var that = this;
this.init(); // 5 getDataList
this.getDataList(); var inter = setInterval(function () {
this.contentStyleChange() that.getDataList();
}, }, 5000);
mounted() { this.inter = inter;
},
}, //
filters: { destroyed() {
htmlfilter: function (val) { //
return val.replace(/<[^>]*>/g).replace(/undefined/g,''); clearInterval(this.inter);
} },
}, //
components: { components: {
AddOrUpdate, AddOrUpdate
}, },
methods: { methods: {
contentStyleChange() { //
this.contentSearchStyleChange()
this.contentBtnAdAllStyleChange()
this.contentSearchBtnStyleChange()
this.contentTableBtnStyleChange()
this.contentPageStyleChange()
},
contentSearchStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.form-content .slt .el-input__inner').forEach(el=>{
let textAlign = 'left'
if(this.contents.inputFontPosition == 2) textAlign = 'center'
if(this.contents.inputFontPosition == 3) textAlign = 'right'
el.style.textAlign = textAlign
el.style.height = this.contents.inputHeight
el.style.lineHeight = this.contents.inputHeight
el.style.color = this.contents.inputFontColor
el.style.fontSize = this.contents.inputFontSize
el.style.borderWidth = this.contents.inputBorderWidth
el.style.borderStyle = this.contents.inputBorderStyle
el.style.borderColor = this.contents.inputBorderColor
el.style.borderRadius = this.contents.inputBorderRadius
el.style.backgroundColor = this.contents.inputBgColor
})
if(this.contents.inputTitle) {
document.querySelectorAll('.form-content .slt .el-form-item__label').forEach(el=>{
el.style.color = this.contents.inputTitleColor
el.style.fontSize = this.contents.inputTitleSize
el.style.lineHeight = this.contents.inputHeight
})
}
setTimeout(()=>{
document.querySelectorAll('.form-content .slt .el-input__prefix').forEach(el=>{
el.style.color = this.contents.inputIconColor
el.style.lineHeight = this.contents.inputHeight
})
document.querySelectorAll('.form-content .slt .el-input__suffix').forEach(el=>{
el.style.color = this.contents.inputIconColor
el.style.lineHeight = this.contents.inputHeight
})
document.querySelectorAll('.form-content .slt .el-input__icon').forEach(el=>{
el.style.lineHeight = this.contents.inputHeight
})
},10)
})
},
//
contentSearchBtnStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.form-content .slt .el-button--success').forEach(el=>{
el.style.height = this.contents.searchBtnHeight
el.style.color = this.contents.searchBtnFontColor
el.style.fontSize = this.contents.searchBtnFontSize
el.style.borderWidth = this.contents.searchBtnBorderWidth
el.style.borderStyle = this.contents.searchBtnBorderStyle
el.style.borderColor = this.contents.searchBtnBorderColor
el.style.borderRadius = this.contents.searchBtnBorderRadius
el.style.backgroundColor = this.contents.searchBtnBgColor
})
})
},
//
contentBtnAdAllStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.form-content .ad .el-button--success').forEach(el=>{
el.style.height = this.contents.btnAdAllHeight
el.style.color = this.contents.btnAdAllAddFontColor
el.style.fontSize = this.contents.btnAdAllFontSize
el.style.borderWidth = this.contents.btnAdAllBorderWidth
el.style.borderStyle = this.contents.btnAdAllBorderStyle
el.style.borderColor = this.contents.btnAdAllBorderColor
el.style.borderRadius = this.contents.btnAdAllBorderRadius
el.style.backgroundColor = this.contents.btnAdAllAddBgColor
})
document.querySelectorAll('.form-content .ad .el-button--danger').forEach(el=>{
el.style.height = this.contents.btnAdAllHeight
el.style.color = this.contents.btnAdAllDelFontColor
el.style.fontSize = this.contents.btnAdAllFontSize
el.style.borderWidth = this.contents.btnAdAllBorderWidth
el.style.borderStyle = this.contents.btnAdAllBorderStyle
el.style.borderColor = this.contents.btnAdAllBorderColor
el.style.borderRadius = this.contents.btnAdAllBorderRadius
el.style.backgroundColor = this.contents.btnAdAllDelBgColor
})
document.querySelectorAll('.form-content .ad .el-button--warning').forEach(el=>{
el.style.height = this.contents.btnAdAllHeight
el.style.color = this.contents.btnAdAllWarnFontColor
el.style.fontSize = this.contents.btnAdAllFontSize
el.style.borderWidth = this.contents.btnAdAllBorderWidth
el.style.borderStyle = this.contents.btnAdAllBorderStyle
el.style.borderColor = this.contents.btnAdAllBorderColor
el.style.borderRadius = this.contents.btnAdAllBorderRadius
el.style.backgroundColor = this.contents.btnAdAllWarnBgColor
})
})
},
//
rowStyle({ row, rowIndex}) {
if (rowIndex % 2 == 1) {
if(this.contents.tableStripe) {
return {color:this.contents.tableStripeFontColor}
}
} else {
return ''
}
},
cellStyle({ row, rowIndex}){
if (rowIndex % 2 == 1) {
if(this.contents.tableStripe) {
return {backgroundColor:this.contents.tableStripeBgColor}
}
} else {
return ''
}
},
headerRowStyle({ row, rowIndex}){
return {color: this.contents.tableHeaderFontColor}
},
headerCellStyle({ row, rowIndex}){
return {backgroundColor: this.contents.tableHeaderBgColor}
},
//
contentTableBtnStyleChange(){
// this.$nextTick(()=>{
// setTimeout(()=>{
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--success').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight
// el.style.color = this.contents.tableBtnDetailFontColor
// el.style.fontSize = this.contents.tableBtnFontSize
// el.style.borderWidth = this.contents.tableBtnBorderWidth
// el.style.borderStyle = this.contents.tableBtnBorderStyle
// el.style.borderColor = this.contents.tableBtnBorderColor
// el.style.borderRadius = this.contents.tableBtnBorderRadius
// el.style.backgroundColor = this.contents.tableBtnDetailBgColor
// })
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--primary').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight
// el.style.color = this.contents.tableBtnEditFontColor
// el.style.fontSize = this.contents.tableBtnFontSize
// el.style.borderWidth = this.contents.tableBtnBorderWidth
// el.style.borderStyle = this.contents.tableBtnBorderStyle
// el.style.borderColor = this.contents.tableBtnBorderColor
// el.style.borderRadius = this.contents.tableBtnBorderRadius
// el.style.backgroundColor = this.contents.tableBtnEditBgColor
// })
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--danger').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight
// el.style.color = this.contents.tableBtnDelFontColor
// el.style.fontSize = this.contents.tableBtnFontSize
// el.style.borderWidth = this.contents.tableBtnBorderWidth
// el.style.borderStyle = this.contents.tableBtnBorderStyle
// el.style.borderColor = this.contents.tableBtnBorderColor
// el.style.borderRadius = this.contents.tableBtnBorderRadius
// el.style.backgroundColor = this.contents.tableBtnDelBgColor
// })
// }, 50)
// })
},
//
contentPageStyleChange(){
let arr = []
if(this.contents.pageTotal) arr.push('total')
if(this.contents.pageSizes) arr.push('sizes')
if(this.contents.pagePrevNext){
arr.push('prev')
if(this.contents.pagePager) arr.push('pager')
arr.push('next')
}
if(this.contents.pageJumper) arr.push('jumper')
this.layouts = arr.join()
this.contents.pageEachNum = 10
},
init () {
},
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() { getDataList() {
//
this.dataListLoading = true; this.dataListLoading = true;
let params = { // HTTP
this.$http({
url: 'chat/page',
method: "get",
params: {
page: this.pageIndex, page: this.pageIndex,
limit: this.pageSize, limit: this.pageSize,
sort: 'id', sort: 'id',
zhuangtaiTypes: 1,
chatTypes: 1,
} }
if(this.searchForm.name!='' && this.searchForm.name!=undefined){
params['name'] = '%' + this.searchForm.name + '%'
}
this.$http({
url: "config/page",
method: "get",
params: params
}).then(({ data }) => { }).then(({ data }) => {
if (data && data.code === 0) { if (data && data.code === 0) {
//
this.dataList = data.data.list; this.dataList = data.data.list;
//
this.totalPage = data.data.total; this.totalPage = data.data.total;
} else { } else {
//
this.dataList = []; this.dataList = [];
this.totalPage = 0; this.totalPage = 0;
} }
//
this.dataListLoading = false; this.dataListLoading = false;
}); });
}, },
// //
sizeChangeHandle(val) { sizeChangeHandle(val) {
//
this.pageSize = val; this.pageSize = val;
// 1
this.pageIndex = 1; this.pageIndex = 1;
//
this.getDataList(); this.getDataList();
}, },
// //
currentChangeHandle(val) { currentChangeHandle(val) {
//
this.pageIndex = val; this.pageIndex = val;
//
this.getDataList(); this.getDataList();
}, },
// //
selectionChangeHandler(val) { addOrUpdateHandler(row) {
this.dataListSelections = val; // /
}, this.showFlag = true;
// / // DOM init
addOrUpdateHandler(id,type) {
this.showFlag = false;
this.addOrUpdateFlag = true;
this.crossAddOrUpdateFlag = false;
if(type!='info'){
type = 'else';
}
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id,type); this.$refs.addOrUpdate.init(row);
}); });
},
//
//
download(file){
window.open(`${file}`)
},
//
deleteHandler(id) {
var ids = id
? [Number(id)]
: this.dataListSelections.map(item => {
return Number(item.id);
});
this.$confirm(`确定进行[${id ? "删除" : "批量删除"}]操作?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$http({
url: "config/delete",
method: "post",
data: ids
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.search();
} }
});
} else {
this.$message.error(data.msg);
}
});
});
},
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 部分样式类定义,用于设置表格、按钮等元素的样式 */
.slt { .slt {
margin: 0 !important; margin: 0 !important;
display: flex; display: flex;
@ -468,7 +198,6 @@ export default {
} }
} }
.el-button +.el-button { .el-button +.el-button {
margin: 0; margin: 0;
} }
@ -510,4 +239,5 @@ export default {
& /deep/.el-button { & /deep/.el-button {
margin: 4px; margin: 4px;
} }
}</style> }
</style>

@ -4,15 +4,7 @@
class="detail-form-content" class="detail-form-content"
ref="ruleForm" ref="ruleForm"
:model="ruleForm" :model="ruleForm"
:rules="rules" :rule" clearable :readonly="ro.dicCode"></el-input>
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}">
<el-row>
<input id="updateId" name="id" type="hidden">
<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="字段" prop="dicCode">
<el-input v-model="ruleForm.dicCode"
placeholder="字段" clearable :readonly="ro.dicCode"></el-input>
</el-form-item> </el-form-item>
<div v-else> <div v-else>
<el-form-item class="input" label="字段" prop="dicCode"> <el-form-item class="input" label="字段" prop="dicCode">

@ -1,5 +1,6 @@
<template> <template>
<div class="addEdit-block"> <div class="addEdit-block">
<!-- 使用 Element UI 的表单组件绑定表单数据和验证规则 -->
<el-form <el-form
class="detail-form-content" class="detail-form-content"
ref="ruleForm" ref="ruleForm"
@ -7,10 +8,14 @@
:rules="rules" :rules="rules"
label-width="80px" label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"> :style="{backgroundColor:addEditForm.addEditBoxColor}">
<!-- 使用 Element UI 的行组件 -->
<el-row> <el-row>
<!-- sessionTable 不是 'yisheng' 时显示该列 -->
<el-col :span="12" v-if="sessionTable!='yisheng'"> <el-col :span="12" v-if="sessionTable!='yisheng'">
<!-- type 不是 'info' 时显示该表单域用于选择医生 -->
<el-form-item class="select" v-if="type!='info'" label="医生" prop="yishengId"> <el-form-item class="select" v-if="type!='info'" label="医生" prop="yishengId">
<el-select v-model="ruleForm.yishengId" :disabled="ro.yishengId" filterable placeholder="请选择医生" @change="yishengChange"> <el-select v-model="ruleForm.yishengId" :disabled="ro.yishengId" filterable placeholder="请选择医生" @change="yishengChange">
<!-- 循环渲染医生选项 -->
<el-option <el-option
v-for="(item,index) in yishengOptions" v-for="(item,index) in yishengOptions"
v-bind:key="item.id" v-bind:key="item.id"
@ -22,10 +27,12 @@
</el-col> </el-col>
<el-col :span="12" v-if="sessionTable!='yisheng' "> <el-col :span="12" v-if="sessionTable!='yisheng' ">
<!-- type 不是 'info' 时显示该表单域用于显示医生工号只读 -->
<el-form-item class="input" v-if="type!='info'" label="医生工号" prop="yishengUuidNumber"> <el-form-item class="input" v-if="type!='info'" label="医生工号" prop="yishengUuidNumber">
<el-input v-model="yishengForm.yishengUuidNumber" <el-input v-model="yishengForm.yishengUuidNumber"
placeholder="医生工号" clearable readonly></el-input> placeholder="医生工号" clearable readonly></el-input>
</el-form-item> </el-form-item>
<!-- type 'info' 时显示该表单域用于显示医生工号只读 -->
<div v-else> <div v-else>
<el-form-item class="input" label="医生工号" prop="yishengUuidNumber"> <el-form-item class="input" label="医生工号" prop="yishengUuidNumber">
<el-input v-model="ruleForm.yishengUuidNumber" <el-input v-model="ruleForm.yishengUuidNumber"
@ -33,6 +40,7 @@
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<!-- 以下类似结构的代码块根据不同条件显示和处理不同的表单域用于显示和编辑医生的相关信息 -->
<el-col :span="12" v-if="sessionTable!='yisheng' "> <el-col :span="12" v-if="sessionTable!='yisheng' ">
<el-form-item class="input" v-if="type!='info'" label="医生名称" prop="yishengName"> <el-form-item class="input" v-if="type!='info'" label="医生名称" prop="yishengName">
<el-input v-model="yishengForm.yishengName" <el-input v-model="yishengForm.yishengName"
@ -82,10 +90,13 @@
</div> </div>
</el-col> </el-col>
<el-col :span="24" v-if="sessionTable!='yisheng' "> <el-col :span="24" v-if="sessionTable!='yisheng' ">
<!-- type 不是 'info' ro.yishengPhoto false 时显示该表单域用于上传医生头像 -->
<el-form-item class="upload" v-if="type!='info' &&!ro.yishengPhoto" label="医生头像" prop="yishengPhoto"> <el-form-item class="upload" v-if="type!='info' &&!ro.yishengPhoto" label="医生头像" prop="yishengPhoto">
<!-- 循环显示已上传的头像图片 -->
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in (yishengForm.yishengPhoto || '').split(',')" :src="item" width="100" height="100"> <img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in (yishengForm.yishengPhoto || '').split(',')" :src="item" width="100" height="100">
</el-form-item> </el-form-item>
<div v-else> <div v-else>
<!-- type 'info' ruleForm.yishengPhoto 存在时显示该表单域用于显示医生头像 -->
<el-form-item v-if="ruleForm.yishengPhoto" label="医生头像" prop="yishengPhoto"> <el-form-item v-if="ruleForm.yishengPhoto" label="医生头像" prop="yishengPhoto">
<img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in (ruleForm.yishengPhoto || '').split(',')" :src="item" width="100" height="100"> <img style="margin-right:20px;" v-bind:key="index" v-for="(item,index) in (ruleForm.yishengPhoto || '').split(',')" :src="item" width="100" height="100">
</el-form-item> </el-form-item>
@ -198,6 +209,7 @@
</el-form-item> </el-form-item>
</div> </div>
</el-col> </el-col>
<!-- 隐藏输入框用于存储相关 ID -->
<input id="updateId" name="id" type="hidden"> <input id="updateId" name="id" type="hidden">
<input id="yishengId" name="yishengId" type="hidden"> <input id="yishengId" name="yishengId" type="hidden">
<input id="yonghuId" name="yonghuId" type="hidden"> <input id="yonghuId" name="yonghuId" type="hidden">
@ -268,431 +280,4 @@
</el-col> </el-col>
</el-row> </el-row>
<el-form-item class="btn"> <el-form-item class="btn">
<el-button v-if="type!='info'" type="primary" class="btn-success" @click="onSubmit"></el-button> <!-- type 不是 'info
<el-button v-if="type!='info'" class="btn-close" @click="back()"></el-button>
<el-button v-if="type=='info'" class="btn-close" @click="back()"></el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import styleJs from "../../../utils/style.js";
// url
import { isNumber,isIntNumer,isEmail,isPhone, isMobile,isURL,checkIdCard } from "@/utils/validate";
export default {
data() {
return {
addEditForm:null,
id: '',
type: '',
sessionTable : "",//
role : "",//
userId:"",//id
yishengForm: {},
yonghuForm: {},
ro:{
yishengId: false,
yonghuId: false,
guahaoUuinNumber: false,
guahaoTime: false,
guahaoTypes: false,
guahaoStatusTypes: false,
guahaoYesnoTypes: false,
guahaoYesnoText: false,
},
ruleForm: {
yishengId: '',
yonghuId: '',
guahaoUuinNumber: '',
guahaoTime: '',
guahaoTypes: '',
guahaoStatusTypes: '',
guahaoYesnoTypes: '',
guahaoYesnoText: '',
},
guahaoTypesOptions : [],
guahaoStatusTypesOptions : [],
guahaoYesnoTypesOptions : [],
yishengOptions : [],
yonghuOptions : [],
rules: {
yishengId: [
{ required: true, message: '医生不能为空', trigger: 'blur' },
{ pattern: /^[1-9][0-9]*$/,
message: '只允许输入整数',
trigger: 'blur'
}
],
yonghuId: [
{ required: true, message: '用户不能为空', trigger: 'blur' },
{ pattern: /^[1-9][0-9]*$/,
message: '只允许输入整数',
trigger: 'blur'
}
],
guahaoUuinNumber: [
{ required: true, message: '就诊识别码不能为空', trigger: 'blur' },
{ pattern: /^[1-9][0-9]*$/,
message: '只允许输入整数',
trigger: 'blur'
}
],
guahaoTime: [
{ required: true, message: '挂号时间不能为空', trigger: 'blur' },
],
guahaoTypes: [
{ required: true, message: '时间类型不能为空', trigger: 'blur' },
{ pattern: /^[1-9][0-9]*$/,
message: '只允许输入整数',
trigger: 'blur'
}
],
guahaoStatusTypes: [
{ required: true, message: '挂号状态不能为空', trigger: 'blur' },
{ pattern: /^[1-9][0-9]*$/,
message: '只允许输入整数',
trigger: 'blur'
}
],
guahaoYesnoTypes: [
{ required: true, message: '挂号审核不能为空', trigger: 'blur' },
{ pattern: /^[1-9][0-9]*$/,
message: '只允许输入整数',
trigger: 'blur'
}
],
guahaoYesnoText: [
{ required: true, message: '审核结果不能为空', trigger: 'blur' },
],
}
};
},
props: ["parent"],
computed: {
},
created() {
//
this.sessionTable = this.$storage.get("sessionTable");
this.role = this.$storage.get("role");
this.userId = this.$storage.get("userId");
if (this.role != "管理员"){
}
this.addEditForm = styleJs.addStyle();
this.addEditStyleChange()
this.addEditUploadStyleChange()
//
this.$http({
url:`dictionary/page?page=1&limit=100&sort=&order=&dicCode=guahao_types`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.guahaoTypesOptions = data.data.list;
}
});
this.$http({
url:`dictionary/page?page=1&limit=100&sort=&order=&dicCode=guahao_status_types`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.guahaoStatusTypesOptions = data.data.list;
}
});
this.$http({
url:`dictionary/page?page=1&limit=100&sort=&order=&dicCode=guahao_yesno_types`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.guahaoYesnoTypesOptions = data.data.list;
}
});
this.$http({
url: `yisheng/page?page=1&limit=100`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.yishengOptions = data.data.list;
}
});
this.$http({
url: `yonghu/page?page=1&limit=100`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.yonghuOptions = data.data.list;
}
});
},
mounted() {
},
methods: {
//
download(file){
window.open(`${file}`)
},
//
init(id,type) {
if (id) {
this.id = id;
this.type = type;
}
if(this.type=='info'||this.type=='else'){
this.info(id);
}
//
this.$http({
url:`${this.$storage.get("sessionTable")}/session`,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
var json = data.data;
} else {
this.$message.error(data.msg);
}
});
},
yishengChange(id){
this.$http({
url: `yisheng/info/`+id,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.yishengForm = data.data;
}
});
},
yonghuChange(id){
this.$http({
url: `yonghu/info/`+id,
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.yonghuForm = data.data;
}
});
},
//
info(id) {
let _this =this;
_this.$http({
url: `guahao/info/${id}`,
method: 'get'
}).then(({ data }) => {
if (data && data.code === 0) {
_this.ruleForm = data.data;
_this.yishengChange(data.data.yishengId)
_this.yonghuChange(data.data.yonghuId)
} else {
_this.$message.error(data.msg);
}
});
},
//
onSubmit() {
this.$refs["ruleForm"].validate(valid => {
if (valid) {
this.$http({
url:`guahao/${!this.ruleForm.id ? "save" : "update"}`,
method: "post",
data: this.ruleForm
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.guahaoCrossAddOrUpdateFlag = false;
this.parent.search();
this.parent.contentStyleChange();
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
},
// uuid
getUUID () {
return new Date().getTime();
},
//
back() {
this.parent.showFlag = true;
this.parent.addOrUpdateFlag = false;
this.parent.guahaoCrossAddOrUpdateFlag = false;
this.parent.contentStyleChange();
},
//
addEditStyleChange() {
this.$nextTick(()=>{
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputFontColor
el.style.fontSize = this.addEditForm.inputFontSize
el.style.borderWidth = this.addEditForm.inputBorderWidth
el.style.borderStyle = this.addEditForm.inputBorderStyle
el.style.borderColor = this.addEditForm.inputBorderColor
el.style.borderRadius = this.addEditForm.inputBorderRadius
el.style.backgroundColor = this.addEditForm.inputBgColor
})
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputLableColor
el.style.fontSize = this.addEditForm.inputLableFontSize
})
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectFontColor
el.style.fontSize = this.addEditForm.selectFontSize
el.style.borderWidth = this.addEditForm.selectBorderWidth
el.style.borderStyle = this.addEditForm.selectBorderStyle
el.style.borderColor = this.addEditForm.selectBorderColor
el.style.borderRadius = this.addEditForm.selectBorderRadius
el.style.backgroundColor = this.addEditForm.selectBgColor
})
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectLableColor
el.style.fontSize = this.addEditForm.selectLableFontSize
})
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor
el.style.fontSize = this.addEditForm.selectIconFontSize
})
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateFontColor
el.style.fontSize = this.addEditForm.dateFontSize
el.style.borderWidth = this.addEditForm.dateBorderWidth
el.style.borderStyle = this.addEditForm.dateBorderStyle
el.style.borderColor = this.addEditForm.dateBorderColor
el.style.borderRadius = this.addEditForm.dateBorderRadius
el.style.backgroundColor = this.addEditForm.dateBgColor
})
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateLableColor
el.style.fontSize = this.addEditForm.dateLableFontSize
})
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor
el.style.fontSize = this.addEditForm.dateIconFontSize
el.style.lineHeight = this.addEditForm.dateHeight
})
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px'
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight
el.style.color = this.addEditForm.uploadLableColor
el.style.fontSize = this.addEditForm.uploadLableFontSize
})
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor
el.style.fontSize = this.addEditForm.uploadIconFontSize
el.style.lineHeight = iconLineHeight
el.style.display = 'block'
})
//
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaFontColor
el.style.fontSize = this.addEditForm.textareaFontSize
el.style.borderWidth = this.addEditForm.textareaBorderWidth
el.style.borderStyle = this.addEditForm.textareaBorderStyle
el.style.borderColor = this.addEditForm.textareaBorderColor
el.style.borderRadius = this.addEditForm.textareaBorderRadius
el.style.backgroundColor = this.addEditForm.textareaBgColor
})
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor
el.style.fontSize = this.addEditForm.textareaLableFontSize
})
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth
el.style.height = this.addEditForm.btnSaveHeight
el.style.color = this.addEditForm.btnSaveFontColor
el.style.fontSize = this.addEditForm.btnSaveFontSize
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle
el.style.borderColor = this.addEditForm.btnSaveBorderColor
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius
el.style.backgroundColor = this.addEditForm.btnSaveBgColor
})
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth
el.style.height = this.addEditForm.btnCancelHeight
el.style.color = this.addEditForm.btnCancelFontColor
el.style.fontSize = this.addEditForm.btnCancelFontSize
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle
el.style.borderColor = this.addEditForm.btnCancelBorderColor
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius
el.style.backgroundColor = this.addEditForm.btnCancelBgColor
})
})
},
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
})
},
}
};
</script>
<style lang="scss">
.editor{
height: 500px;
& /deep/ .ql-container {
height: 310px;
}
}
.amap-wrapper {
width: 100%;
height: 500px;
}
.search-box {
position: absolute;
}
.addEdit-block {
margin: -10px;
}
.detail-form-content {
padding: 12px;
}
.btn .el-button {
padding: 0;
}</style>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,701 +1,243 @@
.container { <template>
margin: 0 auto; <!-- -->
width: 980px; <div class="main-content">
} <!-- showFlag false -->
<div v-if="!showFlag">
label { <!-- -->
margin: 0; <div class="table-content">
} <!-- Element UI -->
<el-table
/* 导航栏 */ :data="dataList"
.nav { empty-text="暂无需要回复的消息"
text-align: center; border
} v-loading="dataListLoading"
style="width: 100%;"
.layui-nav * { >
font-size: 18px; <!-- -->
} <el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column>
<!-- -->
/* 轮播图 */ <el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column>
.swiper-item { <!-- -->
width: 100%; <el-table-column
} prop="allnode"
header-align="center"
.layui-carousel-ind li { align="center"
width: 80px; sortable
height: 5px; label="状态"
border-radius: 0; width="150"
} >
<!-- -->
/* 商品推荐标题 */ <template slot-scope="scope">
.recommend-container { <!-- -->
margin-top: 20px; <el-tag v-if="" :type="scope.row.zhuangtaiTypes === 1? 'success' : 'info'">{{ scope.row.zhuangtaiValue }}</el-tag>
} </template>
</el-table-column>
.index-title { <!-- -->
margin: 0 auto; <el-table-column
width: 980px; fixed="right"
text-align: center; header-align="center"
font-size: 42px; align="center"
font-family: "Times New Roman", Times, serif; width="150"
text-transform: uppercase; label="操作"
} >
<!-- -->
.recommend-list { <template slot-scope="scope">
width: 1000px; <!-- addOrUpdateHandler -->
margin: 0 auto; <el-button
height: 360px; type="text"
padding: 0px 0 0 0; icon="el-icon-edit"
} size="small"
@click="addOrUpdateHandler(scope.row)"
.recommend-item { ></el-button>
float: left; </template>
width: 1000px; </el-table-column>
padding: 20px 0 0 0; </el-table>
} <!-- -->
<el-pagination
.recommend-item li { @size-change="sizeChangeHandle"
float: left; @current-change="currentChangeHandle"
width: 218px; :current-page="pageIndex"
position: relative; :page-sizes="[10, 20, 50, 100]"
display: inline; :page-size="pageSize"
margin: 0 15px; :total="totalPage"
} layout="total, sizes, prev, pager, next, jumper"
class="pagination-content"
.recommend-item li a.img { ></el-pagination>
float: left; </div>
width: 218px; </div>
height: 218px; <!-- / showFlag true -->
position: absolute; <add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
left: 0; </div>
top: 0; </template>
background: url(../img/yuan.png) left top no-repeat;
} <script>
// /
.recommend-item li a.wor { import AddOrUpdate from "./add-or-update";
float: left; //
width: 218px; import { setInterval, clearInterval } from 'timers';
height: 30px;
line-height: 30px; export default {
text-align: center; data() {
text-overflow: ellipsis; return {
overflow: hidden; //
white-space: nowrap; searchForm: {},
font-size: 14px; //
color: #000; dataList: [],
display: inline; //
margin: 10px 0 0 0; pageIndex: 1,
} //
pageSize: 10,
/* 首页新闻样式(手风琴) */ //
.news-home-container { totalPage: 0,
padding-top: 20px; //
margin-bottom: 20px; dataListLoading: false,
padding-bottom: 20px; // /
} showFlag: false,
//
.news-home-container .layui-collapse { dataListSelections: [],
border: 0; //
margin: 0 20px; inter: null
} };
},
.news-home-container .layui-colla-item { //
margin-top: 14px; created() {
} var that = this;
// 5 getDataList
.news-home-container .layui-colla-content { var inter = setInterval(function () {
font-size: 16px; that.getDataList();
line-height: 40px; }, 5000);
height: 115px; this.inter = inter;
} },
//
.news-home-container .layui-colla-title { destroyed() {
height: 50px; //
line-height: 50px; clearInterval(this.inter);
font-size: 16px; },
font-weight: 500; //
} components: {
AddOrUpdate
.news-home-container .card-container { },
margin-top: 18px; methods: {
} //
getDataList() {
.news-home-container .layui-card-header { //
height: 50px; this.dataListLoading = true;
line-height: 50px; // HTTP
} this.$http({
url: 'chat/page',
/* 底部导航 */ method: "get",
.nav-bottom { params: {
text-align: center; page: this.pageIndex,
} limit: this.pageSize,
sort: 'id',
/* 底部栏 */ zhuangtaiTypes: 1,
.footer { chatTypes: 1,
margin: 10px; }
text-align: center; }).then(({ data }) => {
} if (data && data.code === 0) {
//
.footer-item { this.dataList = data.data.list;
color: #515151; //
margin-top: 10px; this.totalPage = data.data.total;
} } else {
//
/* 留言 */ this.dataList = [];
.message-container { this.totalPage = 0;
width: 980px; }
margin: 0 auto; //
text-align: center; this.dataListLoading = false;
} });
},
.message-container .message-form { //
margin-top: 20px; sizeChangeHandle(val) {
border-bottom: 1px dotted #888888; //
} this.pageSize = val;
// 1
.message-container .message-list { this.pageIndex = 1;
text-align: left; //
} this.getDataList();
},
//
.message-container .message-list .message-item { currentChangeHandle(val) {
margin-top: 20px; //
border-bottom: 1px solid #EEEEEE; this.pageIndex = val;
} //
this.getDataList();
.message-container .message-list .message-item .username-container { },
font-size: 18px; //
} addOrUpdateHandler(row) {
// /
.message-container .message-list .message-item .username-container .avator { this.showFlag = true;
width: 60px; // DOM init
height: 60px; this.$nextTick(() => {
border-radius: 50%; this.$refs.addOrUpdate.init(row);
} });
}
.message-container .message-list .message-item .content { }
margin: 10px; };
} </script>
.message-container .message-list .message-item .replay { <style lang="scss" scoped>
background: #EEEEEE; /* 部分样式类定义,用于设置表格、按钮等元素的样式 */
margin: 10px; .slt {
padding: 20px; margin: 0 !important;
border-radius: 20px;
}
/* 论坛 */
.forum-container {
width: 980px;
margin: 0 auto;
text-align: center;
}
.forum-container .forum-list {
text-align: left;
margin-top: 20px;
}
.forum-container .forum-list .forum-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
border-bottom: 3px dotted #EEEEEE;
border-top: 3px dotted #EEEEEE;
}
.forum-container .forum-list .forum-item.line {
background: #EEEEEE;
}
.forum-container .forum-list .forum-item .h2 {
font-size: 14px;
}
.forum-container .forum-list .forum-item .create-time {
font-size: 14px;
}
.forum-container {
margin-top: 20px;
}
.forum-container .title {
font-size: 22px;
font-weight: bold;
}
.forum-container .content {
width: 980px;
margin: 0 auto;
text-align: left;
margin-top: 30px;
font-size: 16px;
line-height: 30px;
}
.forum-container .auth-container {
margin-top: 20px;
color: #888888;
border-bottom: 1px dotted #888888;
padding-bottom: 20px;
}
.forum-container .bottom-container {
display: flex;
justify-content: space-between;
width: 980px;
margin: 0 auto;
background: #EEEEEE;
height: 60px;
line-height: 60px;
margin-top: 30px;
}
.forum-container .bottom-container .title {
margin-left: 30px;
font-size: 20px;
color: #515151;
}
.forum-container .bottom-container .btn {
font-size: 20px;
padding: 0 20px;
}
.forum-container .message-list {
text-align: left;
}
.forum-container .message-list .message-item {
margin-top: 20px;
border-bottom: 1px solid #EEEEEE;
}
.forum-container .message-list .message-item .username-container {
font-size: 18px;
}
.forum-container .message-list .message-item .username-container .avator {
width: 60px;
height: 60px;
border-radius: 50%;
}
.forum-container .message-list .message-item .content {
margin: 10px;
}
.forum-container .message-list .message-item .replay {
background: #EEEEEE;
margin: 10px;
padding: 20px;
border-radius: 20px;
}
/* 考试 */
.paper-container {
width: 980px;
margin: 0 auto;
margin-top: 20px;
text-align: center;
}
.paper-container thead {
border-radius: 100px;
}
.paper-container thead tr th {
font-size: 16px;
font-weight: blod;
line-height: 50px;
height: 50px;
text-align: center;
}
.paper-container tbody tr td {
font-size: 16px;
height: 50px;
border-bottom: 5px dotted #EEEEEE;
}
.paper-container tbody tr {
border: 3px dotted #EEEEEE;
}
/* 个人中心 */
.center-container {
width: 980px;
margin: 0 auto;
margin-top: 20px;
text-align: center;
display: flex; display: flex;
margin-bottom: 20px;
}
.center-container .left-container {
border: 2px dotted #EEEEEE;
background: #FFFFFF;
width: 200px;
padding-top: 20px;
height: 600px;
}
.center-container .right-container {
flex: 1;
border: 2px dotted #EEEEEE;
background: #FFFFFF;
text-align: left;
padding: 20px;
padding-top: 40px;
}
/* 购物车 */
.btn-container {
margin-top: 20px;
text-align: right;
margin-bottom: 60px;
border: 2px dotted #EEEEEE;
padding: 20px;
} }
/* 登陆注册 */ .ad {
.login-container { margin: 0 !important;
background: #FFFFFF;
z-index: 9;
position: relative;
width: 480px;
margin: 0 auto;
border-radius: 20px;
margin-top: 100px;
padding-top: 30px;
}
.login-form {
text-align: center;
padding: 20px;
}
.login-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.8;
background-size: 100% 100%;
background-repeat: no-repeat;
}
.login-container .bottom-container {
text-align: center;
color: #888888;
padding: 20px;
}
.login-container .bottom-container a {
margin-left: 10px;
border: 2px dotted #888888;
padding: 10px;
}
/* 确认下单页面 */
.address-table {
border: 3px dotted #EEEEEE;
}
/* 图文列表 */
.data-container {
margin: 20px 0;
text-align: center;
display: flex; display: flex;
flex-direction: column;
} }
.data-container .data-list .data-item { .pages {
padding: 20px; & /deep/ el-pagination__sizes {
text-align: left; & /deep/ el-input__inner {
margin-bottom: 10px; height: 22px;
min-height: 330px; line-height: 22px;
} }
.data-container .data-list .data-item:hover {
padding: 10px;
} }
.data-container .data-list .data-item .cover {
width: 100%;
height: 200px;
object-fit: cover;
border: 1px solid #EEEEEE;
}
.data-container .data-list .data-item .title {
text-align: center;
padding: 10px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.data-container .data-list .data-item .price {
font-size: 20px;
text-align: right;
}
.data-container .data-list .data-item .data {
font-size: 16px;
border: 1px solid #EEEEEE;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.data-container .data-list .data-item .data .item {
width: 40%;
text-align: center;
margin: 10px;
}
.search-container {
border: 0;
font-size: 16px;
width: 980px;
margin: 0 auto;
text-align: left;
margin-top: 10px;
margin-bottom: 10px;
}
/* 数据详情页 */
.data-detail {
width: 980px;
margin: 0 auto;
margin-top: 20px;
text-align: left;
margin-bottom: 20px;
}
.data-detail-breadcrumb {
margin: 10px 0;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.data-detail .title {
font-size: 20px;
font-weight: bold;
border: 3px dotted #EEEEEE;
padding: 10px;
}
.data-detail .count-container {
background: url(../img/seckilling.jpg);
margin-top: 20px;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
}
.data-detail .count-container .text {
font-size: 18px;
font-weight: blod;
}
.data-detail .count-container .number {
padding: 10px;
font-size: 16px;
font-weight: blod;
} }
.data-detail .tool-container { .el-button +.el-button {
display: flex; margin: 0;
justify-content: space-between;
align-items: center;
margin-top: 20px;
font-size: 16px;
font-weight: bolder;
padding: 10px;
}
.data-detail .price {
color: red;
font-size: 16px;
font-weight: bolder;
font-size: 20px;
font-weight: bolder;
}
.data-detail .detail-item {
background: #EEEEEE;
padding: 10px;
display: flex;
align-items: center;
}
.data-detail .desc {
font-size: 16px;
color: #515151;
}
.video-container {
width: 100%;
margin-top: 20px;
}
.num-picker {
display: flex;
align-items: center;
margin-right: 20px;
}
.num-picker button {
border: 0;
font-size: 20px;
}
.num-picker input {
width: 50px;
text-align: center;
height: 40px;
}
.data-add-container{
width: 800px;
margin: 0 auto;
margin-top: 20px;
text-align: left;
margin-bottom: 20px;
background: #FFFFFF;
padding: 20px;
padding-top: 30px;
}
/* 详情页选座 */
.seat-list {
display: flex;
align-items: center;
flex-wrap: wrap;
background: #FFFFFF;
margin: 20px;
border-radius: 20px;
padding: 20px;
font-size: 16px;
}
.seat-item {
width: 10%;
display: flex;
align-items: center;
flex-direction: column;
margin-bottom: 20px;
} }
.seat-icon { .tables {
width: 30px; & /deep/.el-button--success {
height: 30px; height: 30px;
margin-bottom: 10px; color: rgba(88, 179, 81, 1);
} font-size: 12px;
border-width: 1px;
/* banner */ border-style: none none solid none;
.banner { border-color: rgba(88, 179, 81, 1);
width: 100%; border-radius: 0px;
height: 50px; background-color: #fff;
margin-top: 30px;
}
/* 新闻列表 */
.news-container {
text-align: center;
margin: 0 auto;
margin: 40px 0;
}
.news-container .pager {
margin: 20px 0;
}
.news-container .news-list {
width: 980px;
margin: 0 auto;
text-align: left;
}
.news-container .news-list .news-item {
display: flex;
border-bottom: 1px solid #EEEEEE;
padding: 10px;
}
.news-container .news-list .news-item .cover-container {
margin: 0 20px;
}
.news-container .news-list .news-item .cover-container .cover {
width: 200px;
height: 200px;
object-fit: cover;
} }
.news-container .news-list .news-item .detail-container .h2 { & /deep/.el-button--primary {
font-size: 18px; height: 30px;
font-weight: bold; color: rgba(88, 179, 81, 1);
} font-size: 12px;
border-width: 1px;
.news-container .news-list .news-item .detail-container .desc { border-style: none none solid none;
height: 140px; border-color: rgba(88, 179, 81, 1);
padding-top: 20px; border-radius: 0px;
} background-color: #fff;
.news-container .title {
font-size: 22px;
font-weight: bold;
}
.news-container .content {
width: 980px;
margin: 0 auto;
text-align: left;
margin-top: 30px;
font-size: 16px;
line-height: 30px;
}
.news-container .auth-container {
margin-top: 20px;
color: #888888;
border-bottom: 1px dotted #888888;
padding-bottom: 20px;
} }
& /deep/.el-button--danger {
.news-container .bottom-container { height: 30px;
display: flex; color: rgba(88, 179, 81, 1);
justify-content: space-between; font-size: 12px;
width: 980px; border-width: 1px;
margin: 0 auto; border-style: none none solid none;
background: #EEEEEE; border-color: rgba(88, 179, 81, 1);
height: 60px; border-radius: 0px;
line-height: 60px; background-color: #fff;
margin-top: 30px;
} }
.news-container .bottom-container .title { & /deep/.el-button {
margin-left: 30px; margin: 4px;
font-size: 20px;
color: #515151;
} }
.news-container .bottom-container .btn {
font-size: 20px;
padding: 0 20px;
} }
</style>

@ -1,69 +1,85 @@
/** /**
* 邮箱 * 验证输入的字符串是否为有效的邮箱地址
* @param {*} s * @param {*} s - 要验证的字符串预期为邮箱地址
* @returns {boolean} - 如果字符串是有效的邮箱地址返回 true否则返回 false当传入的 s null undefined 直接返回 true
*/ */
function isEmail(s) { function isEmail(s) {
if (s) { if (s) {
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s) // 使用正则表达式匹配邮箱地址的格式
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s);
} }
return true; return true;
} }
/** /**
* 手机号码 * 验证输入的字符串是否为有效的手机号码
* @param {*} s * @param {*} s - 要验证的字符串预期为手机号码
* @returns {boolean} - 如果字符串是有效的手机号码返回 true否则返回 false当传入的 s null undefined 直接返回 true
*/ */
function isMobile(s) { function isMobile(s) {
if (s) { if (s) {
return /^1[0-9]{10}$/.test(s) // 使用正则表达式匹配手机号码的格式(以 1 开头,后面跟着 10 位数字)
return /^1[0-9]{10}$/.test(s);
} }
return true; return true;
} }
/** /**
* 电话号码 * 验证输入的字符串是否为有效的电话号码
* @param {*} s * @param {*} s - 要验证的字符串预期为电话号码
* @returns {boolean} - 如果字符串是有效的电话号码返回 true否则返回 false当传入的 s null undefined 直接返回 true
*/ */
function isPhone(s) { function isPhone(s) {
if (s) { if (s) {
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s) // 使用正则表达式匹配电话号码的格式(可以有 3 到 4 位区号,后面跟着 7 到 8 位号码,区号和号码之间用 - 分隔)
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s);
} }
return true; return true;
} }
/** /**
* URL地址 * 验证输入的字符串是否为有效的 URL 地址
* @param {*} s * @param {*} s - 要验证的字符串预期为 URL 地址
* @returns {boolean} - 如果字符串是有效的 URL 地址返回 true否则返回 false当传入的 s null undefined 直接返回 true
*/ */
function isURL(s) { function isURL(s) {
if (s) { if (s) {
return /^http[s]?:\/\/.*/.test(s) // 使用正则表达式匹配 URL 地址的格式(以 http 或 https 开头)
return /^http[s]?:\/\/.*/.test(s);
} }
return true; return true;
} }
/** /**
* 匹配数字可以是小数不可以是负数,可以为空 * 验证输入的字符串是否为有效的数字可以是小数不能是负数可以为空
* @param {*} s * @param {*} s - 要验证的字符串预期为数字
* @returns {boolean} - 如果字符串是有效的数字符合指定格式返回 true否则返回 false当传入的 s null undefined 直接返回 true
*/ */
function isNumber(s) { function isNumber(s) {
if (s) { if (s) {
// 使用正则表达式匹配数字的格式,包括小数和科学计数法形式,不允许负数
return /(^-?[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$)|(^$)/.test(s); return /(^-?[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$)|(^$)/.test(s);
} }
return true; return true;
} }
/** /**
* 匹配整数可以为空 * 验证输入的字符串是否为有效的整数可以为空
* @param {*} s * @param {*} s - 要验证的字符串预期为整数
* @returns {boolean} - 如果字符串是有效的整数符合指定格式返回 true否则返回 false当传入的 s null undefined 直接返回 true
*/ */
function isIntNumer(s) { function isIntNumer(s) {
if (s) { if (s) {
// 使用正则表达式匹配整数的格式,包括正负整数和空字符串
return /(^-?\d+$)|(^$)/.test(s); return /(^-?\d+$)|(^$)/.test(s);
} }
return true; return true;
} }
/** /**
* 身份证校验 * 验证输入的字符串是否为有效的身份证号码
* @param {string} idcard - 要验证的字符串预期为身份证号码
* @returns {boolean} - 如果字符串是有效的身份证号码符合 15 18 位或 17 位加最后一位为 X x 的格式返回 true否则返回 false当传入的 idcard null undefined 直接返回 true
*/ */
function isIdentity(idcard) { function isIdentity(idcard) {
const regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; const regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
@ -14,6 +15,7 @@
<!-- 通用的css --> <!-- 通用的css -->
<link rel="stylesheet" href="../../css/common.css" /> <link rel="stylesheet" href="../../css/common.css" />
</head> </head>
<!-- 自定义样式部分,设置页面背景、轮播图指示器、按钮样式等 -->
<style> <style>
html::after { html::after {
position: fixed; position: fixed;
@ -28,10 +30,12 @@
background-position: center; background-position: center;
z-index: -1; z-index: -1;
} }
#swiper { #swiper {
overflow: hidden; overflow: hidden;
margin: 0 auto; margin: 0 auto;
} }
#swiper.layui-carousel-ind li { #swiper.layui-carousel-ind li {
width: 20px; width: 20px;
height: 10px; height: 10px;
@ -42,6 +46,7 @@
background-color: #f7f7f7; background-color: #f7f7f7;
box-shadow: 0 0 6px rgba(255, 0, 0,.8); box-shadow: 0 0 6px rgba(255, 0, 0,.8);
} }
#swiper.layui-carousel-ind li.layui-this { #swiper.layui-carousel-ind li.layui-this {
width: 30px; width: 30px;
height: 10px; height: 10px;
@ -51,7 +56,8 @@
border-radius: 6px; border-radius: 6px;
} }
button, button:focus { button,
button:focus {
outline: none; outline: none;
} }
@ -64,32 +70,38 @@
border-style: solid; border-style: solid;
text-align: center; text-align: center;
} }
.data-add-container.add.layui-form-item { .data-add-container.add.layui-form-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.data-add-container.layui-form-pane.layui-form-item[pane].layui-form-label { .data-add-container.layui-form-pane.layui-form-item[pane].layui-form-label {
margin: 0; margin: 0;
position: inherit; position: inherit;
background: transparent; background: transparent;
border: 0; border: 0;
} }
.data-add-container.add.layui-input-block { .data-add-container.add.layui-input-block {
margin: 0; margin: 0;
flex: 1; flex: 1;
} }
.data-add-container.layui-form-pane.layui-form-item[pane].layui-input-inline { .data-add-container.layui-form-pane.layui-form-item[pane].layui-input-inline {
margin: 0; margin: 0;
flex: 1; flex: 1;
display: flex; display: flex;
} }
</style> </style>
<body style="background: #EEEEEE; "> <body style="background: #EEEEEE; ">
<div id="app"> <div id="app">
<!-- 轮播图部分使用Layui的轮播图组件 -->
<div class="layui-carousel" id="swiper" :style='{"boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"0px","borderWidth":"0","width":"100%","borderStyle":"solid"}'> <div class="layui-carousel" id="swiper" :style='{"boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"0px","borderWidth":"0","width":"100%","borderStyle":"solid"}'>
<div carousel-item id="swiper-item"> <div carousel-item id="swiper-item">
<!-- 循环渲染轮播图图片 -->
<div v-for="(item, index) in swiperList" :key="index"> <div v-for="(item, index) in swiperList" :key="index">
<img style="width: 100%; height: 100%; object-fit: cover;" :src="item.img" /> <img style="width: 100%; height: 100%; object-fit: cover;" :src="item.img" />
</div> </div>
@ -97,12 +109,10 @@
</div> </div>
<!-- 轮播图 --> <!-- 轮播图 -->
<!-- 医生信息添加表单容器 -->
<div class="data-add-container sub_borderColor" :style='{"padding":"20px","margin":"30px auto","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"10px","borderWidth":"1px","borderStyle":"solid"}'> <div class="data-add-container sub_borderColor" :style='{"padding":"20px","margin":"30px auto","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"10px","borderWidth":"1px","borderStyle":"solid"}'>
<form class="layui-form layui-form-pane add" lay-filter="myForm"> <form class="layui-form layui-form-pane add" lay-filter="myForm">
0 <!-- 医生工号输入框 -->
<!-- 当前表的 -->
<!-- 唯一uuid -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
医生工号: 医生工号:
@ -112,6 +122,7 @@
v-model="detail.yishengUuidNumber" lay-verify="required" type="text" :readonly="ro.yishengUuidNumber" name="yishengUuidNumber" id="yishengUuidNumber" autocomplete="off"> v-model="detail.yishengUuidNumber" lay-verify="required" type="text" :readonly="ro.yishengUuidNumber" name="yishengUuidNumber" id="yishengUuidNumber" autocomplete="off">
</div> </div>
</div> </div>
<!-- 账户输入框 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
账户: 账户:
@ -121,6 +132,7 @@
v-model="detail.username" type="text" :readonly="ro.username" name="username" id="username" autocomplete="off"> v-model="detail.username" type="text" :readonly="ro.username" name="username" id="username" autocomplete="off">
</div> </div>
</div> </div>
<!-- 医生名称输入框 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
医生名称: 医生名称:
@ -130,6 +142,7 @@
v-model="detail.yishengName" type="text" :readonly="ro.yishengName" name="yishengName" id="yishengName" autocomplete="off"> v-model="detail.yishengName" type="text" :readonly="ro.yishengName" name="yishengName" id="yishengName" autocomplete="off">
</div> </div>
</div> </div>
<!-- 职位选择框 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
职位: 职位:
@ -137,10 +150,12 @@
<div class="layui-input-block"> <div class="layui-input-block">
<select name="zhiweiTypes" id="zhiweiTypes" lay-filter="zhiweiTypes"> <select name="zhiweiTypes" id="zhiweiTypes" lay-filter="zhiweiTypes">
<option value="">请选择</option> <option value="">请选择</option>
<!-- 循环渲染职位选项 -->
<option v-for="(item, index) in zhiweiTypesList" v-bind:key="index" :value="item.codeIndex" :key="item.codeIndex">{{ item.indexName }}</option> <option v-for="(item, index) in zhiweiTypesList" v-bind:key="index" :value="item.codeIndex" :key="item.codeIndex">{{ item.indexName }}</option>
</select> </select>
</div> </div>
</div> </div>
<!-- 职称输入框 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
职称: 职称:
@ -150,322 +165,28 @@
v-model="detail.yishengZhichneg" type="text" :readonly="ro.yishengZhichneg" name="yishengZhichneg" id="yishengZhichneg" autocomplete="off"> v-model="detail.yishengZhichneg" type="text" :readonly="ro.yishengZhichneg" name="yishengZhichneg" id="yishengZhichneg" autocomplete="off">
</div> </div>
</div> </div>
<!-- 医生头像上传部分 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
医生头像: 医生头像:
</label> </label>
<div class="layui-input-block"> <div class="layui-input-block">
<!-- 如果有头像则显示头像图片和隐藏的头像路径输入框 -->
<div v-if="detail.yishengPhoto" style="display: inline-block; margin-right: 10px;"> <div v-if="detail.yishengPhoto" style="display: inline-block; margin-right: 10px;">
<img id="yishengPhotoImg" style="width: 100px; height: 100px; border-radius: 50%; border: 2px solid #EEEEEE;" :src="detail.yishengPhoto"> <img id="yishengPhotoImg" style="width: 100px; height: 100px; border-radius: 50%; border: 2px solid #EEEEEE;" :src="detail.yishengPhoto">
<input type="hidden" :value="detail.yishengPhoto" id="yishengPhoto" name="yishengPhoto" /> <input type="hidden" :value="detail.yishengPhoto" id="yishengPhoto" name="yishengPhoto" />
</div> </div>
<!-- 如果头像可编辑则显示上传按钮 -->
<button v-if="!ro.yishengPhoto" :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"0 10px 0 0","borderColor":"#ccc","color":"#fff","borderRadius":"8px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"44px"}' type="button" class="layui-btn btn-theme main_backgroundColor" id="yishengPhotoUpload"> <button v-if="!ro.yishengPhoto" :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"0 10px 0 0","borderColor":"#ccc","color":"#fff","borderRadius":"8px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"44px"}' type="button" class="layui-btn btn-theme main_backgroundColor" id="yishengPhotoUpload">
<i v-if="true" :style='{"color":"#fff","show":true,"fontSize":"14px"}' class="layui-icon">&#xe67c;</i>上传医生头像 <i v-if="true" :style='{"color":"#fff","show":true,"fontSize":"14px"}' class="layui-icon">&#xe67c;</i>上传医生头像
</button> </button>
</div> </div>
</div> </div>
<!-- 手机号 --> <!-- 联系方式输入框 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
联系方式: 联系方式:
</label> </label>
<div class="layui-input-block"> <div class="layui-input-block">
<input class="layui-input main_borderColor" :style='{"padding":"0 12px","boxShadow":"0 0 0px rgba(160, 67, 26, 1)","backgroundColor":"#fff","color":"rgba(135, 206, 250, 1)","borderRadius":"4px","textAlign":"left","borderWidth":"1px","fontSize":"15px","borderStyle":"solid","height":"40px"}' <input class="layui-input main_borderColor" :style='{"padding":"0 12px","boxShadow":"0 0 0px rgba(160, 67, 26, 1)","backgroundColor":"#fff","color":"rgba(135, 206, 250, 1)","borderRadius":"4px","textAlign":"left","borderWidth":"1px","fontSize":"15px","borderStyle":"solid","height":"40px"}'
v-model="detail.yishengPhone" lay-verify="phone|required" type="text" :readonly="ro.yishengPhone" name="yishengPhone" id="yishengPhone" autocomplete="off"> v-model="detail.yishengPhone" lay-verify="phone|required" type="text" :readonly="ro.yishengPhone" name="yishengPhone"
</div>
</div>
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
挂号须知:
</label>
<div class="layui-input-block">
<input class="layui-input main_borderColor" :style='{"padding":"0 12px","boxShadow":"0 0 0px rgba(160, 67, 26, 1)","backgroundColor":"#fff","color":"rgba(135, 206, 250, 1)","borderRadius":"4px","textAlign":"left","borderWidth":"1px","fontSize":"15px","borderStyle":"solid","height":"40px"}'
v-model="detail.yishengGuahao" type="text" :readonly="ro.yishengGuahao" name="yishengGuahao" id="yishengGuahao" autocomplete="off">
</div>
</div>
<!-- 邮箱 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<label :style='{"width":"110px","borderColor": "rgba(255, 255, 255, 0)","padding":"0 12px 0 0","backgroundColor":"rgba(255, 255, 255, 0)","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
邮箱:
</label>
<div class="layui-input-block">
<input class="layui-input main_borderColor" :style='{"padding":"0 12px","boxShadow":"0 0 0px rgba(160, 67, 26, 1)","backgroundColor":"#fff","color":"rgba(135, 206, 250, 1)","borderRadius":"4px","textAlign":"left","borderWidth":"1px","fontSize":"15px","borderStyle":"solid","height":"40px"}'
v-model="detail.yishengEmail" lay-verify="email|required" type="text" :readonly="ro.yishengEmail" name="yishengEmail" id="yishengEmail" autocomplete="off">
</div>
</div>
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"rgba(255, 255, 255, 0)","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<div class="layui-input-block" style="text-align: right;">
<button :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"0 10px","borderColor":"#ccc","backgroundColor":"rgba(75, 92, 196, 1)","color":"#fff","borderRadius":"8px","borderWidth":"0","width":"25%","fontSize":"14px","borderStyle":"solid","height":"44px"}' class="layui-btn btn-submit" lay-submit lay-filter="thisSubmit">提交</button>
</div>
</div>
</form>
</div>
</div>
<script src="../../layui/layui.js"></script>
<script src="../../js/vue.js"></script>
<!-- 引入element组件库 -->
<script src="../../xznstatic/js/element.min.js"></script>
<!-- 引入element样式 -->
<link rel="stylesheet" href="../../xznstatic/css/element.min.css">
<!-- 组件配置信息 -->
<script src="../../js/config.js"></script>
<!-- 扩展插件配置信息 -->
<script src="../../modules/config.js"></script>
<!-- 工具方法 -->
<script src="../../js/utils.js"></script>
<!-- 校验格式工具类 -->
<script src="../../js/validate.js"></script>
<!-- 地图 -->
<script type="text/javascript" src="../../js/jquery.js"></script>
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=ca04cee7ac952691aa67a131e6f0cee0"></script>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/bootstrap.AMapPositionPicker.js"></script>
<script>
var jquery = $;
var vue = new Vue({
el: '#app',
data: {
// 轮播图
swiperList: [{
img: '../../img/banner.jpg'
}],
dataList: [],
ro:{
yishengUuidNumber: true,
username: false,
password: false,
yishengName: false,
yishengTypes: false,
zhiweiTypes: false,
yishengZhichneg: false,
yishengPhoto: false,
yishengPhone: false,
yishengGuahao: false,
yishengEmail: false,
yishengNewMoney: false,
yishengContent: false,
createTime: false,
},
detail: {
yishengUuidNumber: new Date().getTime(),//数字
username: '',
password: '',
yishengName: '',
yishengTypes: '',//数字
yishengValue: '',//数字对应的值
zhiweiTypes: '',//数字
zhiweiValue: '',//数字对应的值
yishengZhichneg: '',
yishengPhoto: '',
yishengPhone: '',
yishengGuahao: '',
yishengEmail: '',
yishengNewMoney: '',
yishengContent: '',
createTime: '',
},
// 级联表的
// 下拉框
yishengTypesList: [],
zhiweiTypesList: [],
centerMenu: centerMenu
},
updated: function() {
layui.form.render('select', 'myForm');
},
computed: {
},
methods: {
jump(url) {
jump(url)
}
}
})
layui.use(['layer', 'element', 'carousel', 'http', 'jquery', 'form', 'upload', 'laydate','tinymce'], function() {
var layer = layui.layer;
var element = layui.element;
var carousel = layui.carousel;
var http = layui.http;
var jquery = layui.jquery;
var form = layui.form;
var upload = layui.upload;
var laydate = layui.laydate;
var tinymce = layui.tinymce
// 获取轮播图 数据
http.request('config/list', 'get', {
page: 1,
limit: 5
}, function (res) {
if (res.data.list.length > 0) {
let swiperList = [];
res.data.list.forEach(element => {
if(element.value != null){
swiperList.push({
img: element.value
});
}
});
vue.swiperList = swiperList;
vue.$nextTick(() => {
carousel.render({
elem: '#swiper',
width: '100%',
height: '450px',
arrow: 'hover',
anim: 'default',
autoplay: 'true',
interval: '3000',
indicator: 'inside'
});
});
}
});
// 下拉框
// 科室的查询和初始化
yishengTypesSelect();
// 职位的查询和初始化
zhiweiTypesSelect();
// 上传文件
// 医生头像的文件上传
upload.render({
//绑定元素
elem: '#yishengPhotoUpload',
//上传接口
url: http.baseurl + 'file/upload',
// 请求头
headers: {
Token: localStorage.getItem('Token')
},
// 允许上传时校验的文件类型
accept: 'images',
before: function () {
//loading层
var index = layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
// 上传成功
done: function (res) {
console.log(res);
layer.closeAll();
if (res.code == 0) {
layer.msg("上传成功", {
time: 2000,
icon: 6
})
var url = http.baseurl + 'upload/' + res.file;
jquery('#yishengPhoto').val(url);
vue.detail.yishengPhoto = url;
jquery('#yishengPhotoImg').attr('src', url);
} else {
layer.msg(res.msg, {
time: 2000,
icon: 5
})
}
},
//请求异常回调
error: function () {
layer.closeAll();
layer.msg("请求接口异常", {
time: 2000,
icon: 5
})
}
});
// 日期效验规则及格式
dateTimePick();
// 表单效验规则
form.verify({
// 正整数效验规则
integer: [
/^[1-9][0-9]*$/
,'必须是正整数'
]
// 小数效验规则
,double: [
/^[1-9][0-9]{0,5}(\.[0-9]{1,2})?$/
,'最大整数位为6为,小数最大两位'
]
});
// session独取
let table = localStorage.getItem("userTable");
http.request(table+"/session", 'get', {}, function (data) {
// 表单赋值
//form.val("myForm", data.data);
// data = data.data;
for (var key in data) {
vue.detail[table+"Id"] = data.id
}
});
// 提交
form.on('submit(thisSubmit)', function (data) {
data = data.field;
data["Id"]= localStorage.getItem("userid");
// 提交数据
http.requestJson('yisheng' + '/add', 'post', data, function (res) {
layer.msg('提交成功', {
time: 2000,
icon: 6
}, function () {
back();
});
});
return false
});
});
// 日期框初始化
function dateTimePick(){
var myDate = new Date(); //获取当前时间
/*
,change: function(value, date, endDate){
value 得到日期生成的值2017-08-18
date 得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
endDate 得结束的日期时间对象开启范围选择range: true才会返回。对象成员同上。
*/
}
// 科室的查询
function yishengTypesSelect() {
//填充下拉框选项
layui.http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=yisheng_types", "GET", {}, (res) => {
if(res.code == 0){
vue.yishengTypesList = res.data.list;
}
});
}
// 职位的查询
function zhiweiTypesSelect() {
//填充下拉框选项
layui.http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=zhiwei_types", "GET", {}, (res) => {
if(res.code == 0){
vue.zhiweiTypesList = res.data.list;
}
});
}
</script>
</body>
</html>

@ -1,22 +1,25 @@
<!-- 个人中心 -->
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<!-- 设置字符编码为UTF-8 -->
<meta charset="utf-8"> <meta charset="utf-8">
<!-- 设置页面在不同设备上的显示效果 -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<!-- 设置页面标题为个人中心 -->
<title>个人中心</title> <title>个人中心</title>
<!-- 引入Layui的CSS样式文件 -->
<link rel="stylesheet" href="../../layui/css/layui.css"> <link rel="stylesheet" href="../../layui/css/layui.css">
<!-- 引入element样式 --> <!-- 引入Element UI的CSS样式文件 -->
<link rel="stylesheet" href="../../xznstatic/css/element.min.css"> <link rel="stylesheet" href="../../xznstatic/css/element.min.css">
<!-- 样式 --> <!-- 引入自定义样式文件 -->
<link rel="stylesheet" href="../../css/style.css" /> <link rel="stylesheet" href="../../css/style.css" />
<!-- 主题(主要颜色设置) --> <!-- 引入主题样式文件 -->
<link rel="stylesheet" href="../../css/theme.css" /> <link rel="stylesheet" href="../../css/theme.css" />
<!-- 通用的css --> <!-- 引入通用样式文件 -->
<link rel="stylesheet" href="../../css/common.css" /> <link rel="stylesheet" href="../../css/common.css" />
</head> </head>
<style> <style>
/* 设置页面背景样式 */
html::after { html::after {
position: fixed; position: fixed;
top: 0; top: 0;
@ -30,9 +33,11 @@
background-position: center; background-position: center;
z-index: -1; z-index: -1;
} }
/* 设置轮播图容器样式 */
#swiper { #swiper {
overflow: hidden; overflow: hidden;
} }
/* 设置轮播图指示器样式 */
#swiper .layui-carousel-ind li { #swiper .layui-carousel-ind li {
width: 20px; width: 20px;
height: 10px; height: 10px;
@ -43,6 +48,7 @@
background-color: #f7f7f7; background-color: #f7f7f7;
box-shadow: 0 0 6px rgba(255,0,0,.8); box-shadow: 0 0 6px rgba(255,0,0,.8);
} }
/* 设置轮播图当前指示器样式 */
#swiper .layui-carousel-ind li.layui-this { #swiper .layui-carousel-ind li.layui-this {
width: 30px; width: 30px;
height: 10px; height: 10px;
@ -51,7 +57,7 @@
border-color: rgba(0,0,0,.3); border-color: rgba(0,0,0,.3);
border-radius: 6px; border-radius: 6px;
} }
/* 设置标题容器样式 */
.index-title { .index-title {
text-align: center; text-align: center;
box-sizing: border-box; box-sizing: border-box;
@ -61,16 +67,20 @@
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
} }
/* 设置标题文字样式 */
.index-title span { .index-title span {
padding: 0 10px; padding: 0 10px;
line-height: 1.4; line-height: 1.4;
} }
/* 设置个人中心菜单容器样式 */
.center-container .layui-nav-tree { .center-container .layui-nav-tree {
width: 100%; width: 100%;
} }
/* 设置个人中心菜单样式 */
.center-container .layui-nav { .center-container .layui-nav {
position: inherit; position: inherit;
} }
/* 设置个人中心菜单项样式 */
.center-container .layui-nav-tree .layui-nav-item { .center-container .layui-nav-tree .layui-nav-item {
height: 44px; height: 44px;
line-height: 44px; line-height: 44px;
@ -82,10 +92,12 @@
background-color: #fff; background-color: #fff;
text-align: center; text-align: center;
} }
/* 设置个人中心菜单选中条样式 */
.center-container .layui-nav-tree .layui-nav-bar { .center-container .layui-nav-tree .layui-nav-bar {
height: 44px !important; height: 44px !important;
opacity: 0 !important; opacity: 0 !important;
} }
/* 设置个人中心菜单当前选中项样式 */
.center-container .layui-nav-tree .layui-nav-item.layui-this { .center-container .layui-nav-tree .layui-nav-item.layui-this {
font-size: 16px; font-size: 16px;
color: rgba(17, 17, 17, 1); color: rgba(17, 17, 17, 1);
@ -93,6 +105,7 @@
border-style: solid; border-style: solid;
border-radius: 0; border-radius: 0;
} }
/* 设置个人中心菜单项悬停样式 */
.center-container .layui-nav-tree .layui-nav-item:hover { .center-container .layui-nav-tree .layui-nav-item:hover {
font-size: 14px; font-size: 14px;
color: #fff; color: #fff;
@ -100,6 +113,7 @@
border-style: solid; border-style: solid;
border-radius: 0; border-radius: 0;
} }
/* 设置个人中心菜单项链接样式 */
.center-container .layui-nav-tree .layui-nav-item a { .center-container .layui-nav-tree .layui-nav-item a {
line-height: inherit; line-height: inherit;
height: auto; height: auto;
@ -107,18 +121,21 @@
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
} }
/* 设置右侧内容容器样式 */
.right-container { .right-container {
position: relative; position: relative;
} }
/* 设置右侧表单元素样式 */
.right-container .layui-form-item { .right-container .layui-form-item {
display: flex; display: flex;
align-items: center; align-items: center;
} }
/* 设置右侧表单输入框容器样式 */
.right-container .layui-input-block { .right-container .layui-input-block {
margin: 0; margin: 0;
flex: 1; flex: 1;
} }
/* 设置右侧输入框样式 */
.right-container .input .layui-input { .right-container .input .layui-input {
padding: 0 12px; padding: 0 12px;
height: 40px; height: 40px;
@ -129,6 +146,7 @@
background-color: #fff; background-color: #fff;
text-align: left; text-align: left;
} }
/* 设置右侧下拉框样式 */
.right-container .select .layui-input { .right-container .select .layui-input {
padding: 0 12px; padding: 0 12px;
height: 40px; height: 40px;
@ -139,6 +157,7 @@
background-color: #fff; background-color: #fff;
text-align: left; text-align: left;
} }
/* 设置右侧日期输入框样式 */
.right-container .date .layui-input { .right-container .date .layui-input {
padding: 0 12px; padding: 0 12px;
height: 40px; height: 40px;
@ -151,33 +170,50 @@
box-shadow: 0 0 0px rgba(255,0,0,.8); box-shadow: 0 0 0px rgba(255,0,0,.8);
text-align: left; text-align: left;
} }
/* 设置头部动画和样式 */
.header {animation-name: fadeInUp; padding-bottom: 26px;padding-top: 70px;position:relative;border-bottom:1px solid rgba(0,0,0,0.1);margin-bottom:40px;} .header {animation-name: fadeInUp; padding-bottom: 26px;padding-top: 70px;position:relative;border-bottom:1px solid rgba(0,0,0,0.1);margin-bottom:40px;}
/* 设置特定头部样式 */
#plheader{ top: 48px;padding-bottom: 40px;width: 220px;position: relative;height: 70px;border-radius: 3px 3px 0px 0px;padding-top: 40px !important;} #plheader{ top: 48px;padding-bottom: 40px;width: 220px;position: relative;height: 70px;border-radius: 3px 3px 0px 0px;padding-top: 40px !important;}
/* 设置头部标题样式 */
.header p.title {color: #fff;font-size: 25px;margin-bottom: 8px;text-align: left;white-space: nowrap;overflow: hidden;margin-left: 31px;font-weight: bold; padding-bottom: 8px;margin-top: 0px;width: 158px;border-bottom: 1px solid rgba(255, 255, 255, 0.16);letter-spacing:1px;} .header p.title {color: #fff;font-size: 25px;margin-bottom: 8px;text-align: left;white-space: nowrap;overflow: hidden;margin-left: 31px;font-weight: bold; padding-bottom: 8px;margin-top: 0px;width: 158px;border-bottom: 1px solid rgba(255, 255, 255, 0.16);letter-spacing:1px;}
#category {padding-top: 136px;margin-left: 0px;padding-bottom: 30px;width: 205px;float: left;padding-left: 15px;text-align: left;margin-top: -120px;background-color: var(--publicMainColor);border-radius: 0px 0px 3px 3px;} /* 设置头部副标题样式 */
.header p.subtitle {font-family:HELVETICANEUELTPRO-THEX, "微软雅黑";letter-spacing: 1px;font-size: 15px;display: inline-block;padding-top: 0px;color: #ffffff; margin-top: 0px; margin-right:31px;float: right;overflow: hidden;width: 156px;text-align: left;} .header p.subtitle {font-family:HELVETICANEUELTPRO-THEX, "微软雅黑";letter-spacing: 1px;font-size: 15px;display: inline-block;padding-top: 0px;color: #ffffff; margin-top: 0px; margin-right:31px;float: right;overflow: hidden;width: 156px;text-align: left;}
/* 设置分类菜单激活项样式 */
#category a.active::before {display: none;} #category a.active::before {display: none;}
/* 设置分类菜单激活项样式 */
#category a.active::after {display:none;} #category a.active::after {display:none;}
/* 设置分类菜单激活项和悬停样式 */
#category a.active, #category a:hover {background: var(--publicSubColor);color: #FFFFFF;border-color: #838383;transition: 0.3s; transform-origin: bottom;} #category a.active, #category a:hover {background: var(--publicSubColor);color: #FFFFFF;border-color: #838383;transition: 0.3s; transform-origin: bottom;}
/* 设置分类菜单项样式 */
#category li {height:auto;position:relative;float:none; display:block;margin-top:1px;margin-bottom:1px;line-height:43px;border-bottom: 1px solid rgba(255, 255, 255, 0.05);padding-left: 15px;margin-right:16px;transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;} #category li {height:auto;position:relative;float:none; display:block;margin-top:1px;margin-bottom:1px;line-height:43px;border-bottom: 1px solid rgba(255, 255, 255, 0.05);padding-left: 15px;margin-right:16px;transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;}
/* 设置分类菜单最后一项样式 */
#category li:last-child { border-bottom:none;} #category li:last-child { border-bottom:none;}
/* 设置分类菜单链接样式 */
#category a { border:0px; background:none; color:#CFDCF9; font-size:14px; position:relative; padding:0;line-height: 42px;height: 42px;} #category a { border:0px; background:none; color:#CFDCF9; font-size:14px; position:relative; padding:0;line-height: 42px;height: 42px;}
/* 设置分类菜单链接前伪元素样式 */
#category a::before { content:''; position:absolute; content: '';position: absolute;width: 190px;background-color: #AEAEAF;height: 42px;background: transparent;left: -16px;position: absolute;transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s; } #category a::before { content:''; position:absolute; content: '';position: absolute;width: 190px;background-color: #AEAEAF;height: 42px;background: transparent;left: -16px;position: absolute;transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s; }
/* 设置分类菜单激活项前伪元素样式 */
#category a.active::before {display: none;} #category a.active::before {display: none;}
/* 设置分类菜单项悬停样式 */
#category li:hover {padding-left:30px;background-color: var(--publicSubColor);transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;} #category li:hover {padding-left:30px;background-color: var(--publicSubColor);transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;}
/* 设置分类菜单特定项样式 */
#category .bbbb, #category li .aaaa {padding-left:30px;background-color: var(--publicSubColor);transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;background: var(--publicSubColor);color: #FFFFFF; transition: 0.3s; transform-origin: bottom;} #category .bbbb, #category li .aaaa {padding-left:30px;background-color: var(--publicSubColor);transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1) 0s;background: var(--publicSubColor);color: #FFFFFF; transition: 0.3s; transform-origin: bottom;}
/* 设置分类菜单项悬停时子项宽度 */
#category li:hover ul li{width: 136px;} #category li:hover ul li{width: 136px;}
/* 设置分类菜单项悬停时子项链接样式 */
#category li:hover ul li a{color: rgba(255, 255, 255, 0.45);width: 136px;overflow: hidden; background-color: rgb(34, 73, 160); padding-left:0px;} #category li:hover ul li a{color: rgba(255, 255, 255, 0.45);width: 136px;overflow: hidden; background-color: rgb(34, 73, 160); padding-left:0px;}
/* 设置分类菜单项悬停时子项链接悬停样式 */
#category li ul li:hover a{ padding-left:0px; margin-left: 0px;} #category li ul li:hover a{ padding-left:0px; margin-left: 0px;}
/* 设置分类菜单项悬停时链接样式 */
#category li:hover a{color:#fff} #category li:hover a{color:#fff}
</style> </style>
<body> <body>
<!-- Vue实例挂载点 -->
<div id="app"> <div id="app">
<!-- 轮播图 --> <!-- 轮播图 -->
<div class="layui-carousel" id="swiper" :style='{"boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"0px","borderWidth":"0","width":"100%","borderStyle":"solid"}'> <div class="layui-carousel" id="swiper" :style='{"boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"0px","borderWidth":"0","width":"100%","borderStyle":"solid"}'>
<div carousel-item> <div carousel-item>
<!-- 循环渲染轮播图图片 -->
<div v-for="(item,index) in swiperList" :key="index"> <div v-for="(item,index) in swiperList" :key="index">
<img style="width: 100%;height: 100%;object-fit:cover;" :src="item.img" /> <img style="width: 100%;height: 100%;object-fit:cover;" :src="item.img" />
</div> </div>
@ -190,57 +226,82 @@
<div class="line-container"> <div class="line-container">
<p class="line" style="background: #EEEEEE;"> 个人中心 </p> <p class="line" style="background: #EEEEEE;"> 个人中心 </p>
</div> --> </div> -->
<!-- 标题 --> <!-- 标题 -->
<!-- 个人中心容器 -->
<div class="center-container"> <div class="center-container">
<!-- 个人中心菜单 config.js--> <!-- 个人中心菜单 config.js-->
<div style=" width:auto; margin:-70px 10px 0px auto"> <div style=" width:auto; margin:-70px 10px 0px auto">
<!-- 头部标题部分 -->
<div class="header" id="plheader"> <div class="header" id="plheader">
<!-- 主标题 -->
<p class="title">个人中心</p> <p class="title">个人中心</p>
<!-- 副标题 -->
<p class="subtitle">USER / CENTER</p> <p class="subtitle">USER / CENTER</p>
</div> </div>
<!-- 分类菜单 -->
<ul id="category"> <ul id="category">
<!-- 循环渲染菜单列表 -->
<li v-for="(item,index) in centerMenu" v-bind:key="index" :class="index==0?'bbbb':''"> <li v-for="(item,index) in centerMenu" v-bind:key="index" :class="index==0?'bbbb':''">
<!-- 菜单项链接 -->
<a :href="'javascript:jump(\''+item.url+'\')'" style="color:#FFFFFF;" :class="index==0?'aaaa':''">{{item.name}}</a> <a :href="'javascript:jump(\''+item.url+'\')'" style="color:#FFFFFF;" :class="index==0?'aaaa':''">{{item.name}}</a>
</li> </li>
</ul> </ul>
</div> <!-- 个人中心菜单 --> </div>
<!-- 个人中心菜单 -->
<!-- 个人中心 --> <!-- 个人中心 -->
<div class="right-container sub_borderColor" :style='{"padding":"20px","boxShadow":"0px rgba(255,0,0,.8)","margin":"0","backgroundColor":"#fff","borderRadius":"0","borderWidth":"1px","borderStyle":"solid"}'> <div class="right-container sub_borderColor" :style='{"padding":"20px","boxShadow":"0px rgba(255,0,0,.8)","margin":"0","backgroundColor":"#fff","borderRadius":"0","borderWidth":"1px","borderStyle":"solid"}'>
<!-- 表单部分 -->
<form class="layui-form"> <form class="layui-form">
<!-- 主键 --> <!-- 隐藏的主键输入框 -->
<input type="hidden" v-model="detail.id" name="id" id="id" /> <input type="hidden" v-model="detail.id" name="id" id="id" />
<!-- 医生工号输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
医生工号 医生工号
</label> </label>
<!-- 输入框容器 -->
<div class="layui-input-block input"> <div class="layui-input-block input">
<!-- 医生工号输入框 -->
<input type="text" v-model="detail.yishengUuidNumber" name="yishengUuidNumber" id="yishengUuidNumber" lay-verify="required" placeholder="医生工号" autocomplete="off" class="layui-input"> <input type="text" v-model="detail.yishengUuidNumber" name="yishengUuidNumber" id="yishengUuidNumber" lay-verify="required" placeholder="医生工号" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<!-- 账户输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
账户 账户
</label> </label>
<!-- 输入框容器 -->
<div class="layui-input-block input"> <div class="layui-input-block input">
<!-- 账户输入框 -->
<input type="text" v-model="detail.username" name="username" id="username" lay-verify="required" placeholder="账户" autocomplete="off" class="layui-input"> <input type="text" v-model="detail.username" name="username" id="username" lay-verify="required" placeholder="账户" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<!-- 医生名称输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
医生名称 医生名称
</label> </label>
<!-- 输入框容器 -->
<div class="layui-input-block input"> <div class="layui-input-block input">
<!-- 医生名称输入框 -->
<input type="text" v-model="detail.yishengName" name="yishengName" id="yishengName" lay-verify="required" placeholder="医生名称" autocomplete="off" class="layui-input"> <input type="text" v-model="detail.yishengName" name="yishengName" id="yishengName" lay-verify="required" placeholder="医生名称" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<!-- 科室选择项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
科室 科室
</label> </label>
<!-- 选择框容器 -->
<div class="layui-input-block select"> <div class="layui-input-block select">
<!-- Element UI的选择框 -->
<el-select v-model="detail.yishengTypes" filterable placeholder="请选择科室 Search111" style="border-color: var(--publicMainColor, #808080);" name="yishengTypes" id="yishengTypes"> <el-select v-model="detail.yishengTypes" filterable placeholder="请选择科室 Search111" style="border-color: var(--publicMainColor, #808080);" name="yishengTypes" id="yishengTypes">
<!-- 循环渲染科室选项 -->
<el-option <el-option
v-for="(item,index) in yishengTypesList" v-for="(item,index) in yishengTypesList"
v-bind:key="item.codeIndex" v-bind:key="item.codeIndex"
@ -250,12 +311,17 @@
</el-select> </el-select>
</div> </div>
</div> </div>
<!-- 职位选择项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
职位 职位
</label> </label>
<!-- 选择框容器 -->
<div class="layui-input-block select"> <div class="layui-input-block select">
<!-- Element UI的选择框 -->
<el-select v-model="detail.zhiweiTypes" filterable placeholder="请选择职位 Search111" style="border-color: var(--publicMainColor, #808080);" name="zhiweiTypes" id="zhiweiTypes"> <el-select v-model="detail.zhiweiTypes" filterable placeholder="请选择职位 Search111" style="border-color: var(--publicMainColor, #808080);" name="zhiweiTypes" id="zhiweiTypes">
<!-- 循环渲染职位选项 -->
<el-option <el-option
v-for="(item,index) in zhiweiTypesList" v-for="(item,index) in zhiweiTypesList"
v-bind:key="item.codeIndex" v-bind:key="item.codeIndex"
@ -265,72 +331,108 @@
</el-select> </el-select>
</div> </div>
</div> </div>
<!-- 职称输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
职称 职称
</label> </label>
<!-- 输入框容器 -->
<div class="layui-input-block input"> <div class="layui-input-block input">
<!-- 职称输入框 -->
<input type="text" v-model="detail.yishengZhichneg" name="yishengZhichneg" id="yishengZhichneg" lay-verify="required" placeholder="职称" autocomplete="off" class="layui-input"> <input type="text" v-model="detail.yishengZhichneg" name="yishengZhichneg" id="yishengZhichneg" lay-verify="required" placeholder="职称" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<!-- 医生头像显示项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 隐藏标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' style="opacity: 0;" class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' style="opacity: 0;" class="layui-form-label">
医生头像 医生头像
</label> </label>
<!-- 头像显示容器 -->
<div class="layui-input-block"> <div class="layui-input-block">
<!-- 医生头像图片 -->
<img id="yishengPhotoImg" style="width: 100px;height: 100px;border-radius: 50%;border: 2px solid #EEEEEE;" :style='{"boxShadow":"0 0 3px rgba(160, 67, 26, 1)","borderColor":"rgba(135, 206, 250, 1)","backgroundColor":"#fff","borderRadius":"10px","borderWidth":"1px","width":"80px","borderStyle":"solid","height":"80px"}' :src="detail.yishengPhoto"> <img id="yishengPhotoImg" style="width: 100px;height: 100px;border-radius: 50%;border: 2px solid #EEEEEE;" :style='{"boxShadow":"0 0 3px rgba(160, 67, 26, 1)","borderColor":"rgba(135, 206, 250, 1)","backgroundColor":"#fff","borderRadius":"10px","borderWidth":"1px","width":"80px","borderStyle":"solid","height":"80px"}' :src="detail.yishengPhoto">
<!-- 隐藏的头像路径输入框 -->
<input type="hidden" v-model="detail.yishengPhoto" id="yishengPhoto" name="yishengPhoto" /> <input type="hidden" v-model="detail.yishengPhoto" id="yishengPhoto" name="yishengPhoto" />
</div> </div>
</div> </div>
<!-- 医生头像上传按钮项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 隐藏标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' style="opacity: 0;" class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' style="opacity: 0;" class="layui-form-label">
医生头像 医生头像
</label> </label>
<!-- 上传按钮容器 -->
<div class="layui-input-block"> <div class="layui-input-block">
<!-- 上传按钮 -->
<button class="main_backgroundColor" :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"0 10px 0 0","borderColor":"#ccc","color":"#fff","borderRadius":"8px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"44px"}' type="button" class="layui-btn btn-theme" <button class="main_backgroundColor" :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"0 10px 0 0","borderColor":"#ccc","color":"#fff","borderRadius":"8px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"44px"}' type="button" class="layui-btn btn-theme"
id="yishengPhotoUpload"> id="yishengPhotoUpload">
<!-- 上传图标 -->
<i v-if="true" :style='{"color":"#fff","show":true,"fontSize":"14px"}' class="layui-icon">&#xe67c;</i>上传医生头像 <i v-if="true" :style='{"color":"#fff","show":true,"fontSize":"14px"}' class="layui-icon">&#xe67c;</i>上传医生头像
</button> </button>
</div> </div>
</div> </div>
<!-- 联系方式输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
联系方式 联系方式
</label> </label>
<!-- 输入框容器 -->
<div class="layui-input-block input"> <div class="layui-input-block input">
<!-- 联系方式输入框 -->
<input type="text" v-model="detail.yishengPhone" name="yishengPhone" id="yishengPhone" lay-verify="required|phone" placeholder="联系方式" autocomplete="off" class="layui-input"> <input type="text" v-model="detail.yishengPhone" name="yishengPhone" id="yishengPhone" lay-verify="required|phone" placeholder="联系方式" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<!-- 挂号须知输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
挂号须知 挂号须知
</label> </label>
<!-- 输入框容器 -->
<div class="layui-input-block input"> <div class="layui-input-block input">
<!-- 挂号须知输入框 -->
<input type="text" v-model="detail.yishengGuahao" name="yishengGuahao" id="yishengGuahao" lay-verify="required" placeholder="挂号须知" autocomplete="off" class="layui-input"> <input type="text" v-model="detail.yishengGuahao" name="yishengGuahao" id="yishengGuahao" lay-verify="required" placeholder="挂号须知" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<!-- 邮箱输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label"> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">
邮箱 邮箱
</label> </label>
<!-- 输入框容器 -->
<div class="layui-input-block input"> <div class="layui-input-block input">
<!-- 邮箱输入框 -->
<input type="text" v-model="detail.yishengEmail" name="yishengEmail" id="yishengEmail" lay-verify="required|email" placeholder="邮箱" autocomplete="off" class="layui-input"> <input type="text" v-model="detail.yishengEmail" name="yishengEmail" id="yishengEmail" lay-verify="required|email" placeholder="邮箱" autocomplete="off" class="layui-input">
</div> </div>
</div> </div>
<!-- 挂号价格输入项 -->
<div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'> <div class="layui-form-item main_borderColor" :style='{"padding":"10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 0 10px 0","backgroundColor":"#fff","borderRadius":"1px","borderWidth":"0 0 1px 0","borderStyle":"solid"}'>
<!-- 标签 -->
<label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">挂号价格</label> <label :style='{"width":"110px","padding":"0 12px 0 0","fontSize":"15px","color":"#333","textAlign":"left"}' class="layui-form-label">挂号价格</label>
<!-- 输入框容器 -->
<div class="layui-input-inline input"> <div class="layui-input-inline input">
<!-- 挂号价格输入框,禁用状态 -->
<input type="number" v-model="detail.yishengNewMoney" name="yishengNewMoney" id="yishengNewMoney" placeholder="挂号价格" autocomplete="off" class="layui-input" disabled="disabled"> <input type="number" v-model="detail.yishengNewMoney" name="yishengNewMoney" id="yishengNewMoney" placeholder="挂号价格" autocomplete="off" class="layui-input" disabled="disabled">
</div> </div>
<!-- 充值提示和链接 -->
<div class="layui-form-mid layui-word-aux"> <div class="layui-form-mid layui-word-aux">
<!-- 提示图标 -->
<i class="layui-icon" style="font-size: 20px;color: red;">&#xe65e;</i> <i class="layui-icon" style="font-size: 20px;color: red;">&#xe65e;</i>
<!-- 充值链接 -->
<a id="btn-recharge" href="javascript:void(0)">点我充值</a> <a id="btn-recharge" href="javascript:void(0)">点我充值</a>
</div> </div>
</div> </div>
<!-- 表单提交和退出登录按钮 -->
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block" style="display: flex;flex-wrap:wrap;"> <div class="layui-input-block" style="display: flex;flex-wrap:wrap;">
<!-- 更新信息按钮 -->
<button class="main_backgroundColor" :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"10px auto 0","borderColor":"#ccc","color":"#fff","borderRadius":"8px","borderWidth":"0","width":"30%","fontSize":"15px","borderStyle":"solid","height":"44px"}' class="layui-btn btn-submit btn-theme" lay-submit lay-filter="*">更新信息</button> <button class="main_backgroundColor" :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"10px auto 0","borderColor":"#ccc","color":"#fff","borderRadius":"8px","borderWidth":"0","width":"30%","fontSize":"15px","borderStyle":"solid","height":"44px"}' class="layui-btn btn-submit btn-theme" lay-submit lay-filter="*">更新信息</button>
<!-- 退出登录按钮 -->
<button :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"10px auto","borderColor":"#ccc","backgroundColor":"rgba(255, 0, 0, 1)","color":"rgba(255, 255, 255, 1)","borderRadius":"8px","borderWidth":"0","width":"30%","fontSize":"14px","borderStyle":"solid","height":"44px"}' @click="logout" class="layui-btn btn-submit">退出登录</button> <button :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.5)","margin":"10px auto","borderColor":"#ccc","backgroundColor":"rgba(255, 0, 0, 1)","color":"rgba(255, 255, 255, 1)","borderRadius":"8px","borderWidth":"0","width":"30%","fontSize":"14px","borderStyle":"solid","height":"44px"}' @click="logout" class="layui-btn btn-submit">退出登录</button>
</div> </div>
</div> </div>
@ -341,27 +443,31 @@
</div> </div>
<!-- layui --> <!-- 引入Layui的JS文件 -->
<script src="../../layui/layui.js"></script> <script src="../../layui/layui.js"></script>
<!-- vue --> <!-- 引入Vue的JS文件 -->
<script src="../../js/vue.js"></script> <script src="../../js/vue.js"></script>
<!-- 引入element组件库 --> <!-- 引入Element UI的JS文件 -->
<script src="../../xznstatic/js/element.min.js"></script> <script src="../../xznstatic/js/element.min.js"></script>
<!-- 组件配置信息 --> <!-- 引入组件配置信息文件 -->
<script src="../../js/config.js"></script> <script src="../../js/config.js"></script>
<!-- 扩展插件配置信息 --> <!-- 引入扩展插件配置信息文件 -->
<script src="../../modules/config.js"></script> <script src="../../modules/config.js"></script>
<!-- 工具方法 --> <!-- 引入工具方法文件 -->
<script src="../../js/utils.js"></script> <script src="../../js/utils.js"></script>
<!-- 校验格式工具类 --> <!-- 引入校验格式工具类文件 -->
<script src="../../js/validate.js"></script> <script src="../../js/validate.js"></script>
<script> <script>
// 创建Vue实例
var vue = new Vue({ var vue = new Vue({
// 挂载点
el: '#app', el: '#app',
// 数据部分
data: { data: {
// 轮播图 // 轮播图数据
swiperList: [], swiperList: [],
// 个人信息详情
detail: { detail: {
yishengUuidNumber: new Date().getTime(),//数字 yishengUuidNumber: new Date().getTime(),//数字
username: '', username: '',
@ -380,18 +486,27 @@
yishengContent: '', yishengContent: '',
createTime: '', createTime: '',
}, },
// 科室列表
yishengTypesList: [], yishengTypesList: [],
// 职位列表
zhiweiTypesList: [], zhiweiTypesList: [],
// 个人中心菜单数据
centerMenu: centerMenu centerMenu: centerMenu
}, },
// 数据更新后的钩子函数
updated: function() { updated: function() {
// 重新渲染表单
// layui.form.render(null, 'myForm'); // layui.form.render(null, 'myForm');
}, },
// 方法部分
methods: { methods: {
// 跳转页面方法
jump(url) { jump(url) {
jump(url) jump(url)
}, },
// 退出登录方法
logout(){ logout(){
// 清除本地存储的登录信息
localStorage.removeItem('Token'); localStorage.removeItem('Token');
localStorage.removeItem('role'); localStorage.removeItem('role');
localStorage.removeItem('sessionTable'); localStorage.removeItem('sessionTable');
@ -399,195 +514,17 @@
localStorage.removeItem('userid'); localStorage.removeItem('userid');
localStorage.removeItem('userTable'); localStorage.removeItem('userTable');
localStorage.removeItem('iframeUrl'); localStorage.removeItem('iframeUrl');
// 跳转到登录页面
window.parent.location.href = '../login/login.html'; window.parent.location.href = '../login/login.html';
} }
} }
}) })
// 使用Layui的模块
layui.use(['layer', 'element', 'carousel', 'http', 'jquery', 'laydate', 'form', 'upload'], function() { layui.use(['layer', 'element', 'carousel', 'http', 'jquery', 'laydate', 'form', 'upload'], function() {
// 获取Layui的模块
var layer = layui.layer; var layer = layui.layer;
var element = layui.element; var element = layui.element;
var carousel = layui.carousel; var carousel = layui.carousel;
var http = layui.http; var http = layui.http;
var jquery = layui.jquery; var jquery = layui.jquery;
var form = layui.form;
var upload = layui.upload;
// 充值
jquery('#btn-recharge').click(function(e) {
layer.open({
type: 2,
title: '用户充值',
area: ['900px', '600px'],
content: '../recharge/recharge.html'
});
});
// 获取轮播图 数据
http.request('config/list', 'get', {
page: 1,
limit: 5
}, function(res) {
if (res.data.list.length > 0) {
let swiperList = [];
res.data.list.forEach(element => {
if (element.value != null) {
swiperList.push({
img: element.value
});
}
});
vue.swiperList = swiperList;
// 轮播图
vue.$nextTick(() => {
carousel.render({
elem: '#swiper',
width: '100%',
height: '450px',
arrow: 'hover',
anim: 'default',
autoplay: 'true',
interval: '3000',
indicator: 'inside'
});
})
}
});
// 查询字典表相关
// 科室的查询和初始化
yishengTypesSelect();
// 职位的查询和初始化
zhiweiTypesSelect();
// 日期效验规则及格式
dateTimePick();
// 表单效验规则
form.verify({
// 正整数效验规则
integer: [
/^[1-9][0-9]*$/
,'必须是正整数'
]
// 小数效验规则
,double: [
/^[0-9]{0,6}(\.[0-9]{1,2})?$/
,'最大整数位为6为,小数最大两位'
]
});
// 上传 文件/图片
// 医生头像的文件上传
var yishengPhotoUpload = upload.render({
//绑定元素
elem: '#yishengPhotoUpload',
//上传接口
url: http.baseurl + 'file/upload',
// 请求头
headers: {
Token: localStorage.getItem('Token')
},
// 允许上传时校验的文件类型
accept: 'images',
before: function() {
//loading层
var index = layer.load(1, {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
},
// 上传成功
done: function(res) {
console.log(res);
layer.closeAll();
if (res.code == 0) {
layer.msg("上传成功", {
time: 2000,
icon: 6
})
var url = http.baseurl + 'upload/' + res.file;
vue.detail.yishengPhoto = url;
} else {
layer.msg(res.msg, {
time: 2000,
icon: 5
})
}
},
//请求异常回调
error: function() {
layer.closeAll();
layer.msg("请求接口异常", {
time: 2000,
icon: 5
})
}
});
// 查询用户信息
let table = localStorage.getItem("userTable");
if(!table){
layer.msg('请先登录', {
time: 2000,
icon: 5
}, function() {
window.parent.location.href = '../login/login.html';
});
}
http.request(`yisheng/session`, 'get', {}, function(data) {
// 表单赋值
// form.val("myForm", data.data);
vue.detail = data.data
// 图片赋值
//jquery("#yishengPhotoImg").attr("src", data.data.yishengPhoto);
});
// 提交表单
form.on('submit(*)', function(data) {
data = vue.detail;
data['createTime']=jquery("#createTime").val();
http.requestJson(table + '/update', 'post', data, function(res) {
layer.msg('修改成功', {
time: 2000,
icon: 6
}, function() {
window.location.reload();
});
});
return false
});
});
// 日期框初始化
function dateTimePick(){
}
//科室的查询
function yishengTypesSelect() {
//填充下拉框选项
layui.http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=yisheng_types", "GET", {}, (res) => {
if(res.code == 0){
vue.yishengTypesList = res.data.list;
}
});
}
//职位的查询
function zhiweiTypesSelect() {
//填充下拉框选项
layui.http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=zhiwei_types", "GET", {}, (res) => {
if(res.code == 0){
vue.zhiweiTypesList = res.data.list;
}
});
}
</script>
</body>
</html>

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dao.YishengDao"> <mapper namespace="com.dao.YishengDao">
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
<!-- 定义了一个 SQL 片段,包含了从数据库表中查询的列,将这些列别名为实体类中的属性名,方便结果映射 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.id as id a.id as id
,a.yisheng_uuid_number as yishengUuidNumber ,a.yisheng_uuid_number as yishengUuidNumber
@ -20,64 +20,77 @@
,a.yisheng_content as yishengContent ,a.yisheng_content as yishengContent
,a.create_time as createTime ,a.create_time as createTime
</sql> </sql>
<!-- 定义一个查询方法id 为 "selectListView",参数类型为 Map返回类型为 com.entity.view.YishengView -->
<select id="selectListView" parameterType="map" resultType="com.entity.view.YishengView"> <select id="selectListView" parameterType="map" resultType="com.entity.view.YishengView">
SELECT SELECT
<!-- 引入上面定义的通用查询结果列 SQL 片段 -->
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
-- 级联表的字段 -- 级联表的字段
FROM yisheng a FROM yisheng a
<!-- 条件查询部分 -->
<where> <where>
<!-- 如果参数中存在 "ids",并且其值不为空,构建 in 条件 -->
<if test="params.ids != null"> <if test="params.ids != null">
and a.id in and a.id in
<foreach item="item" index="index" collection="params.ids" open="(" separator="," close=")"> <foreach item="item" index="index" collection="params.ids" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<!-- 如果参数中 "yishengUuidNumber" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengUuidNumber != '' and params.yishengUuidNumber != null and params.yishengUuidNumber != 'null' "> <if test=" params.yishengUuidNumber != '' and params.yishengUuidNumber != null and params.yishengUuidNumber != 'null' ">
and a.yisheng_uuid_number like CONCAT('%',#{params.yishengUuidNumber},'%') and a.yisheng_uuid_number like CONCAT('%',#{params.yishengUuidNumber},'%')
</if> </if>
<!-- 如果参数中 "username" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.username != '' and params.username != null and params.username != 'null' "> <if test=" params.username != '' and params.username != null and params.username != 'null' ">
and a.username like CONCAT('%',#{params.username},'%') and a.username like CONCAT('%',#{params.username},'%')
</if> </if>
<!-- 如果参数中 "password" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.password != '' and params.password != null and params.password != 'null' "> <if test=" params.password != '' and params.password != null and params.password != 'null' ">
and a.password like CONCAT('%',#{params.password},'%') and a.password like CONCAT('%',#{params.password},'%')
</if> </if>
<!-- 如果参数中 "yishengName" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengName != '' and params.yishengName != null and params.yishengName != 'null' "> <if test=" params.yishengName != '' and params.yishengName != null and params.yishengName != 'null' ">
and a.yisheng_name like CONCAT('%',#{params.yishengName},'%') and a.yisheng_name like CONCAT('%',#{params.yishengName},'%')
</if> </if>
<!-- 如果参数中 "yishengTypes" 不为空且不为空字符串,构建等于条件 -->
<if test="params.yishengTypes != null and params.yishengTypes != ''"> <if test="params.yishengTypes != null and params.yishengTypes != ''">
and a.yisheng_types = #{params.yishengTypes} and a.yisheng_types = #{params.yishengTypes}
</if> </if>
<!-- 如果参数中 "zhiweiTypes" 不为空且不为空字符串,构建等于条件 -->
<if test="params.zhiweiTypes != null and params.zhiweiTypes != ''"> <if test="params.zhiweiTypes != null and params.zhiweiTypes != ''">
and a.zhiwei_types = #{params.zhiweiTypes} and a.zhiwei_types = #{params.zhiweiTypes}
</if> </if>
<!-- 如果参数中 "yishengZhichneg" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengZhichneg != '' and params.yishengZhichneg != null and params.yishengZhichneg != 'null' "> <if test=" params.yishengZhichneg != '' and params.yishengZhichneg != null and params.yishengZhichneg != 'null' ">
and a.yisheng_zhichneg like CONCAT('%',#{params.yishengZhichneg},'%') and a.yisheng_zhichneg like CONCAT('%',#{params.yishengZhichneg},'%')
</if> </if>
<!-- 如果参数中 "yishengPhone" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengPhone != '' and params.yishengPhone != null and params.yishengPhone != 'null' "> <if test=" params.yishengPhone != '' and params.yishengPhone != null and params.yishengPhone != 'null' ">
and a.yisheng_phone like CONCAT('%',#{params.yishengPhone},'%') and a.yisheng_phone like CONCAT('%',#{params.yishengPhone},'%')
</if> </if>
<!-- 如果参数中 "yishengGuahao" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengGuahao != '' and params.yishengGuahao != null and params.yishengGuahao != 'null' "> <if test=" params.yishengGuahao != '' and params.yishengGuahao != null and params.yishengGuahao != 'null' ">
and a.yisheng_guahao like CONCAT('%',#{params.yishengGuahao},'%') and a.yisheng_guahao like CONCAT('%',#{params.yishengGuahao},'%')
</if> </if>
<!-- 如果参数中 "yishengEmail" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengEmail != '' and params.yishengEmail != null and params.yishengEmail != 'null' "> <if test=" params.yishengEmail != '' and params.yishengEmail != null and params.yishengEmail != 'null' ">
and a.yisheng_email like CONCAT('%',#{params.yishengEmail},'%') and a.yisheng_email like CONCAT('%',#{params.yishengEmail},'%')
</if> </if>
<!-- 如果参数中 "yishengNewMoneyStart" 不为空,构建大于等于条件,使用 CDATA 防止特殊字符转义 -->
<if test="params.yishengNewMoneyStart != null "> <if test="params.yishengNewMoneyStart != null ">
<![CDATA[ and a.yisheng_new_money >= #{params.yishengNewMoneyStart} ]]> <![CDATA[ and a.yisheng_new_money >= #{params.yishengNewMoneyStart} ]]>
</if> </if>
<!-- 如果参数中 "yishengNewMoneyEnd" 不为空,构建小于等于条件,使用 CDATA 防止特殊字符转义 -->
<if test="params.yishengNewMoneyEnd != null "> <if test="params.yishengNewMoneyEnd != null ">
<![CDATA[ and a.yisheng_new_money <= #{params.yishengNewMoneyEnd} ]]> <![CDATA[ and a.yisheng_new_money <= #{params.yishengNewMoneyEnd} ]]>
</if> </if>
<!-- 如果参数中 "yishengContent" 不为空字符串、不为 null 且不等于 "null" 字符串,构建模糊查询条件 -->
<if test=" params.yishengContent != '' and params.yishengContent != null and params.yishengContent != 'null' "> <if test=" params.yishengContent != '' and params.yishengContent != null and params.yishengContent != 'null' ">
and a.yisheng_content like CONCAT('%',#{params.yishengContent},'%') and a.yisheng_content like CONCAT('%',#{params.yishengContent},'%')
</if> </if>
</where> </where>
<!-- 根据参数中的 "orderBy" 字段进行降序排序 -->
order by a.${params.orderBy} desc order by a.${params.orderBy} desc
</select> </select>
</mapper> </mapper>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save