zsl 3 年之前
父節點
當前提交
547a3d89ed

+ 12 - 0
ruoyi-admin/pom.xml

@@ -61,6 +61,18 @@
             <artifactId>ruoyi-generator</artifactId>
         </dependency>
 
+        <!-- 测试-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <version>2.6.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 6 - 0
ruoyi-system/pom.xml

@@ -28,6 +28,12 @@
             <version>1.6.2</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+
+
 
     </dependencies>
 

+ 37 - 23
ruoyi-system/src/main/java/com/ruoyi/system/domain/BusPatient.java

@@ -37,6 +37,14 @@ public class BusPatient extends BaseEntity
     @Excel(name = "身高")
     private BigDecimal height;
 
+    /** 年龄 */
+    @Excel(name = "年龄")
+    private Long age;
+
+    /** 体重 */
+    @Excel(name = "体重")
+    private Long weight;
+
     /** 来源,1门诊,2急诊 */
     @Excel(name = "来源,1门诊,2急诊")
     private Integer source;
@@ -66,15 +74,20 @@ public class BusPatient extends BaseEntity
     @Excel(name = "删除标志", readConverterExp = "0=代表存在,1=代表删除")
     private Boolean isDelete;
 
-    /** 年龄 */
-    @Excel(name = "年龄")
-    private Long age;
+    /** 状态(0已签到 1正在治疗 2 已下机) */
+    @Excel(name = "状态", readConverterExp = "0=已签到,1=正在治疗,2=,已=下机")
+    private Integer status;
 
-    /** 体重 */
-    @Excel(name = "体重")
-    private Long weight;
 
-    public void setId(Long id) 
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }
@@ -204,21 +217,22 @@ public class BusPatient extends BaseEntity
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("code", getCode())
-            .append("name", getName())
-            .append("gender", getGender())
-            .append("height", getHeight())
-            .append("source", getSource())
-            .append("address", getAddress())
-            .append("createTime", getCreateTime())
-            .append("phone", getPhone())
-            .append("relationName", getRelationName())
-            .append("relationPhone", getRelationPhone())
-            .append("dieTime", getDieTime())
-            .append("isDelete", getIsDelete())
-            .append("age", getAge())
-            .append("weight", getWeight())
-            .toString();
+                .append("id", getId())
+                .append("code", getCode())
+                .append("name", getName())
+                .append("gender", getGender())
+                .append("height", getHeight())
+                .append("age", getAge())
+                .append("weight", getWeight())
+                .append("source", getSource())
+                .append("address", getAddress())
+                .append("createTime", getCreateTime())
+                .append("phone", getPhone())
+                .append("relationName", getRelationName())
+                .append("relationPhone", getRelationPhone())
+                .append("dieTime", getDieTime())
+                .append("isDelete", getIsDelete())
+                .append("status", getStatus())
+                .toString();
     }
 }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/BusPatientMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
 
 import java.util.List;
 import com.ruoyi.system.domain.BusPatient;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 患者Mapper接口
@@ -58,4 +59,13 @@ public interface BusPatientMapper
      * @return 结果
      */
     public int deleteBusPatientByIds(Long[] ids);
+
+    /**
+     * 修改患者状态
+     *
+     * @param ids 需要修改的数据主键集合
+     * @param status  需要修改的状态
+     * @return 结果
+     */
+    public int updateStatusByIds(@Param("ids") Long[] ids , @Param("status") Integer status);
 }

+ 36 - 20
ruoyi-system/src/main/resources/mapper/system/BusPatientMapper.xml

@@ -1,15 +1,17 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.BusPatientMapper">
-    
+
     <resultMap type="BusPatient" id="BusPatientResult">
         <result property="id"    column="id"    />
         <result property="code"    column="code"    />
         <result property="name"    column="name"    />
         <result property="gender"    column="gender"    />
         <result property="height"    column="height"    />
+        <result property="age"    column="age"    />
+        <result property="weight"    column="weight"    />
         <result property="source"    column="source"    />
         <result property="address"    column="address"    />
         <result property="createTime"    column="create_time"    />
@@ -18,21 +20,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="relationPhone"    column="relation_phone"    />
         <result property="dieTime"    column="die_time"    />
         <result property="isDelete"    column="is_delete"    />
-        <result property="age"    column="age"    />
-        <result property="weight"    column="weight"    />
+        <result property="status"    column="status"    />
     </resultMap>
 
     <sql id="selectBusPatientVo">
-        select id, code, name, gender, height, source, address, create_time, phone, relation_name, relation_phone, die_time, is_delete, age, weight from bus_patient
+        select id, code, name, gender, height, age, weight, source, address, create_time, phone, relation_name, relation_phone, die_time, is_delete, status from bus_patient
     </sql>
 
     <select id="selectBusPatientList" parameterType="BusPatient" resultMap="BusPatientResult">
         <include refid="selectBusPatientVo"/>
-        <where>  
+        <where>
             <if test="code != null  and code != ''"> and code = #{code}</if>
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="gender != null "> and gender = #{gender}</if>
             <if test="height != null "> and height = #{height}</if>
+            <if test="age != null "> and age = #{age}</if>
+            <if test="weight != null "> and weight = #{weight}</if>
             <if test="source != null "> and source = #{source}</if>
             <if test="address != null  and address != ''"> and address = #{address}</if>
             <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
@@ -40,16 +43,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="relationPhone != null  and relationPhone != ''"> and relation_phone = #{relationPhone}</if>
             <if test="dieTime != null "> and die_time = #{dieTime}</if>
             <if test="isDelete != null "> and is_delete = #{isDelete}</if>
-            <if test="age != null "> and age = #{age}</if>
-            <if test="weight != null "> and weight = #{weight}</if>
+            <if test="status != null "> and status = #{status}</if>
         </where>
     </select>
-    
+
     <select id="selectBusPatientById" parameterType="Long" resultMap="BusPatientResult">
         <include refid="selectBusPatientVo"/>
         where id = #{id}
     </select>
-        
+
     <insert id="insertBusPatient" parameterType="BusPatient" useGeneratedKeys="true" keyProperty="id">
         insert into bus_patient
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -57,6 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">name,</if>
             <if test="gender != null">gender,</if>
             <if test="height != null">height,</if>
+            <if test="age != null">age,</if>
+            <if test="weight != null">weight,</if>
             <if test="source != null">source,</if>
             <if test="address != null">address,</if>
             <if test="createTime != null">create_time,</if>
@@ -65,14 +69,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="relationPhone != null">relation_phone,</if>
             <if test="dieTime != null">die_time,</if>
             <if test="isDelete != null">is_delete,</if>
-            <if test="age != null">age,</if>
-            <if test="weight != null">weight,</if>
-         </trim>
+            <if test="status != null">status,</if>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="code != null">#{code},</if>
             <if test="name != null">#{name},</if>
             <if test="gender != null">#{gender},</if>
             <if test="height != null">#{height},</if>
+            <if test="age != null">#{age},</if>
+            <if test="weight != null">#{weight},</if>
             <if test="source != null">#{source},</if>
             <if test="address != null">#{address},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -81,9 +86,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="relationPhone != null">#{relationPhone},</if>
             <if test="dieTime != null">#{dieTime},</if>
             <if test="isDelete != null">#{isDelete},</if>
-            <if test="age != null">#{age},</if>
-            <if test="weight != null">#{weight},</if>
-         </trim>
+            <if test="status != null">#{status},</if>
+        </trim>
     </insert>
 
     <update id="updateBusPatient" parameterType="BusPatient">
@@ -93,6 +97,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="name != null">name = #{name},</if>
             <if test="gender != null">gender = #{gender},</if>
             <if test="height != null">height = #{height},</if>
+            <if test="age != null">age = #{age},</if>
+            <if test="weight != null">weight = #{weight},</if>
             <if test="source != null">source = #{source},</if>
             <if test="address != null">address = #{address},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
@@ -101,8 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="relationPhone != null">relation_phone = #{relationPhone},</if>
             <if test="dieTime != null">die_time = #{dieTime},</if>
             <if test="isDelete != null">is_delete = #{isDelete},</if>
-            <if test="age != null">age = #{age},</if>
-            <if test="weight != null">weight = #{weight},</if>
+            <if test="status != null">status = #{status},</if>
         </trim>
         where id = #{id}
     </update>
@@ -112,9 +117,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteBusPatientByIds" parameterType="String">
-        delete from bus_patient where id in 
+        delete from bus_patient where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>
+
+    <update id="updateStatusByIds">
+        update bus_device_history
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="status != null">status = #{status},</if>
+        </trim>
+        where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
 </mapper>