瀏覽代碼

优化了代码。

xiaochan 4 年之前
父節點
當前提交
2d3bc2d8b4

+ 1 - 1
src/main/java/thyyxxk/webserver/config/exception/ExceptionEnum.java

@@ -7,7 +7,7 @@ package thyyxxk.webserver.config.exception;
 public enum ExceptionEnum {
     SUCCESS(200, "成功。"),
     // 提示成功
-    SUCCESS_AND_NOTIFICATION(201, ""),
+    SUCCESS_AND_NOTIFICATION(201, "操作成功"),
     // 以下是需要消息提示的错误
     INTERNAL_SERVER_ERROR(1001, "服务器内部错误!"),
     NULL_POINTER(1002, "有不合法的空值存在!"),

+ 2 - 0
src/main/java/thyyxxk/webserver/controller/querydata/ConsumablesStatisticsController.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.controller.querydata;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
+import thyyxxk.webserver.config.auth.PassToken;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.ConsumablesStatistics;
@@ -34,6 +35,7 @@ public class ConsumablesStatisticsController {
         return service.query(param);
     }
 
+    @PassToken
     @PostMapping("/exportExcel")
     public void exportExcel(HttpServletResponse response,
                             @RequestBody @Validated ConsumablesStatistics param) {

+ 50 - 29
src/main/java/thyyxxk/webserver/dao/his/datamodify/InOrOutOfWarehouseDao.java

@@ -1,7 +1,10 @@
 package thyyxxk.webserver.dao.his.datamodify;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.apache.ibatis.annotations.*;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.datamodify.InOrOutOfWarehousePojo;
 import thyyxxk.webserver.entity.datamodify.YpInDetl;
@@ -17,7 +20,6 @@ import java.util.List;
  * @author xc
  * @date 2021-06-01 14:06
  */
-@Mapper
 public interface InOrOutOfWarehouseDao {
 
     /**
@@ -32,7 +34,7 @@ public interface InOrOutOfWarehouseDao {
             "manu_code_name = (select name from yp_zd_manufactory where code = manu_code)," +
             "purchaser_name = (select  name from a_employee_mi where code = purchaser)," +
             "charge_code_name = (select name from yp_zd_dict where " +
-            " serial = yp_in_detl.serial  and code = charge_code),* " +
+            "serial = yp_in_detl.serial and code = charge_code),* " +
             "from yp_in_detl where 1=1 " +
             "<if test=\"param.startTime!=null and param.startTime!=''\">" +
             "and in_date &gt;= #{param.startTime} and in_date&lt;=#{param.endTime} " +
@@ -41,8 +43,8 @@ public interface InOrOutOfWarehouseDao {
             "and in_docu_no=#{param.inDocuNo}" +
             "</if>" +
             "</script>")
-    List<YpInDetl> queryRuKuXinXi(IPage<InOrOutOfWarehousePojo> page, @Param("param") InOrOutOfWarehousePojo param);
-
+    List<YpInDetl> queryRuKuXinXi(IPage<InOrOutOfWarehousePojo> page,
+                                  @Param("param") InOrOutOfWarehousePojo param);
 
     /**
      * 根据不同拼音码 和 不同的表格来查询数据
@@ -51,15 +53,19 @@ public interface InOrOutOfWarehouseDao {
      * @param pyCode    拼音码
      * @return 返回多个 code 和 name
      */
-    @Select("select code,rtrim(name)name from ${tableName} where py_code like #{pyCode} and isnull(del_flag,0)=0")
+    @Select("<script>" +
+            "select code,rtrim(name)name from ${tableName} where py_code like #{pyCode} and isnull(del_flag,0)=0" +
+            "<if test=\"tableName == 'a_employee_mi'\">" +
+            "and dept_code = '2060000' " +
+            "</if>" +
+            "</script>")
     List<GetDropdownBox> queryCode(@Param("tableName") String tableName,
                                    @Param("pyCode") String pyCode);
 
-
     /**
      * 更新 入库信息
      *
-     * @param param 要更新的字段
+     * @param param 要更新的字段 以及条件
      */
     @Update("update yp_in_detl set in_docu_no=#{inDocuNo},supply_code=#{supplyCode},rept_no=#{reptNo}, " +
             "purchaser=#{purchaser},fp_no=#{fpNo},manu_no=#{manuNo},manu_code=#{manuCode}," +
@@ -69,7 +75,6 @@ public interface InOrOutOfWarehouseDao {
             "where in_docu_no = #{oldInDocuNo} and charge_code = #{chargeCode} and in_seri=#{inSeri}")
     void xiuGiRuKuXinXi(YpInDetl param);
 
-
     /**
      * 根据入库单号 或者 入库时间 来查询数据
      *
@@ -90,18 +95,17 @@ public interface InOrOutOfWarehouseDao {
             "and out_date &gt;= #{param.startTime} and out_date&lt;=#{param.endTime} " +
             "</if>" +
             "<if test=\"param.drawNo!=null and param.drawNo!=''\">" +
-            "and draw_no=#{param.drawNo}" +
+            "and draw_no=#{param.drawNo} " +
             "</if>" +
             "<if test=\"param.inDrawNo!=null and param.inDrawNo!=''\">" +
-            "and in_draw_no=#{param.inDrawNo}" +
+            "and in_draw_no=#{param.inDrawNo} " +
             "</if>" +
             "<if test=\"param.chargeCode!=null and param.chargeCode!=''\">" +
-            "and charge_code=#{param.chargeCode}" +
+            "and charge_code=#{param.chargeCode} " +
             "</if>" +
             "</script>")
     List<YpOutDetl> queryChuKuXinXi(IPage<InOrOutOfWarehousePojo> page, @Param("param") InOrOutOfWarehousePojo param);
 
-
     /**
      * 获取到科室的code
      *
@@ -115,7 +119,7 @@ public interface InOrOutOfWarehouseDao {
      *
      * @return 返回code name
      */
-    @Select("select group_no code,rtrim(group_name) name from yp_zd_group_name")
+    @Select("select group_no code,rtrim(group_name) name from yp_zd_group_name ")
     List<GetDropdownBox> queryGroupNo();
 
     /**
@@ -123,22 +127,33 @@ public interface InOrOutOfWarehouseDao {
      *
      * @param param 要更新的字段
      */
-    @Update("update yp_out_detl set draw_no=#{drawNo},out_seri=#{outSeri},in_draw_no=#{inDrawNo},   " +
-            "in_date=#{inDate},group_no=#{groupNo}," +
-            "out_amt=#{outAmt},manu_no=#{manuNo}," +
-            "group_no_out=#{groupNoOut},dept_code=#{deptCode},out_date=#{outDate},   " +
-            "sys_date=#{outDate},   " +
-            "confirm_date=#{confirmDate}   " +
-            "where out_seri=#{oldOutSeri} and draw_no=#{oldDrawNo} and charge_code = #{chargeCode}")
+    @Update("UPDATE yp_out_detl SET draw_no=#{drawNo}, " +
+            "out_seri=#{outSeri}, " +
+            "in_draw_no=#{inDrawNo}, " +
+            "in_date=#{inDate}, " +
+            "group_no=#{groupNo}, " +
+            "out_amt=#{outAmt}, " +
+            "manu_no=#{manuNo}, " +
+            "group_no_out=#{groupNoOut}, " +
+            "dept_code=#{deptCode}, " +
+            "out_date=#{outDate}, " +
+            "sys_date=#{outDate}, " +
+            "confirm_date=#{confirmDate} " +
+            "WHERE out_seri=#{oldOutSeri} " +
+            "AND draw_no=#{oldDrawNo} " +
+            "AND charge_code = #{chargeCode}")
     void xiuGaiChuKu(YpOutDetl param);
 
-
+    /**
+     * 在修改出库信息的时候要同步修改 药库的信息
+     *
+     * @param param 修改的参数 以及 查询到的条件
+     */
     @Update("update yp_in_detl_yf set " +
             "manu_no=#{manuNo},buy_amt = #{outAmt},group_no=#{groupNoOut} " +
             "where charge_code = #{chargeCode} and out_draw_no = #{oldDrawNo} and in_seri = #{oldOutSeri}")
     void xiuGaiYaoFangRuKuXinXi(YpOutDetl param);
 
-
     /**
      * 删除出库的一条记录
      *
@@ -153,15 +168,21 @@ public interface InOrOutOfWarehouseDao {
             "and in_draw_no=#{inDrawNo}" +
             "</if> " +
             "</script>")
-    void shanChuChuKuXinXin(@Param("drawNo") String drawNo,
-                            @Param("chargeCode") String chargeCode,
-                            @Param("outSeri") Integer outSeri,
-                            @Param("inDrawNo") String inDrawNo);
+    Integer shanChuChuKuXinXin(@Param("drawNo") String drawNo,
+                               @Param("chargeCode") String chargeCode,
+                               @Param("outSeri") Integer outSeri,
+                               @Param("inDrawNo") String inDrawNo);
 
+    /**
+     * 在删除出库信息的时候也要同步删除 药库的信息
+     *
+     * @param outDrawNo  出库单号
+     * @param chargeCode 药品编码
+     * @param inSeri     序号
+     * @return 返回收到影响的行数 用来判断是否真的删除成功了
+     */
     @Delete("delete from yp_in_detl_yf  where out_draw_no=#{outDrawNo} and charge_code=#{chargeCode} and in_seri=#{inSeri}")
     Integer shanChuYaoFangShuJu(@Param("outDrawNo") String outDrawNo,
                                 @Param("chargeCode") String chargeCode,
                                 @Param("inSeri") Integer inSeri);
-
-
 }

+ 0 - 1
src/main/java/thyyxxk/webserver/dao/his/datamodify/YzTemperatureDao.java

@@ -19,7 +19,6 @@ import java.util.List;
 @Mapper
 public interface YzTemperatureDao {
 
-
     /**
      * 查询住院 护理记录单
      *

+ 5 - 1
src/main/java/thyyxxk/webserver/dao/his/querydata/CovidVaccinateAppointmentDao.java

@@ -102,7 +102,7 @@ public interface CovidVaccinateAppointmentDao {
      */
     @Select("select *,(b.date) date,(b.value) value,(b.id) id  from t_covid_vaccinate_factory a left join t_covid_vaccinate_threshold_new b on " +
             "(a.code = b.code and date = convert(char(10),getdate(),120)) where vaccinate_id=#{id}")
-    List<CovidVaccinateFactory> chaKanChangJia(@Param("id") Integer id);
+    List<CovidVaccinateFactory> chaKanChangJiaXinXi(@Param("id") Integer id);
 
     /**
      * 在插入 厂家信息的时候查看 是否以及存在了
@@ -198,4 +198,8 @@ public interface CovidVaccinateAppointmentDao {
     void kaiQiHuoGuanBiYuYue(@Param("code") Integer code,
                              @Param("enableFlag") Integer enableFlag);
 
+
+    @Insert("insert into t_covid_vaccinate_threshold_new (code, date, value) values (#{code},convert(char(10),getdate(),120),0)")
+    void chaRuJinRiYuZhi(Integer code);
+
 }

+ 30 - 17
src/main/java/thyyxxk/webserver/service/datamodify/InOrOutOfWarehouseService.java

@@ -31,6 +31,7 @@ import java.util.Map;
 @Service
 @Slf4j
 public class InOrOutOfWarehouseService {
+
     private final InOrOutOfWarehouseDao dao;
 
     @Autowired
@@ -48,14 +49,25 @@ public class InOrOutOfWarehouseService {
         IPage<InOrOutOfWarehousePojo> page = new Page<>(param.getCurrentPage(), param.getPageSize());
         List<YpInDetl> list = dao.queryRuKuXinXi(page, param);
         if (list.size() > 0) {
-            Map<String, Object> map = new HashMap<>(Capacity.TWO);
-            map.put("data", list);
-            map.put("total", page.getTotal());
-            return ResultVoUtil.success(map);
+            return ResultVoUtil.success(getMap(page.getTotal(), list));
         }
         return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
     }
 
+    /**
+     * 封装返回 map 的类
+     *
+     * @param total 总条数
+     * @param list  数据
+     * @return 返回map数据
+     */
+    private Map<String, Object> getMap(long total, List<?> list) {
+        Map<String, Object> map = new HashMap<>(Capacity.TWO);
+        map.put("data", list);
+        map.put("total", total);
+        return map;
+    }
+
     /**
      * 远程搜索:供应商、采购员、生产厂家
      *
@@ -74,7 +86,7 @@ public class InOrOutOfWarehouseService {
             //生产厂家
             return ResultVoUtil.success(dao.queryCode("yp_zd_manufactory", pyCode.toUpperCase() + "%"));
         }
-        return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR);
+        return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
     }
 
     /**
@@ -100,13 +112,10 @@ public class InOrOutOfWarehouseService {
     public ResultVo<Map<String, Object>> queryChuKuXinXi(InOrOutOfWarehousePojo param) {
         IPage<InOrOutOfWarehousePojo> page = new Page<>(param.getCurrentPage(), param.getPageSize());
         List<YpOutDetl> list = dao.queryChuKuXinXi(page, param);
-        if (list.size() <= 0) {
-            return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+        if (list.size() > 0) {
+            return ResultVoUtil.success(getMap(page.getTotal(), list));
         }
-        Map<String, Object> map = new HashMap<>(Capacity.TWO);
-        map.put("data", list);
-        map.put("total", page.getTotal());
-        return ResultVoUtil.success(map);
+        return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
     }
 
     /**
@@ -144,12 +153,16 @@ public class InOrOutOfWarehouseService {
      * @return 返回提醒
      */
     public ResultVo<String> shanChuChuKuXinXi(String drawNo, String chargeCode, Integer outSeri, String inDrawNo) {
-        log.info("删除出库信息:操作人:{},出库号:{},药品编码:{},序号:{},入库单号:{}", TokenUtil.getTokenUserId(), drawNo, chargeCode, outSeri, inDrawNo);
-        dao.shanChuChuKuXinXin(drawNo, chargeCode, outSeri, inDrawNo);
-        if (dao.shanChuYaoFangShuJu(drawNo, chargeCode, outSeri) == 0) {
-            log.info("出库信息删除成功,但药房药品入库没有删除成功");
-            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "出库单删除成功,但药房药品入库没有删除成功<br />原因:【系统找不到对应的信息】。");
+        if (dao.shanChuChuKuXinXin(drawNo, chargeCode, outSeri, inDrawNo) > 0) {
+            log.info("删除出库信息:操作人:{},出库号:{},药品编码:{},序号:{},入库单号:{}", TokenUtil.getTokenUserId(), drawNo, chargeCode, outSeri, inDrawNo);
+            if (dao.shanChuYaoFangShuJu(drawNo, chargeCode, outSeri) == 0) {
+                log.info("出库信息删除成功,但药房药品入库没有删除成功");
+                return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "出库单删除成功,但药房药品入库没有删除成功<br />" +
+                        "原因:<span style='color:red'>【出库单序号与药库入库单序号不一致】。</span>");
+            }
+            return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "删除成功。");
         }
-        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "删除成功。");
+        log.info("删除出库信息失败:操作人:{},出库号:{},药品编码:{},序号:{},入库单号:{}", TokenUtil.getTokenUserId(), drawNo, chargeCode, outSeri, inDrawNo);
+        return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "删除失败,原因:【修改了出库单号或序号,导致系统找不到指定的数据,解决方法重新查找对应的数据】");
     }
 }

+ 2 - 2
src/main/java/thyyxxk/webserver/service/querydata/ConsumablesStatisticsService.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.service.querydata;
 
 import com.alibaba.fastjson.JSON;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.dao.his.querydata.ConsumablesStatisticsDao;
@@ -29,6 +30,7 @@ public class ConsumablesStatisticsService {
 
     private final ConsumablesStatisticsDao dao;
 
+    @Autowired
     public ConsumablesStatisticsService(ConsumablesStatisticsDao dao) {
         this.dao = dao;
     }
@@ -77,6 +79,4 @@ public class ConsumablesStatisticsService {
     public ResultVo<List<GetDropdownBox>> getDropdownBox() {
         return ResultVoUtil.success(dao.chargeClassName());
     }
-
-
 }

+ 9 - 1
src/main/java/thyyxxk/webserver/service/querydata/CovidVaccinateAppointmentService.java

@@ -216,7 +216,14 @@ public class CovidVaccinateAppointmentService {
      * @return 对应的数据
      */
     public ResultVo<List<CovidVaccinateFactory>> chaKanChangJia(int id) {
-        return ResultVoUtil.success(dao.chaKanChangJia(id));
+        List<CovidVaccinateFactory> list = dao.chaKanChangJiaXinXi(id);
+        list.forEach(item -> {
+            if (item.getDate() == null) {
+                log.info("疫苗编码为:{},插入今日阈值", item.getCode());
+                dao.chaRuJinRiYuZhi(item.getCode());
+            }
+        });
+        return ResultVoUtil.success(dao.chaKanChangJiaXinXi(id));
     }
 
     /**
@@ -282,4 +289,5 @@ public class CovidVaccinateAppointmentService {
                 String.format("操作成功 --> %s", enableFlag == 0 ? "<span style='color:red'>关闭预约</span>" :
                         "<span style='color:#67C23A'>开启预约</span>"));
     }
+
 }

+ 2 - 0
src/main/java/thyyxxk/webserver/service/querydata/InquiryOfConsultationFeeService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
@@ -29,6 +30,7 @@ import java.util.Map;
 public class InquiryOfConsultationFeeService {
     private final InquiryOfConsultationFeeDao dao;
 
+    @Autowired
     public InquiryOfConsultationFeeService(InquiryOfConsultationFeeDao dao) {
         this.dao = dao;
     }

+ 0 - 2
src/main/java/thyyxxk/webserver/service/querydata/QueryDrugsAndProjectsService.java

@@ -11,7 +11,6 @@ import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
 import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
 import thyyxxk.webserver.utils.ResultVoUtil;
-import thyyxxk.webserver.utils.TokenUtil;
 
 import java.util.HashMap;
 import java.util.List;
@@ -55,7 +54,6 @@ public class QueryDrugsAndProjectsService {
      */
     public ResultVo<List<QueryDrugsAndProjects>> queryProjects(QueryDrugsAndProjects param) {
         List<QueryDrugsAndProjects> list = dao.queryProjects(param);
-        log.info("查询项目收费 --> {},操作人:{},返回的数据:{}", JSON.toJSONString(param), TokenUtil.getTokenUserId(), list.size());
         if (list.size() > 0) {
             return ResultVoUtil.success(list);
         }