若依脚手架 创建一个系统 his医院信息管理系统

news2024/9/23 19:19:05

         

  一、创建his-medicine模块

            0) 在创建好的若依后端项目中创建一个maven模块his-medicine

         1)his模块的整合步骤

                ①)his的依赖

                这个是若依项目所有系统模块都需要添加的依赖,domain和controller继承的类就在这里面。

 <!-- 通用工具-->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common</artifactId>
        </dependency>
                ②)安装his模块

               ③)  在ruoyi-admin模块中引入his模块

                        实质上在项目运行时,实际运行的是ruoyi-admin项目,所有其他模块的文件最终都放到此模块下。

          2)实现his的思路

                          his医院信息管理系统的业务对象包括生产厂家、供应商、药品、订单、订单详情等等,要想完成一个his,首先需要把所有的业务对象的增删改查基础代码写出来,单表的增删改查过程可以直接使用代码生成器,但是代码生成器有时候前端会漏写,后端有可能包路径不对,可以尝试自己手动写一个系统对象,熟悉若依的系统框架到底是怎么运行的;

                           然后再考虑复杂的业务场景。

                

二、生产厂家系统:

        1)数据库sql建表语句

drop table if exists his_medicine_factory
CREATE TABLE `his_medicine_factory` (
  `factory_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '厂家ID',
  `factory_name` varchar(100) DEFAULT NULL COMMENT '厂家名称',
  `factory_code` varchar(50) NOT NULL COMMENT '厂家编码',
  `factory_person` varchar(50) NOT NULL COMMENT '厂家联系人',
  `factory_phone` char(11) DEFAULT '00' COMMENT '联系方式',
  `factory_keyword` varchar(50) DEFAULT '' COMMENT '厂家关键字',
  `factory_address` varchar(100) DEFAULT '' COMMENT '厂家地址',
  `status` char(1) DEFAULT '0' COMMENT '(0正常 1 禁用)',
  `create_by` varchar(64) DEFAULT '' COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) DEFAULT '' COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`factory_id`)
	
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8 COMMENT='生产厂家信息表';

        2)单表增删改查的实现

                        写一个生产厂家的管理系统可以对照写好的部门系统SysPost格式,从后端到前端不管是代码的格式还是界面elementplus标签 岗位系统是比较好的参考例子。

                〇)domain

                        通过若依写好的岗位管理系统发现所有实体类都继承了BaseEntity

                        BaseEntity主要用来存放一些公共的属性值,对应的也就是数据库中表中的公共字段

                        那根据数据库创建的实体类MedicineFactory也继承BaseEntity

package com.ruoyi.domain;

import com.ruoyi.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Date;

/**
 * @author rk
 * @description: TODO
 * @date 2024/8/28 19:08
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MedicineFactory extends BaseEntity {
    private Long factoryId;
    private String factoryName;
    private String factoryCode;
    private String factoryPerson;
    private String factoryPhone;

    private String factoryKeyword;

    private String factoryAddress;
    private String status;
    private String createBy;
    private Date createTime;
    private String updateBy;
    private Date updateTime;
    private String remake;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd" )
    private Date endTime;
}
                ①mapper    没有影响 ,照写
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">


<mapper namespace="com.ruoyi.mapper.HisMedicineFactoryMapper">

    <resultMap id="factory" type="com.ruoyi.domain.MedicineFactory">
        <id column="factory_id" property="factoryId"></id>
        <result column="factory_name" property="factoryName"></result>
        <result column="factory_code" property="factoryCode"></result>
        <result column="factory_person" property="factoryPerson"></result>
        <result column="factory_phone" property="factoryPhone"></result>
        <result column="factory_keyword" property="factoryKeyword"></result>
        <result column="factory_address" property="factoryAddress"></result>
        <result column="create_by" property="createBy"></result>
        <result column="create_time" property="createTime"></result>
        <result column="update_by" property="updateBy"></result>
        <result column="update_time" property="updateTime"></result>
        <result column="remark" property="remark"></result>
<!--        <association property="" resultMap=""></association>-->
    </resultMap>

    <sql id="selectFactory">
        select factory_id,factory_name,factory_code,factory_person,
               factory_phone ,factory_keyword,factory_address,create_by,create_time,
               update_by,update_time,remark,status
        from his_medicine_factory
    </sql>

    <select id="selectFactoryList" resultMap="factory">
        <include refid="selectFactory"></include>
        <where>
            <if test="factoryName!=null and factoryName!=''">
               and factory_name like concat('%',#{factoryName},'%')
            </if>
            <if test="factoryKeyword!=null and factoryKeyword!=''">
                and  factory_keyword = #{factoryKeyword}
            </if>
            <if test="factoryPhone!=null and factoryPhone!=''">
                and factory_phone = #{factoryPhone}
            </if>
            <if test="status!=null and status!=''">
                and  status = #{status}
            </if>
            <if test="params.startTime!=null and params.startTime!=''">
                and  create_time  >= #{params.startTime}
            </if>
            <if test="params.endTime!=null and params.endTime!=''">
                and  create_time  &lt;= #{params.endTime}
            </if>
        </where>
    </select>





    <update id="updateFactory">
        update his_medicine_factory
        <set>
            <if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
            <if test="factoryPerson != null and factoryPerson != ''">factory_person = #{factoryPerson},</if>
            <if test="factoryKeyword != null and factoryKeyword !=''">factory_keyword = #{factoryKeyword},</if>
            <if test="factoryAddress != null and factoryAddress !=''">factory_address = #{factoryAddress},</if>
            <if test="status != null and status != ''">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            update_time = sysdate()
        </set>
        where factory_id = #{factoryId}
    </update>

    <insert id="addFactory">
        insert into his_medicine_factory
        values(0,#{factoryName},#{factoryCode},#{factoryPerson},#{factoryPhone},#{factoryKeyword},
               #{factoryAddress},#{status},#{createBy},sysdate(),
              0,NULL,#{remake})
    </insert>


    <delete id="deleteFactoryById">
        delete from his_medicine_factory
        where factory_id = #{id}
    </delete>


    <select id="selectFactoryById" resultMap="factory">
        <include refid="selectFactory"></include>
        where factory_id = #{id}
    </select>

</mapper>
package com.ruoyi.mapper;

import com.ruoyi.domain.MedicineFactory;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
@Mapper
public interface HisMedicineFactoryMapper {
    List<MedicineFactory> selectFactoryList(MedicineFactory medicineFactory);

    int updateFactory(MedicineFactory medicineFactory);

    int addFactory(MedicineFactory medicineFactory);

    int deleteFactoryById(Long  id);

    MedicineFactory selectFactoryById(Long id);
}
                ②service  没有影响 ,照写
package com.ruoyi.service;

import com.ruoyi.domain.MedicineFactory;

import java.util.List;

public interface IHisMedicineFactory {
    List<MedicineFactory> selectFactoryList(MedicineFactory medicineFactory);

    int updateFactory(MedicineFactory medicineFactory);

    int addFactory(MedicineFactory medicineFactory);

    int deleteFactoryById(Long  id);

    MedicineFactory selectFactoryById(Long id);


}
package com.ruoyi.service.impl;

import com.ruoyi.mapper.HisMedicineFactoryMapper;
import com.ruoyi.service.IHisMedicineFactory;
import com.ruoyi.domain.MedicineFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author rk
 * @description: TODO
 * @date 2024/8/28 20:26
 */
@Service
public class HisMedicineFactoryImpl implements IHisMedicineFactory {
    @Autowired
    private HisMedicineFactoryMapper hisMedicineFactoryMapper;

    @Override
    public List<MedicineFactory> selectFactoryList(MedicineFactory medicineFactory) {
        return hisMedicineFactoryMapper.selectFactoryList(medicineFactory);
    }

    @Override
    public int updateFactory(MedicineFactory medicineFactory) {
        return hisMedicineFactoryMapper.updateFactory(medicineFactory);

    }

    @Override
    public int addFactory(MedicineFactory medicineFactory) {
        return hisMedicineFactoryMapper.addFactory(medicineFactory);
    }

    @Override
    public int deleteFactoryById(Long id) {
        return hisMedicineFactoryMapper.deleteFactoryById(id);
    }

    @Override
    public MedicineFactory selectFactoryById(Long id) {
        return hisMedicineFactoryMapper.selectFactoryById(id);
    }
}
                ③controller

                        controller类的代码放在ruoyi-admin目录下;

                        需要继承BaseController

                        每个单元方法上添加检验权限标识符的注解@PreAuthorize

package com.ruoyi.web.controller.medicine;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.MedicineFactory;
import com.ruoyi.service.IHisMedicineFactory;
import com.ruoyi.system.domain.SysPost;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author rk
 * @description: TODO
 * @date 2024/8/28 20:34
 */
@RestController
@RequestMapping("medicine/factory")
public class MedicineController extends BaseController {
    @Autowired
    private IHisMedicineFactory hisMedicineFactory;

    /**
     *
     */
    @PreAuthorize("@ss.hasPermi('medicine:factory:list')")
    @GetMapping("/list")
    public TableDataInfo list(MedicineFactory medicineFactory)
    {
        startPage();
        List<MedicineFactory> list = hisMedicineFactory.selectFactoryList(medicineFactory);
        return getDataTable(list);
    }

    /**
     * 根据岗位编号获取详细信息
     */
    @PreAuthorize("@ss.hasPermi('medicine:factory:list')")
    @GetMapping(value = "/list/{id}")
    public AjaxResult getInfo(@PathVariable Long id)
    {
        return success(hisMedicineFactory.selectFactoryById(id));
    }



    @PreAuthorize("@ss.hasPermi('medicine:factory:add')")
    @PostMapping
    public AjaxResult add(@Validated @RequestBody MedicineFactory medicineFactory)
    {
        medicineFactory.setCreateBy(getUsername());
        return toAjax(hisMedicineFactory.addFactory(medicineFactory));
    }

    /**
     * 修改岗位
     */
    @PreAuthorize("@ss.hasPermi('medicine:factory:edit')")
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody MedicineFactory medicineFactory)
    {
        medicineFactory.setUpdateBy(getUsername());
        return toAjax(hisMedicineFactory.updateFactory(medicineFactory));
    }

    /**
     * 删除岗位
     */
    @PreAuthorize("@ss.hasPermi('medicine:factory:remove')")
    @DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(hisMedicineFactory.deleteFactoryById(id));
    }



}

        3)对应的前端界面

                        〇)界面效果

                        ①)登录若依管理系统手动添加对应的路由地址和url

                       ②) 前端代码

                                界面的elementplus标签和script内语法可以参照岗位系统的前端界面post.vue代码。

三、

四、

五、

六、

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2090486.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【位置编码】【Positional Encoding】直观理解位置编码!把位置编码想象成秒针!

【位置编码】【Positional Encoding】直观理解位置编码&#xff01;把位置编码想象成秒针&#xff01; 你们有没有好奇过为啥位置编码非得长成这样&#xff1a; P E ( p o s , 2 i ) s i n ( p o s 1000 0 2 i / d m o d e l ) P E ( p o s , 2 i 1 ) c o s ( p o s 1000 …

基于yolov8的手势识别0-9检测系统python源码+onnx模型+评估指标曲线+精美GUI界面

【算法介绍】 基于YOLOv8的手势识别0-9检测系统是一个利用深度学习技术&#xff0c;特别是YOLOv8算法&#xff0c;实现对手势&#xff08;0至9的数字手势&#xff09;进行快速、准确识别的系统。YOLOv8以其高效的性能和准确性&#xff0c;在实时性要求较高的手势识别领域表现出…

ant-design-vue v-decorator用法

笔者一直在做后端&#xff0c;最近公司要求&#xff0c;帮助前端同时写一下前端页面。这里也记录下一些新学的知识&#xff0c;帮助大家避坑 在ant-design中&#xff0c;v-decorator可以实现双向绑定与表单验证。即如果你使用v-decorator 你可以不用使用v-model。 <a-form…

[000-01-015].第03节:SpringBoot中数据源的自动配置

我的后端学习大纲 SpringBoot学习大纲 1.数据访问流程&#xff1a; 2.搭建数据库开发场景&#xff1a; 2.1.导入JDBC场景&#xff1a; 2.2.分析自动导入的内容&#xff1a; 2.3.分析为何没有导入数据库驱动&#xff1a; 1.因为人家也不知道我要用啥数据库&#xff0c;所以在自…

92. UE5 RPG 使用C++创建GE实现灼烧的负面效果

在正常游戏里&#xff0c;有些伤害技能会携带一些负面效果&#xff0c;比如火焰伤害的技能会携带燃烧效果&#xff0c;敌人在受到伤害后&#xff0c;会接受一个燃烧的效果&#xff0c;燃烧效果会在敌人身上持续一段时间&#xff0c;并且持续受到火焰灼烧。 我们将在这一篇文章里…

PTA L1-028 判断素数

L1-028 判断素数&#xff08;10分&#xff09; 本题的目标很简单&#xff0c;就是判断一个给定的正整数是否素数。 输入格式&#xff1a; 输入在第一行给出一个正整数N&#xff08;≤ 10&#xff09;&#xff0c;随后N行&#xff0c;每行给出一个小于的需要判断的正整数。 …

vscode里调试python3.6的配置

vscode里需要降级如下插件&#xff1a; ● Python v2022.8.1 ● Pylance v2022.6.30 ● Python Debugger v2023.1.XXX (pre-release version | debugpy v1.5.1)

vue-echarts :知识图谱可视化,动态更新 动态赋值series,更新options

<template><div style="display: flex;align-items: center;justify-content: space-between;"><

Java语言程序设计基础篇_编程练习题*17.10 (分割文件)

目录 题目&#xff1a;*17.10 (分割文件) 代码示例 输出结果 题目&#xff1a;*17.10 (分割文件) 假设希望在 CD-R 上备份一个大文件(例如&#xff0c;一个 10GB 的 AVI文件)。可以将该文件分割为几个小一些的片段&#xff0c;然后独立备份这些小片段。编写一个工具程序&am…

Taro 微信小程序 分页上拉加载

需求&#xff1a; 页面表头及上面部分都固定&#xff0c;表格数据部分可以滚动&#xff0c;支持分页&#xff0c;上拉加载下一页数据 如果是最后一页需判断一下&#xff0c;上拉不再继续加载数据 效果&#xff1a; template&#xff1a; <scroll-view class"db-det…

BodySlide and Outfit Studio 身形编辑器和模型编辑器v4.7.1汉化版以及使用和汉化方法

感谢小莫汉化&#xff01; 汉化版下载地址&#xff1a;https://pan.quark.cn/s/50987aa39805

《NLP自然语言处理》—— 关键字提取之TF-IDF算法

文章目录 一、TF-IDF算法介绍二、举例说明三、示例&#xff1a;代码实现四、总结 一、TF-IDF算法介绍 TF-IDF&#xff08;Term Frequency-Inverse Document Frequency&#xff09;是一种用于信息检索与文本挖掘的常用加权技术。TF-IDF是一种统计方法&#xff0c;用以评估一个词…

【HarmonyOS NEXT开发】鸿蒙界面开发起步,ArkUI(方舟开发框架)介绍,知识点详解

【HarmonyOS NEXT开发】鸿蒙界面开发起步&#xff0c;ArkUI(方舟开发框架)介绍&#xff0c;知识点详解 大纲 主题&#xff1a;鸿蒙界面开发起步&#xff0c;ArkUI(方舟开发框架)介绍&#xff0c;知识点详解。、 内容摘要&#xff1a;带领直播课的观众一步步熟悉ArkUI的基本框…

语言质量评价对应用翻译质量的影响——以美国市场为例

在竞争激烈的移动应用程序世界中&#xff0c;尤其是在美国这样一个庞大而多样化的市场中&#xff0c;翻译的质量可以决定应用程序的成功与否。语言质量评价对应用翻译的整体质量有着深远的影响&#xff0c;其重要性怎么强调都不为过。 语言质量评价的重要性 语言质量评估是评…

3D打印引领制造业新纪元

增材制造技术&#xff0c;俗称3D打印&#xff0c;作为现代科技发展的璀璨明珠&#xff0c;正稳步迈向制造业舞台的中央&#xff0c;重塑着传统制造行业的格局&#xff0c;一个全新的制造纪元正在悄然到来。 3D打印技术&#xff0c;其核心在于通过精准控制的逐层堆积过程&#x…

SLAM ORB-SLAM2(29)PnP估计姿态

SLAM ORB-SLAM2&#xff08;29&#xff09;PnP估计姿态 1. PnP问题2. EPnP算法2.1. 计算4对控制点的世界坐标2.2. 计算齐次质心坐标2.3. 计算4对控制点的相机坐标2.3.1. 构造M矩阵2.3.2. 计算 M T M M^TM MTM的0特征值对应的特征向量2.3.3. 计算零空间的秩2.3.4. 计算线性组合的…

Openldap可视化工具PhpLdapAdmin服务配置

Openldap可视化工具PhpLdapAdmin服务配置 1、创建组 Create a child entry ------> Generic: Posix Group ------> New Posix Group ------> Create Object 1).Create a child entry 2).Generic: Posix Group 3).New Posix Group 4).Create Object 5).查看创建的组…

嵌入式软件--PCB DAY 4

1.原理图重点 &#xff08;1&#xff09;CH340N为什么有那么多组极。 &#xff08;2&#xff09;TYPEC接口&#xff0c;得到几V的供电&#xff0c;为什么&#xff1f; &#xff08;3&#xff09;P0为什么上拉。 &#xff08;4&#xff09;单片机烧录时要干什么 &#xff0…

【Zookeeper】小白基础入门

1 Zookeeper入门 1.1 概述 1.2 特点 1.3 数据结构 1.4 应用场景 统一命名服务 统一配置管理 统一集群管理 服务动态上下线 软负载均衡 1.5 下载地址 2 Zookeeper本地安装 2.1 本地模式安装 2.2 配置参数解读 3 Zookeeper集群操作 3.1 集群操作 3.1.1 集群安装 3.1.2 选举…

Linux 数据结构 树知识

树&#xff1a;只有一个前驱&#xff0c;但是可以有多个后继 根节点&#xff1a;最顶层节点&#xff08;没有前驱&#xff09; 分支节点&#xff1a;有前驱也有后继 叶子节点&#xff1a;没有后继的节点 层&#xff1a;根节点所在为第一层&#xff0c;每过一个…