WANGJIALIANG il y a 4 ans
Parent
commit
f2babed3dd

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

@@ -732,5 +732,17 @@ public class NavigationController {
         return "mz/clinic";
     }
 
-
+    /**
+     * 嘱托字典
+     *
+     * @return
+     */
+    @RequestMapping("/instruction-code")
+    public String instructionCode(HttpServletRequest httpServletRequest) throws Exception {
+        List<String> urls = getRoleUrls(httpServletRequest);
+        if (!urls.contains("/thmz/instruction-code")) {
+            throw new Exception("您没有此模块的权限,请联系管理员开通!");
+        }
+        return "mz/instruction_code";
+    }
 }

+ 133 - 4
src/main/java/cn/hnthyy/thmz/controller/mz/MzZdInstructionCodeController.java

@@ -1,14 +1,14 @@
 package cn.hnthyy.thmz.controller.mz;
 
+import cn.hnthyy.thmz.Utils.PyWbUtil;
 import cn.hnthyy.thmz.comment.UserLoginToken;
 import cn.hnthyy.thmz.entity.his.zd.MzZdInstructionCode;
+import cn.hnthyy.thmz.pageDto.MzZdInstructionCodePageDto;
 import cn.hnthyy.thmz.service.his.zd.MzZdInstructionCodeService;
 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.*;
 
@@ -52,5 +52,134 @@ public class MzZdInstructionCodeController {
         }
     }
 
+    /**
+     * 查询嘱托
+     *
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/getMzZdInstruction", method = {RequestMethod.POST})
+    public Map<String, Object> getMzZdInstruction(@RequestBody MzZdInstructionCodePageDto mzZdInstructionCodePageDto) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (mzZdInstructionCodePageDto.getMzZdInstructionCode() == null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "查询嘱托失败,参数为空");
+                return resultMap;
+            }
+            List<MzZdInstructionCode> list = mzZdInstructionCodeService.queryMzZdInstructionPage(mzZdInstructionCodePageDto);
+            int total = mzZdInstructionCodeService.queryMzZdInstructionCount(mzZdInstructionCodePageDto.getMzZdInstructionCode());
+            resultMap.put("code", 0);
+            resultMap.put("message", "查询嘱托成功");
+            resultMap.put("data", list);
+            resultMap.put("total", total);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("查询嘱托失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "查询嘱托失败");
+            return resultMap;
+        }
+    }
+
+    /**
+     * 保存嘱托
+     * @param mzZdInstructionCode
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/saveMzZdInstruction",method = {RequestMethod.POST})
+    public Map<String,Object> saveMzZdInstruction(@RequestBody MzZdInstructionCode mzZdInstructionCode){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(mzZdInstructionCode==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "参数不能为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(mzZdInstructionCode.getDelFlag())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "嘱托状态不能为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(mzZdInstructionCode.getInstructionText())){
+                resultMap.put("code", -1);
+                resultMap.put("message", "嘱托内容不能为空");
+                return resultMap;
+            }
+            if(mzZdInstructionCode.getInstructionType() == null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "嘱托类型不能为空");
+                return resultMap;
+            }
+            mzZdInstructionCode.setPyCode(PyWbUtil.toBigFirstChar(mzZdInstructionCode.getInstructionText()));
+            mzZdInstructionCode.setWbCode(PyWbUtil.getWBCode(mzZdInstructionCode.getInstructionText()));
+            mzZdInstructionCode.setDelFlag("0");
+            if(StringUtils.isBlank(mzZdInstructionCode.getCode())){
+                int num=mzZdInstructionCodeService.saveMzZdInstructionCode(mzZdInstructionCode);
+                if(num==0){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "保存失败,请重新操作或者联系管理员");
+                    return resultMap;
+                }
+            }else {
+                //修改
+                int num = mzZdInstructionCodeService.modifyMzZdInstructionCode(mzZdInstructionCode);
+                if(num>=0){
+                    resultMap.put("code", 0);
+                    resultMap.put("message", "保存嘱托成功");
+                    return resultMap;
+                }
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "保存嘱托成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("保存嘱托失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "保存嘱托失败");
+            return resultMap;
+        }
+    }
 
+    /**
+     * 更新嘱托状态
+     * @param code
+     * @param delFlag
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/updateDelFlag",method = {RequestMethod.GET})
+    public Map<String,Object> updateDelFlag(@RequestParam("code") String code,@RequestParam("delFlag") Integer delFlag){
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(delFlag == null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "嘱托状态不能为空");
+                return resultMap;
+            }
+            if(StringUtils.isBlank(code)){
+                resultMap.put("code", -1);
+                resultMap.put("message", "嘱托排序码不能为空");
+                return resultMap;
+            }
+            int num=mzZdInstructionCodeService.modifyDelFlag(code,delFlag);
+            if(num==0){
+                resultMap.put("code", -1);
+                resultMap.put("message", delFlag==0?"启用":"停用"+"失败,请重新操作或者联系管理员");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", delFlag==0?"启用":"停用"+"嘱托成功");
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(delFlag==0?"启用":"停用"+"嘱托失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", delFlag==0?"启用":"停用"+"嘱托失败");
+            return resultMap;
+        }
+    }
 }

+ 116 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zd/MzZdInstructionCodeMapper.java

@@ -1,8 +1,11 @@
 package cn.hnthyy.thmz.mapper.his.zd;
 
 import cn.hnthyy.thmz.entity.his.zd.MzZdInstructionCode;
+import cn.hnthyy.thmz.pageDto.MzZdInstructionCodePageDto;
+import org.apache.ibatis.annotations.Insert;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -17,4 +20,117 @@ public interface MzZdInstructionCodeMapper {
     @Select("SELECT code,instruction_text,del_flag,py_code, d_code wb_code,instruction_type FROM mz_zd_instruction_code  where del_flag=0 and (instruction_type=2 or instruction_type=#{instructionType})")
     List<MzZdInstructionCode> selectMzZdInstructionByType(@Param("instructionType") Integer instructionType);
 
+    /**
+     * 查询嘱托
+     * @param mzZdInstructionCodePageDto
+     * @return
+     */
+    @Select({
+            "<script>",
+            " SELECT top ${pageSize} code,instruction_text,del_flag,py_code,wb_code,instruction_type",
+            " FROM (SELECT ROW_NUMBER() OVER (ORDER BY mz_zd_instruction_code.code desc) ",
+            " AS RowNumber,code,instruction_text,del_flag,py_code, d_code wb_code,instruction_type from mz_zd_instruction_code where 1=1 ",
+            "<when test='mzZdInstructionCode.code!=null'>",
+            " and code = #{mzZdInstructionCode.code}",
+            "</when>",
+            "<when test='mzZdInstructionCode.instructionText!=null'>",
+            " and instruction_text like '%${mzZdInstructionCode.instructionText}%'",
+            "</when>",
+            "<when test='mzZdInstructionCode.delFlag!=null'>",
+            " and del_flag = #{mzZdInstructionCode.delFlag}",
+            "</when>",
+            "<when test='mzZdInstructionCode.pyCode!=null'>",
+            " and py_code = #{mzZdInstructionCode.pyCode}",
+            "</when>",
+            "<when test='mzZdInstructionCode.wbCode!=null'>",
+            " and d_code = #{mzZdInstructionCode.wbCode}",
+            "</when>",
+            "<when test='mzZdInstructionCode.instructionType!=null'>",
+            " and instruction_type = #{mzZdInstructionCode.instructionType}",
+            "</when>",
+            ") as A WHERE RowNumber >#{pageSize}*#{pageIndex} order by RowNumber asc",
+            "</script>"
+    })
+    List<MzZdInstructionCode> selectMzZdInstructionPage(MzZdInstructionCodePageDto mzZdInstructionCodePageDto);
+
+    /**
+     * 统计嘱托数量
+     *
+     * @param mzZdInstructionCode 嘱托查询条件
+     * @return
+     */
+    @Select({"<script>",
+            "select count(1) from mz_zd_instruction_code where 1=1 ",
+            "<when test='code!=null'>",
+            " and code = #{code}",
+            "</when>",
+            "<when test='instructionText!=null'>",
+            " and instruction_text like '%${instructionText}%'",
+            "</when>",
+            "<when test='delFlag!=null'>",
+            " and del_flag = #{delFlag}",
+            "</when>",
+            "<when test='pyCode!=null'>",
+            " and py_code = #{pyCode}",
+            "</when>",
+            "<when test='wbCode!=null'>",
+            " and d_code = #{wbCode}",
+            "</when>",
+            "<when test='instructionType!=null'>",
+            " and instruction_type = #{instructionType}",
+            "</when>",
+            "</script>"})
+    int selectMzZdInstructionCount(MzZdInstructionCode mzZdInstructionCode);
+
+    /**
+     * 修改嘱托
+     * @param mzZdInstructionCode
+     * @return
+     */
+    @Update({"<script>",
+            "update mz_zd_instruction_code",
+            "<trim prefix='set' prefixOverrides=',' suffix=' where code = #{code} '>",
+            "<when test='instructionText!=null'>",
+            "instruction_text =#{instructionText}",
+            "</when>",
+            "<when test='delFlag!=null'>",
+            ",del_flag =#{delFlag}",
+            "</when>",
+            "<when test='pyCode!=null'>",
+            ",py_code =#{pyCode}",
+            "</when>",
+            "<when test='wbCode!=null'>",
+            ",d_code =#{wbCode}",
+            "</when>",
+            "<when test='instructionType!=null'>",
+            ",instruction_type =#{instructionType}",
+            "</when>",
+            "</trim>",
+            "</script>"})
+    int updateMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode);
+
+    /**
+     * 根据排序码code修改停用状态
+     * @param code
+     * @param delFlag
+     * @return
+     */
+    @Update("update mz_zd_instruction_code set del_flag=#{delFlag} where code=#{code}")
+    int updateDelFlag(@Param("code") String code,@Param("delFlag") Integer delFlag);
+
+    /**
+     * 新增嘱托
+     * @param mzZdInstructionCode
+     * @return
+     */
+    @Insert("insert into mz_zd_instruction_code (code,instruction_text,del_flag,py_code,d_code,instruction_type) " +
+            " values(#{code},#{instructionText},#{delFlag},#{pyCode},#{wbCode},#{instructionType})")
+    int insertMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode);
+
+    /**
+     * 查询嘱托最大编码code
+     * @return
+     */
+    @Select("select max(code) from mz_zd_instruction_code")
+    String selectMaxCode();
 }

+ 18 - 0
src/main/java/cn/hnthyy/thmz/pageDto/MzZdInstructionCodePageDto.java

@@ -0,0 +1,18 @@
+package cn.hnthyy.thmz.pageDto;
+
+import cn.hnthyy.thmz.entity.his.zd.MzZdInstructionCode;
+import lombok.Data;
+
+/**
+ * 医嘱字典分页参数
+ */
+@Data
+public class MzZdInstructionCodePageDto {
+    private MzZdInstructionCode mzZdInstructionCode;
+    //默认页
+    private   Integer pageIndex=0;
+    //默认页面展示数
+    private  Integer pageSize=10;
+    //排序字段
+    private String orderByCase;
+}

+ 37 - 0
src/main/java/cn/hnthyy/thmz/service/his/zd/MzZdInstructionCodeService.java

@@ -1,6 +1,7 @@
 package cn.hnthyy.thmz.service.his.zd;
 
 import cn.hnthyy.thmz.entity.his.zd.MzZdInstructionCode;
+import cn.hnthyy.thmz.pageDto.MzZdInstructionCodePageDto;
 
 import java.util.List;
 
@@ -13,4 +14,40 @@ public interface MzZdInstructionCodeService {
      */
     List<MzZdInstructionCode> queryMzZdInstructionByType(Integer instructionType);
 
+    /**
+     * 查询嘱托
+     * @param mzZdInstructionCodePageDto
+     * @return
+     */
+    List<MzZdInstructionCode> queryMzZdInstructionPage(MzZdInstructionCodePageDto mzZdInstructionCodePageDto);
+
+    /**
+     * 统计嘱托数量
+     *
+     * @param mzZdInstructionCode 嘱托查询条件
+     * @return
+     */
+    int queryMzZdInstructionCount(MzZdInstructionCode mzZdInstructionCode);
+
+    /**
+     * 修改嘱托
+     * @param mzZdInstructionCode
+     * @return
+     */
+    int modifyMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode);
+
+    /**
+     * 根据排序码code修改停用状态
+     * @param code
+     * @param delFlag
+     * @return
+     */
+    int modifyDelFlag(String code,Integer delFlag);
+
+    /**
+     * 新增嘱托
+     * @param mzZdInstructionCode
+     * @return
+     */
+    int saveMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode);
 }

+ 28 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zd/MzZdInstructionCodeServiceImpl.java

@@ -2,6 +2,7 @@ package cn.hnthyy.thmz.service.impl.his.zd;
 
 import cn.hnthyy.thmz.entity.his.zd.MzZdInstructionCode;
 import cn.hnthyy.thmz.mapper.his.zd.MzZdInstructionCodeMapper;
+import cn.hnthyy.thmz.pageDto.MzZdInstructionCodePageDto;
 import cn.hnthyy.thmz.service.his.zd.MzZdInstructionCodeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -18,4 +19,31 @@ public class MzZdInstructionCodeServiceImpl implements MzZdInstructionCodeServic
     public List<MzZdInstructionCode> queryMzZdInstructionByType(Integer instructionType) {
         return mzZdInstructionCodeMapper.selectMzZdInstructionByType(instructionType);
     }
+
+    @Override
+    public List<MzZdInstructionCode> queryMzZdInstructionPage(MzZdInstructionCodePageDto mzZdInstructionCodePageDto) {
+        return mzZdInstructionCodeMapper.selectMzZdInstructionPage(mzZdInstructionCodePageDto);
+    }
+
+    @Override
+    public int queryMzZdInstructionCount(MzZdInstructionCode mzZdInstructionCode) {
+        return mzZdInstructionCodeMapper.selectMzZdInstructionCount(mzZdInstructionCode);
+    }
+
+    @Override
+    public int modifyMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode) {
+        return mzZdInstructionCodeMapper.updateMzZdInstructionCode(mzZdInstructionCode);
+    }
+
+    @Override
+    public int modifyDelFlag(String code, Integer delFlag) {
+        return mzZdInstructionCodeMapper.updateDelFlag(code,delFlag);
+    }
+
+    @Override
+    public int saveMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode) {
+        String code = mzZdInstructionCodeMapper.selectMaxCode();
+        mzZdInstructionCode.setCode(Integer.parseInt(code)+1+"");
+        return mzZdInstructionCodeMapper.insertMzZdInstructionCode(mzZdInstructionCode);
+    }
 }

+ 283 - 0
src/main/resources/static/js/mz/instruction_code.js

@@ -0,0 +1,283 @@
+//@ sourceURL=instruction_code.js
+$(function () {
+    $("input").each(function (){
+        this.onkeydown = function (e) { // 监听键盘事件
+            let theEvent = window.event || e;
+            let code = theEvent.keyCode || theEvent.which;
+            if (code == 13) {//回车事件
+                $("#btn_search").click(); //触发搜索按钮点击事件
+            }
+        }
+    });
+    //新增按钮点击事件
+    $("#btn_add").click(function (t) {
+        $("#editModal").modal();
+        $("#classTitle").text("新增");
+        clearInput();
+        $("#delFlag").val(0);
+    });
+    //保存按钮点击事件
+    $("#btn_save").click(function (t) {
+        var validatorResult = validator.checkAll($("#editGroupForm"));
+        if (validatorResult) {
+            saveMzZdInstruction();
+        }
+    });
+    $(".selectpicker").selectpicker();
+    //初始化表格数据
+    getAllMzZdInstruction();
+});
+
+/**
+ * 保存数据
+ */
+function saveMzZdInstruction() {
+    var data = JSON.stringify({
+        code: $("#code").val(),
+        delFlag: $("#delFlag").val(),
+        instructionText: $("#instructionText").val(),
+        instructionType: $("#instructionType").val()
+    });
+    $.ajax({
+        type: "POST",
+        url: '/thmz/saveMzZdInstruction',
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: data,
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                $("#editModal").modal("hide");
+                clearInput();
+                $('#tb_table').bootstrapTable('refresh');
+                successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+
+}/**
+ * 修改嘱托状态
+ */
+function updateDelFlag(code,delFlag) {
+    $.ajax({
+        type: "GET",
+        url: '/thmz/updateDelFlag?code='+code+'&delFlag='+delFlag,
+        contentType: "application/json;charset=UTF-8",
+        dataType: "json",
+        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+        data: {},
+        success: function (res) {
+            if (res == '401' || res == 401) {
+                window.location.href = '/thmz/login/view'
+                return;
+            }
+            if (res.code == 0) {
+                $("#editModal").modal("hide");
+                clearInput();
+                $('#tb_table').bootstrapTable('refresh');
+                successMesage(res);
+            } else {
+                errorMesage(res);
+            }
+        }
+    });
+}
+
+
+/**
+ * 清空输入框
+ */
+function clearInput() {
+    $("#instructionText").val(null);
+    $("#instructionType").val(null);
+    $("#code").val(null);
+    $("#delFlag").val(null);
+    $("#instructionType").selectpicker('refresh');
+}
+
+/**
+ * 重置查询表单
+ */
+function resetSearch() {
+    $("#instructionTypeSearch").val(null);
+    $("#pyCodeSearch").val(null);
+    $("#wbCodeSearch").val(null);
+    $("#instructionTypeSearch").selectpicker('refresh');
+    $("#delFlagSearch").val(null);
+    $("#delFlagSearch").selectpicker('refresh');
+    $("#instructionTextSearch").val(null);
+    $("#codeSearch").val(null);
+}
+
+
+/**
+ * 查询列表
+ */
+function getAllMzZdInstruction() {
+    $('#tb_table').bootstrapTable("destroy");
+    $('#tb_table').bootstrapTable({
+        url: '/thmz/getMzZdInstruction',         //请求后台的URL(*)
+        method: 'post',                      //请求方式(*)
+        toolbar: '#toolbar',                //工具按钮用哪个容器
+        striped: true,                      //是否显示行间隔色
+        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
+        pagination: true,                   //是否显示分页(*)
+        sortable: true,                     //是否启用排序
+        sortOrder: "desc",                   //排序方式
+        queryParams: queryParams,           //传递参数(*)
+        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)
+        pageNumber: 1,                       //初始化加载第一页,默认第一页
+        pageSize: 10,                       //每页的记录行数(*)
+        pageList: [10, 15, 25, 50, 100],        //可供选择的每页的行数(*)
+        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
+        strictSearch: true,
+        showColumns: false,                  //是否显示所有的列
+        showRefresh: false,                  //是否显示刷新按钮
+        minimumCountColumns: 2,             //最少允许的列数
+        clickToSelect: true,                //是否启用点击选中行
+        uniqueId: "groupNo",                     //每一行的唯一标识,一般为主键列
+        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
+        cardView: false,                    //是否显示详细视图
+        detailView: false,
+        //rowStyle:rowStyle,//通过自定义函数设置行样式
+        ajaxOptions: {
+            headers: {
+                'Accept': 'application/json',
+                'Authorization': 'Bearer ' + localStorage.getItem("token")
+            }
+        },
+        columns: [
+            {
+                title: '操作',
+                field: 'op',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    var str = '';
+                    if (row.delFlag == 0) {
+                        str += '<button type="button" class="btn btn-warning  btn-sm" onclick="updateDelFlag(\'' + row.code + '\',1)">停用</button>';
+                    } else if (row.delFlag == 1) {
+                        str += '<button type="button" class="btn btn-success  btn-sm" onclick="updateDelFlag(\'' + row.code + '\',0)">启用</button>';
+                    }
+                    str += '<button type="button" class="btn btn-primary  btn-sm" onclick="updateInstructionCode(\'' + row.code + '\',\'' + row.instructionText + '\',\'' + row.instructionType + '\',\'' + row.delFlag + '\')">编辑</button>';
+                    return [str].join('');
+                }
+            }, {
+                field: 'instructionText',
+                title: '嘱托内容',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'delFlag',
+                title: '停用状态',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    return value == 0 ? '<span style="color: green">否</span>' : '<span style="color: red">是</span>';
+                }
+            },
+            {
+                field: 'code',
+                title: '排序码',
+                align: "center",
+                valign: 'middle'
+            },
+            {
+                field: 'pyCode',
+                title: '拼音码',
+                align: "center",
+                valign: 'middle'
+            },
+            {
+                field: 'wbCode',
+                title: '五笔码',
+                align: "center",
+                valign: 'middle'
+            }, {
+                field: 'instructionType',
+                title: '类型',
+                align: "center",
+                valign: 'middle',
+                formatter: function (value, row, index) {
+                    if(value == 0){
+                        return "西药";
+                    }else if(value == 1){
+                        return "中药";
+                    }else if(value == 2){
+                        return "通用";
+                    }
+                    return '-';
+                }
+            }
+        ],
+        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   //数据
+            };
+        },
+    });
+}
+
+
+/**
+ * 构建列表查询参数
+ * @param params
+ */
+function queryParams(params) {
+    var temp = {   //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
+        pageSize: params.limit,   //页面大小
+        pageIndex: params.offset / params.limit,  //页码
+        mzZdInstructionCode: {
+            delFlag: $("#delFlagSearch").val() == "" ? null : $("#delFlagSearch").val(),
+            instructionType: $("#instructionTypeSearch").val() == "" ? null : $("#instructionTypeSearch").val(),
+            wbCode: $("#wbCodeSearch").val() == "" ? null : $("#wbCodeSearch").val(),
+            pyCode: $("#pyCodeSearch").val() == "" ? null : $("#pyCodeSearch").val(),
+            instructionText: $("#instructionTextSearch").val() == "" ? null : $("#instructionTextSearch").val()
+        }
+    };
+    return temp;
+}
+
+
+/**
+ * 打开编辑窗口
+ * @param row
+ */
+function updateInstructionCode(code,instructionText,instructionType,delFlag) {
+    clearInput();
+    $("#classTitle").text("修改");
+    $("#code").val(code);
+    $("#delFlag").val(delFlag);
+    $("#instructionText").val(instructionText);
+    $("#instructionType").val(instructionType);
+    $("#instructionText").selectpicker('refresh');
+    $("#instructionType").selectpicker('refresh');
+    $("#editModal").modal();
+}

+ 115 - 0
src/main/resources/templates/mz/instruction_code.html

@@ -0,0 +1,115 @@
+<link rel="stylesheet" href="/thmz/css/bootstrap/css/bootstrap-select.css"/>
+<link rel="stylesheet" href="/thmz/css/custom.min.css">
+<script src="/thmz/js/dependent/bootstrap-select.js"></script>
+<script src="/thmz/js/mz/instruction_code.js"></script>
+<div class="row" style="height: calc(100% - 60px);overflow-y: auto;">
+    <div class="col-md-12 col-sm-12 col-xs-12">
+        <div class="x_panel">
+            <div class="panel-body">
+                <form id="formSearch" class="form-horizontal" autocomplete="off">
+                    <div class="item form-group ">
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="pyCodeSearch">拼音码
+                        </label>
+                        <div class="col-md-1 col-sm-1 col-xs-12">
+                            <input id="pyCodeSearch" class="form-control optional" type="text">
+                        </div>
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="wbCodeSearch">五笔码
+                        </label>
+                        <div class="col-md-1 col-sm-1 col-xs-12">
+                            <input id="wbCodeSearch" class="form-control optional" type="text">
+                        </div>
+                        <label class="control-label col-md-1 col-sm-1 col-xs-12" for="instructionTextSearch">内容
+                        </label>
+                        <div class="col-md-2 col-sm-2 col-xs-12">
+                            <input id="instructionTextSearch" class="form-control optional" type="text">
+                        </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="delFlagSearch">停用</label>
+                            <div class="col-md-8 col-sm-8 col-xs-12">
+                                <select class="form-control selectpicker show-tick" required="required" title="请选择"
+                                        id="delFlagSearch" onchange="getAllMzZdInstruction()">
+                                    <option value="0">否</option>
+                                    <option value="1">是</option>
+                                </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="instructionTypeSearch">类型</label>
+                            <div class="col-md-8 col-sm-8 col-xs-12">
+                                <select class="form-control selectpicker show-tick" required="required" title="请选择"
+                                        id="instructionTypeSearch" onchange="getAllMzZdInstruction()">
+                                    <option value="0">西药</option>
+                                    <option value="1">中药</option>
+                                    <option value="2">通用</option>
+                                </select>
+                            </div>
+                        </div>
+                        <button type="button" id="btn_search" class="btn btn-primary"
+                                title="查询" onclick="getAllMzZdInstruction()"><i class="glyphicon glyphicon-search"></i>
+                        </button>
+                        <button type="button" id="btn_reset" class="btn btn-primary"
+                                title="重置" onclick="resetSearch()"><i class="fa fa-rotate-left"></i>
+                        </button>
+                    </div>
+                    <div class="item form-group ">
+                        <button type="button" id="btn_add" class="btn btn-primary"
+                                title="添加嘱托"><i class="fa fa-plus"></i>
+                        </button>
+                    </div>
+                </form>
+            </div>
+            <table id="tb_table"></table>
+        </div>
+    </div>
+</div>
+
+<!--新增或者编辑嘱托信息弹窗开始-->
+<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true" id="editModal">
+    <div class="modal-dialog modal-lg">
+        <div class="modal-content" style="width: 520px;margin-left: 250px;margin-top: 120px;">
+            <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">嘱托管理【<span id="classTitle">新增</span>】</h4>
+            </div>
+            <div class="modal-body">
+                <form class="form-horizontal form-label-left" novalidate id="editGroupForm" autocomplete="off">
+                    <input id="code" class="form-control" type="hidden">
+                    <input id="delFlag" class="form-control" type="hidden">
+                    <div class="item form-group ">
+                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="instructionText">嘱托内容 <span
+                                class="required">*</span>
+                        </label>
+                        <div class="col-md-5 col-sm-5 col-xs-12">
+                            <input id="instructionText" class="form-control optional" type="text" required="required" data-validate-length-range="1,60">
+                        </div>
+                    </div>
+                    <div class="item form-group ">
+                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="instructionType">嘱托类型 <span
+                                class="required">*</span>
+                        </label>
+                        <div class="col-md-5 col-sm-5 col-xs-12">
+                            <select class="form-control show-tick" required="required" title="请选择"
+                                    id="instructionType">
+                                <option value="0">西药</option>
+                                <option value="1">中药</option>
+                                <option value="2">通用</option>
+                            </select>
+                        </div>
+                    </div>
+                </form>
+            </div>
+            <div class="modal-footer">
+                <input id="requestId" type="hidden"/>
+                <button type="button" class="btn btn-primary" id="btn_save">保存</button>
+                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+            </div>
+        </div>
+    </div>
+</div>
+<!--新增或者编辑嘱托弹窗结尾-->
+
+
+