/// <summary> /// 新增明细项 /// </summary> private void InsertBloodGasDetail(MED_BLOOD_GAS_MASTER tempNewMaster) { // 添加默认的血气项 List <MED_BLOOD_GAS_DETAIL_SHOW> tempNewDetailList = new List <MED_BLOOD_GAS_DETAIL_SHOW>(); foreach (MED_BLOOD_GAS_DICT tempDict in ApplicationModel.Instance.AllDictList.BloodGasDictList) { if (tempDict.BLG_STATUS.Equals("1")) { MED_BLOOD_GAS_DETAIL_SHOW tempNewDetailShow = new MED_BLOOD_GAS_DETAIL_SHOW(); tempNewDetailShow.ROWNUM = tempNewDetailList.Count + 1; tempNewDetailShow.DETAIL_ID = tempNewMaster.DETAIL_ID; tempNewDetailShow.BLG_CODE = tempDict.BLG_CODE; tempNewDetailShow.BLG_VALUE = string.Empty; tempNewDetailShow.OPERATOR = tempNewMaster.OPERATOR; tempNewDetailShow.OP_DATE = DateTime.Now; tempNewDetailShow.BLG_NAME = tempDict.BLG_NAME; tempNewDetailShow.BLG_SHOWID = tempDict.BLG_SHOWID; tempNewDetailShow.BLG_UNIT = tempDict.BLG_UNIT; tempNewDetailShow.BLG_REFER_VALUE = tempDict.BLG_REFER_VALUE; tempNewDetailList.Add(tempNewDetailShow); } } this.MedBloodGasDetailShow = tempNewDetailList; }
private string GetDisplayName(MED_BLOOD_GAS_MASTER row) { string itemText = "静脉"; if (!string.IsNullOrEmpty(row.NURSE_MEMO1) && !string.IsNullOrEmpty(row.NURSE_MEMO1.Trim())) { itemText = row.NURSE_MEMO1; } return(itemText); }
protected override SaveResult SaveData() { // 保存主表数据 if (this.insertBloodGasMaster != null) { this.insertBloodGasMaster = null; } // 保存明细数据 List <MED_BLOOD_GAS_DETAIL_EXT> tempDetailList = new List <MED_BLOOD_GAS_DETAIL_EXT>(); foreach (MED_BLOOD_GAS_DETAIL_SHOW item in this.MedBloodGasDetailShow) { MED_BLOOD_GAS_DETAIL_EXT tempDetail = new MED_BLOOD_GAS_DETAIL_EXT(); tempDetail.DETAIL_ID = item.DETAIL_ID; tempDetail.BLG_CODE = item.BLG_CODE; tempDetail.BLG_VALUE = item.BLG_VALUE; tempDetail.OPERATOR = item.OPERATOR; tempDetail.ABNORMAL_INDICATOR = item.ABNORMAL_INDICATOR; tempDetailList.Add(tempDetail); } // NURSE_MEMO2为空时则显示,不为空是则不显示 //this.MedBloodGasMaster.ForEach(x => //{ // x.NURSE_MEMO2 = ""; //}); if (this.outDateTime != null)// 检验血气是否超过了出室时间 { List <MED_BLOOD_GAS_MASTER> errorGasMasters = this.MedBloodGasMaster.FindAll(x => x.RECORD_DATE > this.outDateTime); if (errorGasMasters.Count > 0) { this.ShowMessageBox("血气时间有误,超过出室时间!", MessageBoxButton.OK, MessageBoxImage.Information); return(SaveResult.Fail); } } bool result = CommonService.ClientInstance.UpdateByTransaction(TransactionParamsters.Create(this.MedBloodGasMaster, tempDetailList).ToString()); this.AddButtonIsEnabled = true; this.DelButtonIsEnabled = true; this.EditButtonIsEnabled = true; return(result ? SaveResult.Success : SaveResult.Fail); }
/// <summary> /// 保存数据 /// </summary> private void SaveBloodGasMasterAndDetail() { // 保存主表数据 if (this.insertBloodGasMaster != null) { this.insertBloodGasMaster = null; } // 保存明细数据(以EXT表为主) List <MED_BLOOD_GAS_DETAIL_EXT> tempDetailList = new List <MED_BLOOD_GAS_DETAIL_EXT>(); foreach (MED_BLOOD_GAS_DETAIL_SHOW item in this.MedBloodGasDetailShow) { MED_BLOOD_GAS_DETAIL_EXT tempDetail = new MED_BLOOD_GAS_DETAIL_EXT(); tempDetail.DETAIL_ID = item.DETAIL_ID; tempDetail.BLG_CODE = item.BLG_CODE; tempDetail.BLG_VALUE = item.BLG_VALUE; tempDetail.OPERATOR = item.OPERATOR; tempDetail.ABNORMAL_INDICATOR = item.ABNORMAL_INDICATOR; tempDetailList.Add(tempDetail); } if (this.outDateTime != null)// 检验血气是否超过了出室时间 { List <MED_BLOOD_GAS_MASTER> errorGasMasters = this.MedBloodGasMaster.FindAll(x => x.RECORD_DATE > this.outDateTime); if (errorGasMasters.Count > 0) { this.ShowMessageBox("血气时间有误,超过出室时间!", MessageBoxButton.OK, MessageBoxImage.Information); return; } } CommonService.ClientInstance.UpdateByTransaction(TransactionParamsters.Create(this.MedBloodGasMaster, tempDetailList).ToString()); this.ShowMessageBox("保存成功!", MessageBoxButton.OK, MessageBoxImage.Information); this.CloseContentWindow(); this.AddButtonIsEnabled = true; this.DelButtonIsEnabled = true; this.EditButtonIsEnabled = true; }
/// <summary> /// 保存数据 /// </summary> public void AddBloodGasMasterRecord(object operatorUserID, string strType) { if (null == operatorUserID || string.IsNullOrEmpty(operatorUserID.ToString())) { this.ShowMessageBox("操作者不能为空,请重新选择!", MessageBoxButton.OK, MessageBoxImage.Information); } else if (this.InsertDateTime > this.curPatInfo.OUT_DATE_TIME && this.curPatInfo.OUT_DATE_TIME != null)// 检验血气的填写时间是否超过了出室时间 { this.ShowMessageBox("血气时间有误,超过了出室时间!", MessageBoxButton.OK, MessageBoxImage.Information); } else { if (paramaterData != null) { MED_BLOOD_GAS_MASTER tmpItem = paramaterData as MED_BLOOD_GAS_MASTER; tmpItem.RECORD_DATE = this.InsertDateTime; tmpItem.NURSE_MEMO1 = strType; tmpItem.OPERATOR = operatorUserID.ToString(); Messenger.Default.Send <object>(tmpItem, EnumMessageKey.RefreshBloodGasMaster); } else { MED_BLOOD_GAS_MASTER newMaster = new MED_BLOOD_GAS_MASTER(); newMaster.DETAIL_ID = this.InsertDateTime.ToString("yyyy-MM-dd HH:mm") + "|" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10); newMaster.PATIENT_ID = this.curPatInfo.PATIENT_ID; newMaster.VISIT_ID = this.curPatInfo.VISIT_ID; newMaster.OPER_ID = this.curPatInfo.OPER_ID; newMaster.RECORD_DATE = this.InsertDateTime; newMaster.NURSE_MEMO1 = strType; newMaster.NURSE_MEMO2 = "ok@"; newMaster.OP_DATE = DateTime.Now; newMaster.OPERATOR = operatorUserID.ToString(); newMaster.ModelStatus = ModelStatus.Add; // 刷新血气主表信息 Messenger.Default.Send <object>(newMaster, EnumMessageKey.RefreshBloodGasMaster); } this.CloseContentWindow(); } }
/// <summary> /// 注册命令信息 /// </summary> private void RegisterCommand() { // 切换血气分析明细信息 this.ShowDetailCommand = new RelayCommand <object>(par => { // 在新增血气状态下不能切换 if (this.AddButtonIsEnabled) { MED_BLOOD_GAS_MASTER tempMaster = par as MED_BLOOD_GAS_MASTER; if (null != tempMaster) { this.RefreshDetailData(tempMaster.DETAIL_ID); } } }); // 新增血气分析项 this.AddMasterCommand = new RelayCommand <object>(par => { var message = new ShowContentWindowMessage("AddBloodGasMaster", "新增血气分析记录"); message.Height = 250; message.Width = 300; Messenger.Default.Send <ShowContentWindowMessage>(message); }); // 增加血气成功后刷新左侧列表信息 Messenger.Default.Register <object>(this, EnumMessageKey.RefreshBloodGasMaster, msg => { if (null != msg && msg is MED_BLOOD_GAS_MASTER) { // 添加按钮不可用 this.AddButtonIsEnabled = false; this.DelButtonIsEnabled = false; this.EditButtonIsEnabled = true; // 将新添加的血气主信息添加到数据源 this.insertBloodGasMaster = msg as MED_BLOOD_GAS_MASTER; List <MED_BLOOD_GAS_MASTER> tempMasterList = new List <MED_BLOOD_GAS_MASTER>(this.MedBloodGasMaster); MED_BLOOD_GAS_MASTER tmpItem = tempMasterList.Find(x => x.DETAIL_ID == insertBloodGasMaster.DETAIL_ID); if (tmpItem != null) { tempMasterList.Remove(tmpItem); } tempMasterList.Add(this.insertBloodGasMaster); this.MedBloodGasMaster = tempMasterList; // 新增明细项 this.InsertBloodGasDetail(this.insertBloodGasMaster); // 刷新界面 Messenger.Default.Send <object>(this.insertBloodGasMaster, EnumMessageKey.RefreshBloodGasMasterSelection); } }); // 保存血气分析明细 this.SaveDetailCommand = new RelayCommand <object>(par => { this.PublicKeyBoardMessage(KeyCode.AppCode.Save); }); // 删除血气主表数据 this.DelMasterCommand = new RelayCommand <object>(par => { if (par != null && par is MED_BLOOD_GAS_MASTER) { this.ShowMessageBox("确认删除选中项?", MessageBoxButton.YesNo, MessageBoxImage.Question, new Action <MessageBoxResult>((mbr) => { if (mbr == MessageBoxResult.OK) { TransactionParamsters tp = TransactionParamsters.Create(); MED_BLOOD_GAS_MASTER tempMaster = par as MED_BLOOD_GAS_MASTER; tempMaster.ModelStatus = ModelStatus.Deleted; tp.Append(tempMaster); // 不修改EXT表的内容 //List<MED_BLOOD_GAS_DETAIL_EXT> detailList = AnesInfoService.ClientInstance.GetBloodGasDetailExtList(tempMaster.DETAIL_ID); //foreach (MED_BLOOD_GAS_DETAIL_EXT item in detailList) //{ // item.ModelStatus = ModelStatus.Deleted; //} // //tp.Append(detailList); CommonService.ClientInstance.UpdateByTransaction(tp.ToString()); // 刷新主表数据 this.RefreshMasterData(); this.ShowMessageBox("删除成功!", MessageBoxButton.OK, MessageBoxImage.Information); } })); } else { this.ShowMessageBox("请选中数据行再执行删除!", MessageBoxButton.OK, MessageBoxImage.Information); } }); // 编辑血气主表数据 this.EditMasterCommand = new RelayCommand <object>(par => { if (par != null && par is MED_BLOOD_GAS_MASTER) { var message = new ShowContentWindowMessage("AddBloodGasMaster", "新增血气分析记录"); message.Height = 250; message.Width = 300; message.Args = new object[] { par }; Messenger.Default.Send <ShowContentWindowMessage>(message); } }); }
private void btnSave_Click(object sender, EventArgs e) { List <MED_BLOOD_GAS_MASTER> bloodGasMasterDataTable = AnesInfoService.ClientInstance.GetBloodGasMasterList(_patientID, _visitID, _operID); if (bloodGasMasterDataTable == null) { return; } MED_BLOOD_GAS_MASTER row = null; if (string.IsNullOrEmpty(_detailID)) { _detailID = TimePoint.ToString("yyyy-MM-dd HH:mm") + "|" + Guid.NewGuid().ToString().Replace("-", "").Substring(0, 10); row = new MED_BLOOD_GAS_MASTER(); row.PATIENT_ID = _patientID; row.VISIT_ID = _visitID; row.OPER_ID = _operID; row.RECORD_DATE = TimePoint; row.OP_DATE = DateTime.Now; row.OPERATOR = string.IsNullOrEmpty(ExtendAppContext.Current.LoginUser.USER_JOB_ID) ? ExtendAppContext.Current.LoginUser.LOGIN_NAME : ExtendAppContext.Current.LoginUser.USER_JOB_ID; row.DETAIL_ID = _detailID; bloodGasMasterDataTable.Add(row); } else { row = bloodGasMasterDataTable.Where(x => x.DETAIL_ID == _detailID).FirstOrDefault(); } if (row == null) { return; } if (radioGroupBloodGasTypes.SelectedIndex == 1) { row.NURSE_MEMO1 = "动脉"; } else { row.NURSE_MEMO1 = null; } row.NURSE_MEMO2 = "ok@" + comboBoxEditSample.Text.Trim(); if (!AnesInfoService.ClientInstance.SaveBloodGasMaster(bloodGasMasterDataTable)) { return; } List <MED_BLOOD_GAS_DETAIL> detailTable = AnesInfoService.ClientInstance.GetBloodGasDetailList(_detailID); foreach (DataGridViewRow drow in dataGridView1.Rows) { string blgCode = drow.Cells[0].Value.ToString(); MED_BLOOD_GAS_DETAIL detailRow = detailTable.Where(x => x.BLG_CODE == blgCode).FirstOrDefault(); if (detailRow == null) { detailRow = new MED_BLOOD_GAS_DETAIL(); detailRow.DETAIL_ID = _detailID; detailRow.BLG_CODE = blgCode; detailTable.Add(detailRow); } detailRow.OP_DATE = DateTime.Now; detailRow.OPERATOR = string.IsNullOrEmpty(ExtendAppContext.Current.LoginUser.USER_JOB_ID) ? ExtendAppContext.Current.LoginUser.LOGIN_NAME : ExtendAppContext.Current.LoginUser.USER_JOB_ID; string value = ""; if (drow.Cells[2].Value != null && drow.Cells[2].Value != System.DBNull.Value) { value = drow.Cells[2].Value.ToString(); } detailRow.BLG_VALUE = value; } if (!AnesInfoService.ClientInstance.SaveBloodGasDetail(detailTable)) { return; } ParentForm.DialogResult = DialogResult.OK; }
public RequestResult <bool> DeleteBloodGasMaster(MED_BLOOD_GAS_MASTER deleRow) { return(Success(_anesInfoService.DeleteBloodGasMaster(deleRow))); }
public RequestResult <bool> InsertBloodGasMaster(MED_BLOOD_GAS_MASTER newMaster) { return(Success(_anesInfoService.InsertBloodGasMaster(newMaster))); }