Explorar o código

Merge branch 'dev-1.0.6' into dev-1.0.5

hurugang %!s(int64=5) %!d(string=hai) anos
pai
achega
c850477a49

+ 1 - 1
src/main/java/cn/hnthyy/thmz/controller/MzChargeDetailController.java

@@ -124,7 +124,7 @@ public class MzChargeDetailController {
         } catch (MzException e) {
             log.error("查询费用列表失败,错误信息{}", e);
             resultMap.put("code", -1);
-            resultMap.put("message", "查询费用列表失败【" + e.getMessage()+"】");
+            resultMap.put("message", "查询费用列表失败,错误原因:" + e.getMessage());
             return resultMap;
         } catch (Exception e) {
             e.printStackTrace();

+ 8 - 2
src/main/java/cn/hnthyy/thmz/controller/MzyRequestController.java

@@ -197,9 +197,15 @@ public class MzyRequestController {
                 resultMap.put("message", "根据时间范围查询号标数据失败,参数为空");
                 return resultMap;
             }
+            if(StringUtils.isBlank(requestParamsVo.getUnitCode())){
+                requestParamsVo.setUnitCode(null);
+            }
+            if(StringUtils.isBlank(requestParamsVo.getAmpm())){
+                requestParamsVo.setAmpm(null);
+            }
             resultMap.put("code", 0);
             resultMap.put("message", "根据时间范围查询号标数据成功");
-            List<MzyRequest> mzyRequests = mzyRequestService.queryByTimes(requestParamsVo.getBeginDate(), requestParamsVo.getEndDate());
+            List<MzyRequest> mzyRequests = mzyRequestService.queryByTimes(requestParamsVo.getBeginDate(), requestParamsVo.getEndDate(),requestParamsVo.getUnitCode(),requestParamsVo.getAmpm());
             fitRequest(mzyRequests);
             resultMap.put("data", mzyRequests);
             return resultMap;
@@ -289,7 +295,7 @@ public class MzyRequestController {
                 resultMap.put("message", "根据源号表数据模板创建新的号表数据失败,新号表开始时间必须晚于已有号表的结束时间");
                 return resultMap;
             }
-            List<MzyRequest> mzyRequests = mzyRequestService.queryByTimes(requestParamsVo.getBeginDate(), requestParamsVo.getEndDate());
+            List<MzyRequest> mzyRequests = mzyRequestService.queryByTimes(requestParamsVo.getBeginDate(), requestParamsVo.getEndDate(),null,null);
             if (mzyRequests==null || mzyRequests.size()==0){
                 resultMap.put("code", -1);
                 resultMap.put("message", "根据源号表数据模板创建新的号表数据失败,源号表不存在");

+ 19 - 7
src/main/java/cn/hnthyy/thmz/mapper/his/MzyRequestMapper.java

@@ -126,7 +126,6 @@ public interface MzyRequestMapper {
     int insertRequest(MzyRequest mzyRequest);
 
 
-
     /**
      * 保存老系统排班表
      *
@@ -155,6 +154,7 @@ public interface MzyRequestMapper {
 
     /**
      * 退号时需要将号表数据返回
+     *
      * @param id
      * @return
      */
@@ -164,20 +164,31 @@ public interface MzyRequestMapper {
 
     /**
      * 按时间区间查询号表数据
+     *
      * @param beginDate
      * @param endDate
      * @return
      */
-    @Select("  SELECT id,request_day,ampm,unit_code,group_code,doctor_code,charge_type,total_num,op_id,left_num,check_fee,bespeak_no " +
-            "    FROM mzy_request_new " +
-            " where " +
-            "         request_day >= #{beginDate,jdbcType=TIMESTAMP} and " +
-            "         request_day <= #{endDate,jdbcType=TIMESTAMP} order by request_day,unit_code,doctor_code,ampm ")
-    List<MzyRequest> selectByTimes(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
+    @Select({"<script>",
+            "  SELECT id,request_day,ampm,unit_code,group_code,doctor_code,charge_type,total_num,op_id,left_num,check_fee,bespeak_no " +
+                    "    FROM mzy_request_new " +
+                    " where " +
+                    "         request_day <![CDATA[>=]]> #{beginDate,jdbcType=TIMESTAMP} and " +
+                    "         request_day <![CDATA[<=]]> #{endDate,jdbcType=TIMESTAMP} " +
+            "<when test='unitCode!=null'>",
+            " and unit_code=#{unitCode} ",
+            "</when>",
+            "<when test='ampm!=null'>",
+            " and ampm=#{ampm} ",
+            "</when>",
+            "order by request_day,unit_code,doctor_code,ampm ",
+            "</script>"})
+    List<MzyRequest> selectByTimes(@Param("beginDate") Date beginDate, @Param("endDate") Date endDate, @Param("unitCode") String unitCode, @Param("ampm") String ampm);
 
 
     /**
      * 更新号表
+     *
      * @param mzyRequest
      * @return
      */
@@ -187,6 +198,7 @@ public interface MzyRequestMapper {
 
     /**
      * 更新老号表
+     *
      * @param mzyRequest
      * @return
      */

+ 10 - 2
src/main/java/cn/hnthyy/thmz/service/his/MzyRequestService.java

@@ -50,6 +50,7 @@ public interface MzyRequestService {
 
     /**
      * 获取挂号号别的最新编号,并更新
+     *
      * @param mzyRequest 当前号别对象
      */
     Integer getReqOrder(MzyRequest mzyRequest) throws MzException;
@@ -57,6 +58,7 @@ public interface MzyRequestService {
 
     /**
      * 同步排班表
+     *
      * @return
      */
     int synchronizationRequest();
@@ -64,6 +66,7 @@ public interface MzyRequestService {
 
     /**
      * 查询当天最新的排班信息
+     *
      * @return
      */
     List<MzyRequest> queryRequestForToday(Date today);
@@ -71,6 +74,7 @@ public interface MzyRequestService {
 
     /**
      * 根据所以筛选条件查询号表
+     *
      * @param mzyRequest
      * @return
      */
@@ -79,6 +83,7 @@ public interface MzyRequestService {
 
     /**
      * 保存排班表
+     *
      * @return
      */
     int saveRequest(MzyRequest mzyRequest);
@@ -86,21 +91,24 @@ public interface MzyRequestService {
 
     /**
      * 保存排班表
+     *
      * @return
      */
-    int saveRequest(List<MzyRequest> mzyRequests,String opId);
+    int saveRequest(List<MzyRequest> mzyRequests, String opId);
 
 
     /**
      * 按时间区间查询号表数据
+     *
      * @param beginDate
      * @param endDate
      * @return
      */
-    List<MzyRequest> queryByTimes(Date beginDate, Date endDate);
+    List<MzyRequest> queryByTimes(Date beginDate, Date endDate, String unitCode, String ampm);
 
     /**
      * 根据主键查询号表信息
+     *
      * @param id
      * @return
      */

+ 3 - 3
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -1792,7 +1792,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 return itemNo;
             }
             if (YesNoEnum.YES.code.equals(zdChargeItem.getDelFlag())) {
-                throw new MzException("【" + zdChargeItem.getName() + "】被停用,请联系物价科确认!");
+                throw new MzException("收费项目【" + zdChargeItem.getName() + "(编码"+zdChargeItem.getCode()+")】被停用,请联系物价科确认!");
             }
             MzChargeDetail newMzChargeDetail = new MzChargeDetail();
             newMzChargeDetail.setPatientId(mzChargeDetail.getPatientId());
@@ -1867,7 +1867,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 return itemNo;
             }
             if (YesNoEnum.YES.code.equals(zdChargeItem.getDelFlag())) {
-                throw new MzException("【" + zdChargeItem.getName() + "】被停用,请联系物价科确认!");
+                throw new MzException("收费项目【" + zdChargeItem.getName() + "(编码"+zdChargeItem.getCode()+")】被停用,请联系物价科确认!");
             }
             MzChargeDetail newMzChargeDetail = new MzChargeDetail();
             newMzChargeDetail.setPatientId(mzChargeDetail.getPatientId());
@@ -2092,7 +2092,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             return itemNo;
         }
         if (YesNoEnum.YES.code.equals(zdChargeItem.getDelFlag())) {
-            throw new MzException("【" + zdChargeItem.getName() + "】被停用,请联系物价科确认!");
+            throw new MzException("收费项目【" + zdChargeItem.getName() + "(编码"+zdChargeItem.getCode()+")】被停用,请联系物价科确认!");
         }
         MzChargeDetail newMzChargeDetail = new MzChargeDetail();
         newMzChargeDetail.setPatientId(mzChargeDetail.getPatientId());

+ 26 - 22
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyRequestServiceImpl.java

@@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -68,8 +69,8 @@ public class MzyRequestServiceImpl implements MzyRequestService {
         List<MzyZdChargeType> list = new ArrayList<>();
         chargeTypes.forEach(ct -> {
             if (StringUtils.isNotBlank(ct)) {
-                List<MzyRequest> mzyRequests=mzyRequestMapper.selectOldRequestByRequestDay(requestDay, unitCode, ampm,ct,null);
-                if(mzyRequests!=null && mzyRequests.size()>0){
+                List<MzyRequest> mzyRequests = mzyRequestMapper.selectOldRequestByRequestDay(requestDay, unitCode, ampm, ct, null);
+                if (mzyRequests != null && mzyRequests.size() > 0) {
                     MzyZdChargeType mzct = mzyZdChargeTypeMapper.selectByCode(ct);
                     if (mzct != null) {
                         list.add(mzct);
@@ -83,31 +84,31 @@ public class MzyRequestServiceImpl implements MzyRequestService {
 
     @Override
     public Integer getReqOrder(MzyRequest mzyRequest) throws MzException {
-        if(mzyRequest==null){
+        if (mzyRequest == null) {
             throw new MzException("没有查询到匹配的可挂号表,请先创建!");
         }
 
-        List<MzyRequest> mzyRequests=mzyRequestMapper.selectOldRequestByRequestDay(DateFormatUtils.format(mzyRequest.getRequestDay(), "yyyy-MM-dd"), mzyRequest.getUnitCode(), mzyRequest.getAmpm(),mzyRequest.getChargeType(),mzyRequest.getDoctorCode());
-        if(mzyRequests==null || mzyRequests.size()==0){
+        List<MzyRequest> mzyRequests = mzyRequestMapper.selectOldRequestByRequestDay(DateFormatUtils.format(mzyRequest.getRequestDay(), "yyyy-MM-dd"), mzyRequest.getUnitCode(), mzyRequest.getAmpm(), mzyRequest.getChargeType(), mzyRequest.getDoctorCode());
+        if (mzyRequests == null || mzyRequests.size() == 0) {
             throw new MzException("没有查询到匹配的可挂号表,请先创建!");
         }
-        MzyRequest oldMzyRequest=mzyRequests.get(0);
-        Integer oldBespeakNo=oldMzyRequest.getBespeakNo();
-        Integer bespeakNo=mzyRequest.getBespeakNo();
+        MzyRequest oldMzyRequest = mzyRequests.get(0);
+        Integer oldBespeakNo = oldMzyRequest.getBespeakNo();
+        Integer bespeakNo = mzyRequest.getBespeakNo();
         Integer leftNum = mzyRequest.getLeftNum();
-        if(oldBespeakNo>bespeakNo){
-            bespeakNo=oldBespeakNo;
+        if (oldBespeakNo > bespeakNo) {
+            bespeakNo = oldBespeakNo;
             leftNum = oldMzyRequest.getLeftNum();
         }
         mzyRequest.setOrgiBespeakNo(bespeakNo);
         mzyRequest.setOrgiLeftNum(leftNum);
-        Integer newBespeakNo=bespeakNo+1;
-        Integer newLeftNum=leftNum-1;
+        Integer newBespeakNo = bespeakNo + 1;
+        Integer newLeftNum = leftNum - 1;
         mzyRequest.setBespeakNo(newBespeakNo);
         mzyRequest.setLeftNum(newLeftNum);
-        int num=mzyRequestMapper.updateMzyRequest(mzyRequest);
+        int num = mzyRequestMapper.updateMzyRequest(mzyRequest);
         mzyRequestMapper.updateOriMzyRequest(mzyRequest);
-        if(num==0){
+        if (num == 0) {
             throw new MzException("更新挂号表信息出错,请重试或者联系管理员!");
         }
         return mzyRequest.getOrgiBespeakNo();
@@ -135,16 +136,19 @@ public class MzyRequestServiceImpl implements MzyRequestService {
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
-    public int saveRequest(List<MzyRequest> mzyRequests,String opId) {
+    public int saveRequest(List<MzyRequest> mzyRequests, String opId) {
         Date now = new Date();
-        for (MzyRequest m:mzyRequests){
-            if(m!=null){
-                if(m.getChargeType()==null){
+        for (MzyRequest m : mzyRequests) {
+            if (m != null) {
+                if (m.getChargeType() == null) {
                     m.setChargeType("");
                 }
+                if (m.getCheckFee() == null) {
+                    m.setCheckFee(BigDecimal.ZERO);
+                }
                 m.setOpId(opId);
                 m.setSysDate(now);
-                if(m.getId()!=null){
+                if (m.getId() != null) {
                     MzyRequest dbMzyRequest = mzyRequestMapper.selectMzyRequestById(m.getId());
                     m.setRequestDayOld(dbMzyRequest.getRequestDay());
                     m.setAmpmOld(dbMzyRequest.getAmpm());
@@ -153,7 +157,7 @@ public class MzyRequestServiceImpl implements MzyRequestService {
                     m.setChargeTypeOld(dbMzyRequest.getChargeType());
                     mzyRequestMapper.updateMzyRequestNew(m);
                     mzyRequestMapper.updateMzyRequestOld(m);
-                }else {
+                } else {
                     m.setGroupCode("");
                     m.setDelFlag(YesNoEnum.NO.code);
                     mzyRequestMapper.insertRequest(m);
@@ -165,8 +169,8 @@ public class MzyRequestServiceImpl implements MzyRequestService {
     }
 
     @Override
-    public List<MzyRequest> queryByTimes(Date beginDate, Date endDate) {
-        return mzyRequestMapper.selectByTimes(beginDate,endDate);
+    public List<MzyRequest> queryByTimes(Date beginDate, Date endDate, String unitCode, String ampm) {
+        return mzyRequestMapper.selectByTimes(beginDate, endDate, unitCode, ampm);
     }
 
     @Override

+ 4 - 0
src/main/java/cn/hnthyy/thmz/vo/RequestParamsVo.java

@@ -29,6 +29,10 @@ public class RequestParamsVo {
     @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date newEndDate;
+    //科室编码
+    private String unitCode;
+    //上下午
+    private String ampm;
     //排班集合
     List<MzyRequest> mzyRequests;
 }

+ 28 - 11
src/main/resources/static/js/request.js

@@ -29,8 +29,8 @@ $(function () {
         initSourceList();
         $("#btn_creat").removeClass('in').addClass('hide');
         $("#btn_cancel").removeClass('hide').addClass('in');
-        $("#tb_table_1").css("display","block");
-        $("#tb_table_2").css("display","block");
+        $("#tb_table_1").css("display", "block");
+        $("#tb_table_2").css("display", "block");
     });
     $("#btn_cancel").click(function (t) {
         showTwoTable = false;
@@ -39,8 +39,8 @@ $(function () {
         initSourceList();
         $("#btn_cancel").removeClass('in').addClass('hide');
         $("#btn_creat").removeClass('hide').addClass('in');
-        $("#tb_table_1").css("display","none");
-        $("#tb_table_2").css("display","none");
+        $("#tb_table_1").css("display", "none");
+        $("#tb_table_2").css("display", "none");
     });
 
     $("#btn_add").click(function (t) {
@@ -344,6 +344,8 @@ function queryParams(params) {
         var temp = {
             beginDate: "2012-02-13 00:00:00",
             endDate: "2012-02-19 23:59:59",
+            unitCode: $("#unitCode").val(),
+            ampm: $("#ampmParams").val()
         };
         return temp;
     }
@@ -351,6 +353,8 @@ function queryParams(params) {
     var temp = {
         beginDate: rePortRangeArr[0],
         endDate: rePortRangeArr[1],
+        unitCode: $("#unitCode").val(),
+        ampm: $("#ampmParams").val()
     };
     return temp;
 };
@@ -596,6 +600,11 @@ function getNewRangeArr() {
 function cleanParams() {
     $('#sourceRange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
     $('#newRange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
+    $('#ampmParams').selectpicker('val', null);
+    $('#ampmParams').selectpicker('refresh');
+    $('#unitCode').selectpicker('val', null);
+    $('#unitCode').selectpicker('refresh');
+    initSourceList();
 }
 
 
@@ -603,7 +612,7 @@ function cleanParams() {
  * 保存临时生成的新号表数据
  */
 function saveTempRequest() {
-   var index =$("#requestId").val();
+    var index = $("#requestId").val();
     var realParams = JSON.parse('{"mzyRequests":""}');
     var tempJson = JSON.parse('{"requestDay":"","ampm":"","unitCode":"","doctorCode":"","chargeType":"","totalNum":"","leftNum":"","bespeakNo":"1","checkFee":""}');
     tempJson.requestDay = $("#editDay").val();
@@ -614,9 +623,9 @@ function saveTempRequest() {
     tempJson.totalNum = $("#totalNum").val();
     tempJson.leftNum = $("#totalNum").val();
     tempJson.checkFee = $("#checkFee").val();
-    if(index==null || index ==""){
+    if (index == null || index == "") {
         tempData[tempData.length] = tempJson;
-    }else {
+    } else {
         tempData[index] = tempJson;
     }
     realParams.mzyRequests = tempData;
@@ -650,7 +659,7 @@ function saveRequest() {
     } else {
         data = JSON.stringify({
             mzyRequests: [{
-                id:$("#requestId").val(),
+                id: $("#requestId").val(),
                 requestDay: $("#editDay").val(),
                 ampm: $("#ampm").val(),
                 unitCode: $("#deptNo").val(),
@@ -713,6 +722,10 @@ function initMzWorkTime() {
             $('#ampm').empty();   //清空resText里面的所有内容
             $('#ampm').html(html);
             $('#ampm').selectpicker('refresh');
+
+            $('#ampmParams').empty();   //清空resText里面的所有内容
+            $('#ampmParams').html(html);
+            $('#ampmParams').selectpicker('refresh');
         }
     });
 }
@@ -740,6 +753,10 @@ function initDeptSelect() {
             $('#deptNo').empty();
             $('#deptNo').html(html);
             $('#deptNo').selectpicker('refresh');
+
+            $('#unitCode').empty();
+            $('#unitCode').html(html);
+            $('#unitCode').selectpicker('refresh');
         }
     });
 }
@@ -761,9 +778,9 @@ function initDoctorSelect() {
                 window.location.href = '/thmz/login/view'
                 return;
             }
-            var html = '';
+            var html = '<option value=""></option>';
             $.each(res.data, function (commentIndex, comment) {
-                html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + ' ('+comment.deptName+') </option>';
+                html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + ' (' + comment.deptName + ') </option>';
             });
             $('#doctorParam').empty();
             $('#doctorParam').html(html);
@@ -842,7 +859,7 @@ function updateRequest(id) {
  */
 function updateRequestByIndex(index) {
     $("#requestId").val(index);
-    var data =tempData[index];
+    var data = tempData[index];
     $("#classTitle").text("修改");
     $("#editDay").val(format(data.requestDay, "yyyy-MM-dd"));
     $('#ampm').selectpicker('val', data.ampm);

+ 21 - 3
src/main/resources/templates/request.html

@@ -11,8 +11,26 @@
             <div class="panel-body">
                 <form id="formSearch" class="form-horizontal" autocomplete="off">
                     <div class="form-group col-md-12 col-sm-12 col-xs-12">
-                        <div class="col-md-2 col-sm-2 col-xs-12"></div>
-                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="sourceRange"> 源号表日期
+                        <div class="col-md-2 col-sm-2 col-xs-12 item">
+                            <label class="control-label col-md-4 col-sm-4 col-xs-12" for="unitCode">科室
+                            </label>
+                            <div class="col-md-8 col-sm-8 col-xs-12">
+                                <select class="form-control selectpicker show-tick" data-live-search="true" required="required"
+                                        title="请选择" onchange="initSourceList()"
+                                        id="unitCode">
+                                </select>
+                            </div>
+                        </div>
+                        <div class="col-md-2 col-sm-2 col-xs-12 item">
+                            <label class="control-label col-md-4 col-sm-4 col-xs-12" for="ampmParams">号段</label>
+                            <div class="col-md-8 col-sm-8 col-xs-12">
+                                <select class="form-control selectpicker show-tick" required="required" title="请选择"
+                                        onchange="initSourceList()"
+                                        id="ampmParams">
+                                </select>
+                            </div>
+                        </div>
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="sourceRange"> 源表日期
                         </label>
                         <div class="col-md-3 col-sm-3 col-xs-12">
                             <div id="sourceRange" class="pull-right"
@@ -21,7 +39,7 @@
                                 <span>December 30, 2014 - January 28, 2015</span> <b class="caret"></b>
                             </div>
                         </div>
-                        <label class="control-label col-md-2 col-sm-2 col-xs-12" for="newRange"> 新号表日期
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="newRange"> 新表日期
                         </label>
                         <div class="col-md-3 col-sm-3 col-xs-12">
                             <div id="newRange" class="pull-right"