فهرست منبع

增加收费项目延迟改价功能

hurugang 3 سال پیش
والد
کامیت
b21f59a950

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

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller;
 
+import cn.hnthyy.thmz.Utils.HttpUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.entity.thmz.*;
 import cn.hnthyy.thmz.service.thmz.MenuService;
@@ -36,8 +37,10 @@ public class NavigationController {
      * @return
      */
     @RequestMapping("/login/view")
-    public String loginView() {
+    public String loginView(HttpServletRequest request) {
+        System.out.println(HttpUtil.getIPAddress(request)+"---------------------");
         return "login";
+
     }
 
     /**

+ 62 - 0
src/main/java/cn/hnthyy/thmz/controller/mz/ZdChargeItemController.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.DateUtil;
 import cn.hnthyy.thmz.Utils.PyWbUtil;
 import cn.hnthyy.thmz.Utils.TokenUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -355,6 +357,66 @@ public class ZdChargeItemController {
     }
 
 
+
+
+    /**
+     * 延迟改价
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveEffectivePrice", method = {RequestMethod.POST})
+    public Map<String, Object> saveEffectivePrice(@RequestBody ZdChargeItem zdChargeItem, HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(zdChargeItem==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "参数不能为空");
+                return resultMap;
+            }
+            if(zdChargeItem.getCode()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "收费项目编码不能为空");
+                return resultMap;
+            }
+            if(zdChargeItem.getEffectivePrice()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "新的收费金额不能为空");
+                return resultMap;
+            }
+            if(zdChargeItem.getEffectiveTime()==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "生效时间不能为空");
+                return resultMap;
+            }
+            Date now = new Date();
+            if(zdChargeItem.getEffectiveTime().before(now)){
+                resultMap.put("code", -1);
+                resultMap.put("message", "生效时间不能早于当前时间");
+                return resultMap;
+            }
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            zdChargeItem.setUpdateId(tokenUser.getUserIdCode());
+            zdChargeItem.setUpdateTime(now);
+            zdChargeItem.setEffectiveTime(DateUtil.getFirstSecond(zdChargeItem.getEffectiveTime()));
+            //修改
+            zdChargeItemService.modifyZdChargeItem(zdChargeItem);
+            resultMap.put("code", 0);
+            resultMap.put("message", "保存延迟改价成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("保存延迟改价失败,错误信息{}", e);
+            resultMap.put("code", -1);
+            resultMap.put("message", "保存延迟改价失败");
+            return resultMap;
+        }
+    }
+
+
+
+
+
     /**
      * 查询所有使用中的收费项目字典列表
      * @return

+ 11 - 0
src/main/java/cn/hnthyy/thmz/entity/his/zd/ZdChargeItem.java

@@ -1,6 +1,8 @@
 package cn.hnthyy.thmz.entity.his.zd;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -114,10 +116,19 @@ public class ZdChargeItem {
     private String xlCode;
     //操作用户idcode
     private String operId;
+    //延迟改价生效时间
+    private Date effectiveTime;
+    //新的价格
+    private BigDecimal effectivePrice;
+    //修改人id
+    private String updateId;
+    //修改时间
+    private Date updateTime;
     //使用数量 非数据库字段
     private BigDecimal num;
     //收费总金额 非数据库字段
     private BigDecimal totalAmount;
     //套餐编码非数据库字段
     private String tcCode;
+
 }

+ 20 - 5
src/main/java/cn/hnthyy/thmz/mapper/his/zd/ZdChargeItemMapper.java

@@ -24,7 +24,8 @@ public interface ZdChargeItemMapper {
                     "            rtrim(self_flag) self_flag,rtrim(separate_flag) separate_flag,rtrim(suppress_flag) suppress_flag,py_code,d_code wb_code,bill_item_zy,bill_item_mz," +
                     "            charge_unit,percent_group_zy,percent_group_mz,rtrim(case  when in_out_flag ='' then null else in_out_flag end) in_out_flag,n_code yn_code,class_code,s_code bz_code,discription,rtrim(del_flag) del_flag," +
                     "            rtrim(yp_flag) yp_flag,bill_item_code,rtrim(xnh_flag) xnh_flag,add_date,hnsyb_code,hnsyb_name,xnh_code,xnh_name,xnh_ratio,xnh_quotamoney,rtrim(xnh_status) xnh_status," +
-                    "            yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,cl_code,e_code yb_code,co,xl_code FROM (SELECT ROW_NUMBER() OVER (ORDER BY zd_charge_item_page.add_date desc) ",
+                    "            yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,cl_code,e_code yb_code,co,xl_code,effective_time,effective_price,update_id,update_time " +
+                    " FROM (SELECT ROW_NUMBER() OVER (ORDER BY zd_charge_item_page.add_date desc) ",
             "AS RowNumber,* from dbo.zd_charge_item zd_charge_item_page WITH(NOLOCK)  where 1=1 ",
             "<when test='zdChargeItem.delFlag!=null'>",
             " and del_flag =#{zdChargeItem.delFlag}",
@@ -101,7 +102,8 @@ public interface ZdChargeItemMapper {
             "rtrim(self_flag) self_flag,rtrim(separate_flag) separate_flag,rtrim(suppress_flag) suppress_flag,py_code,d_code wb_code,bill_item_zy,bill_item_mz," +
             "charge_unit,percent_group_zy,percent_group_mz,rtrim(case  when in_out_flag ='' then null else in_out_flag end) in_out_flag,n_code yn_code,class_code,s_code bz_code,discription,rtrim(del_flag) del_flag, " +
             "rtrim(yp_flag) yp_flag,bill_item_code,rtrim(xnh_flag) xnh_flag,add_date,hnsyb_code,hnsyb_name,xnh_code,xnh_name,xnh_ratio,xnh_quotamoney,rtrim(xnh_status) xnh_status," +
-            "yb_flag_new,yb_comment_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,yb_bl_new,e_code yb_code,cl_code,co,xl_code from zd_charge_item  WITH(NOLOCK)  where  code = #{code,jdbcType=VARCHAR} ")
+            "yb_flag_new,yb_comment_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,yb_bl_new,e_code yb_code,cl_code,co,xl_code,effective_time,effective_price,update_id,update_time " +
+            " from zd_charge_item  WITH(NOLOCK)  where  code = #{code,jdbcType=VARCHAR} ")
     //     " and (del_flag != 1 or del_flag is null) " )
     ZdChargeItem selectZdChargeItemByCode(@Param("code") String code);
 
@@ -118,7 +120,8 @@ public interface ZdChargeItemMapper {
             "charge_unit,percent_group_zy,percent_group_mz,rtrim(case  when in_out_flag ='' then null else in_out_flag end) in_out_flag,n_code yn_code,class_code,s_code bz_code,discription,rtrim(del_flag) del_flag, ",
             "rtrim(yp_flag) yp_flag,bill_item_code,rtrim(xnh_flag) xnh_flag,add_date,hnsyb_code,hnsyb_name,xnh_code,xnh_name,xnh_ratio,xnh_quotamoney,rtrim(xnh_status) xnh_status,",
             // "yb_flag_new,yb_comment_new,yb_bl_new from zd_charge_item where (del_flag != 1 or del_flag is null) ",
-            "yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,e_code yb_code,cl_code,co,xl_code from zd_charge_item WITH(NOLOCK)  ",
+            "yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,e_code yb_code,cl_code,co,xl_code,effective_time,effective_price,update_id,update_time " +
+                    " from zd_charge_item WITH(NOLOCK)  ",
             "<when test='codes!=null'>",
             " where code in",
             "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
@@ -240,6 +243,18 @@ public interface ZdChargeItemMapper {
             "<when test='ybComment!=null'>",
             ",yb_comment =#{ybComment}",
             "</when>",
+            "<when test='effectiveTime!=null'>",
+            ",effective_time =#{effectiveTime}",
+            "</when>",
+            "<when test='effectivePrice!=null'>",
+            ",effective_price =#{effectivePrice}",
+            "</when>",
+            "<when test='updateId!=null'>",
+            ",update_id =#{updateId}",
+            "</when>",
+            "<when test='updateTime!=null'>",
+            ",update_time =#{updateTime}",
+            "</when>",
             "</trim>",
             "</script>"})
     int updateZdChargeItem(ZdChargeItem zdChargeItem);
@@ -255,7 +270,7 @@ public interface ZdChargeItemMapper {
                     "            rtrim(self_flag) self_flag,rtrim(separate_flag) separate_flag,rtrim(suppress_flag) suppress_flag,py_code,d_code wb_code,bill_item_zy,bill_item_mz," +
                     "            charge_unit,percent_group_zy,percent_group_mz,rtrim(case  when in_out_flag ='' then null else in_out_flag end) in_out_flag,n_code yn_code,class_code,s_code bz_code,discription,rtrim(del_flag) del_flag," +
                     "            rtrim(yp_flag) yp_flag,bill_item_code,rtrim(xnh_flag) xnh_flag,add_date,hnsyb_code,hnsyb_name,xnh_code,xnh_name,xnh_ratio,xnh_quotamoney,rtrim(xnh_status) xnh_status," +
-                    "            yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,cl_code,e_code yb_code,co,xl_code FROM zd_charge_item WITH(NOLOCK)  ",
+                    "            yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,cl_code,e_code yb_code,co,xl_code,effective_time,effective_price,update_id,update_time FROM zd_charge_item WITH(NOLOCK)  ",
             " where del_flag =0 ",
             "</script>"})
     List<ZdChargeItem> selectAllInUsedZdCharge();
@@ -271,7 +286,7 @@ public interface ZdChargeItemMapper {
                     "            rtrim(self_flag) self_flag,rtrim(separate_flag) separate_flag,rtrim(suppress_flag) suppress_flag,py_code,d_code wb_code,bill_item_zy,bill_item_mz," +
                     "            charge_unit,percent_group_zy,percent_group_mz,rtrim(case  when in_out_flag ='' then null else in_out_flag end) in_out_flag,n_code yn_code,class_code,s_code bz_code,discription,rtrim(del_flag) del_flag," +
                     "            rtrim(yp_flag) yp_flag,bill_item_code,rtrim(xnh_flag) xnh_flag,add_date,hnsyb_code,hnsyb_name,xnh_code,xnh_name,xnh_ratio,xnh_quotamoney,rtrim(xnh_status) xnh_status," +
-                    "            yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,cl_code,e_code yb_code,co,xl_code FROM zd_charge_item WITH(NOLOCK)  ",
+                    "            yb_flag_new,yb_comment_new,yb_bl_new,charge_amount_lwg,percent_group_1  percent_group1,yb_name,yb_comment,cl_code,e_code yb_code,co,xl_code,effective_time,effective_price,update_id,update_time FROM zd_charge_item WITH(NOLOCK)  ",
             "</script>"})
     List<ZdChargeItem> selectAllZdCharge();
 

+ 97 - 4
src/main/resources/static/js/mz/charge_detail.js

@@ -32,10 +32,26 @@ $(function () {
     $('#btn_add').click(function () {
         $("#myModalLabel").text("新增收费项目");
         $("#percentag2Params").val(1);
-        $("div.bs-example-modal-lg").modal();
+        $("#chargeDetailModal").modal();
     });
 
-
+    $("#effectiveTimeParams").change(function (e) {
+        var effectiveTimeParams=$("#effectiveTimeParams").val();
+        if (effectiveTimeParams.length == 8 && effectiveTimeParams.indexOf("-") <= 0) {
+            effectiveTimeParams = effectiveTimeParams.substring(0, 4) + "-" + effectiveTimeParams.substring(4, 6) + "-" + effectiveTimeParams.substring(6);
+            $("#effectiveTimeParams").val(effectiveTimeParams);
+        }
+        var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
+        if (!dateFormat.test(effectiveTimeParams)) {
+            new PNotify({
+                title: '错误提示',
+                text: '生效日期格式错误,格式为yyyy-mm-dd',
+                type: 'error',
+                hide: true,
+                styling: 'bootstrap3'
+            });
+        }
+    });
 
 });
 
@@ -83,6 +99,7 @@ function initZdChargeItemList() {
                 valign: 'middle',
                 formatter: function (value, row, index) {
                     var str = '<button type="button" class="btn btn-primary  btn-sm" onclick="updateZdChargeItem(\'' + row.code + '\')">编辑</button>';
+                    str += '<button type="button" class="btn btn-primary  btn-sm" onclick="updateZdChargeItemPrice(\'' + row.code + '\')">延时调价</button>';
                     if (row.delFlag == 0) {
                         str += '<button type="button" class="btn btn-warning  btn-sm" onclick="updateZdChargeItemDelFlag(\'' + row.code + '\',\'' + row.name + '\',1)">停用</button>';
                     } else if (row.delFlag == 1) {
@@ -545,6 +562,7 @@ function updateZdChargeItemDelFlag(code, name,delFlag) {
  * @param code
  */
 function updateZdChargeItem(code) {
+    $("#myModalLabel").text("编辑收费项目");
     $.ajax({
         type: "GET",
         url: '/thmz/getZdChargeItemByCode?code=' + code,
@@ -591,7 +609,7 @@ function updateZdChargeItem(code) {
                     $("#xlCodeParams").val(0.5);
                 }
                 $("#code").val(res.data.code);
-                $("div.bs-example-modal-lg").modal();
+                $("#chargeDetailModal").modal();
             } else {
                 errorMesage(res);
             }
@@ -600,6 +618,41 @@ function updateZdChargeItem(code) {
 }
 
 
+
+/**
+ * 收费项目延时调价
+ * @param code
+ */
+function updateZdChargeItemPrice(code) {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/getZdChargeItemByCode?code=' + code,
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                $("#namepPricePamras").val(res.data.name);
+                $("#chargeAmountPriceParams").val(res.data.chargeAmount);
+                $("#code_price").val(res.data.code);
+                $("#chargeAmountPriceNeedUpdateParams").val(res.data.effectivePrice);
+                if(res.data.effectiveTime!=null){
+                    $("#effectiveTimeParams").val(format(res.data.effectiveTime, "yyyy-MM-dd"));
+                }
+                $("#priceModal").modal();
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+
+
+
+
 /**
  * 挂号列表中的科室列表
  */
@@ -661,7 +714,7 @@ $('#save').click(function () {
                 return;
             }
             if (res.code == 0) {
-                $("div.bs-example-modal-lg").modal("hide");
+                $("#chargeDetailModal").modal("hide");
                 clearInput();
                 successMesage(res);
                 $('#tb_table').bootstrapTable("refresh");
@@ -674,6 +727,35 @@ $('#save').click(function () {
 
 
 
+//保存收费项目延迟改价
+$('#save_price').click(function () {
+    $.ajax({
+        type: "POST",
+        url: '/thmz/saveEffectivePrice',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: JSON.stringify({
+            "effectivePrice": $("#chargeAmountPriceNeedUpdateParams").val(),"effectiveTime": $("#effectiveTimeParams").val(),
+            "code": $("#code_price").val()}),
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                $("#priceModal").modal("hide");
+                clearPriceInput();
+                successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+});
+
+
+
 /**
  * 清空输入框
  */
@@ -703,6 +785,17 @@ function clearInput() {
 }
 
 
+/**
+ * 清空输入框
+ */
+function clearPriceInput() {
+    $("#namepPricePamras").val(null);
+    $("#chargeAmountPriceParams").val(null);
+    $("#chargeAmountPriceNeedUpdateParams").val(null);
+    $("#effectiveTimeParams").val(null);
+    $("#code_price").val(null);
+}
+
 /**
  * 加价率改变事件
  */

+ 72 - 1
src/main/resources/templates/mz/charge_detail.html

@@ -120,7 +120,7 @@
             </div>
         </div>
 
-        <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
+        <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true"  id="chargeDetailModal">
             <div class="modal-dialog modal-lg">
                 <div class="modal-content">
 
@@ -325,6 +325,77 @@
             </div>
         </div>
 
+
+
+
+
+
+
+
+
+
+
+        <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="priceModal">
+            <div class="modal-dialog modal-lg">
+                <div class="modal-content">
+
+                    <div class="modal-header">
+                        <button type="button" class="close" data-dismiss="modal" onclick="clearPriceInput()"><span aria-hidden="true">×</span>
+                        </button>
+                        <h4 class="modal-title modal-title-thmz">收费项目调价</h4>
+                    </div>
+                    <div class="modal-body">
+                        <form class="form-horizontal form-label-left" novalidate >
+                            <div class="item form-group">
+                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="namepPricePamras">项目名称
+                                </label>
+                                <div class="col-md-6 col-sm-6 col-xs-12">
+                                    <input type="text" id="namepPricePamras" data-validate-length-range="1,20"
+                                           class="form-control col-md-7 col-xs-12" readonly>
+                                </div>
+                            </div>
+                            <div class="item form-group">
+                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="chargeAmountPriceParams">原收费金额
+                                </label>
+                                <div class="col-md-6 col-sm-6 col-xs-12">
+                                    <input type="number" id="chargeAmountPriceParams"
+                                           class="form-control col-md-7 col-xs-12" readonly>
+                                </div>
+                            </div>
+                            <div class="item form-group">
+                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="chargeAmountPriceNeedUpdateParams">现收费金额 <span
+                                        class="required">*</span>
+                                </label>
+                                <div class="col-md-6 col-sm-6 col-xs-12">
+                                    <input type="number" id="chargeAmountPriceNeedUpdateParams"
+                                           class="form-control col-md-7 col-xs-12">
+                                </div>
+                            </div>
+                            <div class="item form-group">
+                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="effectiveTimeParams">生效时间 <span
+                                        class="required">*</span>
+                                </label>
+                                <div class="col-md-6 col-sm-6 col-xs-12">
+                                    <input type="text" id="effectiveTimeParams"
+                                           class="form-control col-md-7 col-xs-12">
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                    <div class="modal-footer">
+                        <input type="hidden" id="code_price"/>
+                        <button type="button" class="btn btn-primary" id="save_price">保存</button>
+                        <button type="button" class="btn btn-default" data-dismiss="modal" onclick="clearPriceInput()">取消</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+
+
+
+
+
         <!--&lt;!&ndash; 信息删除确认 &ndash;&gt;-->
         <!--<div class="modal fade" id="deleteConfirmModel">-->
             <!--<div class="modal-dialog">-->