lihong před 3 měsíci
rodič
revize
b02e92efd4

+ 1 - 0
src/main/java/cn/hnthyy/thmz/Utils/DateUtil.java

@@ -451,6 +451,7 @@ public class DateUtil {
      * @throws Exception
      */
     public static int getAge(Date birthDay) {
+        if(birthDay == null) return 0;
         Calendar cal = Calendar.getInstance();
         if (cal.before(birthDay)) { //出生日期晚于当前时间,无法计算
 //            throw new IllegalArgumentException(

+ 58 - 16
src/main/java/cn/hnthyy/thmz/controller/mz/ZyReqController.java

@@ -11,6 +11,7 @@ import cn.hnthyy.thmz.entity.his.mz.MzPatientMi;
 import cn.hnthyy.thmz.entity.his.mz.MzZyReq;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.GenderEnum;
+import cn.hnthyy.thmz.enums.NumberEnum;
 import cn.hnthyy.thmz.enums.ZyReqEnum;
 import cn.hnthyy.thmz.service.his.RegionService;
 import cn.hnthyy.thmz.service.his.ResponceTypeService;
@@ -23,6 +24,7 @@ import cn.hnthyy.thmz.service.thmz.UserDeptRelationService;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -95,7 +97,7 @@ public class ZyReqController {
      */
     @UserLoginToken
     @RequestMapping(value = "/printZyReq", method = {RequestMethod.GET})
-    public Map<String, Object> printZyReq(@RequestParam("patientId") String patientId) {
+    public Map<String, Object> printZyReq(@RequestParam("patientId") String patientId,@RequestParam(value = "visitDate",required = false,defaultValue = "") String visitDate) {
         Map<String, Object> resultMap = new HashMap<>();
         try {
             if (StringUtils.isBlank(patientId)) {
@@ -109,22 +111,27 @@ public class ZyReqController {
                 resultMap.put("message", "打印入院通知单失败,当前病人没有对应的住院证");
                 return resultMap;
             }
-            MzZyReq mzZyReq = list.get(0);
-            if(mzZyReq!=null){
-                if(mzZyReq.getDeptCode()!=null && StringUtils.isNotBlank(mzZyReq.getDeptCode())){
-                    mzZyReq.setDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getDeptCode()));
-                }
-                if(mzZyReq.getReqDept()!=null && StringUtils.isNotBlank(mzZyReq.getReqDept())){
-                    mzZyReq.setReqDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getReqDept()));
-                    mzZyReq.setReqWardName(mzZyReq.getReqDeptName());
-                }
-                if(mzZyReq.getSmallDept()!=null && StringUtils.isNotBlank(mzZyReq.getSmallDept())){
-                    mzZyReq.setSmallDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getSmallDept()));
-                }
-                if(mzZyReq.getDoctorCode()!=null && StringUtils.isNotBlank(mzZyReq.getDoctorCode())){
-                    Employee employee= employeeService.queryByUserCode(mzZyReq.getDoctorCode());
-                    mzZyReq.setDoctorName(employee!=null?employee.getEmployeeName():"");
+            List<MzZyReq> mzZyReqList = list.stream().filter(item -> !NumberEnum.FOUR.getCode().equals(item.getReqStatus())).collect(Collectors.toList());
+            if(CollUtil.isEmpty(mzZyReqList)){
+                resultMap.put("code", -1);
+                resultMap.put("message", "打印入院通知单失败,当前病人没有对应的住院证");
+                return resultMap;
+            }
+            MzZyReq mzZyReq ;
+            if(StrUtil.isNotBlank(visitDate)){
+                List<MzZyReq> collect = mzZyReqList.stream().filter(item -> DateUtil.format(item.getVisitDate(), "yyyy-MM-dd HH:mm:ss").equals(visitDate)).collect(Collectors.toList());
+                if(CollUtil.isNotEmpty(collect)){
+                    mzZyReq = collect.get(0);
+                }else {
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "打印入院通知单失败,当前病人没有对应的住院证");
+                    return resultMap;
                 }
+            }else {
+                mzZyReq =  mzZyReqList.get(0);
+            }
+            if(mzZyReq!=null){
+                dealMzyReq(mzZyReq);
                 if(mzZyReq.getRouteOfAdmission() !=null){
                     List<Map<String, Object>> mapList = mzZdCommonService.queryRouteOfAdmission();
                     Map<Integer, List<Map<String, Object>>> codeMap = mapList.stream().collect(Collectors.groupingBy(item -> Convert.toInt(item.get("code"))));
@@ -149,6 +156,41 @@ public class ZyReqController {
         }
     }
 
+    @PostMapping("/queryZyzByPatientId")
+    public R queryZyzByPatientId(@RequestBody MzZyReq param){
+        AssertUtil.isNotBlank(param.getPatientId(),"门诊号不能为空");
+        List<MzZyReq> list = mzZyReqService.queryMzZyReqByPatientId(param.getPatientId(),null);
+        if(CollUtil.isNotEmpty(list)){
+            List<MzZyReq> collect = list.stream().filter(item -> !NumberEnum.FOUR.getCode().equals(item.getReqStatus())).collect(Collectors.toList());
+            if(CollUtil.isNotEmpty(collect)){
+                for(MzZyReq mzZyReq : collect){
+                    dealMzyReq(mzZyReq);
+                }
+                return R.ok().put("data", collect);
+            }
+        }
+        return R.ok().put("data", null);
+    }
+
+
+
+    private void dealMzyReq(MzZyReq mzZyReq) {
+        if (mzZyReq.getDeptCode() != null && StringUtils.isNotBlank(mzZyReq.getDeptCode())) {
+            mzZyReq.setDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getDeptCode()));
+        }
+        if (mzZyReq.getReqDept() != null && StringUtils.isNotBlank(mzZyReq.getReqDept())) {
+            mzZyReq.setReqDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getReqDept()));
+            mzZyReq.setReqWardName(mzZyReq.getReqDeptName());
+        }
+        if (mzZyReq.getSmallDept() != null && StringUtils.isNotBlank(mzZyReq.getSmallDept())) {
+            mzZyReq.setSmallDeptName(zdUnitCodeService.queryDeptNameByIdInCache(mzZyReq.getSmallDept()));
+        }
+        if (mzZyReq.getDoctorCode() != null && StringUtils.isNotBlank(mzZyReq.getDoctorCode())) {
+            Employee employee = employeeService.queryByUserCode(mzZyReq.getDoctorCode());
+            mzZyReq.setDoctorName(employee != null ? employee.getEmployeeName() : "");
+        }
+    }
+
 //    /**
 //     * 保存病人的住院证
 //     *

+ 143 - 3
src/main/resources/static/js/mz/add_mzzyreq.js

@@ -277,6 +277,7 @@ function getAllPatient() {
                 formatter: function (value, row, index) {
                     // var rowData = JSON.stringify(row);
                     var str = '<button type="button" class="btn btn-primary  btn-sm" onclick="editAdd(\'' + row.patientId + '\')">办理住院证</button>';
+                     str += '<button type="button" class="btn btn-primary  btn-sm" onclick="bdZyz(\'' + row.patientId + '\')">补打住院证</button>';
                     return str;
                 }
             },
@@ -355,7 +356,7 @@ function getAllPatient() {
 function queryParams(params) {
     var temp = {
         pageSize: params.limit,
-        offset: params.offset,
+        offset: params.offset/params.limit,
         patientId: $("#patientIdSearch").val() == "" ? null : $("#patientIdSearch").val(),
         name: $("#nameSearch").val() == "" ? null : $("#nameSearch").val(),
         socialNo: $("#socialNoSearch").val() == "" ? null : $("#socialNoSearch").val()
@@ -536,7 +537,146 @@ function resetSearch() {
     $("#socialNoSearch").val(null);
 }
 
+//住院证补打
+function bDPrintZyz(patientId,visitDate) {
+   let date =  format(visitDate,'yyyy-MM-dd HH:mm:ss')
+    printZyReq(patientId,1,date)
+}
+
+
+/**
+ * 打开编辑窗口
+ * @param row
+ */
+function bdZyz(patientId) {
+    $("#bdZyzModal").modal();
+    getBdZyzData(patientId);
+}
+
+function getBdZyzData(patientId) {
+    $('#bdZyz_tb_table').bootstrapTable("destroy");
+    $('#bdZyz_tb_table').bootstrapTable({
+        url: '/thmz/queryZyzByPatientId',         //请求后台的URL(*)
+        method: 'post',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: true,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "asc",                   //排序方式
+        queryParams: {patientId:patientId},           //传递参数(*)
+        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 10,                       //每页的记录行数(*)
+        pageList: [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: [
+            {
+                title: '操作',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    // var rowData = JSON.stringify(row);
+                    var str = '<button type="button" class="btn btn-primary  btn-sm" onclick="bDPrintZyz(\'' + row.patientId + '\',\'' + row.visitDate + '\')">打印</button>';
+                    return str;
+                }
+            },
+            {
+                field: 'patientId',
+                title: '门诊号',
+                align: "center",
+                valign: 'middle'
+
+            },
+            {
+                field: 'name',
+                title: '姓名',
+                align: "center",
+                valign: 'middle',
+            },
+            {
+                field: 'visitDate',
+                title: '就诊时间',
+                align: "center",
+                valign: 'middle',
+                formatter:function (value,row,index) {
+                    return format(value,'yyyy-MM-dd HH:mm:ss')
+                }
+
+            },
+            {
+                field: 'doctorName',
+                title: '医生',
+                align: "center",
+                valign: 'middle'
+
+            },
+            {
+                field: 'icdTextNew',
+                title: '诊断',
+                align: "center",
+                valign: 'middle'
+
+            },
+            {
+                field: 'reqDeptName',
+                title: '入院科室',
+                align: "center",
+                valign: 'middle'
 
+            },
+            {
+                field: 'smallDeptName',
+                title: '入院病区',
+                align: "center",
+                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) {
+                if (ress.message != null && ress.message != '') {
+                    new PNotify({
+                        title: '错误提示',
+                        text: ress.message,
+                        type: 'error',
+                        hide: true,
+                        styling: 'bootstrap3'
+                    });
+                }
+                return {
+                    "total": 0,//总页数
+                    "rows": {}   //数据
+                };
+            }
+            return {
+                // "total": ress.total,//总页数
+                "rows": ress.data   //数据
+            };
+        },
+    });
+}
 
 /**
  * 打印入院通知单
@@ -546,10 +686,10 @@ function resetSearch() {
  * @param payMark
  * @param printType 打印模式 1 预览打印  2 打印设置
  */
-function printZyReq(patientId, printType) {
+function printZyReq(patientId, printType,visitDate) {
     $.ajax({
         type: "GET",
-        url: '/thmz/printZyReq?patientId=' + patientId,
+        url: '/thmz/printZyReq?patientId=' + patientId+'&visitDate='+visitDate,
         contentType: "application/json;charset=UTF-8",
         dataType: "json",
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},

+ 24 - 1
src/main/resources/templates/mz/add_mzzyreq.html

@@ -221,7 +221,30 @@
     </div>
 </div>
 
-
+<!--补打住院证列表-->
+<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="bdZyzModal">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content" style="width: 900px;margin-left: 250px;margin-top: 120px;height: calc(100% - 60px);overflow-y: auto;">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
+                </button>
+                <h4 class="modal-title modal-title-thmz">住院证列表</h4>
+            </div>
+            <div class="modal-body">
+                <div class="col-md-12 col-sm-12 col-xs-12">
+                    <div class="x_panel">
+                        <div class="panel-body">
+                        </div>
+                        <table id="bdZyz_tb_table"></table>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
 
 <!--打印入院通知单开始-->
 <div id="mz_zy_req_table" class="hide"