コード例 #1
0
 /// <summary>
 ///数据绑定
 /// </summary>
 private void BindData()
 {
     foreach (MTextBox mtb in textBoxs)
     {
         if (mtb.SourceTableName == "MED_PAT_MASTER_INDEX")
         {
             if (patMasterIndex != null)
             {
                 if (mtb.SourceFieldName.Equals("PATIENT_ID") && emptyInpNoOrPatID)
                 {
                 }
                 else
                 {
                     if (patMasterIndex.GetValue(mtb.SourceFieldName) != null)
                     {
                         if (mtb.SourceFieldName.Equals("DATE_OF_BIRTH") && !string.IsNullOrEmpty(patMasterIndex.GetValue(mtb.SourceFieldName).ToString()))
                         {
                             mtb.Text = DateTime.Parse(patMasterIndex.GetValue(mtb.SourceFieldName).ToString()).ToString("yyyy-MM-dd");
                         }
                         else
                         {
                             mtb.Text = patMasterIndex.GetValue(mtb.SourceFieldName).ToString();
                         }
                     }
                     else
                     {
                         mtb.Text = string.Empty;
                         mtb.Data = string.Empty;
                     }
                 }
             }
         }
         else if (mtb.SourceTableName == "MED_OPERATION_MASTER")
         {
             if (operationMaster != null)
             {
                 if (mtb.SourceFieldName.Equals("SCHEDULED_DATE_TIME"))
                 {
                     if (operationMaster.GetValue(mtb.SourceFieldName) != null && !string.IsNullOrEmpty(operationMaster.GetValue(mtb.SourceFieldName).ToString()))
                     {
                         mtb.Text = DateTime.Parse(operationMaster.GetValue(mtb.SourceFieldName).ToString()).ToString("yyyy-MM-dd HH:mm");
                     }
                     else
                     {
                         mtb.Text = AccountService.GetServerTime().ToString("yyyy-MM-dd HH:mm");
                     }
                 }
                 else if (operationMaster.GetValue(mtb.SourceFieldName) != null)
                 {
                     mtb.Text = operationMaster.GetValue(mtb.SourceFieldName).ToString();  // operationMasterDT.Rows[0][mtb.SourceFieldName].ToString();
                 }
             }
         }
         else if (mtb.SourceTableName == "MED_OPERATION_SCHEDULE")
         {
             if (currentOperSchedule != null)
             {
                 if (mtb.SourceFieldName.Equals("SCHEDULED_DATE_TIME"))
                 {
                     if (currentOperSchedule.GetValue(mtb.SourceFieldName) != null && !string.IsNullOrEmpty(currentOperSchedule.GetValue(mtb.SourceFieldName).ToString()))
                     {
                         mtb.Text = DateTime.Parse(currentOperSchedule.GetValue(mtb.SourceFieldName).ToString()).ToString("yyyy-MM-dd HH:mm");
                     }
                     else
                     {
                         mtb.Text = AccountService.GetServerTime().ToString("yyyy-MM-dd HH:mm");
                     }
                 }
                 else if (currentOperSchedule.GetValue(mtb.SourceFieldName) != null)
                 {
                     mtb.Text = currentOperSchedule.GetValue(mtb.SourceFieldName).ToString();
                 }
             }
         }
         else if (mtb.SourceTableName == "MED_PAT_VISIT")
         {
             if (patVisit != null)
             {
                 if (mtb.SourceFieldName.Equals("INP_NO") && emptyInpNoOrPatID)
                 {
                 }
                 else
                 {
                     if (patVisit.GetValue(mtb.SourceFieldName) != null)
                     {
                         mtb.Text = patVisit.GetValue(mtb.SourceFieldName).ToString();
                     }
                     else
                     {
                         mtb.Text = string.Empty;
                         mtb.Data = string.Empty;
                     }
                 }
             }
         }
         else if (mtb.SourceTableName == "MED_PATS_IN_HOSPITAL")
         {
             if (patInHospital != null)
             {
                 if (mtb.SourceFieldName.Equals("INP_NO") && emptyInpNoOrPatID)
                 {
                 }
                 else
                 {
                     if (patInHospital.GetValue(mtb.SourceFieldName) != null)
                     {
                         if (mtb.DictTableName != null && mtb.DictTableName == "MED_DEPT_DICT")
                         {
                             List <MED_DEPT_DICT> deptDict = ExtendAppContext.CurntSelect.CommDict.DeptDict;
                             string deptID = patInHospital.GetValue(mtb.SourceFieldName).ToString();
                             foreach (MED_DEPT_DICT row in deptDict)
                             {
                                 if (row.DEPT_CODE == deptID)
                                 {
                                     mtb.Text = row.DEPT_NAME; mtb.SelectedData = deptID; break;
                                 }
                             }
                         }
                         else
                         {
                             mtb.Text = patInHospital.GetValue(mtb.SourceFieldName).ToString();
                         }
                     }
                     else
                     {
                         mtb.Text = string.Empty;
                         mtb.Data = string.Empty;
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
        private void SyncPatientByPatientId(string patientID)
        {
            if (!string.IsNullOrEmpty(patientID))
            {
                if (ExtendApplicationContext.Current.IsSync)
                {
                    string ret = "";

                    ret = syncInfoRepository.SyncPatientInfoAndInHospital(patientID).Data;

                    ret += syncInfoRepository.SyncScheduleInfo(patientID, accountRepository.GetServerTime().Data).Data;

                    if (!string.IsNullOrEmpty(ret))
                    {
                        MessageBoxFormPC.Show(ret);
                    }
                }
            }
            bool flag = true;

            if (patientID != "")
            {
                patMasterIndex = operationInfoRepository.GetPatMasterIndex(patientID).Data;

                MED_PATS_IN_HOSPITAL patsInHospital = null;
                if (patMasterIndex == null)
                {
                    patsInHospital = operationInfoRepository.GetPatsInHospital(patientID).Data;
                    if (patsInHospital != null)
                    {
                        patientID      = patsInHospital.PATIENT_ID;
                        patMasterIndex = operationInfoRepository.GetPatMasterIndex(patientID).Data;
                    }
                }
                List <MED_PAT_VISIT> patVisitList = operationInfoRepository.GetPatVisitList(patientID).Data;

                if (patVisitList != null && patVisitList.Count > 0)
                {
                    flag     = flag & false;
                    patVisit = patVisitList[0];
                    _visitID = Convert.ToInt32(patVisitList[0].GetValue("VISIT_ID"));
                }
                else
                {
                    flag     = flag & true;
                    patVisit = new MED_PAT_VISIT();
                    _visitID = 1;
                    patVisit.SetValue("PATIENT_ID", patientID);
                }
                if (patMasterIndex == null)
                {
                    flag           = flag & true;
                    patMasterIndex = new MED_PAT_MASTER_INDEX();
                    patMasterIndex.SetValue("PATIENT_ID", patientID);
                    MessageBoxFormPC.Show("当前输入患者ID,需要手动输入患者信息进行急诊登记", "系统提示");
                    // return;
                }
                List <MED_OPERATION_MASTER> operMasterList = operationInfoRepository.GetOperMasterList(patientID, _visitID).Data;
                if (operMasterList != null && operMasterList.Count > 0)
                {
                    _operID = Convert.ToInt32(operMasterList[0].GetValue("OPER_ID")) + 1;
                }
                operationMaster                     = new MED_OPERATION_MASTER();
                operationMaster.PATIENT_ID          = patientID;
                operationMaster.VISIT_ID            = _visitID;
                operationMaster.OPER_ID             = _operID;
                operationMaster.OPER_ROOM           = ExtendApplicationContext.Current.OperRoom;
                operationMaster.OPER_ROOM_NO        = ExtendApplicationContext.Current.OperRoomNo;
                operationMaster.HOSP_BRANCH         = ExtendApplicationContext.Current.HospBranchCode;
                operationMaster.SCHEDULED_DATE_TIME = accountRepository.GetServerTime().Data;
                if (patsInHospital != null)
                {
                    patVisit.INP_NO           = patsInHospital.INP_NO;
                    operationMaster.WARD_CODE = patsInHospital.WARD_CODE;
                    operationMaster.DEPT_CODE = patsInHospital.WARD_CODE;
                    operationMaster.BED_NO    = patsInHospital.BED_NO;
                }
                else
                {
                    patsInHospital = operationInfoRepository.GetPatsInHospitalByID(patientID, _visitID).Data;

                    patVisit.INP_NO           = patsInHospital.INP_NO;
                    operationMaster.WARD_CODE = patsInHospital.WARD_CODE;
                    operationMaster.DEPT_CODE = patsInHospital.WARD_CODE;
                    operationMaster.BED_NO    = patsInHospital.BED_NO;
                }
                ExtendApplicationContext.Current.MED_PAT_MASTER_INDEX = patMasterIndex;
                ExtendApplicationContext.Current.MED_OPERATION_MASTER
                    = operationMaster;
                ExtendApplicationContext.Current.MED_PAT_VISIT
                         = patVisit;
                anesPlan = new DocDataRepository().GetAnesthesiaPlan(_patientID, _visitID, _operID);

                _patientCard = new MED_PATIENT_CARD();
                foreach (string column in _patientCard.GetPropsName())
                {
                    foreach (string col in patMasterIndex.GetPropsName())
                    {
                        if (column == col)
                        {
                            _patientCard.SetValue(column, patMasterIndex.GetValue(col));
                        }
                    }
                    foreach (string col in operationMaster.GetPropsName())
                    {
                        if (column == col)
                        {
                            _patientCard.SetValue(column, operationMaster.GetValue(col));
                        }
                    }
                    foreach (string col in patVisit.GetPropsName())
                    {
                        if (column == col)
                        {
                            _patientCard.SetValue(column, patVisit.GetValue(col));
                        }
                    }
                }
            }
        }