Browse Source

确认医嘱收费中修改历史查询。

xiaochan 4 years ago
parent
commit
2fec482ff3

+ 15 - 5
src/main/java/thyyxxk/webserver/controller/zhuyuanyiji/QueRenYiZhuShouFeiController.java

@@ -1,14 +1,13 @@
 package thyyxxk.webserver.controller.zhuyuanyiji;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.datamodify.YzActOrder;
 import thyyxxk.webserver.service.zhuyuanyiji.QueRenYiZhuShouFeiServer;
 
+import java.util.List;
+
 /**
  * <p>
  * 描述: 确认医嘱收费
@@ -31,11 +30,22 @@ public class QueRenYiZhuShouFeiController {
         return server.getXuQueFeiYiZhu(yzActOrder);
     }
 
+    @GetMapping("/huoQuLiShiQueFeiYiZhu")
+    public ResultVo<List<YzActOrder>> huoQuLiShiQueFeiYiZhu(@RequestParam("startTime") String startTime,
+                                                            @RequestParam("endTime") String endTime,
+                                                            @RequestParam("inpatientNo") String inpatientNo,
+                                                            @RequestParam("wardCode") String wardCode,
+                                                            @RequestParam("execUnit") String execUnit,
+                                                            @RequestParam("paiXu") Integer paiXu,
+                                                            @RequestParam("code") String code) {
+        return server.huoQuLiShiQueFeiYiZhu(startTime, endTime, inpatientNo, wardCode, execUnit, paiXu, code);
+    }
+
 
     @PostMapping("/baoCunYiZhuQueFeiShuJu")
     public ResultVo<String> baoCunYiZhuQueFeiShuJu(@RequestBody YzActOrder param) {
         return server.baoCunYiZhuQueFeiShuJu(param);
     }
 
-   
+
 }

+ 46 - 11
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyiji/QueRenYiZhuShouFeiDao.java

@@ -41,7 +41,7 @@ public interface QueRenYiZhuShouFeiDao {
             "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0  " +
             "then 1 else 0 end  " +
             "FROM yz_zy_patient_fee a  left join  zy_actpatient b on (a.inpatient_no = b.inpatient_no and a.admiss_times = b.admiss_times)  " +
-            "where a.charge_status ${liShi}'3' " +
+            "where a.charge_status ='3' " +
             "<if test=\"list.size > 0\">" +
             "and a.exec_unit in " +
             "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
@@ -71,8 +71,7 @@ public interface QueRenYiZhuShouFeiDao {
                                        @Param("list") List<String> list,
                                        @Param("startTime") String startTime,
                                        @Param("endTime") String endTime,
-                                       @Param("fenLei") String fenLei,
-                                       @Param("liShi") String liShi);
+                                       @Param("fenLei") String fenLei);
 
 
     /**
@@ -97,7 +96,7 @@ public interface QueRenYiZhuShouFeiDao {
             "and status_flag > '2' and isnull(group_no,'00' )='00' and order_code in ('06026','06053','05973')) > 0  " +
             "then 1 else 0 end  " +
             "FROM yz_zy_patient_fee a  left join  zy_actpatient b on (a.inpatient_no = b.inpatient_no and a.admiss_times = b.admiss_times)  " +
-            "where a.charge_status ${liShi} '3' " +
+            "where a.charge_status = '3' " +
             "<if test=\"list.size > 0\">" +
             "and a.exec_unit in " +
             "<foreach collection='list' item='item' index='index' open='(' close=')' separator=','>" +
@@ -126,8 +125,7 @@ public interface QueRenYiZhuShouFeiDao {
                                @Param("wardCode") String wardCode,
                                @Param("list") List<String> list,
                                @Param("startTime") String startTime,
-                               @Param("endTime") String endTime,
-                               @Param("liShi") String liShi);
+                               @Param("endTime") String endTime);
 
     @Select("<script>" +
             "select a.charge_status,e.name docotr_name,a.act_order_no,c.name charge_name,a.charge_code,a.charge_fee," +
@@ -137,11 +135,11 @@ public interface QueRenYiZhuShouFeiDao {
             ",op_id_name = (select rtrim(name) name from a_employee_mi where a_employee_mi.code = a.op_id)," +
             "a.op_date" +
             "</if>" +
-            "from yz_zy_patient_fee a  left join  zd_charge_item c on (a.charge_code=c.code)\n" +
-            "left join yz_act_order d on (a.inpatient_no=d.inpatient_no and a.admiss_times=d.admiss_times and a.act_order_no=d.act_order_no )\n" +
+            "from yz_zy_patient_fee a  left join  zd_charge_item c on (a.charge_code=c.code) " +
+            "left join yz_act_order d on (a.inpatient_no=d.inpatient_no and a.admiss_times=d.admiss_times and a.act_order_no=d.act_order_no ) " +
             "left join a_employee_mi e on (d.physician=e.code)" +
             "where  " +
-            "a.charge_status ${liShi} '3' " +
+            "a.charge_status = '3' " +
             "<choose>" +
             "<when  test=\"startTime != null and startTime != '' \">" +
             " and a.occ_time &gt;= #{startTime} and a.occ_time &lt;= #{endTime} " +
@@ -164,8 +162,45 @@ public interface QueRenYiZhuShouFeiDao {
     List<YzActOrder> getXuQueFeiXiangXiXinXi(@Param("list") List<String> list,
                                              @Param("inpatientNoList") List<YzActOrder> inpatientNoList,
                                              @Param("startTime") String startTime,
-                                             @Param("endTime") String endTime,
-                                             @Param("liShi") String liShi);
+                                             @Param("endTime") String endTime);
+
+
+    @Select("<script>" +
+            "select a.charge_status,e.name docotr_name,a.act_order_no,c.name charge_name,a.charge_code,a.charge_fee, " +
+            "       a.order_count,occ_time,rtrim(a.inpatient_no) inpatient_no,op_id,a.op_date, " +
+            "       a.admiss_times, " +
+            "       op_id_name = (select rtrim(name) name from a_employee_mi where a_employee_mi.code = a.op_id)," +
+            "       name = (select rtrim(name) from zy_patient where zy_patient.inpatient_no = a.inpatient_no " +
+            "and zy_patient.admiss_times = a.admiss_times), " +
+            "       a.op_date " +
+            "from yz_zy_patient_fee a  left join  zd_charge_item c on (a.charge_code=c.code) " +
+            "                          left join yz_act_order d on (a.inpatient_no=d.inpatient_no and a.admiss_times=d.admiss_times and a.act_order_no=d.act_order_no ) " +
+            "                          left join a_employee_mi e on (d.physician=e.code) " +
+            "where occ_time &gt;= #{startTime} and occ_time &lt;= #{endTime} " +
+            "and a.charge_status &lt;&gt; '3' " +
+            "<if test=\"inpatientNo != null and inpatientNo != '' \">" +
+            "and a.inpatient_no = #{inpatientNo} " +
+            "</if>" +
+            "<if test=\"execUnitList.size > 0\">" +
+            "and a.exec_unit in " +
+            "<foreach collection='execUnitList' item='item' index='index' open='(' close=')' separator=','>" +
+            "    #{item}  " +
+            "</foreach>" +
+            "</if>" +
+            "<if test=\"wardCode != null and wardCode != '' \">" +
+            "and a.ward_code = #{wardCode} " +
+            "</if>" +
+            "<if test=\"code != null and code != '' \">" +
+            "and a.op_id = #{code}" +
+            "</if>" +
+            "order by a.inpatient_no" +
+            "</script>")
+    List<YzActOrder> huoQuLiShiXinXi(@Param("startTime") String startTime,
+                                     @Param("endTime") String endTime,
+                                     @Param("inpatientNo") String inpatientNo,
+                                     @Param("execUnitList") List<String> execUnitList,
+                                     @Param("wardCode") String wardCode,
+                                     @Param("code") String code);
 
 
     @Update("<script>" +

+ 28 - 19
src/main/java/thyyxxk/webserver/service/zhuyuanyiji/QueRenYiZhuShouFeiServer.java

@@ -57,36 +57,23 @@ public class QueRenYiZhuShouFeiServer {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "科室信息为空 [・_・?]");
         }
         // 查看历史 等于 3 就是查看 没有被确认的 不等于 3 就是查看历史
-        String liShi = "=";
-
-        if (yzActOrder.getLiShi() == 1) {
-            if (StringUtil.isBlank(yzActOrder.getStartTimeString()) || StringUtil.isBlank(yzActOrder.getEndTimeString())) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "查看历史数据时需要携带医嘱时间");
-            }
-            liShi = "<>";
-        } else {
-            yzActOrder.setStartTimeString("");
-            yzActOrder.setEndTimeString("");
-        }
         log.info("查询需确费医嘱:数据:{}", JSON.toJSONString(yzActOrder));
         String fenLei = "a.ward_code";
         if (yzActOrder.getFenLei() != null && yzActOrder.getFenLei().equals(1)) {
             fenLei = "(select count(*) from yz_zy_patient_fee " +
                     "where op_id = '" + TokenUtil.getTokenUserId() + "' and inpatient_no = a.inpatient_no and admiss_times = a.admiss_times and charge_status <> 3) desc";
         }
-        page.setTotal(dao.getXuQueFeiYiZhuTotal(yzActOrder.getInpatientNo(), yzActOrder.getWardCode(), execUnitList, yzActOrder.getStartTimeString(), yzActOrder.getEndTimeString(), liShi));
+        page.setTotal(dao.getXuQueFeiYiZhuTotal(yzActOrder.getInpatientNo(), yzActOrder.getWardCode(), execUnitList, yzActOrder.getStartTimeString(),
+                yzActOrder.getEndTimeString()));
         dao.getXuQueFeiYiZhu(page, yzActOrder.getInpatientNo(), yzActOrder.getWardCode(), execUnitList, yzActOrder.getStartTimeString(), yzActOrder.getEndTimeString(),
-                fenLei, liShi);
+                fenLei);
         if (page.getRecords().isEmpty()) {
             return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
         }
-
-        List<YzActOrder> ziJieDian = dao.getXuQueFeiXiangXiXinXi(execUnitList, page.getRecords(), yzActOrder.getStartTimeString(), yzActOrder.getEndTimeString(), liShi);
-
+        List<YzActOrder> ziJieDian = dao.getXuQueFeiXiangXiXinXi(execUnitList, page.getRecords(), yzActOrder.getStartTimeString(), yzActOrder.getEndTimeString());
         Map<String, List<YzActOrder>> ziJieDianMap = ziJieDian.stream().collect(
                 Collectors.groupingBy(item -> item.getInpatientNo() + item.getAdmissTimes())
         );
-
         for (int i = 0; i < page.getRecords().size(); i++) {
             YzActOrder yz = page.getRecords().get(i);
             String key = yz.getInpatientNo() + yz.getAdmissTimes();
@@ -100,9 +87,31 @@ public class QueRenYiZhuShouFeiServer {
         return ResultVoUtil.success(page);
     }
 
+
+    public ResultVo<List<YzActOrder>> huoQuLiShiQueFeiYiZhu(String startTime,
+                                                            String endTime,
+                                                            String inpatientNo,
+                                                            String wardCode,
+                                                            String execUnit,
+                                                            Integer paiXu,
+                                                            String code) {
+        if (StringUtil.isBlank(startTime) || StringUtil.isBlank(endTime)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "开始时间和结束时间为空。");
+        } else if (StringUtil.isBlank(execUnit)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "执行科室为空。");
+        }
+        List<YzActOrder> liShiShuJu = dao.huoQuLiShiXinXi(startTime, endTime, inpatientNo, publicServer.getKeShiLieBiaoList(execUnit), wardCode, code);
+        if (ListUtil.notBlank(liShiShuJu)) {
+            return ResultVoUtil.success(liShiShuJu);
+        }
+        log.info("开始时间:{},结束时间:{},住院号:{},病房:{},执行科室:{},排序:{}", startTime, endTime, inpatientNo, wardCode, execUnit, paiXu);
+        return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST);
+    }
+
+
     /**
-     * @param param
-     * @return
+     * @param param 医嘱修改
+     * @return 返回提示
      */
     @Transactional(rollbackFor = Exception.class)
     public ResultVo<String> baoCunYiZhuQueFeiShuJu(YzActOrder param) {