网站外部链接,万网个人网站备案查询,宁波外贸公司实力排名,phpcms网站往期回顾 粤嵌实训医疗项目(小组开发)--day05-CSDN博客粤嵌实训医疗项目--day04#xff08;Vue SpringBoot#xff09;-CSDN博客粤嵌实训医疗项目--day03#xff08;Vue SpringBoot#xff09;-CSDN博客粤嵌实训医疗项目day02#xff08;Vue SpringBoot#xff09;-CS… 往期回顾 粤嵌实训医疗项目(小组开发)--day05-CSDN博客粤嵌实训医疗项目--day04Vue SpringBoot-CSDN博客粤嵌实训医疗项目--day03Vue SpringBoot-CSDN博客粤嵌实训医疗项目day02Vue SpringBoot-CSDN博客粤嵌实训医疗项目--day01VueSpringBoot-CSDN博客 目录
一、预约挂号模块
------------前端实现------------
功能一面包屑样式
功能二搜索栏
功能三功能表格获取当前列内的参数
功能四分页显示
------------后端接口------------
功能一通过列表查询所有挂号记录
功能二根据id查找对应的订单
功能三获取病例订单的详细信息
功能四实现撤回效果 一、预约挂号模块 业务需求 ------------前端实现------------
1.创建本次模块对应的视图名称为RegisterList.Vue 2.配置好对应的动态路由
// 配置子路由children: [{path: vaccineType,// -- /Layout/vaccineTypename: vaccineType,component: () import(/type/TypeList)},{path: userInfo,// -- /Layout/vaccineTypename: userInfo,component: () import(/view/UserInfoList)},
// 本次模块使用的路由地址{path:registration,name:registration,component: () import(/view/RegisterList) }]
配置好后就可以开始实现前端样式了 功能一面包屑样式
头部设置导航栏表明当前导航的地址。
在element官网中找到如下案例 修改代码后如下 div stylebox-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);height: 30px; padding-top: 1%;el-breadcrumb separator/el-breadcrumb-item :to{ path: / }首页/el-breadcrumb-itemel-breadcrumb-itema href/医生模块/a/el-breadcrumb-itemel-breadcrumb-item挂号记录查询/el-breadcrumb-item/el-breadcrumb/div 展示 功能二搜索栏
通过搜索预约订单的id查询到对应的订单。
通过element查找对应组件案例有 修改后代码如下: !-- 顶部搜索栏 --div styledisplay: flex; align-items: center; margin-left: 40%; margin-top: 2%;el-input v-modelinput placeholder请输入挂号订单编号快速查询/el-input/div
但是如此还并不足够因为只有一段 空白输入框并没有查询按钮所以还需要在组件仓库中查找按钮。
查找后插入对应代码如下 !-- 顶部搜索栏 --div styledisplay: flex; align-items: center; margin-left: 40%; margin-top: 2%;el-input v-modelinput placeholder请输入挂号订单编号快速查询/el-inputel-button typeprimary iconel-icon-search搜索/el-button/div
展示 前后端交互
通过get方法访问后端实现查询功能目标通过挂号记录的唯一id查看数据库是否存在。
1.引入request工具进行get请求
// 实现根据挂号记录id查询挂号功能queryById(){request// 这里设置功能根据id查询对应的用户.get(/,{params:{id : this.input,}}).then((res){// 将后台数据返回到表单中this.tableData res.list;if(res.flag false){this.$message.error(查询失败);}else{this.$message.success(查询成功);}})}, 功能三功能表格获取当前列内的参数
首先表格的基础功能在于展示数据但是额外需要实现功能有
按钮一实现查询对应挂号的详细病情
按钮二撤销用户的挂号订单注意用户只能撤销自己的挂号
在仓库表格中找到功能性表格 修改一下代码后放入模板中 divstylemargin: 0 auto; width: 63%; box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); margin-top: 2%;!-- 表格展示数据 --el-table :datatableData border stylewidth: 100%el-table-column fixed propid label挂号订单编号 width150/el-table-columnel-table-column propUserName label病号名称 width120/el-table-columnel-table-column propregistration_time label订单时间 width120/el-table-columnel-table-column propstatus label病历单状态 width300/el-table-columnel-table-column propdoctorName label负责医生 width120/el-table-columnel-table-column fixedright label操作 width250 template slot-scopescope!-- 通过按键打开内容 --el-button typeinfo clickcenterDialogVisible true stylewidth: 120px;病情详细信息/el-buttonel-dialog title病例详细描述 :visible.synccenterDialogVisible width30% centerspan丁丁太小/spanspan slotfooter classdialog-footerel-button clickcenterDialogVisible false取 消/el-buttonel-button typeprimary clickcenterDialogVisible false确 定/el-button/span/el-dialog!-- 撤回按钮 --el-popconfirm title你确定要撤回预约挂号记录吗el-button typedanger slotreference disabled撤回/el-button/el-popconfirm/template/el-table-column/el-table/div
对应的数据案例展示 data() {return {tableData: [{id: 1,UserName: 王小虎,registration_time: 2023-10-22,status: 已处理,doctorName: 陈志平,},],centerDialogVisible: false,}}
展示 前后端交互
通过生命周期在创建时候就进行查询所有挂号记录。
设置生命周期 created() {// 在访问网页时候就进行get请求请求所有挂号记录this.query()},
查询所有数据方法
// 查询所有挂号记录功能query(){request// 对应后端路径.get(/,{// 发送分页参数params:{pageNum: this.pageNum,pageSize: this.pageSize,}}).then((res){this.tableData res.list;this.total res.total;})}},
除了一开始就调用query方法进行返回list之外这个组件还需要实现两个功能一个是查看挂号的详细信息一个是撤回医生自己的表单。
1.查看详细信息 // 查询挂号记录中用户的病情openDetails(val) {request.get(/vaccinum/registration/queryDescription, {params: {id: val}}).then((res) {this.description res.description;// this.src res.src;})},2.实现撤回功能
在组件上加入confrim函数意味着当点击是否撤销时候执行函数handleDelete // 进行撤销操作handleDelete(val) {request.get(/vaccinum/registration/remove, {params: {id: val}}).then((res) {if (res.flag false) {this.$message.error(撤回失败);} else {this.$message.success(撤回成功);}this.query();})}, 发送参数:id !-- 撤回按钮 --el-popconfirm title你确定要撤回预约挂号记录吗 confirmhandleDelete(scope.row.id)el-button typedanger slotreference撤回/el-button/el-popconfirm 功能四分页显示
展示的表格不能一次性展示所有数据所以提供分页功能并且需要可以多种页面容量显示。
仓库中找到分页组件 修改对应代码后如下 !-- 分页标签 --div classblockel-pagination size-changehandleSizeChange current-changehandleCurrentChange:current-page.synccurrentPage2 :page-sizes[8, 10, 12] :page-size100layoutsizes, prev, pager, next :total100/el-pagination/div
实现前端分页函数如下 // 分页函数处理handleSizeChange(val) {console.log(val);this.pageSize val;this.query();},handleCurrentChange(val) {console.log(val);this.currentPage val;this.query();},
展示 前端代码
templatedivdiv stylebox-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);height: 30px; padding-top: 1%;el-breadcrumb separator/el-breadcrumb-item :to{ path: / }首页/el-breadcrumb-itemel-breadcrumb-itema href/医生模块/a/el-breadcrumb-itemel-breadcrumb-item挂号记录查询/el-breadcrumb-item/el-breadcrumb/div!-- 顶部搜索栏 --div styledisplay: flex; align-items: center; margin-left: 40%; margin-top: 2%;el-input placeholder请输入内容 v-modelinput clearable inputhandleInput/el-inputel-button typeprimary iconel-icon-search clickqueryById搜索/el-button/divdivstylemargin: 0 auto; width: 63%; box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); margin-top: 2%;!-- 表格展示数据 --el-table :datatableData border stylewidth: 100%el-table-column fixed propid label挂号订单编号 width150/el-table-columnel-table-column propuserName label病号名称 width120/el-table-columnel-table-column propregistration_time label订单时间 width120/el-table-columnel-table-column propstatus label病历单状态 width300/el-table-columnel-table-column propdoctorName label负责医生 width120/el-table-columnel-table-column fixedright label操作 width250template slot-scopescope!-- 通过按键打开内容 --el-button typeinfo click centerDialogVisible true; openDetails(scope.row.id)stylewidth: 120px;病情详细信息/el-buttonel-dialog title病例详细描述 :visible.synccenterDialogVisible width30% center :modalfalsediv classblockspan classdemonstration styletext-align: center;病情图片展示/spanel-image :srcsrc/el-image/divspan病情详细描述{{ description }}/spanspan slotfooter classdialog-footerel-button clickcenterDialogVisible false取 消/el-buttonel-button typeprimary clickcenterDialogVisible false确 定/el-button/span/el-dialog!-- 撤回按钮 --el-popconfirm title你确定要撤回预约挂号记录吗 confirmhandleDelete(scope.row.id)el-button typedanger slotreference撤回/el-button/el-popconfirm/template/el-table-column/el-table/div!-- 分页标签 --div classblockel-pagination size-changehandleSizeChange current-changehandleCurrentChange:current-page.synccurrentPage2 :page-sizes[8, 10, 12] :page-sizepageSizelayoutsizes, prev, pager, next :totaltableData.length/el-pagination/div/div
/template
script
//导入request工具
import request from /utils/request;export default {methods: {// -----------------------------------------------------前后端交互区---------------------handleClick(row) {console.log(row);},// 实现根据挂号记录id查询挂号功能queryById() {request// 这里设置功能根据id查询对应的用户.get(/vaccinum/registration/queryById, {params: {id: this.input,}}).then((res) {// 将后台数据返回到表单中if (res.flag false) {this.$message.error(查询失败,请检查订单号是否存在);} else {this.$message.success(查询成功);this.tableData res.list;}})},// 查询所有挂号记录功能query() {request// 对应后端路径.get(/vaccinum/registration/list, {// 发送分页参数params: {currentPageNum: this.currentPageNum,pageSize: this.pageSize,}}).then((res) {this.tableData res.list;this.total res.total;for (let i 0; i this.tableData.length; i) {this.tableData[i].status this.getStatusText(this.tableData[i].status);}})},// 查询挂号记录中用户的病情openDetails(val) {request.get(/vaccinum/registration/queryDescription, {params: {id: val}}).then((res) {this.description res.description;// this.src res.src;})},// 进行撤销操作handleDelete(val) {request.get(/vaccinum/registration/remove, {params: {id: val}}).then((res) {if (res.flag false) {this.$message.error(撤回失败);} else {this.$message.success(撤回成功);}this.query();})},// ----------------------------------------------------------前端功能区-------------------// 使用聚焦解决无法输入参数的问题handleInput(value) {console.log(输入值, this.input);},// 分页函数处理handleSizeChange(val) {console.log(val);this.pageSize val;this.query();},handleCurrentChange(val) {console.log(val);this.currentPage val;this.query();},// 前端修改status并转为特定的文字显示getStatusText(status) {if (status 0) {return 处理中;} else if (status 1) {return 已处理;} else if (status 2) {return 异常;} else {return 未知状态;}},},// Vue的生命周期周期created() {// 在访问该模块时候就进行get请求请求所有挂号记录this.query()},// Vue 数据存放处data() {return {// 案例数据tableData: [{id: 1,UserName: 王小虎,registration_time: 2023-10-22,status: 已处理,doctorName: 陈志平,},],centerDialogVisible: false,// 存放默认分页currentPageNum: 1,pageSize: 8,// 存放病情描述input: ,// 图片存放处src: https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg,}}
}/script
style
.el-input {width: 25%;
}
/style ------------后端接口------------
功能一通过列表查询所有挂号记录
// TODO:实现查询挂号订单的功能RequestMapping(/list)public String query(RequestParam(defaultValue 1) Integer pageNum,RequestParam(defaultValue 8) Integer pageSize) throws JsonProcessingException {
// 创建结果集并实现分页HashMap map new HashMap();Page page new Page(pageNum,pageSize);
// 获取结果IPageRegistration iPage registrationService.page(page);ListRegistration records iPage.getRecords();ListInfoSummery summeries new ArrayList();//将筛选后的结果放进表格中for (Registration registration : records){summeries.add(new InfoSummery(registration.getUserId(),userServiceservice.getById(registration.getUserId()).getName(),registration.getRegistrationTime(),registration.getStatus(),doctorService.getById(registration.getDoctorId()).getName()));}map.put(list,summeries);map.put(total,iPage.getTotal());return JSon_Tool.writeValueAsString(map);}// 挂号记录的一般信息类Valueprivate static class InfoSummery{Integer id;String UserName;LocalDateTime registration_time;Integer status;String doctorName;} API测试 前端页面展示 功能二根据id查找对应的订单
// TODO:根据id查找对应的订单RequestMapping(/queryById)public String queryById(RequestParam(id) Integer id) throws JsonProcessingException {
// 结果集HashMap map new HashMap();Registration registration;ListInfoSummery summeryList new ArrayList();
// 默认为falsemap.put(flag,false);try {
// 如果触发异常则说明找不到对应idregistration registrationService.getById(id);summeryList.add(new InfoSummery(registration.getId(),userServiceservice.getById(registration.getUserId()).getName(),registration.getRegistrationTime(), registration.getStatus(), doctorService.getById(registration.getDoctorId()).getName()));map.put(list,summeryList);map.put(flag,true);}catch (Exception e){
// 查询失败打印信息e.printStackTrace();}finally {return JSon_Tool.writeValueAsString(map);}}
前端展示
1.正常查询 2.异常查询 功能三获取病例订单的详细信息
// TODO:获取病例订单的详细信息RequestMapping(/queryDescription)public String queryDiscription(RequestParam(id) Integer id) throws JsonProcessingException {HashMap map new HashMap();map.put(flag,false);
// 创建异常拦截try {String description registrationService.getById(id).getDescription();
// 返回病情描述病情图片map.put(description,description);map.put(flag,true);map.put(src,registrationService.getById(id).getDescribeImg());}catch (Exception e){e.printStackTrace();}finally {
// 无论成功与否都返回数据return JSon_Tool.writeValueAsString(map);}} 前端展示 功能四实现撤回效果
// TODO进行挂号记录的撤销操作RequestMapping(/remove)public String handleDelete(RequestParam(id) Integer id) throws JsonProcessingException {HashMap map new HashMap();map.put(flag, false);try {
// 执行删除操作boolean remove registrationService.removeById(id);map.put(flag,remove);}catch (Exception e){}finally {return JSon_Tool.writeValueAsString(map);}} 前端展示
模块代码
RestController
RequestMapping(/vaccinum/registration)
AllArgsConstructor
public class RegistrationController {AutowiredIRegistrationService registrationService;IUserService userServiceservice;IDoctorService doctorService;ObjectMapper JSon_Tool new ObjectMapper();RequestMapping(/insert)public String register(Registration registration) throws JsonProcessingException {HashMap map new HashMap();boolean save registrationService.save(registration);map.put(flag,save);return JSon_Tool.writeValueAsString(map);}// TODO:根据id查找对应的订单RequestMapping(/queryById)public String queryById(RequestParam(id) Integer id) throws JsonProcessingException {
// 结果集HashMap map new HashMap();Registration registration;ListInfoSummery summeryList new ArrayList();
// 默认为falsemap.put(flag,false);try {
// 如果触发异常则说明找不到对应idregistration registrationService.getById(id);summeryList.add(new InfoSummery(registration.getId(),userServiceservice.getById(registration.getUserId()).getName(),registration.getRegistrationTime(), registration.getStatus(), doctorService.getById(registration.getDoctorId()).getName()));map.put(list,summeryList);map.put(flag,true);}catch (Exception e){
// 查询失败打印信息e.printStackTrace();}finally {return JSon_Tool.writeValueAsString(map);}}// TODO:实现查询挂号订单的功能RequestMapping(/list)public String query(RequestParam(defaultValue 1) Integer pageNum,RequestParam(defaultValue 8) Integer pageSize) throws JsonProcessingException {
// 创建结果集并实现分页HashMap map new HashMap();Page page new Page(pageNum,pageSize);
// 获取结果IPageRegistration iPage registrationService.page(page);ListRegistration records iPage.getRecords();ListInfoSummery summeries new ArrayList();//将筛选后的结果放进表格中for (Registration registration : records){summeries.add(new InfoSummery(registration.getId(),userServiceservice.getById(registration.getUserId()).getName(),registration.getRegistrationTime(),registration.getStatus(),doctorService.getById(registration.getDoctorId()).getName()));}map.put(list,summeries);map.put(total,iPage.getTotal());return JSon_Tool.writeValueAsString(map);}// TODO:获取病例订单的详细信息RequestMapping(/queryDescription)public String queryDiscription(RequestParam(id) Integer id) throws JsonProcessingException {HashMap map new HashMap();map.put(flag,false);
// 创建异常拦截try {String description registrationService.getById(id).getDescription();
// 返回病情描述病情图片map.put(description,description);map.put(flag,true);map.put(src,registrationService.getById(id).getDescribeImg());}catch (Exception e){e.printStackTrace();}finally {
// 无论成功与否都返回数据return JSon_Tool.writeValueAsString(map);}}// TODO进行挂号记录的撤销操作RequestMapping(/remove)public String handleDelete(RequestParam(id) Integer id) throws JsonProcessingException {HashMap map new HashMap();map.put(flag, false);try {
// 执行删除操作boolean remove registrationService.removeById(id);map.put(flag,remove);}catch (Exception e){}finally {return JSon_Tool.writeValueAsString(map);}}
// 挂号记录的一般信息类Valueprivate static class InfoSummery{Integer id;String UserName;LocalDateTime registration_time;Integer status;String doctorName;}
} 收获与总结 前端 1.url处理请求地址中如果出现%20,说明你的请求地址可能尾部有空格 2.对话表格组件使用时候如果出现屏幕半黑的情况那么是屏蔽罩没有关闭。 3.通过表格获取当前列的id只需要在scope作用域中获取对应的值即可如scope.row.id 后端 1.在访问数据时候尽量使用异常处理这样访问时候即使非法访问也能得到一个返回结果。 2.mybatis-plus中设置一个实体集的主键应该按照如下操作 /** * 主键 挂号id* */TableId(typeIdType.AUTO)private Integer id; 文章转载自: http://www.morning.zlkps.cn.gov.cn.zlkps.cn http://www.morning.ypjjh.cn.gov.cn.ypjjh.cn http://www.morning.nnjq.cn.gov.cn.nnjq.cn http://www.morning.fqtzn.cn.gov.cn.fqtzn.cn http://www.morning.qwgct.cn.gov.cn.qwgct.cn http://www.morning.dqcpm.cn.gov.cn.dqcpm.cn http://www.morning.bzqnp.cn.gov.cn.bzqnp.cn http://www.morning.srsln.cn.gov.cn.srsln.cn http://www.morning.ytmx.cn.gov.cn.ytmx.cn http://www.morning.blzrj.cn.gov.cn.blzrj.cn http://www.morning.rswtz.cn.gov.cn.rswtz.cn http://www.morning.fxzgw.com.gov.cn.fxzgw.com http://www.morning.hprmg.cn.gov.cn.hprmg.cn http://www.morning.tygn.cn.gov.cn.tygn.cn http://www.morning.tphrx.cn.gov.cn.tphrx.cn http://www.morning.lznqb.cn.gov.cn.lznqb.cn http://www.morning.sqdjn.cn.gov.cn.sqdjn.cn http://www.morning.bgygx.cn.gov.cn.bgygx.cn http://www.morning.bphqd.cn.gov.cn.bphqd.cn http://www.morning.bpmdr.cn.gov.cn.bpmdr.cn http://www.morning.lyldhg.cn.gov.cn.lyldhg.cn http://www.morning.rkdhh.cn.gov.cn.rkdhh.cn http://www.morning.tmjhy.cn.gov.cn.tmjhy.cn http://www.morning.pdwny.cn.gov.cn.pdwny.cn http://www.morning.zrbpx.cn.gov.cn.zrbpx.cn http://www.morning.rswtz.cn.gov.cn.rswtz.cn http://www.morning.jmnfh.cn.gov.cn.jmnfh.cn http://www.morning.zgqysw.cn.gov.cn.zgqysw.cn http://www.morning.nkdmd.cn.gov.cn.nkdmd.cn http://www.morning.ujianji.com.gov.cn.ujianji.com http://www.morning.mlycx.cn.gov.cn.mlycx.cn http://www.morning.rnribht.cn.gov.cn.rnribht.cn http://www.morning.hdtcj.cn.gov.cn.hdtcj.cn http://www.morning.lfgql.cn.gov.cn.lfgql.cn http://www.morning.mlmwl.cn.gov.cn.mlmwl.cn http://www.morning.zztmk.cn.gov.cn.zztmk.cn http://www.morning.mkyxp.cn.gov.cn.mkyxp.cn http://www.morning.fgrcd.cn.gov.cn.fgrcd.cn http://www.morning.wrbx.cn.gov.cn.wrbx.cn http://www.morning.pzjrm.cn.gov.cn.pzjrm.cn http://www.morning.lbgfz.cn.gov.cn.lbgfz.cn http://www.morning.lgmgn.cn.gov.cn.lgmgn.cn http://www.morning.xgxbr.cn.gov.cn.xgxbr.cn http://www.morning.swkpq.cn.gov.cn.swkpq.cn http://www.morning.nqyfm.cn.gov.cn.nqyfm.cn http://www.morning.spwln.cn.gov.cn.spwln.cn http://www.morning.mqbzk.cn.gov.cn.mqbzk.cn http://www.morning.xbmwm.cn.gov.cn.xbmwm.cn http://www.morning.hkshy.cn.gov.cn.hkshy.cn http://www.morning.dsprl.cn.gov.cn.dsprl.cn http://www.morning.ydfr.cn.gov.cn.ydfr.cn http://www.morning.fhbhr.cn.gov.cn.fhbhr.cn http://www.morning.4r5w91.cn.gov.cn.4r5w91.cn http://www.morning.nqpxs.cn.gov.cn.nqpxs.cn http://www.morning.jkcnq.cn.gov.cn.jkcnq.cn http://www.morning.ho-use.cn.gov.cn.ho-use.cn http://www.morning.qbkw.cn.gov.cn.qbkw.cn http://www.morning.fqhbt.cn.gov.cn.fqhbt.cn http://www.morning.gypcr.cn.gov.cn.gypcr.cn http://www.morning.qllcp.cn.gov.cn.qllcp.cn http://www.morning.pjwfs.cn.gov.cn.pjwfs.cn http://www.morning.stmkm.cn.gov.cn.stmkm.cn http://www.morning.zntf.cn.gov.cn.zntf.cn http://www.morning.ylzdx.cn.gov.cn.ylzdx.cn http://www.morning.brlgf.cn.gov.cn.brlgf.cn http://www.morning.qclmz.cn.gov.cn.qclmz.cn http://www.morning.ffmx.cn.gov.cn.ffmx.cn http://www.morning.llllcc.com.gov.cn.llllcc.com http://www.morning.zhnpj.cn.gov.cn.zhnpj.cn http://www.morning.lgtzd.cn.gov.cn.lgtzd.cn http://www.morning.qkqpy.cn.gov.cn.qkqpy.cn http://www.morning.zmyzt.cn.gov.cn.zmyzt.cn http://www.morning.hrgxk.cn.gov.cn.hrgxk.cn http://www.morning.qtbnm.cn.gov.cn.qtbnm.cn http://www.morning.dbcw.cn.gov.cn.dbcw.cn http://www.morning.bcdqf.cn.gov.cn.bcdqf.cn http://www.morning.dmkhd.cn.gov.cn.dmkhd.cn http://www.morning.ybgyz.cn.gov.cn.ybgyz.cn http://www.morning.kjyqr.cn.gov.cn.kjyqr.cn http://www.morning.ybgyz.cn.gov.cn.ybgyz.cn