Bladeren bron

fix sql修复
add 参数限制

A17404李放 3 jaren geleden
bovenliggende
commit
31ba174c26

+ 1 - 1
nb-system/src/main/java/com/nb/bus/controller/BusClinicController.java

@@ -162,7 +162,7 @@ public class BusClinicController {
     @PostMapping("/edit")
     @SaCheckPermission("bus:clinic:edit")
     @ApiOperation(value = "编辑病人(当前)信息",notes = "编辑病人临床信息,权限【bus:clinic:edit】")
-    public R<Boolean> edit(@RequestAttribute("tenantId")@ApiParam(hidden = true) String tenantId, @RequestBody ClinicEditVo entity){
+    public R<Boolean> edit(@RequestAttribute("tenantId")@ApiParam(hidden = true) String tenantId, @RequestBody@Validated(GenericEntity.Update.class) ClinicEditVo entity){
         if(entity.getHaveDevice()){
             BusClinicEntity clinic = entity.getClinic();
             if(clinic==null){

+ 1 - 0
nb-system/src/main/java/com/nb/bus/controller/vo/ClinicEditVo.java

@@ -24,5 +24,6 @@ public class ClinicEditVo {
     @ApiModelProperty("设备信息")
     private BusDeviceManualEntity manual;
     @ApiModelProperty("手术信息")
+    @NotNull(message = "手术信息不能为空")
     private BusClinicEntity clinic;
 }

+ 15 - 14
nb-system/src/main/java/com/nb/bus/entity/BusClinicEntity.java

@@ -30,14 +30,14 @@ import java.util.*;
 public class BusClinicEntity extends TenantGenericEntity<String,String> {
 
     @ApiModelProperty(value = "临床手术名称")
-    @Length(max = 255,message = "临床手术名称长度不得超过255个字节")
+    @Length(max = 255,message = "临床手术名称长度不得超过255个字节",groups = {Insert.class,Update.class})
     private String surgeryName;
 
     @ApiModelProperty(value = "住院号")
-    @Length(max = 255,message = "病号长度不得超过255个字节")
+    @Length(max = 255,message = "病号长度不得超过255个字节",groups = {Insert.class,Update.class})
     private String patientCode;
 
-    @ApiModelProperty(value = "住院号id")
+    @ApiModelProperty(value = "住院号id",hidden = true)
     private String patientId;
 
     @ApiModelProperty(value = "手术开始时间")
@@ -51,12 +51,12 @@ public class BusClinicEntity extends TenantGenericEntity<String,String> {
     private Date endTime;
 
     @ApiModelProperty(value = "asa")
-    @Length(max = 255,message = "asa长度不得超过255个字节")
+    @Length(max = 255,message = "asa长度不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String asa;
 
     @ApiModelProperty(value = "患者姓名")
-    @Length(max = 255,message = "患者姓名长度不得超过255个字节")
+    @Length(max = 255,message = "患者姓名长度不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String patientName;
 
@@ -69,51 +69,51 @@ public class BusClinicEntity extends TenantGenericEntity<String,String> {
     private Integer patientAge;
 
     @ApiModelProperty(value = "病区")
-    @Length(max = 255,message = "病区")
+    @Length(max = 255,message = "病区名称不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String ward;
 
     @ApiModelProperty(value = "病床号")
-    @Length(max = 255,message = "病床号长度不得超过255个字节")
+    @Length(max = 255,message = "病床号长度不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String bedNo;
 
     @ApiModelProperty(value = "体重")
-    @Length(max = 255,message = "体重不得超过255个字节")
+    @Length(max = 255,message = "体重不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
 
     private String weight;
 
     @ApiModelProperty(value = "身高")
-    @Length(max = 255,message = "身高不得超过255个字节")
+    @Length(max = 255,message = "身高不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
 
     private String height;
 
     @ApiModelProperty(value = "麻醉医生")
-    @Length(max = 255,message = "麻醉医生不得超过255个字节")
+    @Length(max = 255,message = "麻醉医生不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
 
     private String anaDoctor;
 
     @ApiModelProperty(value = "麻醉方式")
     @TableField(updateStrategy = FieldStrategy.IGNORED)
-    @Length(max = 255,message = "麻醉方式不得超过255个字节")
+    @Length(max = 255,message = "麻醉方式不得超过255个字节",groups = {Insert.class,Update.class})
     private String anaType;
 
     @ApiModelProperty(value = "镇痛方式")
     @TableField(updateStrategy = FieldStrategy.IGNORED)
-    @Length(max = 255,message = "镇痛方式不得超过255个字节")
+    @Length(max = 255,message = "镇痛方式不得超过255个字节",groups = {Insert.class,Update.class})
     private String analType;
 
     @ApiModelProperty(value = "手术医生")
-    @Length(max = 255,message = "手术医生不得超过255个字节")
+    @Length(max = 255,message = "手术医生不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String surgeryDoctor;
 
     @ApiModelProperty(value = "配置人员")
     @TableField(updateStrategy = FieldStrategy.IGNORED)
-    @Length(max = 255,message = "配置人员不得超过255个字节")
+    @Length(max = 255,message = "配置人员不得超过255个字节",groups = {Insert.class,Update.class})
     private String configPerson;
 
     @ApiModelProperty(value = "配方")
@@ -137,6 +137,7 @@ public class BusClinicEntity extends TenantGenericEntity<String,String> {
     private Boolean monitorType;
 
     @ApiModelProperty(value = "医嘱")
+    @Length(max = 255,message = "医嘱长度不得超过255个字节",groups = {Insert.class,Update.class})
     @TableField(updateStrategy = FieldStrategy.IGNORED)
     private String entrust;
 

+ 50 - 49
nb-system/src/main/resources/mapper/bus/BusClinicMapper.xml

@@ -83,59 +83,60 @@
 
     <select id="pageQuery" resultMap="queryResult" parameterType="com.nb.bus.service.dto.ClinicQuery">
         select
-        p.id as patient_id,
---         p.code as patient_code,
-        c.id as clinic_id,
-        if(c.monitor_type=1,p.code,c.patient_code) as patient_code,
---         c.patient_code as patient_code,
-        c.patient_name as patient_name,
-        c.ward as ward,
-        c.bed_no as bed_no,
-        c.`surgery_name` as surgery_name,
-        c.surgery_doctor as surgery_doctor,
-        c.ana_doctor as ana_doctor,
-        c.monitor_type as monitor_type,
-        c.finished as finished,
-        c.start_time as clinic_start_time,
-        c.monitor_start_time as monitor_start_time,
-        c.end_time as monitor_end_time,
+        tmp.*,
         i.infusion_count as infusion_count,
         eval.eval_count as eval_count
-        from (select * from bus_clinic
-        <where>
-            <if test="query.monitorType!=null">
-                and monitor_type=#{query.monitorType}
-            </if>
-            <if test="query.finished!=null">
-                and finished=#{query.finished}
-            </if>
-            <if test="query.surgeryName!=null">
-                and surgery_name like concat('%',#{query.surgeryName},'%')
-            </if>
-            <if test="query.patientName!=null">
-                and patient_name like concat('%',#{query.patientName},'%')
-            </if>
-            <if test="query.ward != null and query.ward.size > 0">
-                and ward in
-                <foreach item="w" index="index" collection="query.ward" open="(" separator="," close=")">
-                    #{w, jdbcType=VARCHAR}
-                </foreach>
-            </if>
-            <if test="query.bedNo!=null">
-                and bed_no like concat('%',#{query.bedNo},'%')
-            </if>
-            <if test="query.timeRange != null and query.timeRange.size >0">
-                and monitor_start_time &gt; #{query.timeRange[0]} and  monitor_start_time &lt; #{query.timeRange[1]}
-            </if>
-        </where>
-        ) as c
-        left join (select * from bus_patient)
-         as p on c.patient_id = p.id
-        left join  (select clinic_id,count(1) as infusion_count from bus_infusion_history GROUP BY clinic_id) as i on i.clinic_id=c.id
-        left join (select clinic_id,count(1) as eval_count from bus_evaluation  GROUP BY clinic_id) as eval on eval.clinic_id=c.id
+        from (select p.id as patient_id,
+                c.id as clinic_id,
+                if(c.monitor_type=1,p.code,c.patient_code) as patient_code,
+                c.patient_name as patient_name,
+                c.ward as ward,
+                c.bed_no as bed_no,
+                c.`surgery_name` as surgery_name,
+                c.surgery_doctor as surgery_doctor,
+                c.ana_doctor as ana_doctor,
+                c.monitor_type as monitor_type,
+                c.finished as finished,
+                c.start_time as clinic_start_time,
+                c.monitor_start_time as monitor_start_time,
+                c.end_time as monitor_end_time
+                 from
+                (select * from bus_clinic
+                <where>
+                    <if test="query.monitorType!=null">
+                        and monitor_type=#{query.monitorType}
+                    </if>
+                    <if test="query.finished!=null">
+                        and finished=#{query.finished}
+                    </if>
+                    <if test="query.surgeryName!=null">
+                        and surgery_name like concat('%',#{query.surgeryName},'%')
+                    </if>
+                    <if test="query.patientName!=null">
+                        and patient_name like concat('%',#{query.patientName},'%')
+                    </if>
+                    <if test="query.ward != null and query.ward.size > 0">
+                        and ward in
+                        <foreach item="w" index="index" collection="query.ward" open="(" separator="," close=")">
+                            #{w, jdbcType=VARCHAR}
+                        </foreach>
+                    </if>
+                    <if test="query.bedNo!=null">
+                        and bed_no like concat('%',#{query.bedNo},'%')
+                    </if>
+                    <if test="query.timeRange != null and query.timeRange.size >0">
+                        and monitor_start_time &gt; #{query.timeRange[0]} and  monitor_start_time &lt; #{query.timeRange[1]}
+                    </if>
+                </where>
+                ) as c
+                left join (select * from bus_patient)
+                as p on c.patient_id = p.id
+        ) as tmp
+        left join  (select clinic_id,count(1) as infusion_count from bus_infusion_history GROUP BY clinic_id) as i on i.clinic_id=tmp.clinic_id
+        left join (select clinic_id,count(1) as eval_count from bus_evaluation  GROUP BY clinic_id) as eval on eval.clinic_id=tmp.clinic_id
         <where>
             <if test="query.patientCode!=null">
-                and patient_code like concat('%',#{query.patientCode},'%')
+                patient_code like concat('%',#{query.patientCode},'%')
             </if>
         </where>
         <if test="(query.orderByDesc!=null and query.orderByDesc.size > 0 ) or (query.orderByAsc!=null and query.orderByAsc.size > 0)">

+ 4 - 3
nb-system/src/main/resources/mapper/bus/BusDeviceMapper.xml

@@ -42,7 +42,8 @@
 
 
     <select id="pageQuery" resultMap="pageQueryResult" parameterType="com.nb.bus.service.dto.DeviceQuery">
-        select
+        select tmp.* from
+        (select
         d.id as id,
         d.device_id as device_id,
         d.alias as alias,
@@ -72,7 +73,7 @@
         </where>
         ) AS d
         LEFT JOIN (select * from bus_infusion_history) as i
-        on i.id=d.infusion_id
+        on i.id=d.infusion_id) as tmp
         <where>
             <if test="query.deviceTypes != null and query.deviceTypes.size > 0">
                 type in
@@ -81,7 +82,7 @@
                 </foreach>
             </if>
         </where>
-        order by d.create_time desc
+        order by tmp.create_time desc
     </select>
 
     <select id="view" resultMap="pageQueryResult">