Esempio n. 1
0
        /// <summary>
        /// 把检验信息保存到DataTable中
        /// </summary>
        /// <param name="testInfo">testInfo</param>
        /// <param name="dtResult">目标容器</param>
        /// <returns>DaTaTable</returns>
        private DataTable CreateTestData(LabMaster testInfo, DataTable dtResult)
        {
            if (dtResult.Rows.Count <= 0)
            {
                return(dtResult);
            }

            dtResult.Rows[0]["检验号"]  = testInfo.TEST_ID;
            dtResult.Rows[0]["报告医生"] = testInfo.REPORT_DOCTOR;
            dtResult.Rows[0]["申请医生"] = testInfo.REQUEST_DOCTOR;
            dtResult.Rows[0]["报告时间"] = testInfo.REPORT_TIME;
            dtResult.Rows[0]["申请时间"] = testInfo.REQUEST_TIME;
            dtResult.Rows[0]["标本名称"] = testInfo.SPECIMEN;
            dtResult.Rows[0]["主题"]   = testInfo.SUBJECT;
            return(dtResult);
        }
Esempio n. 2
0
        private bool CanPrint(int rowIndex)
        {
            DataGridViewRow row         = this.dgvLabMaster.Rows[rowIndex];
            LabMaster       labTestInfo = row.Tag as LabMaster;

            if (labTestInfo == null)
            {
                return(false);
            }
            DataGridViewCell cell = row.Cells[this.colNeedPrint.Index];

            if (cell == null)
            {
                return(false);
            }
            List <LabResult> lstResultInfo = row.Cells[this.colYiChang.Index].Tag as List <LabResult>;

            if (lstResultInfo == null || lstResultInfo.Count <= 0)
            {
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        private void LabTestInfoList_SelectionChanged(object sender, EventArgs e)
        {
            if (this.dgvLabMaster.SelectedRows.Count <= 0)
            {
                this.dgvLabResult.SuspendLayout();
                this.dgvLabResult.Rows.Clear();
                this.dgvLabResult.ResumeLayout();
                return;
            }
            this.ShowStatusMessage("正在下载检验记录数据,请稍候...");
            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);

            this.dgvLabResult.Rows.Clear();
            LabMaster labTestInfo = (LabMaster)this.dgvLabMaster.SelectedRows[0].Tag;

            if (labTestInfo != null)
            {
                this.LoadResultList(labTestInfo.TEST_ID);
            }

            this.ShowStatusMessage(null);
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Esempio n. 4
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (this.m_lstTestInfo == null)
            {
                this.m_lstTestInfo = new List <DataTable>();
            }
            else
            {
                this.m_lstTestInfo.Clear();
            }

            if (this.dgvLabMaster.Rows.Count <= 0)
            {
                return;
            }

            for (int index = 0; index < this.dgvLabMaster.Rows.Count; index++)
            {
                DataGridViewRow row         = this.dgvLabMaster.Rows[index];
                LabMaster       labTestInfo = row.Tag as LabMaster;

                if (labTestInfo == null)
                {
                    continue;
                }
                DataGridViewCell cell = row.Cells[this.colNeedPrint.Index];
                if (cell == null)
                {
                    continue;
                }
                object objValue = cell.Value;
                if (objValue == null || !bool.Parse(objValue.ToString()))
                {
                    continue;
                }

                List <LabResult> lstResultInfo = row.Cells[this.colYiChang.Index].Tag as List <LabResult>;
                //short shRet = LabResultAccess.Instance.GetList(labTestInfo.TEST_ID, ref lstResultInfo);
                //if (shRet != SystemData.ReturnValue.OK)
                //    continue;
                if (lstResultInfo == null || lstResultInfo.Count <= 0)
                {
                    continue;
                }

                DataTable dtResult = this.CreateResultData(lstResultInfo);
                dtResult = this.CreateTestData(labTestInfo, dtResult);
                this.m_lstTestInfo.Add(dtResult);
            }
            if (this.m_lstTestInfo.Count <= 0)
            {
                MessageBoxEx.Show("请勾选需要打印记录左边的复选框!");
                return;
            }
            if (SystemParam.Instance.LocalConfigOption.IsLabPrintNewMethod)
            {
                DocumentPrintStyleForm frm         = new DocumentPrintStyleForm();
                TempletType            templetType = TempletTypeCache.Instance.GetWardDocType(SystemData.TempletTypeApplyEnv.LAB_REPROT);
                if (templetType == null)
                {
                    MessageBoxEx.ShowMessage("打印表单未制作");
                    return;
                }
                frm.TempletType = templetType;
                frm.Data        = m_lstTestInfo;
                frm.Text        = templetType.DocTypeName;
                frm.ShowDialog();
                return;
            }

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            ReportType reportType = ReportCache.Instance.GetWardReportType(SystemData.ReportTypeApplyEnv.LAB_RESULT, this.Text);

            if (reportType == null)
            {
                MessageBoxEx.ShowMessage("打印报表还没有制作");
                return;
            }
            byte[] byteReportData = null;
            ReportCache.Instance.GetReportTemplet(reportType, ref byteReportData);
            if (byteReportData != null)
            {
                ReportExplorerForm explorerForm = this.GetReportExplorerForm();
                explorerForm.ReportFileData = byteReportData;
                explorerForm.ReportParamData.Add("是否续打", false);
                explorerForm.ReportParamData.Add("打印数据", this.m_lstTestInfo);
                explorerForm.ShowDialog();
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Esempio n. 5
0
        private void LoadLabTestList()
        {
            this.dgvLabMaster.SuspendLayout();
            this.dgvLabMaster.Rows.Clear();
            this.dgvLabMaster.ResumeLayout();

            if (this.MainForm == null || this.MainForm.IsDisposed)
            {
                return;
            }
            if (SystemParam.Instance.PatVisitInfo == null)
            {
                return;
            }

            string           szPatientID  = SystemParam.Instance.PatVisitInfo.PATIENT_ID;
            string           szVisitID    = SystemParam.Instance.PatVisitInfo.VISIT_ID;
            List <LabMaster> lstLabMaster = null;

            if (GlobalMethods.Misc.IsEmptyString(szPatientID) || GlobalMethods.Misc.IsEmptyString(szVisitID))
            {
                return;
            }
            short shRet = LabMasterAccess.Instance.GetList(szPatientID, szVisitID, ref lstLabMaster);

            if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                MessageBoxEx.Show("检验主记录数据下载失败!");
                return;
            }
            if (lstLabMaster == null || lstLabMaster.Count <= 0)
            {
                return;
            }
            string szTestIDs = string.Empty;

            foreach (var item in lstLabMaster)
            {
                if (szTestIDs == string.Empty)
                {
                    szTestIDs = "'" + item.TEST_ID + "'";
                }
                else
                {
                    szTestIDs = string.Format("{0},'{1}'", szTestIDs, item.TEST_ID);
                }
            }
            List <LabResult> lstResultInfo = null;

            shRet = LabResultAccess.Instance.GetList2(szTestIDs, ref lstResultInfo);
            if (shRet != SystemData.ReturnValue.OK &&
                shRet != SystemData.ReturnValue.RES_NO_FOUND)
            {
                MessageBoxEx.Show("检验记录数据下载失败!");
            }
            this.dgvLabMaster.SuspendLayout();
            for (int index = lstLabMaster.Count - 1; index >= 0; index--)
            {
                LabMaster labMaster = lstLabMaster[index];
                if (labMaster == null)
                {
                    continue;
                }
                int             nRowIndex = this.dgvLabMaster.Rows.Add();
                DataGridViewRow row       = this.dgvLabMaster.Rows[nRowIndex];
                row.Tag = labMaster;
                row.Cells[this.colSpecimen.Index].Value = labMaster.SPECIMEN;
                if (labMaster.REQUEST_TIME != labMaster.DefaultTime)
                {
                    row.Cells[this.colRequestTime.Index].Value = labMaster.REQUEST_TIME.ToString("yyyy-MM-dd");
                }
                row.Cells[this.colRequestDoctor.Index].Value = labMaster.REQUEST_DOCTOR;
                row.Cells[this.colResultStatus.Index].Value  = labMaster.RESULT_STATUS;
                if (labMaster.REPORT_TIME != labMaster.DefaultTime)
                {
                    row.Cells[this.colReportTime.Index].Value = labMaster.REPORT_TIME.ToString("yyyy-MM-dd");
                }
                row.Cells[this.colReportDoctor.Index].Value = labMaster.REPORT_DOCTOR;
                row.Cells[this.colSubject.Index].Value      = labMaster.SUBJECT;
                if (lstResultInfo != null)
                {
                    var result = lstResultInfo.Where(m => m.TEST_ID == labMaster.TEST_ID).ToList();
                    if (result == null || result.Count <= 0)
                    {
                        continue;
                    }
                    row.Cells[this.colYiChang.Index].Tag = result;
                    for (int index1 = 0; index1 < result.Count; index1++)
                    {
                        LabResult labResult = result[index1];
                        if (labResult == null)
                        {
                            continue;
                        }

                        if (labResult.ABNORMAL_INDICATOR.Trim().Contains("危机"))//危机值标红
                        {
                            row.DefaultCellStyle.ForeColor = Color.Red;
                        }
                        if (labResult.ABNORMAL_INDICATOR.Trim().Contains("高") ||
                            labResult.ABNORMAL_INDICATOR.Contains("低"))
                        {
                            row.Cells[this.colYiChang.Index].Value           = "!";
                            row.Cells[this.colYiChang.Index].Style.ForeColor = Color.Red;
                        }
                    }
                }
            }
            this.dgvLabMaster.ResumeLayout();
        }
Esempio n. 6
0
        } /// <summary>
          /// 根据病人ID和就诊号,获取该次住院的检验信息列表
          /// </summary>
          /// <param name="szPatientID">病人编号</param>
          /// <param name="nVisitID">就诊号</param>
          /// <param name="lstLabTestInfo">检验信息列表</param>
          /// <returns>SystemData.ReturnValue</returns>
        public short GetList(string szPatientID, string szVisitID, ref List <LabMaster> lstLabTestInfo)
        {
            if (GlobalMethods.Misc.IsEmptyString(szPatientID) || GlobalMethods.Misc.IsEmptyString(szVisitID))
            {
                LogManager.Instance.WriteLog("EMRDBAccess.GetInpLabTestList", "查询参数为空!");
                return(SystemData.ReturnValue.PARAM_ERROR);
            }

            if (lstLabTestInfo == null)
            {
                lstLabTestInfo = new List <LabMaster>();
            }
            else
            {
                lstLabTestInfo.Clear();
            }

            string szField = string.Format("{0},{1},{2},{3},{4},{5},{6},{7}"
                                           , SystemData.LabMasterView.TEST_ID, SystemData.LabMasterView.SUBJECT
                                           , SystemData.LabMasterView.SPECIMEN, SystemData.LabMasterView.REQUEST_TIME
                                           , SystemData.LabMasterView.REQUEST_DOCTOR, SystemData.LabMasterView.RESULT_STATUS
                                           , SystemData.LabMasterView.REPORT_TIME, SystemData.LabMasterView.REPORT_DOCTOR);
            string szTable     = SystemData.DataView.LAB_MASTER;
            string szCondition = string.Format("{0}='{1}' AND {2}='{3}'"
                                               , SystemData.LabMasterView.PATIENT_ID, szPatientID, SystemData.LabMasterView.VISIT_ID, szVisitID);
            string szOrderField = SystemData.LabMasterView.REQUEST_TIME;
            string szSQL        = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC, szField, szTable, szCondition, szOrderField);

            IDataReader dataReader = null;

            try
            {
                dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text);
                if (dataReader == null || dataReader.IsClosed || !dataReader.Read())
                {
                    return(SystemData.ReturnValue.RES_NO_FOUND);
                }
                do
                {
                    LabMaster labTestInfo = new LabMaster();
                    if (!dataReader.IsDBNull(0))
                    {
                        labTestInfo.TEST_ID = dataReader.GetString(0);
                    }
                    if (!dataReader.IsDBNull(1))
                    {
                        labTestInfo.SUBJECT = dataReader.GetString(1);
                    }
                    if (!dataReader.IsDBNull(2))
                    {
                        labTestInfo.SPECIMEN = dataReader.GetString(2);
                    }
                    if (!dataReader.IsDBNull(3))
                    {
                        labTestInfo.REQUEST_TIME = dataReader.GetDateTime(3);
                    }
                    if (!dataReader.IsDBNull(4))
                    {
                        labTestInfo.REQUEST_DOCTOR = dataReader.GetString(4);
                    }
                    if (!dataReader.IsDBNull(5))
                    {
                        labTestInfo.RESULT_STATUS = dataReader.GetString(5);
                    }
                    if (!dataReader.IsDBNull(6))
                    {
                        labTestInfo.REPORT_TIME = dataReader.GetDateTime(6);
                    }
                    if (!dataReader.IsDBNull(7))
                    {
                        labTestInfo.REPORT_DOCTOR = dataReader.GetString(7);
                    }
                    lstLabTestInfo.Add(labTestInfo);
                } while (dataReader.Read());
                return(SystemData.ReturnValue.OK);
            }
            catch (Exception ex)
            {
                LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, "查询检验信息时出现异常!", ex);
                return(SystemData.ReturnValue.EXCEPTION);
            }
            finally { base.MedQCAccess.CloseConnnection(false); }
        }
Esempio n. 7
0
        //public ItemMaster GetLastCategory()
        //{
        //    var lab = _labRepository.GetAll().LastOrDefault();
        //    return lab;
        //}

        public void updateLab(LabMaster labmaster)
        {
            _labRepository.Update(labmaster);
            _unitOfWork.Commit();
        }
Esempio n. 8
0
 public void createLab(LabMaster labmaster)
 {
     _labRepository.Add(labmaster);
     _unitOfWork.Commit();
 }