2023年6月15日 作业记录

作业内容

  • 修改麻醉方法为可下拉选择,并实现失焦写入表中
  • 手术列表新增RowId列
  • 择期手术申请时间校对,不限制后天及以后的择期申请
  • 手术审核功能业务逻辑梳理

2023年6月15日 记录

1. 修改麻醉方法为可下拉

1.1 全局变量 OperList 中新增对象 AnaMethod

var operList = {
    controlDatas: null,
    TeamLeader: null,
    editIndex: null,
    editData: null,
    AnesthesiologistDesc: null, // 麻醉医师
    AnaMethod: null, // 麻醉方法 
}

1.2 $("#operlistBox").datagrid 配置

// 配置 anaMethodDescOptions 
var anaMethodDescOptions = getAnaMethodDescOptions();

// columns 中设置 editor 为下拉盒子
{ field: "AnaMethodDesc", title: "麻醉方法", width: 100, editor: { type: "combobox", options: anaMethodDescOptions }},

1.3 获取下拉盒子选项

// 定义 getAnaMethodDescOptions() 
// 2023年6月15日
// 获取麻醉方法下拉选项
function getAnaMethodDescOptions() {
    return {
        url: ANCSP.DataQuery,
        onBeforeLoad: function (param) {
            param.ClassName = ANCLS.BLL.CodeQueries;
            param.QueryName = "FindAnaestMethod";
            param.Arg1 = "";
            param.Arg2 = "Y";
            param.ArgCnt = 2;
        },
        valueField: "RowId",  // 麻醉方法 RowId
        textField: "Description",  // 麻醉方法名称
        onSelect: function (record) {
            // if (record.Description.indexOf("局部") >= 0 || record.Description.indexOf("局麻") >= 0) {
            //     $.messager.confirm("提示", "选择了" + record.Description + ",请注意麻醉科室是否正确。", "warning");
            // }
            operList.AnaMethod = {
                RowId: record.RowId,
                Description: record.Description
            };
            // console.log(operList.AnaMethod);
            $("#operlistBox").datagrid("acceptChanges");
            $("#operlistBox").datagrid("endEdit", operList.editIndex);
        }
    }
}

1.4 失焦调用后端方法存入表中

// Description:编辑后的各项保存操作
// Date:2023年6月14日
function editorAfterEdit(rowIndex, rowData, changes) {
    var result = null;
    
    // 保存 麻醉方法 -> AnaMethod
    if (changes.AnaMethodDesc || changes.AnaMethodDesc === "") {
        if (changes.AnaMethodDesc === "" || changes.AnaMethodDesc === undefined) { rowData.AnaMethodDesc = ""; }
        else {
            if (operList.AnaMethod) {
                rowData.AnaMethodDesc = operList.AnaMethod.Description;
            }
        }

        result = dhccl.runServerMethod(ANCLS.BLL.OperArrange, "UpdateAnaMethod", rowData.RowId, operList.AnaMethod.RowId, session.UserID);
    }
    // End 保存 麻醉方法 -> AnaMethod

    if (result) {
        if (result.success) { $("#operlistBox").datagrid("refreshRow", rowIndex); }
        else { $.messager.alert("提示", "手术列表信息保存失败:", + result.result, "error"); }
    }
}

1.5 编写后端保存方法

/// 更新麻醉方法
/// 2023年6月15日
/// 注:没有写入日志
/// w ##class(CIS.AN.BL.OperArrange).UpdateAnaMethod("3","176","662")
ClassMethod UpdateAnaMethod(opsId As %String, AnaMethod As %String, userId As %String) As %String
{
	quit:(##class(CIS.AN.OperSchedule).%ExistsId(opsId)=0) "E^手术记录不存在!"
	
	set anaId=##class(CIS.AN.BL.Anaesthesia).GetMainAnaId(opsId)
	quit:anaId="" "E^无麻醉表信息ID"
	
	set anaesthesia=##class(CIS.AN.Anaesthesia).%OpenId(anaId)
	// set operSchedule.CircualNurse=cirNurseId
	
	set anaesthesia.AnaMethod=AnaMethod
	set status=anaesthesia.%Save()
	if ($System.Status.IsError(status))
	{
		quit "E^"_$System.Status.GetErrorText(status)	
	}	
	
	quit "S^"
}

2. 手术列表新增一列显示RowId

在 columns 中加一个 field 即可
注意:Field 应和 Query 中名称一致
!在这里插入图片描述

/**
 * 初始化手术列表表格
 */
function initOperListGrid() {
    var andocEditorOptions=getAndocEditorOptions();
    var anaMethodDescOptions = getAnaMethodDescOptions();

    var columnsConfig = dhccl.runServerMethod("CIS.AN.BL.DataGrid", "GetDataColumns", session.ModuleID, "operlistBox", session.GroupID, session.UserID);
    
    var columns = [[
        { field: "CheckStatus", title: "勾选", checkbox: true },
        // ---2023年6月15日---
        // 新增一列显示 RowId
        { field: "RowId", title: "OperRowId", width: 100 },

效果如图:
!在这里插入图片描述

posted @ 2023-06-19 13:06  李八御  阅读(16)  评论(0)    收藏  举报