Example #1
0
        public SelectDocumentForm(
            ISelectedDocumentForm form,
            bool[] existInfo,
            CPatient patientInfo,
            CHospitalization hospitalization,
            COperationWorker operationWorker,
            CDischargeEpicrisis dischargeEpicrisis,
            CGlobalSettings globalSettings)
        {
            InitializeComponent();

            _patientInfo                   = patientInfo;
            _hospitalization               = hospitalization;
            _operationWorker               = operationWorker;
            _dischargeEpicrisis            = dischargeEpicrisis;
            _globalSettings                = globalSettings;
            _selectedForm                  = form;
            _selectedForm.SelectedDocument = string.Empty;

            if (existInfo.Length != 4)
            {
                throw new ArgumentException("Lenght of existInfo array should be 4");
            }

            _existInfo = new bool[existInfo.Length];
            existInfo.CopyTo(_existInfo, 0);
            _additionalDocumentsFolderPath = Path.Combine(Application.StartupPath, AdditionalDocumentsFolderName);
        }
        /// <summary>
        /// Обновить информацию о выписном эпикризе
        /// </summary>
        /// <param name="dischargeEpicrisisInfo">Информация о выписном эпикризе</param>
        public void Update(CDischargeEpicrisis dischargeEpicrisisInfo)
        {
            int n = GetIndexFromList(dischargeEpicrisisInfo.HospitalizationId);

            dischargeEpicrisisInfo.NotInDatabase = false;
            _dischargeEpicrisisList[n]           = new CDischargeEpicrisis(dischargeEpicrisisInfo);
            Save();
        }
        /// <summary>
        /// Скопировать все выписные эпикризы для указанной госпитализации
        /// </summary>
        /// <param name="hospitalizationId">Id копируемой госпитализации</param>
        /// <param name="newHospitalizationId">Id нового госпитализации</param>
        public void CopyByHospitalizationId(int hospitalizationId, int newHospitalizationId)
        {
            CDischargeEpicrisis newCLineOfCommunication = GetByHospitalizationId(hospitalizationId);

            newCLineOfCommunication.HospitalizationId = newHospitalizationId;
            _dischargeEpicrisisList.Add(newCLineOfCommunication);
            Save();
        }
        /// <summary>
        /// Получить выписной эпикриз по переданному id госпитализации
        /// </summary>
        /// <param name="hospitalizationId">id госпитализации</param>
        /// <returns></returns>
        public CDischargeEpicrisis GetByHospitalizationId(int hospitalizationId)
        {
            int n = GetIndexFromList(hospitalizationId);

            if (n == _dischargeEpicrisisList.Count)
            {
                var newDischargeEpicrisisInfo = new CDischargeEpicrisis(hospitalizationId)
                {
                    NotInDatabase = true
                };
                _dischargeEpicrisisList.Add(newDischargeEpicrisisInfo);
                return(new CDischargeEpicrisis(newDischargeEpicrisisInfo));
            }

            return(new CDischargeEpicrisis(_dischargeEpicrisisList[n]));
        }
Example #5
0
 /// <summary>
 /// Добавляем выписной эпикриз
 /// </summary>
 /// <param name="fromDischargeEpicrisisWorker">Класс для работы с выписными эпикризами в базе, откуда копируется госпитализация</param>
 /// <param name="toDischargeEpicrisisWorker">Класс для работы с выписными эпикризами в базе, куда копируется госпитализация</param>
 /// <param name="fromHospitalizationId">id госпитализации, из которой берётся выписной эпикриз</param>
 /// <param name="toHospitalizationId">id госпитализации, в которую копируется выписной эпикриз</param>
 public static void AddDischargeEpicrisis(
     CDischargeEpicrisisWorker fromDischargeEpicrisisWorker,
     CDischargeEpicrisisWorker toDischargeEpicrisisWorker,
     int fromHospitalizationId,
     int toHospitalizationId)
 {
     if (fromDischargeEpicrisisWorker.IsExists(fromHospitalizationId))
     {
         toDischargeEpicrisisWorker.GetByHospitalizationId(toHospitalizationId);
         var newDischargeEpicrisis = new CDischargeEpicrisis(
             fromDischargeEpicrisisWorker.GetByHospitalizationId(fromHospitalizationId))
         {
             HospitalizationId = toHospitalizationId
         };
         toDischargeEpicrisisWorker.Update(newDischargeEpicrisis);
     }
 }
Example #6
0
        public DischargeEpicrisisForm(
            CWorkersKeeper workersKeeper,
            CPatient patientInfo,
            CHospitalization hospitalizationInfo,
            CMedicalInspection medicalInspection,
            CDischargeEpicrisis dischargeEpicrisisInfo)
        {
            InitializeComponent();

            _patientInfo              = patientInfo;
            _hospitalizationInfo      = hospitalizationInfo;
            _dischargeEpicrisisInfo   = dischargeEpicrisisInfo;
            _medicalInspection        = medicalInspection;
            _operationWorker          = workersKeeper.OperationWorker;
            _dischargeEpicrisisWorker = workersKeeper.DischargeEpicrisisWorker;
            _globalSettings           = workersKeeper.GlobalSettings;
            _configurationEngine      = workersKeeper.ConfigurationEngine;
        }
Example #7
0
        /// <summary>
        /// Открыть список с документами
        /// </summary>
        /// <param name="sender">Объект, пославший сообщение</param>
        /// <param name="e">Объект, содержащий данные посланного сообщения</param>
        private void buttonDocuments_Click(object sender, EventArgs e)
        {
            if (IsFormHasEmptyNeededFields())
            {
                MessageBox.ShowDialog("Поля, отмеченные звёздочкой, обязательны для заполнения", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var existInfo = new[]
            {
                _workersKeeper.TransferableEpicrisisWorker.IsExists(_hospitalizationInfo.Id),
                _workersKeeper.DischargeEpicrisisWorker.IsExists(_hospitalizationInfo.Id),
                _workersKeeper.MedicalInspectionWorker.IsExists(_hospitalizationInfo.Id),
                _workersKeeper.LineOfCommunicationEpicrisisWorker.IsExists(_hospitalizationInfo.Id)
            };

            CDischargeEpicrisis dischargeEpicrisis = existInfo[1]
                ? _workersKeeper.DischargeEpicrisisWorker.GetByHospitalizationId(_hospitalizationInfo.Id)
                : null;

            new SelectDocumentForm(
                this, existInfo, _patientInfo, _hospitalizationInfo, _workersKeeper.OperationWorker, dischargeEpicrisis, _workersKeeper.GlobalSettings).ShowDialog();

            switch (_selectedDocument)
            {
            case "Переводной эпикриз":
                if (_transferableEpicrisisForm == null || _transferableEpicrisisForm.IsDisposed)
                {
                    _transferableEpicrisisForm = new TransferableEpicrisisForm(
                        _workersKeeper,
                        _patientInfo,
                        _hospitalizationInfo,
                        _workersKeeper.TransferableEpicrisisWorker.GetByHospitalizationId(_hospitalizationInfo.Id))
                    {
                        MdiParent = MdiParent
                    };
                    _transferableEpicrisisForm.Show();
                }
                else
                {
                    _transferableEpicrisisForm.Focus();
                }

                break;

            case "Этапный эпикриз":
                if (_lineOfCommunicationEpicrisisForm == null || _lineOfCommunicationEpicrisisForm.IsDisposed)
                {
                    _lineOfCommunicationEpicrisisForm = new LineOfCommunicationEpicrisisForm(
                        _workersKeeper,
                        _patientInfo,
                        _hospitalizationInfo,
                        _workersKeeper.LineOfCommunicationEpicrisisWorker.GetByHospitalizationId(_hospitalizationInfo.Id))
                    {
                        MdiParent = MdiParent
                    };
                    _lineOfCommunicationEpicrisisForm.Show();
                }
                else
                {
                    _lineOfCommunicationEpicrisisForm.Focus();
                }

                break;

            case "Выписной эпикриз":
                if (_dischargeEpicrisisForm == null || _dischargeEpicrisisForm.IsDisposed)
                {
                    _dischargeEpicrisisForm = new DischargeEpicrisisForm(
                        _workersKeeper,
                        _patientInfo,
                        _hospitalizationInfo,
                        _workersKeeper.MedicalInspectionWorker.GetByHospitalizationId(_hospitalizationInfo.Id),
                        _workersKeeper.DischargeEpicrisisWorker.GetByHospitalizationId(_hospitalizationInfo.Id))
                    {
                        MdiParent = MdiParent
                    };
                    _dischargeEpicrisisForm.Show();
                }
                else
                {
                    _dischargeEpicrisisForm.Focus();
                }

                break;

            case "Осмотр в отделении":
                if (_medicalInspectionForm == null || _medicalInspectionForm.IsDisposed)
                {
                    _medicalInspectionForm = new MedicalInspectionForm(
                        _workersKeeper,
                        _patientInfo,
                        _hospitalizationInfo,
                        _workersKeeper.MedicalInspectionWorker.GetByHospitalizationId(_hospitalizationInfo.Id))
                    {
                        MdiParent = MdiParent
                    };
                    _medicalInspectionForm.Show();
                }
                else
                {
                    _medicalInspectionForm.Focus();
                }

                break;
            }
        }
        /// <summary>
        /// Загрузить список выписных эпикризов
        /// </summary>
        private void Load()
        {
            _dischargeEpicrisisList = new List <CDischargeEpicrisis>();
            string allDataStr = CDatabaseEngine.UnpackText(_dischargeEpicrisisPath);

            // Получаем набор объектов
            string[] objectsStr = allDataStr.Split(new[] { ObjSplitStr }, StringSplitOptions.RemoveEmptyEntries);

            // Проходим по всем объектам
            foreach (string objectStr in objectsStr)
            {
                // Для каждого объекта получаем список значений
                string[] datasStr = objectStr.Split(new[] { DataSplitStr }, StringSplitOptions.RemoveEmptyEntries);

                var dischargeEpicrisisInfo = new CDischargeEpicrisis();
                foreach (string dataStr in datasStr)
                {
                    string[] keyValue = dataStr.Split(new[] { '=' }, 2);
                    switch (keyValue[0])
                    {
                    case "HospitalizationId":
                        dischargeEpicrisisInfo.HospitalizationId = Convert.ToInt32(keyValue[1]);
                        break;

                    case "AnalysisDate":
                        if (string.IsNullOrEmpty(keyValue[1]))
                        {
                            dischargeEpicrisisInfo.AnalysisDate = null;
                        }
                        else
                        {
                            dischargeEpicrisisInfo.AnalysisDate = CConvertEngine.StringToDateTime(keyValue[1]);
                        }
                        break;

                    case "AfterOperation":
                        dischargeEpicrisisInfo.AfterOperation = keyValue[1];
                        break;

                    case "ConservativeTherapy":
                        dischargeEpicrisisInfo.ConservativeTherapy = keyValue[1];
                        break;

                    case "Ekg":
                        dischargeEpicrisisInfo.Ekg = keyValue[1];
                        break;

                    case "OakEritrocits":
                        dischargeEpicrisisInfo.OakEritrocits = keyValue[1];
                        break;

                    case "OakHb":
                        dischargeEpicrisisInfo.OakHb = keyValue[1];
                        break;

                    case "OakLekocits":
                        dischargeEpicrisisInfo.OakLekocits = keyValue[1];
                        break;

                    case "OakSoe":
                        dischargeEpicrisisInfo.OakSoe = keyValue[1];
                        break;

                    case "OamColor":
                        dischargeEpicrisisInfo.OamColor = keyValue[1];
                        break;

                    case "OamDensity":
                        dischargeEpicrisisInfo.OamDensity = keyValue[1];
                        break;

                    case "OamEritrocits":
                        dischargeEpicrisisInfo.OamEritrocits = keyValue[1];
                        break;

                    case "OamLekocits":
                        dischargeEpicrisisInfo.OamLekocits = keyValue[1];
                        break;

                    case "AdditionalAnalises":
                        dischargeEpicrisisInfo.AdditionalAnalises = keyValue[1];
                        break;

                    case "Recomendations":
                        dischargeEpicrisisInfo.Recomendations = CConvertEngine.StringToStringList(keyValue[1]);
                        break;

                    case "AdditionalRecomendations":
                        dischargeEpicrisisInfo.AdditionalRecomendations = CConvertEngine.StringToStringList(keyValue[1]);
                        break;
                    }
                }

                _dischargeEpicrisisList.Add(dischargeEpicrisisInfo);
            }
        }