public MonitorForm(Patient Patient, Record Record)
        {
            this.Patient = Patient;
            //this.Record  = Record;

            InitializeComponent();
            InitializeData(Record);
            InitializeComponents();
            InitializeScreen(Patient, Record);

            state = state.History;
        }
Exemplo n.º 2
0
        public RecordLabel(Doctor Doctor, Patient Patient, int RecordIndex, Point Point)
        {
            InitializeComponent();
            this.Location = Point;

            this.Doctor   = Doctor;
            this.Patient  = Patient;
            this.Record   = Patient.Records[RecordIndex];

            // load record info
            Label.Text = Record.Date.ToString("h : m  d / M / yyyy");
            subLabel.Text   = Record.ID;
        }
Exemplo n.º 3
0
        public RecordManager(Doctor Doctor, Patient Patient, Record Record)
        {
            InitializeComponent();
            this.Bounds = Screen.PrimaryScreen.Bounds;

            this.Doctor  = Doctor;
            this.Patient = Patient;
            this.Record  = Record;

            LoadComment();

            DateTimeLabel.Text          = Record.Date.ToString("d/M/yyyy - h:m");
            AvatarBox.Image             = Patient.Avatar;
            PatientNameLabel.Text       = Patient.Name;
            TreatDoctorNameLabel.Text   = "Doctor: " + Record.DoctorName;
            CommentsNumerLabel.Text     = Record.Comment == null ? "No Comment" : Record.Comment.Count().ToString() + " Comments";
            RecordLeghtLabel.Text       = "Record Time: " + Record.Leght.Hour + " : " + Record.Leght.Minute + " : " + Record.Leght.Second;
        }
        private void InitializeScreen(Patient Patient, Record Record)
        {
            InitializeScreen(Patient);

            // set record info
            RecordInfoLable.Text = "Record: " + Record.Date.ToShortDateString() + " " + Record.Date.ToShortTimeString();
            RecordLeghtLabel.Text = ""; // Record.Leght + "ms";

            // draw graph
            for (int i = 0; i < 12; i++) Graph[i].ResetPanel();
        }
 // get data from history record
 private void InitializeData(Record Record)
 {
     // ************************************** get data from record
     InitializeData();
     GetDataFromString(Data, Record.Data);
 }
        private void AddNewRecord(string data)
        {
            //UploadFile(fileName);
            WebService.ECGServiceClient WS = new WebService.ECGServiceClient();
            string recordID = WS.generateRecordID(Patient.ID);

            Record newRecord = new Record(Patient.DoctorName, Patient.DoctorID, DateTime.Now, recordID, this.Flag, data);
            Patient.AddRecord(newRecord);

            this.Updated = true;
        }
Exemplo n.º 7
0
 public void AddRecord(Record newRecord)
 {
     this.Records.Add(newRecord);
 }
Exemplo n.º 8
0
        private void UploadFile(string filename, Record newRecord)
        {
            try
            {
                // get the exact file name from the path
                String strFile = System.IO.Path.GetFileName(filename);

                // get the file information form the selected file
                FileInfo fInfo = new FileInfo(filename);

                RecordUploader.FileUploaderSoapClient srv = new RecordUploader.FileUploaderSoapClient();
                //TestUploader.FileServiceLocal.FileServiceClient fsl = new FileServiceLocal.FileServiceClient();

                // get the length of the file to see if it is possible
                // to upload it (with the standard 4 MB limit)
                long numBytes = fInfo.Length;
                double dLen = Convert.ToDouble(fInfo.Length / 1000000);

                // Default limit of 4 MB on web server
                // have to change the web.config to if
                // you want to allow larger uploads
                if (dLen < 4)
                {
                    // set up a file stream and binary reader for the
                    // selected file
                    FileStream fStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
                    BinaryReader br = new BinaryReader(fStream);

                    // convert the file to a byte array
                    byte[] data = br.ReadBytes((int)numBytes);
                    br.Close();

                    // get new record id
                    WebService.ECGServiceClient WS = new WebService.ECGServiceClient();
                    string recordID = WS.generateRecordID(Patient.ID);

                    // pass the byte array (file) and file name to the web service
                    //string sTmp = srv.UploadFile(data, strFile);
                    //string sTmp = srv.UploadECGRecord(data, strFile, recordID, Patient.ID, DateTime.Now);
                    string sTmp = srv.UploadECGRecord2(data, strFile, newRecord.ID, newRecord.PatientID, newRecord.Date, newRecord.Data.Count(), newRecord.DoctorID, newRecord.DoctorName, newRecord.HR, newRecord.R, newRecord.QR, newRecord.RS, newRecord.QRS);

                    fStream.Close();
                    fStream.Dispose();

                    // this will always say OK unless an error occurs,
                    // if an error occurs, the service returns the error message
                    // MessageBox.Show("File Upload Status: " + status.ToString(), "File Upload");
                    MessageBox.Show("File Upload Status: " + sTmp.ToString(), "File Upload");
                }
                else
                {
                    // Display message if the file was too large to upload
                    MessageBox.Show("The file selected exceeds the size limit for uploads.", "File Size");
                }
            }
            catch (Exception ex)
            {
                // display an error message to the user
                MessageBox.Show(ex.Message.ToString(), "Upload Error");
            }
        }
Exemplo n.º 9
0
        private void Record(object sender, EventArgs e)
        {
            if (state == state.Realtime)
            {
                StartRecordPoint = Data[0].Count;
                state = state.Record;

                RecordTime = new DateTime(2012, 1, 1, 0, 0, 0);
                RecordTimer.Enabled = true;

                this.StartRecordButton.Image = global::ECGWorkStation.Properties.Resources.square_black;
            }
            else if (state == state.Record)
            {
                // changer state
                RecordTimer.Stop();
                RecordTimer.Enabled = false;

                this.StartRecordButton.Image = global::ECGWorkStation.Properties.Resources._1346394869_Media_WMP;
                state = state.Realtime;

                // create record data

                StringBuilder temp = new StringBuilder();
                temp.Append("1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t1\t");

                int StopRecordPoint = Data[0].Count;
                int Cycle = (int)(Data[0].Time[1] - Data[0].Time[0]);
                int hh = 0;
                int mm = 0;
                int ss = 0;
                int ff = 0;

                for (int i = StartRecordPoint; i < StopRecordPoint; i++)
                {
                    temp.Append(
                        "   " +
                        (hh == 0 ? "   " : hh.ToString("00:")) +
                        (mm > 9 ? mm.ToString("00") : " " + mm.ToString("0"))  + ":" +
                        ss.ToString("00")  + "." +
                        ff.ToString("000") + "\t");

                    ff += Cycle;
                    if (ff >= 1000)
                    {
                        ff = 0;
                        ss += 1;
                        if (ss >= 60)
                        {
                            ss = 0;
                            mm += 1;
                            if (mm >= 60)
                            {
                                mm = 0;
                                hh += 1;
                            }
                        }
                    }

                    foreach (ECGData _data in Data)
                    {
                        if (_data.Sign[i] >= 0) temp.Append(" ");
                        if (Math.Abs(_data.Sign[i]) < 10) temp.Append(" ");
                        temp.Append(_data.Sign[i].ToString("0.000\t"));
                    }
                }

                // Add new Record

                WebService.ECGServiceClient WS = new WebService.ECGServiceClient();
                string recordID = WS.generateRecordID(Patient.ID);

                StreamWriter file = new StreamWriter(recordID + ".txt");
                file.Write(temp.ToString());
                file.Flush();
                file.Close();

                Record newRecord = new Record(Patient, DateTime.Now, recordID, this.Flag, temp.ToString());
                Patient.AddRecord(newRecord);

                this.Updated = true;

                // uploadfile to server

                UploadFile(recordID + ".txt", newRecord);
            }
        }