Ejemplo n.º 1
0
        private NotesViewModel GetNotesFromXml(string examText, PosConstants.NotesType notesType, string userName)
        {
            NotesViewModel notesVM = GetBlankNotes(userName);
            NotesModel notes = notesVM.Notes;
            if (examText == null)
                return notesVM;

            notes.NotesType = notesType;

            GetNotesFromXml(notes, examText);

            return notesVM;
        }
Ejemplo n.º 2
0
        public string Save(PosConstants.NotesSaveType saveType, NotesModel model)
        {
            string message = String.Empty;

            ExamModel exam = new ExamModel()
            {
                ExamID = model.hdnExamID != null ? Convert.ToInt32(model.hdnExamID.Value) : 0,
                ExamDate = Convert.ToDateTime(model.ExamDate.Value),
                PatientID = Convert.ToInt32(model.hdnPatientID.Value),
                UserName = model.User.Value,
                SaveInd = 0,
                LastUpdatedDate = DateTime.Now,
                ExamCorrectDate = DateTime.Now,
                CorrectExamID = null,
            };
            switch (saveType)
            {
                case PosConstants.NotesSaveType.Save:
                    message = PosMessage.NotesSaveSuccessful;
                    exam.ExamText = WebUtil.GetXml(model, false, null);
                    exam.SaveInd = 1;
                    break;
                case PosConstants.NotesSaveType.SignOff:
                    message = PosMessage.NotesSignOffSuccessful;
                    exam.ExamText = WebUtil.GetXml(model, true, null);
                    break;
                case PosConstants.NotesSaveType.Correct:
                    message = PosMessage.NotesCorrectSuccessful;
                    exam.CorrectExamID = exam.ExamID;
                    exam.ExamID = 0;
                    //getting the original exam
                    ExamModel orginalExam = PatientRepository.ExamGet(exam.PatientID, exam.CorrectExamID);
                    Dictionary<string, string> dict = WebUtil.GetDictionary(orginalExam.ExamText, false);
                    exam.ExamText = WebUtil.GetXml(model, true, dict);
                    break;
                default:
                    message = String.Empty;
                    break;
            }

            PatientRepository.ExamSave(exam);

            //removing & creating print queue
            if (saveType == PosConstants.NotesSaveType.Correct)
            {
                PosRepository.PrintQueueRemove(exam.CorrectExamID.Value);
            }

            if(saveType == PosConstants.NotesSaveType.SignOff || saveType == PosConstants.NotesSaveType.Correct)
            {
                //saving additional data
                PatientRepository.ExamDataSave(exam.ExamID, exam.PatientID, model);

                if(model.cbPrintQueue.Value == true.ToString())
                    PosRepository.PrintQueueAdd(new PrintQueueItem() { ExamID = exam.ExamID, UserName = exam.UserName, PrintExamNote = null });
                if(model.ExamNoteTo.Value != "")
                    PosRepository.PrintQueueAdd(new PrintQueueItem() { ExamID = exam.ExamID, UserName = exam.UserName, PrintExamNote = true });
            }

            return message;
        }