Browse Source

门诊 病历打印

hurugang 4 years ago
parent
commit
aac72a0d98

+ 34 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/TemplateController.java

@@ -209,4 +209,38 @@ public class TemplateController {
         }
     }
 
+
+    /**
+     * 更新模板调用次数
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/increaseNumber", method = {RequestMethod.GET})
+    public Map<String, Object> increaseNumber(@RequestParam("id") Long id) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(id==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "更新模板调用次数失败,主键为空");
+                return resultMap;
+            }
+            Template template =templateService.queryById(id);
+            Template updateTemplate = new Template();
+            updateTemplate.setId(id);
+            updateTemplate.setUsedTimes(template.getUsedTimes()==null?1:template.getUsedTimes()+1);
+            templateService.modifyTemplateByKey(updateTemplate);
+            resultMap.put("code", 0);
+            resultMap.put("message", "更新模板调用次数成功");
+            resultMap.put("data",template);
+            return resultMap;
+        }catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "更新模板调用次数失败,请联系管理员");
+            log.error("系统异常,错误信息{}", e.getMessage());
+            return resultMap;
+        }
+    }
+
 }

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/thmz/TemplateMapper.java

@@ -33,7 +33,7 @@ public interface TemplateMapper {
             "<when test='deptNo!=null'>",
             "or dept_no =#{deptNo}",
             "</when>"
-            , ")</script>"})
+            , ") order by used_times DESC </script>"})
     List<Template> selectTemplate(@Param("createId") String createId, @Param("deptNo") String deptNo);
 
     /**

+ 6 - 0
src/main/java/cn/hnthyy/thmz/service/impl/thmz/TemplateServiceImpl.java

@@ -33,4 +33,10 @@ public class TemplateServiceImpl implements TemplateService {
         return templateMapper.selectById(id);
     }
 
+    @Override
+    public int modifyTemplateByKey(Template template) {
+        return templateMapper.updateTemplateByKey(template);
+    }
+
+
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/thmz/TemplateService.java

@@ -32,4 +32,13 @@ public interface TemplateService {
      */
     Template queryById(Long id);
 
+
+    /**
+     * 更新医疗范文
+     *
+     * @param template
+     * @return
+     */
+    int modifyTemplateByKey(Template template);
+
 }

+ 56 - 3
src/main/resources/static/js/mz/clinic.js

@@ -5,6 +5,9 @@ var msg_list_loading = false;
 var pageIndex = 0;
 //药品使用方法,天数和频次的集合
 var groupIdMap = null;
+var LODOP; //声明为全局变量
+//默认打印机下标
+var printIndex = -1;
 $(function () {
     initGenderSelect();
     initResponceTypeSelect();
@@ -1362,7 +1365,7 @@ function callTemplate() {
     clearWorkSpace();
     $.ajax({
         type: "GET",
-        url: '/thmz/getTemplateById?id=' + $("#idTemplate").val(),
+        url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         async: false,
@@ -5498,7 +5501,7 @@ function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
                     $("#printPrescription").removeClass("hide").addClass("in");
                     $("#callPrescription").removeClass("in").addClass("hide");
                     $("#printPrescription").off("click").on("click", function (t) {
-                        alert("打印处方");
+                        printPrescription();
                     });
                 } else {
                     $("#printPrescription").removeClass("in").addClass("hide");
@@ -5512,4 +5515,54 @@ function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
             }
         }
     });
-}
+}
+
+
+/**
+ * 查询默认打印机
+ */
+function setPrint() {
+    if (printIndex >= 0) {
+        return;
+    }
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getLastWindowsByCurrentUser',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        async: false,
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                printIndex = res.data.cgPrintIndex;
+            } else {
+                printIndex = -1;
+            }
+        }
+    });
+}
+
+/**
+ * 打印门诊处方
+ */
+function printPrescription() {
+    // $("#dcountDate").html(format(res.dcountDate, "yyyy-MM-dd HH:mm:ss"));
+    // $("#dcountDate_gh").html(format(res.dcountDate, "yyyy-MM-dd HH:mm:ss"));
+    setPrint();
+    LODOP = getLodop();
+    LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "湖南泰和医院处方笺");
+    LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
+    //设置默认打印机
+    LODOP.SET_PRINTER_INDEX(printIndex);
+    LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "210mm");
+    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "297mm");
+    var strStyle="<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} table,td,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>";
+    LODOP.ADD_PRINT_HTM("0mm", "5mm", "200mm", "280mm",strStyle+ document.getElementById("prescription_table").innerHTML);
+    //LODOP.PRINT();
+    LODOP.PREVIEW();
+    //刷新数据
+}

+ 92 - 0
src/main/resources/templates/mz/clinic.html

@@ -13,8 +13,16 @@
 <script src="/thmz/js/dependent/validator.js"></script>
 <script src="/thmz/js/common/map-util.js"></script>
 <script src="/thmz/zTree_v3/js/jquery.ztree.all.js"></script>
+<script src="/thmz/js/dependent/LodopFuncs.js"></script>
 <script src="/thmz/js/mz/clinic.js"></script>
 <title>就诊</title>
+<!-- 打印的样式-->
+<style media="print">
+    @page {
+        size: auto;
+        margin: 0mm;
+    }
+</style>
 <style>
     .thmz_alert .alert::after {
         content: '';
@@ -1556,3 +1564,87 @@
     </div>
 </div>
 <!--切换接诊提示弹窗结尾-->
+
+
+<!--处方打印模块开始-->
+<div id="prescription_table" class="hide"
+     style="width:920px;height: calc(100% - 160px);margin:0 auto;border: 1px solid #337ab7;font-size: 16px;padding: 40px 20px 40px 20px;overflow-y: auto; overflow-x:hidden;">
+    <div id="report_table_1">
+        <h2 style="text-align:center;font-weight: 700;">湖南泰和医院处方笺</h2>
+        <div style="margin-top: 20px;">
+            <span>收费员:</span><span id=""></span><span
+                style="margin-left: 120px;">工号:</span><span id="userIdCode"></span><span
+                style="margin-left: 120px;">结账时间:</span><span id="dcountDate"></span></div>
+        <table class="table table-striped table-bordered">
+            <tbody>
+            <tr>
+                <td>挂号费</td>
+                <td id="charge1">0.00</td>
+                <td>其他</td>
+                <td id="charge9">0.00</td>
+                <td>消毒费</td>
+                <td id="charge16">0.00</td>
+            </tr>
+            <tr>
+                <td>床位费</td>
+                <td id="charge2">0.00</td>
+                <td>西药费</td>
+                <td id="charge10">0.00</td>
+                <td>材料费</td>
+                <td id="charge18">0.00</td>
+            </tr>
+            <tr>
+                <td>诊查费</td>
+                <td id="charge3">0.00</td>
+                <td>中成药费</td>
+                <td id="charge11">0.00</td>
+                <td>麻醉费</td>
+                <td id="charge19">0.00</td>
+            </tr>
+            <tr>
+                <td>检查费</td>
+                <td id="charge4">0.00</td>
+                <td>中草药费</td>
+                <td id="charge12">0.00</td>
+                <td>四舍五入</td>
+                <td id="charge20">0.00</td>
+            </tr>
+            <tr>
+                <td>治疗费</td>
+                <td id="charge5">0.00</td>
+                <td>特殊材料费</td>
+                <td id="charge13">0.00</td>
+                <td>护理费</td>
+                <td id="charge6">0.00</td>
+            </tr>
+            <tr>
+                <td>输血费</td>
+                <td id="charge14">0.00</td>
+                <td>手术费</td>
+                <td id="charge7">0.00</td>
+                <td>鉴定费</td>
+                <td id="charge15">0.00</td>
+            </tr>
+            <tr>
+                <td>化验费</td>
+                <td id="charge8">0.00</td>
+                <td>手术器械使用费</td>
+                <td id="charge17">0.00</td>
+                <td></td>
+                <td></td>
+            </tr>
+            <tr>
+                <td>合计:</td>
+                <td id="totalCharge">0.00</td>
+                <td id="totalChargeStr" colspan="5">零元整</td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+</div>
+<!--处方打印模块结束-->
+
+
+<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
+    <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
+</object>