فهرست منبع

医嘱生成,打印出院医嘱优化

lihong 6 روز پیش
والد
کامیت
57c449883e

+ 2 - 0
src/main/java/thyyxxk/webserver/dao/his/executeItem/YzYpZyOrderDao.java

@@ -116,6 +116,7 @@ public interface YzYpZyOrderDao extends BaseMapper<YzYpZyOrder> {
           "    yz_yp_zy_order.ward_code = #{wardCode} and " +
           "    yz_yp_zy_order.status_flag in ('3','4') and " +
           "    yz_yp_zy_order.amount > 0 and " +
+          "    b.frequ_code !='ONCE' and " +
           "    yz_yp_zy_order.occ_time >  b.end_time and " +
           "    yz_yp_zy_order.inpatient_no=b.inpatient_no and " +
           "    yz_yp_zy_order.admiss_times=b.admiss_times and " +
@@ -129,6 +130,7 @@ public interface YzYpZyOrderDao extends BaseMapper<YzYpZyOrder> {
           "   where a.drug_class <>'d' " +
           "   and  a.occ_time > b.end_time " +
           "   and a.amount > 0" +
+          "   and b.frequ_code != 'ONCE'" +
           "   and a.status_flag in ('3','4') " +
           "   and a.dept_code = #{wardCode} " +
           "   and a.ward_code = #{wardCode} ")

+ 8 - 8
src/main/java/thyyxxk/webserver/dao/his/medicaladvice/medicamanage/MedicalManagementDao.java

@@ -68,7 +68,7 @@ public interface MedicalManagementDao {
             "              new_order_name = rtrim(a.order_name) + (case when a.group_no <> '00' then (case when isnull(a.drug_specification,'')=''then '' else '(' + isnull(a.drug_specification,'')+')' end) + ' ' +\n" +
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  )"+
-            " FROM      yz_act_order a, yz_order_item b , view_zy_patient_all c\n" +
+            " FROM      ${tableName} a, yz_order_item b , view_zy_patient_all c\n" +
             " WHERE       a.inpatient_no = #{patNo} and\n" +
             "        a.admiss_times = #{times} AND\n" +
             "    ${pageCondition} and \n" +
@@ -128,7 +128,7 @@ public interface MedicalManagementDao {
             "              new_order_name = rtrim(a.order_name) + (case when a.group_no <> '00' then (case when isnull(a.drug_specification,'')=''then '' else '(' + isnull(a.drug_specification,'')+')' end) + ' ' +\n" +
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  )"+
-            " FROM       yz_act_order a, view_zy_patient_all c\n" +
+            " FROM       ${tableName} a, view_zy_patient_all c\n" +
             " WHERE       a.inpatient_no = #{patNo} and\n" +
             "        a.admiss_times = #{times} AND\n" +
             "    ${pageCondition} and"  +
@@ -139,7 +139,7 @@ public interface MedicalManagementDao {
             "        a.group_no     <> '00'      and\n" +
             "        a.doctor_flag='1'\n" +
             "order by page_no,confirm_time,act_order_no_b,act_order_no")
-    List<YzPrintVO> getcqYzPrint(@Param("patNo") String patNo, @Param("times")Integer times,@Param("pageCondition")String pageCondition);
+    List<YzPrintVO> getcqYzPrint(@Param("patNo") String patNo, @Param("times")Integer times,@Param("pageCondition")String pageCondition,@Param("tableName")String tableName);
     @Select("SELECT act_order_no=a.act_order_no,\n" +
             "              inpatient_no=a.inpatient_no,\n" +
             "              name        =c.name,\n" +
@@ -190,7 +190,7 @@ public interface MedicalManagementDao {
             "                                                                                                                  (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
             "                                                                                                                  (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else ' ' end),\n" +
             "              a.confirm_time\n" +
-            " FROM       yz_act_order a, yz_order_item b,view_zy_patient_all c\n" +
+            " FROM       ${tableName} a, yz_order_item b,view_zy_patient_all c\n" +
             " WHERE       a.inpatient_no = #{patNo} and\n" +
             "        a.admiss_times = #{times} AND\n" +
             "    ${pageCondition} and\n" +
@@ -253,7 +253,7 @@ public interface MedicalManagementDao {
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  ),\n" +
             "              a.confirm_time\n" +
-            " FROM       yz_act_order a, view_zy_patient_all c\n" +
+            " FROM       ${tableName} a, view_zy_patient_all c\n" +
             " WHERE       a.inpatient_no = #{patNo} and\n" +
             "        a.admiss_times = #{times} AND\n" +
             "    ${pageCondition} and\n" +
@@ -314,7 +314,7 @@ public interface MedicalManagementDao {
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  rtrim(a.dose) + (select name from yp_zd_unit where code=a.dose_unit) end) + ' ' +\n" +
             "                                                                                        (case when isnull(a.dose_unit,'') = '' then '' else  '共'+ rtrim(a.drug_quan) + (select name from yp_zd_unit where code=a.mini_unit) end) else isnull(a.drug_specification,'') end  ),\n" +
             "              a.confirm_time\n" +
-            " FROM       yz_act_order a, view_zy_patient_all c\n" +
+            " FROM       ${tableName} a, view_zy_patient_all c\n" +
             " WHERE       a.inpatient_no = #{patNo} and\n" +
             "        a.admiss_times = #{times} AND\n" +
             "   ${pageCondition}  and\n" +
@@ -326,7 +326,7 @@ public interface MedicalManagementDao {
             "        a.group_no = '00' and\n" +
             "    (a.order_name like '%草药%' or a.order_name like '%会诊%')\n" +
             "order by page_no,confirm_time,act_order_no_b")
-    List<YzPrintVO> getlsYzPrint(@Param("patNo") String patNo, @Param("times")Integer times,@Param("pageCondition")String pageCondition);
+    List<YzPrintVO> getlsYzPrint(@Param("patNo") String patNo, @Param("times")Integer times,@Param("pageCondition")String pageCondition,@Param("tableName") String tableName);
     @Select("select\n" +
             "                   RTRIM(a.bed_no) bedNo,\n" +
             "                   RTRIM(a.inpatient_no) inpatientNo,\n" +
@@ -338,7 +338,7 @@ public interface MedicalManagementDao {
     List<Patient> queryPatientInfo(@Param(Constants.WRAPPER)QueryWrapper<?> query,@Param("tableName")String tableName);
     @Select("select top 1 1  from op_record where inpatient_no=#{patNo} and admiss_times=#{times}")
     Integer existOprt(@Param("patNo") String patNo, @Param("times")Integer times);
-    @Select(" select max(print_page) print_page,max(print_page_once) print_page_once  from  yz_act_order where inpatient_no=#{patNo} and admiss_times =#{times} ")
+    @Select(" select max(print_page) print_page,max(print_page_once) print_page_once  from  ${tableName} where inpatient_no=#{patNo} and admiss_times =#{times} ")
     YzPrintVO selectMaxPagaNo(YzOrderParam param);
     @Update(" UPDATE yz_act_order SET ${printPageWhere} = #{pageNo} WHERE act_order_no in  (${orderNoList})")
     void updatePrintPageNo(@Param("orderNoList") String orderNoList,@Param("pageNo")Integer pageNo, @Param("printPageWhere")String printPageWhere);

+ 1 - 0
src/main/java/thyyxxk/webserver/entity/medicaladvice/medicamanage/YzOrderParam.java

@@ -20,5 +20,6 @@ public class YzOrderParam {
 
     /**在院出院标识 1 出院 0 在院 */
     private String inOutStatusFlag;
+    private String tableName;
 
 }

+ 14 - 10
src/main/java/thyyxxk/webserver/service/medicaladvice/medicamanage/MedicalManagementService.java

@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.jetbrains.annotations.NotNull;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import thyyxxk.webserver.config.exception.BizException;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
@@ -29,11 +28,7 @@ import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYzActOrder;
 import thyyxxk.webserver.service.hutoolcache.ExtraCache;
 import thyyxxk.webserver.service.hutoolcache.UserCache;
 import thyyxxk.webserver.service.inpatient.PatientService;
-import thyyxxk.webserver.utils.AssertUtil;
-import thyyxxk.webserver.utils.CommonUtil;
-import thyyxxk.webserver.utils.EntityStringTrim;
-import thyyxxk.webserver.utils.ResultVoUtil;
-import thyyxxk.webserver.utils.StringUtil;
+import thyyxxk.webserver.utils.*;
 
 import java.math.BigDecimal;
 import java.util.*;
@@ -88,13 +83,14 @@ public class MedicalManagementService {
     private ResultVo<Map<String, Object>> getPrinInfo(YzOrderParam param) {
         Map<String, Object> map = new HashMap<>(2);
         List<YzPrintVO> yzPrintVOList;
+        String tableName = NumberEnum.ONE.getCode().equals(param.getInOutStatusFlag()) ? "yz_inact_order" : "yz_act_order";
         if (param.getType() == 1) {
             //长期医嘱
             String pageCondition = getPageCondition(param, "a.print_page");
-            yzPrintVOList = dao.getcqYzPrint(param.getPatNo(), param.getTimes(), pageCondition);
+            yzPrintVOList = dao.getcqYzPrint(param.getPatNo(), param.getTimes(), pageCondition,tableName);
         } else {
             String pageCondition = getPageCondition(param, "a.print_page_once");
-            yzPrintVOList = dao.getlsYzPrint(param.getPatNo(), param.getTimes(), pageCondition);
+            yzPrintVOList = dao.getlsYzPrint(param.getPatNo(), param.getTimes(), pageCondition,tableName);
         }
         if (CollUtil.isNotEmpty(yzPrintVOList)) {
             List<YzPrintVO> childrenList = yzPrintVOList.stream().filter(o -> o.getParentNo() != null).collect(Collectors.toList());
@@ -344,6 +340,7 @@ public class MedicalManagementService {
 
     public Map getTotalPageNUm(YzOrderParam param) {
         Map map = new HashMap(1);
+        setYzActTableName(param);
         YzPrintVO data = dao.selectMaxPagaNo(param);
         if (param.getType() == 1) {
             map.put("total", data == null ? null : data.getPrintPage());
@@ -353,6 +350,11 @@ public class MedicalManagementService {
         return map;
     }
 
+    private void setYzActTableName(YzOrderParam param){
+        String tableName = NumberEnum.ONE.getCode().equals(param.getInOutStatusFlag()) ? "yz_inact_order" : "yz_act_order";
+        param.setTableName(tableName);
+    }
+
     public ResultVo<String> recPrint(YzOrderParam param) {
         //--打印新增需要插入一条 print_ord_once  print_ord_long 一页20条, 请第几页进行续打
         //select * from    yz_print_rec where   inpatient_no ='0418368' and admiss_times =1 and print_name ='print_ord_once'
@@ -364,7 +366,8 @@ public class MedicalManagementService {
         query.eq("admiss_times", param.getTimes());
         query.eq("print_name", param.getType() == 1 ? PRINT_NAME_ORD_LONG : PRINT_NAME_ORD_ONCE);
         YzPrintRec yzPrintRec = yzPrintRecDao.selectOne(query);
-        List<YzPrintVO> yzPrintVOS = param.getType() == 1 ? dao.getcqYzPrint(param.getPatNo(), param.getTimes(), " isnull(a.print_page,0)=0 ") : dao.getlsYzPrint(param.getPatNo(), param.getTimes(), " isnull(a.print_page_once,0)=0 ");
+        String tableName = NumberEnum.ONE.getCode().equals(param.getInOutStatusFlag()) ? "yz_inact_order" : "yz_act_order";
+        List<YzPrintVO> yzPrintVOS = param.getType() == 1 ? dao.getcqYzPrint(param.getPatNo(), param.getTimes(), " isnull(a.print_page,0)=0 ",tableName) : dao.getlsYzPrint(param.getPatNo(), param.getTimes(), " isnull(a.print_page_once,0)=0 ",tableName);
         YzPrintRec rec = new YzPrintRec();
         rec.setInpatientNo(param.getPatNo());
         rec.setAdmissTimes(param.getTimes());
@@ -427,7 +430,8 @@ public class MedicalManagementService {
 
     public ResultVo<String> clearPrintPageNo(YzOrderParam param) {
         AssertUtil.isnotBlank(param.getPatNo(), "请选择一条病人");
-        dao.updatePrintPage(param, param.getType() == 1 ? "print_page =null" : "print_page_once=null", "yz_act_order");
+        setYzActTableName(param);
+        dao.updatePrintPage(param, param.getType() == 1 ? "print_page =null" : "print_page_once=null", param.getTableName());
         dao.updatePrintPage(param, param.getType() == 1 ? "print_page =null" : "print_page_once=null", "yz_erase_order");
         QueryWrapper query = new QueryWrapper();
         query.eq("inpatient_no", param.getPatNo());