Browse Source

精麻药统计合并药品发药记录统计开发

WANGJIALIANG 4 years ago
parent
commit
21f3e58313

+ 38 - 11
src/main/java/cn/hnthyy/thmz/controller/yf/YfSpiritAnestheticPrintController.java

@@ -7,21 +7,16 @@ import cn.hnthyy.thmz.service.his.mz.EmployeeService;
 import cn.hnthyy.thmz.service.his.yf.YfSpiritAnestheticPrintService;
 import cn.hnthyy.thmz.service.his.zd.ZdUnitCodeService;
 import cn.hnthyy.thmz.vo.MzSendMedicineVo;
+import cn.hnthyy.thmz.vo.SendDrugRecordVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
- * @description:精麻药品查询统计
+ * @description:药品发药查询统计
  * @author: WANGJIALIANG
  * @time: 2021/10/7 11:13
  */
@@ -34,6 +29,7 @@ public class YfSpiritAnestheticPrintController {
     ZdUnitCodeService zdUnitCodeService;
     @Autowired
     EmployeeService employeeService;
+
     /**
      * 获取精麻药品统计信息
      * @return
@@ -63,9 +59,12 @@ public class YfSpiritAnestheticPrintController {
             sendMedicineVos.forEach(mzSendMedicineVo -> {
                 String warnDeptName = zdUnitCodeService.queryDeptNameByIdInCache(mzSendMedicineVo.getWarnDept());
                 mzSendMedicineVo.setWarnDeptName(warnDeptName);
-                Employee employee = employeeService.queryByUserCode(mzSendMedicineVo.getDoctorCode());
-                mzSendMedicineVo.setEmployeeName(employee.getEmployeeName());
+                if(StringUtils.isNotBlank(mzSendMedicineVo.getDoctorCode())){
+                    Employee employee = employeeService.queryByUserCode(mzSendMedicineVo.getDoctorCode());
+                    mzSendMedicineVo.setEmployeeName(employee.getEmployeeName());
+                }
             });
+            Collections.sort(sendMedicineVos, Comparator.comparing(MzSendMedicineVo::getChargeItemCode));
             resultMap.put("code", 0);
             resultMap.put("message", "查询精麻药品统计信息成功");
             resultMap.put("data", sendMedicineVos);
@@ -76,4 +75,32 @@ public class YfSpiritAnestheticPrintController {
             return resultMap;
         }
     }
+
+    /**
+     * 药房药品发药记录查询
+     * @param sendDrugRecordVo
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getSendDrugRecord",method = {RequestMethod.POST})
+    public Map<String, Object> getSendDrugRecord(@RequestBody SendDrugRecordVo sendDrugRecordVo) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(sendDrugRecordVo == null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "药品发药记录查询失败,参数为空");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("data", yfSpiritAnestheticPrintService.getSendDrugRecord(sendDrugRecordVo));
+            resultMap.put("message", "药品发药记录查询成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("药品发药记录查询失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "药品发药记录查询失败,错误原因【" + e.getMessage() + "】");
+            return resultMap;
+        }
+    }
 }

+ 183 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/yf/YfSpiritAnestheticPrintMapper.java

@@ -1,13 +1,14 @@
 package cn.hnthyy.thmz.mapper.his.yf;
 
 import cn.hnthyy.thmz.vo.MzSendMedicineVo;
+import cn.hnthyy.thmz.vo.SendDrugRecordVo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 
 /**
- *精麻药品查询统计
+ *药品发药查询统计
  */
 public interface YfSpiritAnestheticPrintMapper {
 
@@ -103,4 +104,185 @@ public interface YfSpiritAnestheticPrintMapper {
     "</script>"})
     List<MzSendMedicineVo> selectZySpiritAnestheticPrint(@Param("beginDate") String beginDate,@Param("endDate") String endDate,
                                                         @Param("chargeItemCode") String chargeItemCode,@Param("unitCode") String unitCode,@Param("drugFlags") String[] drugFlags);
+
+
+    /**
+     * 医技录入发药记录
+     * @param sendDrugRecordVo
+     * @return
+     */
+    @Select({"<script>" +
+            "SELECT b.name," +
+            "       i.sex," +
+            "       warn_dept_name=h.name," +
+            "       id=a.inpatient_no," +
+            "       icd_text=cast(b.admiss_diag_str as varchar(50))," +
+            "       drug_name=d.name," +
+            "       abbr_name=e.name," +
+            "       quantity = case when a.serial=d.serial then a.amount else a.amount/d.pack_size end," +
+            "       d.specification," +
+            "       charge_date=a.confirm_time," +
+            "       employee_name=c.name," +
+            "       charge_code=d.code," +
+            "       age=datediff(year,i.birth_date,getdate())," +
+            "       supply_name=''," +
+            "       frequency=''" +
+            " FROM  yp_zy_patient a," +
+            "       zy_patient b," +
+            "       a_employee_mi c," +
+            "       yp_zd_dict d," +
+            "       yp_zd_manufactory e," +
+            "       yp_zd_unit f ," +
+            "       zd_unit_code h," +
+            "       a_patient_mi i" +
+            " WHERE a.inpatient_no = b.inpatient_no and" +
+            "       a.admiss_times=b.admiss_times and" +
+            "       case when isnull(a.doctor_name,'00000')='00000' then a.drawer else a.doctor_name end *= c.code and" +
+            "       a.charge_code = d.code and" +
+            "       a.serial = d.serial and" +
+            "       d.manu_code*= e.code  and" +
+            "       a.inpatient_no*=i.inpatient_no and" +
+            "       b.admiss_dept=h.code and" +
+            "       <when test='sendDrugRecordVo.beginDate != null'>" +
+            "       a.confirm_time<![CDATA[>]]> #{sendDrugRecordVo.beginDate} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.endDate != null'>" +
+            "       a.confirm_time<![CDATA[<=]]>#{sendDrugRecordVo.endDate} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.chargeCode != null'>" +
+            "       a.charge_code = #{sendDrugRecordVo.chargeCode}  and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.serial != null'>" +
+            "       a.serial = #{sendDrugRecordVo.serial} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.warnDept != null'>" +
+            "       h.code = #{sendDrugRecordVo.warnDept} and" +
+            "       </when>" +
+            "       a.act_order_no = '3'" ,
+            " </script>"})
+    List<SendDrugRecordVo> selectYjRecord(@Param("sendDrugRecordVo") SendDrugRecordVo sendDrugRecordVo);
+
+    /**
+     * 住院发药记录
+     * @param sendDrugRecordVo
+     * @return
+     */
+    @Select({"<script>" +
+            "SELECT b.name," +
+            "       i.sex," +
+            "       warn_dept_name=h.name," +
+            "       id=a.inpatient_no," +
+            "       icd_text=cast(b.admiss_diag_str as varchar(50))," +
+            "       drug_name=d.name," +
+            "       abbr_name=e.name," +
+            "       quantity=case when a.serial=d.serial then a.amount else a.amount/d.pack_size end," +
+            "       d.specification," +
+            "       charge_date=a.confirm_time," +
+            "       employee_name=c.name," +
+            "       charge_code=d.code," +
+            "       age=datediff(year,i.birth_date,getdate())," +
+            "       k.supply_name," +
+            "       frequency=g.frequ_code" +
+            " FROM  yp_zy_patient a," +
+            "       zy_patient b," +
+            "       a_employee_mi c," +
+            "       yp_zd_dict d," +
+            "       yp_zd_manufactory e," +
+            "       zd_unit_code h," +
+            "       a_patient_mi i," +
+            "       view_yz_all_order g," +
+            "       yz_supply_type k" +
+            " WHERE  a.inpatient_no = b.inpatient_no and" +
+            "       a.admiss_times=b.admiss_times and" +
+            "       case when isnull(g.physician,'')='' then a.doctor_name else g.physician end*= c.code and" +
+            "       a.charge_code = d.code and" +
+            "       a.serial = d.serial and" +
+            "       d.manu_code*= e.code  and" +
+            "       a.inpatient_no*=i.inpatient_no and" +
+            "       b.admiss_dept=h.code and" +
+            "       a.act_order_no = g.act_order_no and" +
+            "       g.supply_code *= k.supply_code and" +
+            "       <when test='sendDrugRecordVo.beginDate != null'>" +
+            "       a.confirm_time<![CDATA[>]]>#{sendDrugRecordVo.beginDate} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.endDate != null'>" +
+            "       a.confirm_time<![CDATA[<=]]>#{sendDrugRecordVo.endDate} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.chargeCode != null'>" +
+            "       a.charge_code = #{sendDrugRecordVo.chargeCode}  and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.serial != null'>" +
+            "       a.serial = #{sendDrugRecordVo.serial} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.warnDept != null'>" +
+            "       h.code = #{sendDrugRecordVo.warnDept} and" +
+            "       </when>" +
+            "       a.act_order_no <![CDATA[<>]]> '3'" ,
+            " </script>"})
+    List<SendDrugRecordVo> selectZyRecord(@Param("sendDrugRecordVo") SendDrugRecordVo sendDrugRecordVo);
+
+    /**
+     * 门诊发药记录
+     * @param sendDrugRecordVo
+     * @return
+     */
+    @Select({"<script>" +
+            "SELECT b.name," +
+            "       b.sex," +
+            "       warn_dept_name=h.name," +
+            "       id=a.patient_id," +
+            "       icd_text=cast(i.icd_text as varchar(50))," +
+            "       drug_name=d.name," +
+            "       abbr_name=e.name," +
+            "       quantity = case when a.serial=d.serial then a.quantity*a.cy_fy else a.quantity*a.cy_fy/d.pack_size end," +
+            "       d.specification," +
+            "       charge_date=a.confirm_time," +
+            "       employee_name=c.name," +
+            "       charge_code=d.code," +
+            "       age=datediff(year,b.birth_day,getdate())," +
+            "       k.supply_name," +
+            "       g.frequency" +
+            " FROM  yp_mz_fytj a," +
+            "       mz_patient_mi b," +
+            "       a_employee_mi c," +
+            "       yp_zd_dict d," +
+            "       yp_zd_manufactory e," +
+            "       zd_unit_code h," +
+            "       mz_visit_table i," +
+            "       mz_charge_detail g," +
+            "       mz_zd_supply_type k" +
+            " WHERE  ( a.patient_id = b.patient_id ) and" +
+            "       ( a.doctor_id*= c.code ) and" +
+            "       ( a.charge_item_code = d.code ) and" +
+            "       ( a.serial = d.serial)  and" +
+            "       ( d.manu_code*= e.code ) and" +
+            "       a.warn_dept=h.code and" +
+            "       a.patient_id*=i.patient_id and" +
+            "       a.times*=i.times and" +
+            "       isnull(a.pay_mark,5)<![CDATA[<>]]> 5 and" +
+            "       a.patient_id = g.patient_id and" +
+            "       a.times = g.times and" +
+            "       a.receipt_no = g.receipt_no and" +
+            "       a.order_no = g.order_no and" +
+            "       a.item_no = g.item_no and" +
+            "       g.supply_code = k.supply_code and" +
+            "       <when test='sendDrugRecordVo.beginDate != null'>" +
+            "       a.confirm_time<![CDATA[>]]>#{sendDrugRecordVo.beginDate} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.endDate != null'>" +
+            "       a.confirm_time<![CDATA[<=]]>#{sendDrugRecordVo.endDate} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.chargeCode != null'>" +
+            "       a.charge_item_code = #{sendDrugRecordVo.chargeCode}  and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.serial != null'>" +
+            "       a.serial = #{sendDrugRecordVo.serial} and" +
+            "       </when>" +
+            "       <when test='sendDrugRecordVo.warnDept != null'>" +
+            "       h.code = #{sendDrugRecordVo.warnDept} and" +
+            "       </when>" +
+            "       1=1 order by d.code" ,
+            " </script>"})
+    List<SendDrugRecordVo> selectMzRecord(@Param("sendDrugRecordVo") SendDrugRecordVo sendDrugRecordVo);
+
 }

+ 8 - 1
src/main/java/cn/hnthyy/thmz/service/his/yf/YfSpiritAnestheticPrintService.java

@@ -1,11 +1,12 @@
 package cn.hnthyy.thmz.service.his.yf;
 
 import cn.hnthyy.thmz.vo.MzSendMedicineVo;
+import cn.hnthyy.thmz.vo.SendDrugRecordVo;
 
 import java.util.List;
 
 /**
- * @description:精麻药品查询统计
+ * @description:药品发药查询统计
  * @author: WANGJIALIANG
  * @time: 2021/10/12 16:21
  */
@@ -34,4 +35,10 @@ public interface YfSpiritAnestheticPrintService {
      */
     List<MzSendMedicineVo> queryZySpiritAnestheticPrint(String beginDate, String endDate,
                                                          String chargeItemCode, String unitCode, String[] drugFlags);
+    /**
+     * 查询发药记录
+     * @param sendDrugRecordVo
+     * @return
+     */
+    List<SendDrugRecordVo> getSendDrugRecord(SendDrugRecordVo sendDrugRecordVo);
 }

+ 18 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/yf/YfSpiritAnestheticPrintServiceImpl.java

@@ -3,9 +3,11 @@ package cn.hnthyy.thmz.service.impl.his.yf;
 import cn.hnthyy.thmz.mapper.his.yf.YfSpiritAnestheticPrintMapper;
 import cn.hnthyy.thmz.service.his.yf.YfSpiritAnestheticPrintService;
 import cn.hnthyy.thmz.vo.MzSendMedicineVo;
+import cn.hnthyy.thmz.vo.SendDrugRecordVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Service
@@ -23,4 +25,20 @@ public class YfSpiritAnestheticPrintServiceImpl implements YfSpiritAnestheticPri
     public List<MzSendMedicineVo> queryZySpiritAnestheticPrint(String beginDate, String endDate, String chargeItemCode, String unitCode, String[] drugFlags) {
         return yfSpiritAnestheticPrintMapper.selectZySpiritAnestheticPrint(beginDate, endDate, chargeItemCode, unitCode, drugFlags);
     }
+
+    @Override
+    public List<SendDrugRecordVo> getSendDrugRecord(SendDrugRecordVo sendDrugRecordVo) {
+        ArrayList<SendDrugRecordVo> sendDrugRecordVos = new ArrayList<>();
+        if(sendDrugRecordVo.getQueryScope() == 0){
+            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectYjRecord(sendDrugRecordVo));
+            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectZyRecord(sendDrugRecordVo));
+            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectMzRecord(sendDrugRecordVo));
+        }else if(sendDrugRecordVo.getQueryScope() == 1){
+            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectMzRecord(sendDrugRecordVo));
+        }else if(sendDrugRecordVo.getQueryScope() == 2){
+            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectYjRecord(sendDrugRecordVo));
+            sendDrugRecordVos.addAll(yfSpiritAnestheticPrintMapper.selectZyRecord(sendDrugRecordVo));
+        }
+        return sendDrugRecordVos;
+    }
 }

+ 63 - 0
src/main/java/cn/hnthyy/thmz/vo/SendDrugRecordVo.java

@@ -0,0 +1,63 @@
+package cn.hnthyy.thmz.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 药房药品发药记录
+ */
+@Data
+public class SendDrugRecordVo implements Serializable {
+    //病人ID码
+    private String id;
+    //病人名称
+    private String name;
+    //性别  1-男 2-女 0 未知 GenderEnum
+    private Integer sex;
+    //出生日期
+    private Date birthDay;
+    //年龄
+    private Integer age;
+    //申请科室
+    private String warnDeptName;
+    //申请科室编码
+    private String warnDept;
+    //诊断
+    private String icdText;
+    //药品名称
+    private String drugName;
+    //生产厂家
+    private String abbrName;
+    //数量
+    private String quantity;
+    //规格
+    private String specification;
+    //发药时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date chargeDate;
+    //申请医生
+    private String employeeName;
+    //药品编码
+    private String chargeCode;
+    //给药方式
+    private String supplyName;
+    //频率
+    private String frequency;
+    //规格  01 小包装 99 大包装
+    private String serial;
+    //开始时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date beginDate;
+    //结束时间
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date endDate;
+    //来源 0全部 1门诊 2住院
+    private Integer queryScope;
+}

+ 125 - 1
src/main/resources/static/js/common/pharmacy-com.js

@@ -2,7 +2,7 @@
 /**
  * 加载药品搜索窗口
  */
-function initDrugSearchList() {
+/*function initDrugSearchList() {
     var settings = {
         placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left  要显示的位置
         trigger: 'click', //值:click,hover 触发方式
@@ -21,6 +21,29 @@ function initDrugSearchList() {
     //药品弹窗
     settings.content = '<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>';
     $('#searchText').webuiPopover('destroy').webuiPopover(settings);
+}*/
+
+/**
+ * 加载搜索窗口
+ */
+function initSearchList(content, searchTextId, width, height) {
+    var settings = {
+        placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left  要显示的位置
+        trigger: 'click', //值:click,hover 触发方式
+        content: '',//内容,内容可以是函数
+        width: width,
+        //arrow:false,//是否显示箭头
+        multi: true,//在页面允许其他弹出层
+        closeable: true,//显示关闭按钮
+        style: '', //值:'',inverse
+        delay: 300,//延迟时间, 悬浮属性才执行
+        padding: true,//内容填充
+        height: height,
+        //offsetTop:10,
+        cache: true,//如果缓存设置为false,则popover将销毁并重新创建
+        content: content
+    };
+    $('#' + searchTextId).webuiPopover('destroy').webuiPopover(settings);
 }
 
 /**
@@ -113,4 +136,105 @@ function setDefaultPrint() {
             }
         }
     });
+}
+
+//显示查询所有药品悬浮窗
+function showDrugPopover() {
+    $('#tb_table_medicine').bootstrapTable('destroy');
+    $('#tb_table_medicine').bootstrapTable({
+        url: '/thmz/getYp',         //请求后台的URL(*)
+        method: 'GET',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: true,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: false,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "asc",                   //排序方式
+        queryParams: {
+            searchTextDrug: $("#searchTextDrug").val() == "" ? null : $("#searchTextDrug").val(),
+        },
+        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 5,                       //每页的记录行数(*)
+        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数(*)
+        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
+        strictSearch: true,
+        showColumns: false,                  //是否显示所有的列
+        showRefresh: false,                  //是否显示刷新按钮
+        minimumCountColumns: 2,             //最少允许的列数
+        clickToSelect: true,                //是否启用点击选中行
+        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列
+        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
+        cardView: false,                    //是否显示详细视图
+        detailView: false,
+        //rowStyle:rowStyle,//通过自定义函数设置行样式
+        ajaxOptions: {
+            headers: {
+                'Accept': 'application/json',
+                'Authorization': 'Bearer ' + localStorage.getItem("token")
+            }
+        },
+        columns: [
+            {
+                field: 'code',
+                title: '编码',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'name',
+                title: '药品名',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'manufactoryName',
+                title: '厂家',
+                align: "center",
+                valign: 'middle'
+            },
+            {
+                field: 'specification',
+                title: '规格',
+                align: "center",
+                valign: 'middle'
+            },
+            {
+                field: 'packRetprice',
+                title: '零售价',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'delFlag',
+                title: '已作废',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    return value == 1 ? '<span style="color: red">是</span>' : '否';
+                }
+            }
+        ],
+        responseHandler: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            var ress = eval(res);
+            if (ress.code == -1) {
+                errorMesage(res);
+                return {
+                    "total": 0,//总页数
+                    "rows": {}   //数据
+                };
+            }
+            return {
+                "total": ress.data.length,//总页数
+                "rows": ress.data   //数据
+            };
+        },
+        onClickRow: function (row, $element) {
+            $('#searchTextDrug').webuiPopover('hide');
+            $('#codeSearch').val(row.code);
+            $('#serialSearch').val(row.serial);
+            $('#searchTextDrug').val(row.name);
+        }
+    });
 }

+ 2 - 1
src/main/resources/static/js/yf/drug_apply.js

@@ -48,7 +48,8 @@ $(function () {
     init_daterangepicker();
     $('#reportrange span').html(moment().subtract(29, 'days').format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
     //初始化药品查询弹出框
-    initDrugSearchList();
+    initSearchList('<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>',
+        'searchText', 600, 200);
     $('#searchText').on('input focus',function(e){
         showDrugPopover();
     });

+ 8 - 106
src/main/resources/static/js/yf/incoming_records.js

@@ -24,6 +24,10 @@ $(function () {
         'manufactoryNameSearch', 350, 250);
     $('#searchTextDrug').on('input focus', function (e) {
         showDrugPopover();
+        if ($('#searchTextDrug').val().length == 0) {
+            $('#codeSearch').val("");
+            $('#serialSearch').val("");
+        }
     });
     $('#inputNameSearch').on('input focus', function (e) {
         showEmployeePopover();
@@ -33,108 +37,6 @@ $(function () {
     });
 });
 
-//显示查询的药品悬浮窗
-function showDrugPopover() {
-    if ($('#searchTextDrug').val().length == 0) {
-        $('#chargeCode').val("");
-        $('#serial').val("");
-    }
-    $('#tb_table_medicine').bootstrapTable('destroy');
-    $('#tb_table_medicine').bootstrapTable({
-        url: '/thmz/getYp',         //请求后台的URL(*)
-        method: 'GET',                      //请求方式(*)
-        toolbar: '#toolbar',                //工具按钮用哪个容器
-        striped: true,                      //是否显示行间隔色
-        cache: true,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
-        pagination: false,                   //是否显示分页(*)
-        sortable: true,                     //是否启用排序
-        sortOrder: "asc",                   //排序方式
-        queryParams: {
-            searchTextDrug: $("#searchTextDrug").val() == "" ? null : $("#searchTextDrug").val(),
-        },           //传递参数(*)
-        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
-        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
-        strictSearch: true,
-        showColumns: false,                  //是否显示所有的列
-        showRefresh: false,                  //是否显示刷新按钮
-        minimumCountColumns: 2,             //最少允许的列数
-        clickToSelect: true,                //是否启用点击选中行
-        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列
-        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
-        cardView: false,                    //是否显示详细视图
-        detailView: false,
-        //rowStyle:rowStyle,//通过自定义函数设置行样式
-        ajaxOptions: {
-            headers: {
-                'Accept': 'application/json',
-                'Authorization': 'Bearer ' + localStorage.getItem("token")
-            }
-        },
-        columns: [
-            {
-                field: 'code',
-                title: '编码',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'name',
-                title: '药品名',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'manufactoryName',
-                title: '厂家',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'specification',
-                title: '规格',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'packRetprice',
-                title: '零售价',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'delFlag',
-                title: '已作废',
-                align: "center",
-                valign: 'middle',
-                formatter: function (value, row, index) {
-                    return value == 1 ? '<span style="color: red">是</span>' : '否';
-                }
-            }
-        ],
-        responseHandler: function (res) {
-            if (res == '401' || res == 401) {
-                window.location.href = '/thmz/login/view'
-                return;
-            }
-            var ress = eval(res);
-            if (ress.code == -1) {
-                errorMesage(res);
-                return {
-                    "total": 0,//总页数
-                    "rows": {}   //数据
-                };
-            }
-
-            return {
-                "total": ress.data.length,//总页数
-                "rows": ress.data   //数据
-            };
-        },
-        onClickRow: function (row, $element) {
-            $('#searchTextDrug').webuiPopover('hide');
-            $('#searchTextDrug').val(row.name);
-            $('#chargeCode').val(row.code);
-            $('#serial').val(row.serial);
-        }
-    });
-}
 
 //显示查询的医生悬浮窗
 function showEmployeePopover() {
@@ -329,8 +231,8 @@ function initTable() {
  * 重置查询表单
  */
 function resetSearch() {
-    $("#chargeCode").val(null);
-    $("#serial").val(null);
+    $("#codeSearch").val(null);
+    $("#serialSearch").val(null);
     $("#manuCode").val(null);
     $("#inputId").val(null);
     $("#manufactoryNameSearch").val(null);
@@ -412,8 +314,8 @@ function getAll() {
         var temp = {
             'beginTime': rePortRangeArr[0],
             'endTime': rePortRangeArr[1],
-            'chargeCode': $("#chargeCode").val(),
-            'serial': $("#serial").val(),
+            'chargeCode': $("#codeSearch").val(),
+            'serial': $("#serialSearch").val(),
             'manuCode': $("#manuCode").val(),
             'inputId': $("#inputId").val(),
             'inDocuNo': $("#yfInNoSearch").val(),

+ 201 - 153
src/main/resources/static/js/yf/spirit_anesthetic_print.js

@@ -6,14 +6,18 @@ $(function () {
     setTimeout(function () {
         getLodop();
     }, 800);
-
+    $("#jmtj_table").hide();
     $(".selectpicker").selectpicker({
         dropuAuto: false
     });
 
     //初始化页面上面的按钮事件
     $("#btn_search").click(function (t) {
-        getSpiritAnestheticPrintData();
+        if($('#drugFlagSearch').val() == 0){
+            getSendDrugRecordData();
+        }else{
+            getSpiritAnestheticPrintData();
+        }
     });
     $('#btn_clean').click(function () {
         cleanParams();
@@ -24,36 +28,47 @@ $(function () {
     $("#drugFlagSearch").change(function (t,d,e) {
         let drugFlag = $("#drugFlagSearch").val();
         let title = "";
-        if(drugFlag == 0){
-            title = "麻醉药品、精神一类药品使用登记"
-        }else if(drugFlag == 1){
-            title = "终止妊娠药统计"
+        if(drugFlag == 1){
+            title = "麻醉药品、精神一类药品使用登记";
+            $("#jmtj_table").show();
+            $("#qbtj_table").hide();
         }else if(drugFlag == 2){
-            title = "精二及麻黄碱类统计"
+            title = "终止妊娠药统计";
+            $("#jmtj_table").show();
+            $("#qbtj_table").hide();
+        }else if(drugFlag == 3){
+            title = "精二及麻黄碱类统计";
+            $("#jmtj_table").show();
+            $("#qbtj_table").hide();
+        }else if(drugFlag == 0){
+            title = "药品发药明细统计表";
+            $("#qbtj_table").show();
+            $("#jmtj_table").hide();
         }
-        $("#title").html(title);
-        $("#dateRange").html($('#reportrange span').html());
-        $("#printDate").html(format(new Date(),"yyyy-MM-dd HH:mm"));
+        $(".title").html(title);
+        $(".dateRange").html($('#reportrange span').html());
+        $(".printDate").html(format(new Date(),"yyyy-MM-dd HH:mm"));
     });
 
     //初始化药品查询弹出框
-    initDrugSearchList();
-    $('#searchText').on('input focus',function(e){
+    initSearchList('<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>',
+        'searchTextDrug', 700, 250);
+    $('#searchTextDrug').on('input focus',function(e){
         showDrugPopover();
-        if($('#searchText').val() == ''){
+        if($('#searchTextDrug').val() == ''){
             $('#codeSearch').val("");
+            $('#serialSearch').val("");
         }
     });
 });
 
 
 /**
- * 获取统计报表
+ * 获取精麻药统计报表
  */
 function getSpiritAnestheticPrintData() {
-    $("#dateRange").html($('#reportrange span').html());
-    $("#printDate").html(format(new Date(),"yyyy-MM-dd HH:mm"));
-    $('#searchText').html(format(new Date(),"yyyy-MM-dd HH:mm"));
+    $(".dateRange").html($('#reportrange span').html());
+    $(".printDate").html(format(new Date(),"yyyy-MM-dd HH:mm"));
     $.ajax({
         type: "GET",
         url: '/thmz/getSpiritAnestheticPrint',
@@ -76,12 +91,6 @@ function getSpiritAnestheticPrintData() {
                     let data = res.data[i];
                     if(code == ''){
                         code = data.chargeItemCode;
-                        if(number > 0){
-                            html += '<tr class="sjh">';
-                            html += '<td colspan="15" style="text-align: center;font-weight: 700;">共计:' + number + '</td>';
-                            html += '</tr>';
-                            number = 0;
-                        }
                         number += parseFloat(data.quantity);
                     }else if(code == data.chargeItemCode){
                         number += parseFloat(data.quantity);
@@ -89,7 +98,7 @@ function getSpiritAnestheticPrintData() {
                         html += '<tr class="sjh">';
                         html += '<td colspan="15" style="text-align: center;font-weight: 700;">共计:' + number + '</td>';
                         html += '</tr>';
-                        code = '';
+                        code = data.chargeItemCode;
                         number = parseFloat(data.quantity);
                     }
                     if(data.sex == 1){
@@ -100,27 +109,37 @@ function getSpiritAnestheticPrintData() {
                         sex = "未知"
                     }
                     html += '<tr class="sjh">';
-                    html += '<td style="text-align: center;">' + data.chargeDate.substring(5,11) + '</td>';
-                    html += '<td style="text-align: center;">' + data.patientId + '</td>';
-                    html += '<td style="text-align: center;">' + data.name + '</td>';
-                    html += '<td style="text-align: center;">' + sex + '</td>';
-                    html += '<td style="text-align: center;">' + data.age + '</td>';
-                    html += '<td>' + data.socialNo + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.chargeDate.substring(5,11) + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.patientId + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.name + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + sex + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.age + '</td>';
+                    html += '<td style="mso-number-format: \'\\@\';">' + data.socialNo + '</td>';
                     html += '<td>' + data.icdText + '</td>';
-                    html += '<td style="text-align: center;">' + data.chargeItemCode + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.chargeItemCode + '</td>';
                     html += '<td>' + data.drugname + '</td>';
                     html += '<td>' + data.specification + '</td>';
-                    html += '<td style="text-align: center;">' + data.quantity + '</td>';
-                    html += '<td style="text-align: center;">' + data.employeeName + '</td>';
-                    html += '<td style="text-align: center;">' + data.warnDeptName + '</td>';
-                    html += '<td></td>';
-                    html += '<td></td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.quantity + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.employeeName + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.warnDeptName + '</td>';
+                    html += '<td class="xtd" ></td>';
+                    html += '<td class="xtd" ></td>';
                     html += '</tr>';
                 }
                 html += '<tr class="sjh">';
                 html += '<td colspan="15" style="text-align: center;font-weight: 700;">共计:' + number + '</td>';
                 html += '</tr>';
-                $("#tj_table").append(html);
+                $("#jmtj_table").append(html);
+                let drugFlag = $("#drugFlagSearch").val();
+                let title = "";
+                if(drugFlag == 1){
+                    title = "麻醉药品、精神一类药品使用登记";
+                }else if(drugFlag == 2){
+                    title = "终止妊娠药统计";
+                }else if(drugFlag == 3){
+                    title = "精二及麻黄碱类统计";
+                }
+                tableToExcel('jmtj_table', title);
             } else if (res.code == -1) {
                 new PNotify({
                     title: '错误提示',
@@ -134,6 +153,103 @@ function getSpiritAnestheticPrintData() {
     });
 }
 
+/**
+ * 获取所有药品类型统计报表
+ */
+function getSendDrugRecordData() {
+    $(".dateRange").html($('#reportrange span').html());
+    $(".printDate").html(format(new Date(),"yyyy-MM-dd HH:mm"));
+    $.ajax({
+        type: "POST",
+        url: '/thmz/getSendDrugRecord',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: JSON.stringify({
+            'beginDate': getRePortRangeArr()[0],
+            'endDate': getRePortRangeArr()[1],
+            'chargeCode': $('#codeSearch').val()==''?null:$('#codeSearch').val(),
+            'serial': $('#serialSearch').val()==''?null:$('#serialSearch').val(),
+            'warnDept': $('#unitCodeSearch').val()!=null?$('#unitCodeSearch').val()[0]:null,
+            'queryScope': $("#queryScopeSearch").val()
+        }),
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                let html = '';
+                let flag = '';//区分门诊住院 -1住院 其它门诊
+                let number = 0;
+                let totalNumber = 0;
+                let sex;
+                $('.sjh').remove();
+                for (var i = 0; i < res.data.length; i++) {
+                    let data = res.data[i];
+                    if(flag == ''){
+                        flag = data.id.indexOf("-")!=-1?'0':'1';
+                        number += parseFloat(data.quantity);
+                    }else if(flag == (data.id.indexOf("-")!=-1?'0':'1')){
+                        number += parseFloat(data.quantity);
+                    }else{
+                        html += '<tr class="sjh">';
+                        html += '<td colspan="11" style="text-align: right;font-weight: 700;">小计:' + number + '</td>';
+                        html += '<td colspan="5"></td>';
+                        html += '</tr>';
+                        flag = data.id.indexOf("-")!=-1?'0':'1';
+                        totalNumber += number;
+                        number = parseFloat(data.quantity);
+                    }
+                    if(data.sex == 1){
+                        sex = "男"
+                    }else if(data.sex == 2){
+                        sex = "女"
+                    }else{
+                        sex = "未知"
+                    }
+                    let queryScope = data.id.indexOf("-")!=-1?'门诊':'住院';
+                    html += '<tr class="sjh">';
+                    html += '<td class="xtd" style="text-align: center;">' + data.id + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.name + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + sex + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.age + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.warnDeptName + '</td>';
+                    html += '<td>' + data.icdText + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.chargeCode + '</td>';
+                    html += '<td>' + data.drugName + '</td>';
+                    html += '<td>' + data.specification + '</td>';
+                    html += '<td>' + data.abbrName + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.quantity + '</td>';
+                    html += '<td style="text-align: center;">' + data.chargeDate + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.employeeName + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.supplyName + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + data.frequency + '</td>';
+                    html += '<td class="xtd" style="text-align: center;">' + queryScope + '</td>';
+                    html += '</tr>';
+                }
+                html += '<tr class="sjh">';
+                html += '<td colspan="11" style="text-align: right;font-weight: 700;">小计:' + number + '</td>';
+                html += '<td colspan="5"></td>';
+                html += '</tr>';
+                html += '<tr class="sjh">';
+                html += '<td colspan="11" style="text-align: right;font-weight: 700;">总计:' + parseFloat(totalNumber+number) + '</td>';
+                html += '<td colspan="5"></td>';
+                html += '</tr>';
+                $("#qbtj_table").append(html);
+                tableToExcel('qbtj_table', '药品发药明细统计表');
+            } else if (res.code == -1) {
+                new PNotify({
+                    title: '错误提示',
+                    text: res.message,
+                    type: 'error',
+                    hide: true,
+                    styling: 'bootstrap3'
+                });
+            }
+        }
+    });
+}
 
 /**
  * 获取按钮组选择的下标
@@ -171,9 +287,13 @@ function cleanParams() {
     $('#reportrange span').html(moment().subtract(1, 'days').format("YYYY-MM-DD 14:00:00") + ' - ' + moment().format("YYYY-MM-DD 13:59:59"));
     $('#unitCodeSearch').empty();
     $('#drugFlagSearch').val(0);
+    $('#qbtj_table').show();
+    $('#jmtj_table').hide();
+    $('.sjh').remove();
     $('#drugFlagSearch').selectpicker('refresh');
-    $('#searchText').empty();
+    $('#searchTextDrug').empty();
     $('#codeSearch').empty();
+    $('#serialSearch').empty();
 }
 
 /**
@@ -182,7 +302,7 @@ function cleanParams() {
 function print() {
     setDefaultPrint();
     LODOP = getLodop();
-    LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "药房精麻药品发放统计表");
+    LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "药品发放统计表");
     LODOP.SET_PRINT_PAGESIZE(2, 0, 0,"A4");
     //设置默认打印机
     LODOP.SET_PRINTER_INDEX(defaultPrintIndex);
@@ -195,117 +315,8 @@ function print() {
     var strStyle="<style>table{width: 1050px;} table,td,th {border-width: 1px;" +
         "border-style: solid;border-collapse: collapse;table-layout:fixed;word-wrap:break-word;font-size: 14px}</style>";
     LODOP.ADD_PRINT_HTM("0mm", "2mm", "RightMargin:0mm", "BottomMargin:15mm",strStyle+ document.getElementById("report_table_1").innerHTML);
-    LODOP.PRINT();
-    //LODOP.PREVIEW();
-}
-
-
-//显示查询的药品悬浮窗
-function showDrugPopover() {
-    $('#tb_table_medicine').bootstrapTable('destroy');
-    $('#tb_table_medicine').bootstrapTable({
-        url: '/thmz/getYpZdDictBase',         //请求后台的URL(*)
-        method: 'GET',                      //请求方式(*)
-        toolbar: '#toolbar',                //工具按钮用哪个容器
-        striped: true,                      //是否显示行间隔色
-        cache: true,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
-        pagination: false,                   //是否显示分页(*)
-        sortable: true,                     //是否启用排序
-        sortOrder: "asc",                   //排序方式
-        queryParams:queryParamsDrugTable,           //传递参数(*)
-        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
-        pageNumber: 1,                       //初始化加载第一页,默认第一页
-        pageSize: 5,                       //每页的记录行数(*)
-        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数(*)
-        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
-        strictSearch: true,
-        showColumns: false,                  //是否显示所有的列
-        showRefresh: false,                  //是否显示刷新按钮
-        minimumCountColumns: 2,             //最少允许的列数
-        clickToSelect: true,                //是否启用点击选中行
-        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列
-        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
-        cardView: false,                    //是否显示详细视图
-        detailView: false,
-        //rowStyle:rowStyle,//通过自定义函数设置行样式
-        ajaxOptions: {
-            headers: {
-                'Accept': 'application/json',
-                'Authorization': 'Bearer ' + localStorage.getItem("token")
-            }
-        },
-        columns: [
-            {
-                field: 'code',
-                title: '编码',
-                align: "center",
-                valign: 'middle'
-            },{
-                field: 'name',
-                title: '药品名',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'specification',
-                title: '规格',
-                align: "center",
-                valign: 'middle'
-            }, {
-                field: 'manufactoryName',
-                title: '厂家',
-                align: "center",
-                valign: 'middle'
-            },
-            {
-                field: 'packRetprice',
-                title: '单价',
-                align: "center",
-                visible: false,
-                valign: 'middle'
-            }, {
-                field: 'stockAmount',
-                title: '药库库存',
-                align: "center",
-                visible: false,
-                valign: 'middle'
-            }
-        ],
-        responseHandler: function (res) {
-            if (res == '401' || res == 401) {
-                window.location.href = '/thmz/login/view'
-                return;
-            }
-            var ress = eval(res);
-            if (ress.code == -1) {
-                errorMesage(res);
-                return {
-                    "total": 0,//总页数
-                    "rows": {}   //数据
-                };
-            }
-            return {
-                "total": ress.data.length,//总页数
-                "rows": ress.data   //数据
-            };
-        },
-        onClickRow: function (row, $element) {
-            $('#searchText').webuiPopover('hide');
-            $('#codeSearch').val(row.code);
-            $('#searchText').val(row.name);
-        }
-    });
-}
-
-/**
- * 药品列表查询参数
- */
-function queryParamsDrugTable() {
-    var temp = {
-        groupYk: 11,
-        searchText: $("#searchText").val() == "" ? null : $("#searchText").val(),
-    };
-    return temp;
+    //LODOP.PRINT();
+    LODOP.PREVIEW();
 }
 
 /**
@@ -314,12 +325,12 @@ function queryParamsDrugTable() {
 function queryParams() {
     let drugFlags = new Array();
     let flag = $("#drugFlagSearch").val();
-    if(flag == 0){
+    if(flag == 1){
         drugFlags[0] = 2;
         drugFlags[1] = 3;
-    }else if(flag == 1){
-        drugFlags[0] = 6;
     }else if(flag == 2){
+        drugFlags[0] = 6;
+    }else if(flag == 3){
         drugFlags[0] = 1;
         drugFlags[1] = 4;
         drugFlags[2] = 5;
@@ -382,4 +393,41 @@ function init_daterangepickertime() {
         $('#reportrange span').html(start.format('YYYY-MM-DD HH:mm:ss') + ' - ' + end.format('YYYY-MM-DD HH:mm:ss'));
     });
     $('#reportrange span').html(moment().subtract(1, 'days').format("YYYY-MM-DD 14:00:00") + ' - ' + moment().format("YYYY-MM-DD 13:59:59"));
+}
+
+//base64转码
+function base64(s) {
+    return window.btoa(unescape(encodeURIComponent(s)));
+};
+//替换table数据和worksheet名字
+function format1(s, c) {
+    return s.replace(/{(\w+)}/g,
+        function (m, p) {
+            return c[p];
+        });
+};
+function tableToExcel(tableid, sheetName) {
+    var uri = 'data:application/vnd.ms-excel;base64,';
+    var template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"' +
+        'xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>'
+        + '<x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets>'
+        + '</x:ExcelWorkbook></xml><![endif]-->' +
+        '<style type="text/css">' +
+        'table td{' +
+        'border: 1px solid #000000;' +
+        'width: 150px;' +
+        'height: 30px;' +
+        'text-align: center;' +
+        '}' +
+        '.xtd{' +
+        'border: 1px solid #000000;' +
+        'width: 50px;' +
+        'height: 30px;' +
+        'text-align: center;' +
+        '}' +
+        '</style>' +
+        '</head><body ><table class="excelTable">{table}</table></body></html>';
+    if (!tableid.nodeType) tableid = document.getElementById(tableid);
+    var ctx = {worksheet: sheetName || 'Worksheet', table: tableid.innerHTML};
+    $("#btn_excel").attr('href',uri + base64(format1(template, ctx)));
 }

+ 2 - 1
src/main/resources/static/js/yf/yf_divide.js

@@ -5,7 +5,8 @@ $(function () {
     $(".selectpicker").selectpicker();
     $("#pharmacyModal").modal("show");
     //初始化药品查询弹出框
-    initDrugSearchList();
+    initSearchList('<div id="medicinePopoverContent"><table id="tb_table_medicine"></table></div>',
+        'searchText', 600, 200);
     $('#searchText').on('input focus',function(e){
         showDrugPopover();
     });

+ 3 - 2
src/main/resources/templates/yf/incoming_records.html

@@ -6,6 +6,7 @@
 <script src="/thmz/js/dependent/daterangepicker.js"></script>
 <script src="/thmz/js/dependent/bootstrap-select.js"></script>
 <script src="/thmz/js/dependent/jquery.webui-popover.min.js"></script>
+<script src="/thmz/js/common/pharmacy-com.js"></script>
 <script src="/thmz/js/jqGrid/grid.locale-cn.js"></script>
 <script src="/thmz/js/jqGrid/jquery.jqGrid.min.js"></script>
 <script src="/thmz/js/yf/incoming_records.js"></script>
@@ -14,8 +15,8 @@
         <div class="x_panel" style="background: #EBEBE4;">
             <div class="panel-body">
                 <form id="formSearch" class="form-horizontal" autocomplete="off">
-                    <input id="chargeCode" class="form-control optional" type="hidden" >
-                    <input id="serial" class="form-control optional" type="hidden" >
+                    <input id="codeSearch" class="form-control optional" type="hidden" >
+                    <input id="serialSearch" class="form-control optional" type="hidden" >
                     <input id="manuCode" class="form-control optional" type="hidden" >
                     <input id="inputId" class="form-control optional" type="hidden" >
                     <div class="item form-group ">

+ 58 - 28
src/main/resources/templates/yf/spirit_anesthetic_print.html

@@ -9,6 +9,7 @@
 <script src="/thmz/js/dependent/jquery.webui-popover.min.js"></script>
 <script src="/thmz/js/common/pharmacy-com.js"></script>
 <script src="/thmz/js/yf/spirit_anesthetic_print.js"></script>
+<script src="/thmz/js/dependent/jquery.table2excel.min.js"></script>
 <script src="/thmz/js/dependent/LodopFuncs.js"></script>
 <title>精麻药查询统计</title>
 <!-- 打印的样式-->
@@ -18,17 +19,13 @@
         margin: 0mm;
     }
 </style>
-<style>
-    .receipt {
-        padding-left: 40px;
-    }
-</style>
 <div class="row" style="height: calc(100% - 00px);">
     <div class="col-md-12 col-sm-12 col-xs-12" style="height: 100%">
         <div class="x_panel" style="height: 100%">
             <div class="panel-body">
                 <form id="formSearch" class="form-horizontal" autocomplete="off">
                     <input type="hidden" id="codeSearch">
+                    <input type="hidden" id="serialSearch">
                     <div class="form-group col-md-12 col-sm-12 col-xs-12">
                         <div class="col-md-3 col-sm-3 col-xs-12">
                             <label class="control-label col-md-4 col-sm-4 col-xs-12"
@@ -61,23 +58,24 @@
                             </select>
                         </div>
                     </div>
-                    <div class="form-group">
+                    <div class="form-group col-md-12 col-sm-12 col-xs-12">
                         <div class="col-md-3 col-sm-3 col-xs-12">
                             <label class="control-label col-md-4 col-sm-4 col-xs-12"
                                    for="drugFlagSearch">药品类型</label>
                             <div class="col-md-8 col-sm-8 col-xs-12">
                                 <select class="form-control selectpicker show-tick" required="required" title="请选择"
                                         id="drugFlagSearch">
-                                    <option value="0" selected>麻、精一</option>
-                                    <option value="1">终止妊娠药</option>
-                                    <option value="2">精二及麻黄碱类</option>
+                                    <option value="0" selected>全部</option>
+                                    <option value="1">麻、精一</option>
+                                    <option value="2">终止妊娠药</option>
+                                    <option value="3">精二及麻黄碱类</option>
                                 </select>
                             </div>
                         </div>
-                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="searchText">药品
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="searchTextDrug">药品
                         </label>
                         <div class="col-md-2 col-sm-2 col-xs-12">
-                            <input id="searchText" class="form-control optional" type="text">
+                            <input id="searchTextDrug" class="form-control optional" type="text">
                         </div>
                         <button type="button" id="btn_search" class="btn btn-primary"
                                 title="查询"><i class="glyphicon glyphicon-search"></i>
@@ -88,34 +86,66 @@
                         <button type="button" id="btn_daily" class="btn btn-primary"
                                 title="打印"><i class="fa fa-print"></i>
                         </button>
+                        <a id="btn_excel" class="btn btn-primary"
+                           title="导出Excel"><i class="fa fa-file-excel-o"></i>
+                        </a>
                     </div>
                 </form>
             </div>
             <div id="report_table"
                  style="width:1300px;height: calc(100% - 160px);margin:0 auto;border: 1px solid #337ab7;font-size: 14px;padding: 40px 10px 40px 10px;overflow: scroll">
                 <div id="report_table_1">
-                    <h3 style="text-align:center;font-weight: 700;" id="title">麻醉药品、精神一类药品使用登记</h3>
-                    <div style="text-align:center;margin-top: 20px;">
-                        <span>日期范围:</span><span id="dateRange">2021-10-12 14:00:00 - 2021-10-13 13:59:59</span>
-                        <span style="margin-left: 120px;">打印日期:</span><span id="printDate"></span>
-                    </div>
-                    <table id="tj_table" class="table table-striped table-bordered" style="margin-top: 0px;">
+                    <table id="qbtj_table" class="table table-striped table-bordered" style="margin-top: 0px;">
+                        <tr style="font-weight: 700;background-color: #EBEBE4">
+                            <td colspan="16" style="font-size: 21px;text-align: center;border: transparent !important;"><span class="title">药品发药明细统计表</span></td>
+                        </tr>
+                        <tr style="font-weight: 700;background-color: #EBEBE4">
+                            <td colspan="8" style="text-align: left;border: transparent !important;">日期范围:<span class="dateRange"></span></td>
+                            <td colspan="8" style="text-align: right;border: transparent !important;">打印日期:<span class="printDate"></span></td>
+                        </tr>
+                        <tr>
+                            <td class="xtd" style="text-align: center;width: 50px;">病人ID</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">姓名</td>
+                            <td class="xtd" style="text-align: center;width: 30px;">性别</td>
+                            <td class="xtd" style="text-align: center;width: 30px;">年龄</td>
+                            <td class="xtd" style="text-align: center;width: 65px;">科室</td>
+                            <td style="text-align: center;width: 120px;">诊断</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">编码</td>
+                            <td style="text-align: center;width: 80px;">药名</td>
+                            <td style="text-align: center;width: 70px;">规格</td>
+                            <td style="text-align: center;width: 80px;">厂商</td>
+                            <td class="xtd" style="text-align: center;width: 30px;">数量</td>
+                            <td style="text-align: center;width: 45px;">发药日期</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">医师</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">给药方式</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">频率</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">来源</td>
+                        </tr>
+                    </table>
+                    <table id="jmtj_table" class="table table-striped table-bordered" style="margin-top: 0px;">
+                        <tr style="font-weight: 700;background-color: #EBEBE4">
+                            <td colspan="15" style="font-size: 21px;text-align: center;border: transparent !important;"><span class="title">药品发药明细统计表</span></td>
+                        </tr>
+                        <tr style="font-weight: 700;background-color: #EBEBE4">
+                            <td colspan="8" style="text-align: left;border: transparent !important;">日期范围:<span class="dateRange"></span></td>
+                            <td colspan="7" style="text-align: right;border: transparent !important;">打印日期:<span class="printDate"></span></td>
+                        </tr>
                         <tr>
-                            <td style="text-align: center;width: 45px;">日期</td>
-                            <td style="text-align: center;width: 55px;">病人ID</td>
-                            <td style="text-align: center;width: 45px;">姓名</td>
-                            <td style="text-align: center;width: 30px;">性别</td>
-                            <td style="text-align: center;width: 30px;">年龄</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">日期</td>
+                            <td class="xtd" style="text-align: center;width: 55px;">病人ID</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">姓名</td>
+                            <td class="xtd" style="text-align: center;width: 30px;">性别</td>
+                            <td class="xtd" style="text-align: center;width: 30px;">年龄</td>
                             <td style="text-align: center;width: 115px;">身份证号</td>
                             <td style="text-align: center;width: 120px;">诊断</td>
-                            <td style="text-align: center;width: 45px;">编码</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">编码</td>
                             <td style="text-align: center;width: 80px;">药名</td>
                             <td style="text-align: center;width: 70px;">规格</td>
-                            <td style="text-align: center;width: 30px;">数量</td>
-                            <td style="text-align: center;width: 45px;">医师</td>
-                            <td style="text-align: center;width: 70px;">科室</td>
-                            <td style="text-align: center;width: 45px;">复核人</td>
-                            <td style="text-align: center;width: 45px;">发药人</td>
+                            <td class="xtd" style="text-align: center;width: 30px;">数量</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">医师</td>
+                            <td class="xtd" style="text-align: center;width: 70px;">科室</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">复核人</td>
+                            <td class="xtd" style="text-align: center;width: 45px;">发药人</td>
                         </tr>
                     </table>
                 </div>