Beispiel #1
0
        /// <summary>
        /// Convert a time from UTC to a timezone
        /// </summary>
        /// <param name="srcTime">Time to convert</param>
        /// <param name="dstZone">Timezone to convert the datetime to</param>
        /// <returns>DateTime in the timezone</returns>
        public static DateTime ConvertFromUTC(DateTime srcTime, OlsonTimeZone dstZone)
        {
            TimeCheckResult srcCheckRes = dstZone.Check(srcTime);

            switch (srcCheckRes)
            {
            case TimeCheckResult.Valid:
            {
                DateTime dstTime = dstZone.ToLocalTime(srcTime);
                return(dstTime);
            }

            case TimeCheckResult.InSpringForwardGap:
            case TimeCheckResult.InFallBackRange:
                _log.ErrorFormat("Source time in transition period - retry.  [date={0}, tz={1}]", srcTime, dstZone.Name);
                return(ConvertFromUTC(srcTime.AddHours(1), dstZone));

            default:
            {
                string errorMessage = string.Format(
                    "Source time out of range.  [date={0}, tz={1}]", srcTime, dstZone.Name);

                throw new GCalExchangeException(
                          GCalExchangeErrorCode.OlsonTZError, errorMessage);
            }
            }
        }
Beispiel #2
0
        private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex > this.dataGridView1.Rows.Count - 1)
            {
                return;
            }
            if (e.ColumnIndex > this.dataGridView1.Columns.Count - 1)
            {
                return;
            }
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }

            DataGridViewRow row             = this.dataGridView1.Rows[e.RowIndex];
            TimeCheckResult checkResultInfo = row.Tag as TimeCheckResult;

            if (checkResultInfo == null || GlobalMethods.Misc.IsEmptyString(checkResultInfo.DocID))
            {
                return;
            }
            if (this.MainForm == null || this.MainForm.IsDisposed)
            {
                return;
            }
            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            this.ShowStatusMessage("正在准备打开病历,请稍候...");

            MedDocInfo docInfo = null;
            short      shRet   = EmrDocAccess.Instance.GetDocInfo(checkResultInfo.DocID, ref docInfo);

            if (shRet == SystemData.ReturnValue.OK)
            {
                PatVisitInfo patVisitInfo = null;
                shRet = PatVisitAccess.Instance.GetPatVisit(docInfo.PATIENT_ID, docInfo.VISIT_ID, ref patVisitInfo);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    MessageBoxEx.Show("患者信息查找失败,无法打开病历!");
                    this.ShowStatusMessage(null);
                    GlobalMethods.UI.SetCursor(this, Cursors.Default);
                    return;
                }
                this.MainForm.SwitchPatient(patVisitInfo, docInfo);
            }
            //this.MainForm.OpenDocument(docInfo);
            else
            {
                MessageBoxEx.Show("病历详细信息下载失败,无法打开病历!");
            }

            this.ShowStatusMessage(null);
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Beispiel #3
0
 /// <summary>
 ///  截止时间比较器
 /// </summary>
 /// <param name="result1"></param>
 /// <param name="result2"></param>
 /// <returns></returns>
 public int Compare(TimeCheckResult result1, TimeCheckResult result2)
 {
     if (result1 == null)
     {
         if (result2 == null)
         {
             return(1);
         }
         else
         {
             return(-1);
         }
     }
     else if (result2 == null)
     {
         return(1);
     }
     else
     {
         if (result1.EndTime.CompareTo(DateTime.Now) > 0)
         {
             if (result2.EndTime.CompareTo(DateTime.Now) > 0)
             {
                 return(result1.EndTime.CompareTo(result2.EndTime));
             }
             else
             {
                 return(-1);
             }
         }
         else if (result2.EndTime.CompareTo(DateTime.Now) > 0)
         {
             return(1);
         }
         else
         {
             return(0);
         }
     }
 }
        public override bool Execute(object param, object data, out object result)
        {
            try
            {
                QcCheckPoint qcCheckPoint = param as QcCheckPoint;
                PatVisitInfo patVisitLog  = data as PatVisitInfo;
                result = null;
                if (qcCheckPoint.EventID == string.Empty)
                {
                    return(false);
                }
                result = CheckPointHelper.Instance.InitQcCheckResult(qcCheckPoint, patVisitLog);
                QcCheckResult qcCheckResult = result as QcCheckResult;
                //通过时效帮助类,创建一张病历正常书写的用于比对的时效检查时间表
                List <TimeCheckResult> lstTimeCheckResults = TimeCheckHelper.Instance.CreateTimeCheckTable(qcCheckPoint, patVisitLog);
                if (lstTimeCheckResults == null)
                {
                    qcCheckResult.QC_EXPLAIN = "规则通过";
                    qcCheckResult.QC_RESULT  = 1;
                    return(true);
                }
                //查询患者指定文书类型ID号

                List <MedDocInfo> documentlist = TimeCheckHelper.Instance.GetDocumentList(qcCheckPoint.DocTypeID, patVisitLog.MedDocInfos);
                int nErrorCount = 0;
                for (int index = 0; index < lstTimeCheckResults.Count; index++)
                {
                    TimeCheckResult timeCheckResult = lstTimeCheckResults[index];
                    if (timeCheckResult == null)
                    {
                        continue;
                    }
                    if (documentlist == null || documentlist.Count <= 0)
                    {
                        timeCheckResult.WrittenState = WrittenState.Unwrite;
                        continue;
                    }
                    //核对病历内部时间以及实际书写时间
                    for (int nDocIndex = 0; nDocIndex < documentlist.Count; nDocIndex++)
                    {
                        MedDocInfo docInfo = documentlist[nDocIndex];
                        if (docInfo.RECORD_TIME != docInfo.DefaultTime &&
                            (docInfo.RECORD_TIME < timeCheckResult.StartTime || docInfo.RECORD_TIME > timeCheckResult.EndTime))
                        {
                            continue;
                        }
                        if (docInfo.DOC_TIME < timeCheckResult.StartTime)
                        {
                            timeCheckResult.WrittenState = WrittenState.Early;
                        }
                        else if (docInfo.DOC_TIME > timeCheckResult.EndTime)
                        {
                            timeCheckResult.WrittenState = WrittenState.Timeout;
                        }
                        else
                        {
                            timeCheckResult.WrittenState = WrittenState.Normal;
                        }

                        timeCheckResult.DocTime     = docInfo.DOC_TIME;
                        timeCheckResult.RecordTime  = docInfo.RECORD_TIME;
                        timeCheckResult.DocID       = docInfo.DOC_ID;
                        timeCheckResult.CreatorName = docInfo.CREATOR_NAME;
                        timeCheckResult.CreatorID   = docInfo.CREATOR_ID;
                        break;
                    }
                }
                StringBuilder sbQcExplain = new StringBuilder();
                foreach (var item in lstTimeCheckResults)
                {
                    if (item.WrittenState == WrittenState.Timeout)
                    {
                        sbQcExplain.AppendFormat("患者{0}{1},书写{2}时间{3},开始时间{4}截止时间{5},结果超时"
                                                 , item.EventTime.ToString()
                                                 , item.EventName
                                                 , item.DocTitle
                                                 , item.DocTime.ToString()
                                                 , item.StartTime.ToString()
                                                 , item.EndTime.ToString()
                                                 );
                        sbQcExplain.AppendLine();
                        nErrorCount++;
                    }
                    else if (item.WrittenState == WrittenState.Unwrite || item.WrittenState == WrittenState.Uncheck)
                    {
                        if (item.EndTime < DateTime.Now)
                        {
                            sbQcExplain.AppendFormat("患者{0}{1},{2}未书写,开始时间{3}截止时间{4},期限已到,结果超时"
                                                     , item.EventTime.ToString()
                                                     , item.EventName
                                                     , item.DocTitle
                                                     , item.StartTime.ToString()
                                                     , item.EndTime.ToString()
                                                     );
                            sbQcExplain.AppendLine();
                            nErrorCount++;
                        }
                    }
                }
                //找到文书入院记录相关的文书,判断文档创建时间是否在入院24小时之内
                if (nErrorCount > 0)
                {
                    qcCheckResult.QC_RESULT = 0;
                }
                else
                {
                    qcCheckResult.QC_RESULT = 1;
                }
                qcCheckResult.DOC_TITLE   = qcCheckPoint.DocTypeName;
                qcCheckResult.DOCTYPE_ID  = qcCheckPoint.DocTypeID;
                qcCheckResult.QC_EXPLAIN  = sbQcExplain.Length > 2000 ? sbQcExplain.ToString().Substring(0, 2000) : sbQcExplain.ToString();
                qcCheckResult.ERROR_COUNT = nErrorCount;
                return(true);
            }
            catch (Exception ex)
            {
                result = null;
                LogManager.Instance.WriteLog("新军卫-无手术记录或未在患者术后24小时内完成命令发生异常", ex);
                return(false);
            }
        }
Beispiel #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.Rows.Count <= 0)
            {
                MessageBoxEx.ShowMessage("记录为空");
                return;
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
            PatVisitInfo patVisitLog = new PatVisitInfo();

            patVisitLog.PATIENT_ID = this.txtPatientID.Text;
            patVisitLog.VISIT_ID   = this.txtVisitID.Text;
            short               shRet = QcTimeRecordAccess.Instance.GetPatVisitLog(this.txtPatientID.Text, this.txtVisitID.Text, ref patVisitLog);
            DateTime            now   = DateTime.Now;
            List <QcTimeRecord> lstExitQCTimeRecord = new List <QcTimeRecord>();

            QcTimeRecordAccess.Instance.GetQcTimeRecords(this.txtPatientID.Text, this.txtVisitID.Text, ref lstExitQCTimeRecord);
            List <QcTimeRecord> lstQcTimeRecord = new List <QcTimeRecord>();

            foreach (DataGridViewRow item in this.dataGridView1.Rows)
            {
                TimeCheckResult resultInfo = item.Tag as TimeCheckResult;
                if (resultInfo == null)
                {
                    continue;
                }
                QcTimeRecord qcTimeRecord = new QcTimeRecord();

                qcTimeRecord.BeginDate      = resultInfo.StartTime;
                qcTimeRecord.CheckDate      = now;
                qcTimeRecord.CheckName      = "系统自动";
                qcTimeRecord.CreateID       = resultInfo.CreatorID;
                qcTimeRecord.CreateName     = resultInfo.CreatorName;
                qcTimeRecord.DeptInCharge   = patVisitLog.DEPT_CODE;
                qcTimeRecord.DeptStayed     = patVisitLog.DEPT_NAME;
                qcTimeRecord.DocID          = resultInfo.DocID;
                qcTimeRecord.DocTitle       = resultInfo.DocTitle;
                qcTimeRecord.DoctorInCharge = patVisitLog.INCHARGE_DOCTOR;
                qcTimeRecord.DocTypeID      = resultInfo.DocTypeID;
                qcTimeRecord.DocTypeName    = resultInfo.DocTypeName;
                qcTimeRecord.EndDate        = resultInfo.EndTime;
                qcTimeRecord.EventID        = resultInfo.EventID;
                qcTimeRecord.EventName      = resultInfo.EventName;
                qcTimeRecord.EventTime      = resultInfo.EventTime;
                qcTimeRecord.PatientID      = patVisitLog.PATIENT_ID;
                qcTimeRecord.PatientName    = patVisitLog.PATIENT_NAME;
                qcTimeRecord.Point          = resultInfo.QCScore;
                qcTimeRecord.DischargeTime  = patVisitLog.DISCHARGE_TIME;
                qcTimeRecord.QcExplain      = resultInfo.ResultDesc;
                qcTimeRecord.IsVeto         = resultInfo.IsVeto;
                if (resultInfo.WrittenState == WrittenState.Early)
                {
                    qcTimeRecord.QcResult = SystemData.WrittenState.Early;
                }
                if (resultInfo.WrittenState == WrittenState.Normal)
                {
                    qcTimeRecord.QcResult = SystemData.WrittenState.Normal;
                }
                if (resultInfo.WrittenState == WrittenState.Timeout)
                {
                    qcTimeRecord.QcResult = SystemData.WrittenState.Timeout;
                }
                if (resultInfo.WrittenState == WrittenState.Unwrite)
                {
                    //根据海总需求,将未书写的文书分成两种状态:一种是未书写,另一种是正常未书写。第一种代表已经超时了,需要进行扣分。
                    if (resultInfo.EndTime < now)
                    {
                        //病历未书写超过截止时间,状态为未书写超时
                        qcTimeRecord.QcResult = SystemData.WrittenState.Unwrite;
                    }
                    else
                    {
                        qcTimeRecord.QcResult = SystemData.WrittenState.UnwriteNormal;
                    }
                }
                // qcTimeRecord.QcResult = SystemData.WrittenState.Unwrite;
                qcTimeRecord.RecNo      = "0"; //未做处理
                qcTimeRecord.RecordTime = resultInfo.RecordTime;
                qcTimeRecord.DocTime    = resultInfo.DocTime;
                qcTimeRecord.VisitID    = resultInfo.VisitID;
                if (!resultInfo.IsRepeat)
                {
                    qcTimeRecord.QcExplain = string.Format("病人{0}{1},{2}内书写{3}"
                                                           , resultInfo.EventTime.ToString("yyyy-M-d HH:mm")
                                                           , resultInfo.EventName, resultInfo.WrittenPeriod, resultInfo.DocTypeName);
                }
                else
                {
                    qcTimeRecord.QcExplain = string.Format("病人{0}{1},每{2}书写一次{3}"
                                                           , resultInfo.EventTime.ToString("yyyy-M-d HH:mm")
                                                           , resultInfo.EventName, resultInfo.WrittenPeriod, resultInfo.DocTypeName);
                }

                //判断是否已短信通知,海总需求:时效记录已存在的会写入个人统计表,进行短信通知,所以主键相同的已存数据将标记为短信通知,通过该字段避免写入统计到个人的表从而解决重复短信发送的问题。
                if (lstExitQCTimeRecord != null && lstExitQCTimeRecord.Count > 0)
                {
                    foreach (QcTimeRecord exitTimeRecord in lstExitQCTimeRecord)
                    {
                        //QCTimeRecord主键为PatientId,VisitID,DocTypeID,BeginDate,EndDate,QcResult,EventTime
                        if (exitTimeRecord.PatientID == qcTimeRecord.PatientID &&
                            exitTimeRecord.VisitID == qcTimeRecord.VisitID &&
                            exitTimeRecord.DocTypeID == qcTimeRecord.DocTypeID &&
                            exitTimeRecord.BeginDate == qcTimeRecord.BeginDate &&
                            exitTimeRecord.EndDate == qcTimeRecord.EndDate &&
                            exitTimeRecord.QcResult == qcTimeRecord.QcResult &&
                            exitTimeRecord.EventTime == qcTimeRecord.EventTime)
                        {
                            //已存在的记录为当天的,则短信通知仍旧为未通知,主要是测试中会在当天运行两次以上
                            //实际情况是每日只会运行一次
                            if (qcTimeRecord.CheckDate.ToShortDateString() !=
                                exitTimeRecord.CheckDate.ToShortDateString())
                            {
                                qcTimeRecord.MessageNotify = true;
                            }
                        }
                    }
                }
                lstQcTimeRecord.Add(qcTimeRecord);
            }
            shRet = QcTimeRecordAccess.Instance.SavePatientQcTimeRecord(patVisitLog.PATIENT_ID, patVisitLog.VISIT_ID, lstQcTimeRecord);
            if (shRet != SystemData.ReturnValue.OK)
            {
                LogManager.Instance.WriteLog(string.Format("病人{0} 时效质控记录生成失败", patVisitLog.PATIENT_NAME));
            }
            else
            {
                MessageBoxEx.ShowMessage("保存成功");
                LogManager.Instance.WriteLog(string.Format("病人{0} 时效质控记录生成成功", patVisitLog.PATIENT_NAME));
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
            this.ShowStatusMessage(null);
        }
Beispiel #6
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            this.colPatientName.Visible = true;
            this.dataGridView1.Rows.Clear();
            string szPatientID = txtPatientID.Text.Trim();
            string szVisitID   = txtVisitID.Text.Trim();

            if (string.IsNullOrEmpty(szPatientID) || string.IsNullOrEmpty(szVisitID))
            {
                MessageBoxEx.Show("请输入病案号和就诊号");
                return;
            }
            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            PatVisitInfo patVisitLog = new PatVisitInfo();

            patVisitLog.PATIENT_ID = szPatientID;
            patVisitLog.VISIT_ID   = szVisitID;
            short shRet = QcTimeRecordAccess.Instance.GetPatVisitLog(szPatientID, szVisitID, ref patVisitLog);

            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("病案查询失败");
                return;
            }
            if (string.IsNullOrEmpty(patVisitLog.INCHARGE_DOCTOR))
            {
                string doctorInCharge = string.Empty;
                shRet = EmrDocAccess.Instance.GetDoctorInChargeByEmrDoc(szPatientID, szVisitID, ref doctorInCharge);
                if (shRet == SystemData.ReturnValue.OK)
                {
                    patVisitLog.INCHARGE_DOCTOR = doctorInCharge;
                }
            }
            List <TimeCheckResult> lstCheckResults = new List <TimeCheckResult>();
            TimeCheckQuery         timeCheckQuery  = new TimeCheckQuery();

            timeCheckQuery.PatientID   = patVisitLog.PATIENT_ID;
            timeCheckQuery.PatientName = patVisitLog.PATIENT_NAME;
            //timeCheckQuery.VisitID = patVisitLog.VISIT_ID;
            //兼容电子病历配置VISIT_ID=VISIT_NO
            timeCheckQuery.VisitID = patVisitLog.VISIT_NO;
            timeCheckQuery.VisitNO = patVisitLog.VISIT_NO;
            TimeCheckEngine.Instance.PerformTimeCheck(timeCheckQuery);
            lstCheckResults.AddRange(TimeCheckEngine.Instance.TimeCheckResults);
            lstCheckResults.Sort(new Comparison <TimeCheckResult>(this.Compare));
            if (lstCheckResults == null)
            {
                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                this.ShowStatusMessage(null);
                return;
            }
            DateTime now = DateTime.Now;

            for (int index = 0; index < lstCheckResults.Count; index++)
            {
                TimeCheckResult resultInfo = lstCheckResults[index];
                resultInfo.VisitID = patVisitLog.VISIT_ID;
                int             nRowIndex = this.dataGridView1.Rows.Add();
                DataGridViewRow row       = this.dataGridView1.Rows[nRowIndex];
                row.Tag = resultInfo;
                row.Cells[this.colPatientName.Index].Value    = resultInfo.PatientName;
                row.Cells[this.colDocName.Index].Value        = resultInfo.DocTitle;
                row.Cells[this.colDoctorInCharge.Index].Value = patVisitLog.INCHARGE_DOCTOR;
                if (resultInfo.WrittenState == WrittenState.Timeout)
                {
                    row.Cells[this.colStatus.Index].Value = "书写超时";
                }
                else if (resultInfo.WrittenState == WrittenState.Unwrite)
                {
                    row.Cells[this.colStatus.Index].Value = "未书写";
                }
                else if (resultInfo.WrittenState == WrittenState.Early)
                {
                    row.Cells[this.colStatus.Index].Value = "书写提前";
                }
                else if (resultInfo.WrittenState == WrittenState.Normal)
                {
                    row.Cells[this.colStatus.Index].Value = "正常";
                }
                if (resultInfo.WrittenState != WrittenState.Unwrite)
                {
                    row.Cells[this.colCreateTime.Index].Value = resultInfo.DocTime.ToString("yyyy-M-d HH:mm");
                    row.Cells[this.colCreator.Index].Value    = resultInfo.CreatorName;
                }
                row.Cells[this.colEndTime.Index].Value = resultInfo.EndTime.ToString("yyyy-M-d HH:mm");
                if (now.CompareTo(resultInfo.EndTime) < 0)
                {
                    row.Cells[this.colLeave.Index].Value = Math.Round((resultInfo.EndTime - now).TotalHours, 0, MidpointRounding.ToEven);
                }
                else
                {
                    row.Cells[this.colLeave.Index].Value = "已超时";
                }
                if (!resultInfo.IsRepeat)
                {
                    row.Cells[this.colCheckBasis.Index].Value = string.Format("病人{0}{1},{2}内书写{3}"
                                                                              , resultInfo.EventTime.ToString("yyyy-M-d HH:mm")
                                                                              , resultInfo.EventName, resultInfo.WrittenPeriod, resultInfo.DocTypeName);
                }
                else
                {
                    row.Cells[this.colCheckBasis.Index].Value = string.Format("病人{0}{1},每{2}书写一次{3}"
                                                                              , resultInfo.EventTime.ToString("yyyy-M-d HH:mm")
                                                                              , resultInfo.EventName, resultInfo.WrittenPeriod, resultInfo.DocTypeName);
                }
                row.Cells[this.colDocTypeID.Index].Value = resultInfo.DocTypeID;
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
            this.ShowStatusMessage(null);
        }
Beispiel #7
0
        private void SetGridData(List <TimeCheckResult> lstCheckResults)
        {
            DateTime now = DateTime.Now;

            for (int index = 0; index < lstCheckResults.Count; index++)
            {
                TimeCheckResult resultInfo = lstCheckResults[index];

                int             nRowIndex = this.dataGridView1.Rows.Add();
                DataGridViewRow row       = this.dataGridView1.Rows[nRowIndex];
                row.Tag = resultInfo;

                row.Cells[this.colPatientName.Index].Value = resultInfo.PatientName;
                row.Cells[this.colDocTitle.Index].Value    = resultInfo.DocTitle;

                if (resultInfo.WrittenState == WrittenState.Timeout)
                {
                    row.Cells[this.colStatus.Index].Value = "书写超时";
                }
                else if (resultInfo.WrittenState == WrittenState.Unwrite)
                {
                    row.Cells[this.colStatus.Index].Value = "未书写";
                }
                else if (resultInfo.WrittenState == WrittenState.Early)
                {
                    row.Cells[this.colStatus.Index].Value = "书写提前";
                }
                else if (resultInfo.WrittenState == WrittenState.Normal)
                {
                    row.Cells[this.colStatus.Index].Value = "正常";
                }
                if (resultInfo.WrittenState != WrittenState.Unwrite)
                {
                    if (resultInfo.RecordTime != resultInfo.DefaultTime)
                    {
                        row.Cells[this.colRecordTime.Index].Value = resultInfo.RecordTime.ToString("yyyy-MM-dd HH:mm");//.ToString("yyyy-M-d HH:mm");
                    }
                    row.Cells[this.colCreator.Index].Value = resultInfo.CreatorName;
                }

                row.Cells[this.colEndTime.Index].Value   = resultInfo.EndTime.ToString("yyyy-MM-dd HH:mm");
                row.Cells[this.colBeginTime.Index].Value = resultInfo.StartTime.ToString("yyyy-MM-dd HH:mm");
                if (now.CompareTo(resultInfo.EndTime) < 0)
                {
                    row.Cells[this.colLeave.Index].Value = Math.Round((resultInfo.EndTime - now).TotalHours, 0, MidpointRounding.ToEven);
                }
                else
                {
                    if (resultInfo.WrittenState == WrittenState.Timeout || resultInfo.WrittenState == WrittenState.Unwrite)
                    {
                        row.Cells[this.colLeave.Index].Value           = "已超时";
                        row.Cells[this.colLeave.Index].Style.ForeColor = Color.Red;
                    }
                    else
                    {
                        row.Cells[this.colLeave.Index].Value = "0";
                    }
                }
                if (resultInfo.WrittenState == WrittenState.Timeout)
                {
                    row.Cells[this.colTimeout.Index].Value = Math.Round((resultInfo.DocTime - resultInfo.EndTime).TotalHours, 0, MidpointRounding.ToEven);
                }
                if (!resultInfo.IsRepeat)
                {
                    row.Cells[this.colCheckBasis.Index].Value = string.Format("患者{0}{1},{2}内书写{3}"
                                                                              , resultInfo.EventTime.ToString("yyyy-MM-dd HH:mm")
                                                                              , resultInfo.EventName, resultInfo.WrittenPeriod, resultInfo.DocTypeName);
                }
                else
                {
                    row.Cells[this.colCheckBasis.Index].Value = string.Format("患者{0}{1},每{2}书写一次{3}"
                                                                              , resultInfo.EventTime.ToString("yyyy-MM-dd HH:mm")
                                                                              , resultInfo.EventName, resultInfo.WrittenPeriod, resultInfo.DocTypeName);
                }
                if (resultInfo.DocTime != resultInfo.DefaultTime)
                {
                    row.Cells[this.colDocTime.Index].Value = resultInfo.DocTime.ToString("yyyy-MM-dd HH:mm");
                }
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
            this.ShowStatusMessage(null);
        }
Beispiel #8
0
        /// <summary>
        /// 创建一张病历正常书写的用于比对的时效检查时间表
        /// </summary>
        /// <param name="qcCheckPoint">指定时效规则</param>
        /// <param name="lstTimeQCEventResults">时效事件执行结果</param>
        /// <returns>时效检查时间表列表</returns>
        public List <TimeCheckResult> CreateTimeCheckTable(QcCheckPoint qcCheckPoint
                                                           , PatVisitInfo patVisitLog)
        {
            //查询事件结果
            TimeEventHandler.Instance.TimeCheckQuery             = new TimeCheckQuery();
            TimeEventHandler.Instance.TimeCheckQuery.PatientID   = patVisitLog.PATIENT_ID;
            TimeEventHandler.Instance.TimeCheckQuery.PatientName = patVisitLog.PATIENT_NAME;
            TimeEventHandler.Instance.TimeCheckQuery.VisitID     = patVisitLog.VISIT_NO;//兼容新军卫 病历文书visit_id=visit_no
            TimeEventHandler.Instance.TimeCheckQuery.BedCode     = patVisitLog.BED_CODE;
            TimeEventHandler.Instance.TimeCheckQuery.VisitTime   = patVisitLog.VISIT_TIME;

            List <TimeQCEventResult> lstTimeQCEventResults = TimeEventHandler.Instance.PerformTimeEvent(qcCheckPoint.EventID);

            if (lstTimeQCEventResults == null || lstTimeQCEventResults.Count <= 0)
            {
                return(null);
            }
            if (TimeEventHandler.Instance.TimeCheckQuery == null)
            {
                return(null);
            }

            DateTime dtEndValidTime = patVisitLog.DISCHARGE_TIME == patVisitLog.DefaultTime ? DateTime.Now : patVisitLog.DISCHARGE_TIME;
            List <TimeCheckResult> lstTimeCheckResults = new List <TimeCheckResult>();
            string   szPatientID   = TimeEventHandler.Instance.TimeCheckQuery.PatientID;
            string   szPatientName = TimeEventHandler.Instance.TimeCheckQuery.PatientName;
            string   szVisitID     = TimeEventHandler.Instance.TimeCheckQuery.VisitID;
            string   szBedCode     = TimeEventHandler.Instance.TimeCheckQuery.BedCode;
            DateTime dtVisitTime   = TimeEventHandler.Instance.TimeCheckQuery.VisitTime;

            //创建一张病历正常书写的时间表
            for (int index = 0; index < lstTimeQCEventResults.Count; index++)
            {
                TimeQCEventResult timeQCEventResult = lstTimeQCEventResults[index];
                if (timeQCEventResult == null)
                {
                    continue;
                }
                if (!timeQCEventResult.EventTime.HasValue)
                {
                    continue;
                }
                if (!timeQCEventResult.EndTime.HasValue)
                {
                    continue;
                }
                DateTime dtPeriodTime = timeQCEventResult.EventTime.Value;

                do
                {
                    TimeCheckResult timeCheckResult = new TimeCheckResult();
                    timeCheckResult.PatientID    = szPatientID;
                    timeCheckResult.VisitID      = szVisitID;
                    timeCheckResult.EventID      = qcCheckPoint.EventID;
                    timeCheckResult.EventName    = qcCheckPoint.EventName;
                    timeCheckResult.PatientName  = szPatientName;
                    timeCheckResult.DocTypeID    = qcCheckPoint.DocTypeID;
                    timeCheckResult.DocTypeName  = qcCheckPoint.DocTypeName;
                    timeCheckResult.BedCode      = szBedCode;
                    timeCheckResult.VisitTime    = dtVisitTime;
                    timeCheckResult.DocTitle     = timeCheckResult.DocTypeName;
                    timeCheckResult.QCScore      = qcCheckPoint.Score;
                    timeCheckResult.ResultDesc   = qcCheckPoint.MsgDictMessage;
                    timeCheckResult.IsRepeat     = qcCheckPoint.IsRepeat;
                    timeCheckResult.WrittenState = WrittenState.Uncheck;
                    timeCheckResult.EventTime    = timeQCEventResult.EventTime.Value;
                    //timeCheckResult.InnerTime = timeCheckResult.DocTime;
                    timeCheckResult.StartTime = dtPeriodTime;
                    string szWrittenPeriod = qcCheckPoint.WrittenPeriod;
                    string szPeriodDesc    = null;
                    timeCheckResult.EndTime =
                        this.GetWrittenPeriod(szWrittenPeriod, dtPeriodTime, ref szPeriodDesc);
                    timeCheckResult.WrittenPeriod = szPeriodDesc;
                    timeCheckResult.DoctorLevel   = timeQCEventResult.DoctorLevel;
                    lstTimeCheckResults.Add(timeCheckResult);
                    dtPeriodTime = timeCheckResult.EndTime;
                } while (qcCheckPoint.IsRepeat && dtPeriodTime < timeQCEventResult.EndTime && dtPeriodTime < dtEndValidTime);
                //当转院,死亡等事件发生后,不用再循环创建应书写病历,所以需要  dtPeriodTime < timeQCEventResult.EndTime(timeQCEventResult.EndTime:转院或死亡等事件发生时间)
            }
            return(lstTimeCheckResults);
        }