Пример #1
0
        public PatientImage setPatientImage(DataTable dt)
        {
            PatientImage vsold1 = new PatientImage();

            if (dt.Rows.Count > 0)
            {
                vsold1.patient_image_id = dt.Rows[0][pttI.patient_image_id].ToString();
                vsold1.t_patient_id     = dt.Rows[0][pttI.t_patient_id].ToString();
                vsold1.t_visit_id       = dt.Rows[0][pttI.t_visit_id].ToString();
                vsold1.desc1            = dt.Rows[0][pttI.desc1].ToString();
                vsold1.desc2            = dt.Rows[0][pttI.desc2].ToString();
                vsold1.desc3            = dt.Rows[0][pttI.desc3].ToString();
                vsold1.desc4            = dt.Rows[0][pttI.desc4].ToString();
                vsold1.active           = dt.Rows[0][pttI.active].ToString();
                vsold1.remark           = dt.Rows[0][pttI.remark].ToString();
                vsold1.date_create      = dt.Rows[0][pttI.date_create].ToString();
                vsold1.date_modi        = dt.Rows[0][pttI.date_modi].ToString();
                vsold1.date_cancel      = dt.Rows[0][pttI.date_cancel].ToString();
                vsold1.user_create      = dt.Rows[0][pttI.user_create].ToString();
                vsold1.user_modi        = dt.Rows[0][pttI.user_modi].ToString();
                vsold1.user_cancel      = dt.Rows[0][pttI.user_cancel].ToString();
                vsold1.image_path       = dt.Rows[0][pttI.image_path].ToString();
                vsold1.status_image     = dt.Rows[0][pttI.status_image].ToString();
                vsold1.status_document  = dt.Rows[0][pttI.status_document].ToString();
                vsold1.dept_id          = dt.Rows[0][pttI.dept_id].ToString();
            }
            else
            {
                setPatientImage1(vsold1);
            }
            return(vsold1);
        }
Пример #2
0
        private void chkNull(PatientImage p)
        {
            int   chk  = 0;
            Int64 chk1 = 0;

            p.date_create = p.date_create == null ? "" : p.date_create;
            p.date_modi   = p.date_modi == null ? "" : p.date_modi;
            p.date_cancel = p.date_cancel == null ? "" : p.date_cancel;
            p.user_create = p.user_create == null ? "" : p.user_create;
            p.user_modi   = p.user_modi == null ? "" : p.user_modi;
            p.user_cancel = p.user_cancel == null ? "" : p.user_cancel;

            p.desc1           = p.desc1 == null ? "" : p.desc1;
            p.desc2           = p.desc2 == null ? "" : p.desc2;
            p.desc3           = p.desc3 == null ? "" : p.desc3;
            p.desc4           = p.desc4 == null ? "" : p.desc4;
            p.remark          = p.remark == null ? "" : p.remark;
            p.image_path      = p.image_path == null ? "" : p.image_path;
            p.status_image    = p.status_image == null ? "0" : p.status_image;
            p.status_document = p.status_document == null ? "" : p.status_document;
            //p.IntLock = p.IntLock == null ? "" : p.IntLock;

            p.t_patient_id = int.TryParse(p.t_patient_id, out chk) ? chk.ToString() : "0";
            p.t_visit_id   = int.TryParse(p.t_visit_id, out chk) ? chk.ToString() : "0";
            p.dept_id      = int.TryParse(p.dept_id, out chk) ? chk.ToString() : "0";
        }
Пример #3
0
        public String insert(PatientImage p, String userId)
        {
            String re  = "";
            String sql = "";

            p.active = "1";
            //p.ssdata_id = "";
            int chk = 0;

            chkNull(p);
            sql = "Insert Into " + pttI.table + "(" + pttI.t_patient_id + "," + pttI.t_visit_id + "," + pttI.desc1 + "," +
                  pttI.desc2 + "," + pttI.desc3 + "," + pttI.desc4 + "," +
                  pttI.remark + "," + pttI.image_path + "," + pttI.status_image + "," +
                  pttI.date_create + "," + pttI.date_modi + "," + pttI.date_cancel + ", " +
                  pttI.user_create + "," + pttI.user_modi + "," + pttI.user_cancel + "," +
                  pttI.active + "," + pttI.status_document + "," + pttI.dept_id + " " +
                  ") " +
                  "Values ('" + p.t_patient_id + "','" + p.t_visit_id.Replace("'", "''") + "','" + p.desc1.Replace("'", "''") + "'," +
                  "'" + p.desc2.Replace("'", "''") + "','" + p.desc3.Replace("'", "''") + "','" + p.desc4.Replace("'", "''") + "'," +
                  "'" + p.remark.Replace("'", "''") + "','" + p.image_path + "','" + p.status_image + "'," +
                  "now(),'" + p.date_modi + "','" + p.date_cancel + "', " +
                  "'" + userId + "','" + p.user_modi + "','" + p.user_cancel + "'," +
                  "'1','" + p.status_document + "','" + p.dept_id + "' " +
                  ")";
            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
Пример #4
0
        public static Room GetRoom(PatientImage pi)
        {
            if (pi == null)
            {
                logger.Warn("Attemt to get room for null PatientImage");
                return(null);
            }

            var roomBridges = DicomModule.GetRoomBridges();

            if (pi.DeviceSerialNumber != null)
            {
                if (roomBridges.Where(x => x.SerialNumber == pi.DeviceSerialNumber).Any())
                {
                    return(roomBridges.Where(x => x.SerialNumber == pi.DeviceSerialNumber).First().Room);
                }
            }

            if (pi.ManufacturerModelName != null)
            {
                if (roomBridges.Where(x => x.ModelName == pi.ManufacturerModelName).Any())
                {
                    return(roomBridges.Where(x => x.ModelName == pi.ManufacturerModelName).First().Room);
                }
            }
            return(null);
        }
Пример #5
0
        public String update(PatientImage p, String userId)
        {
            String re  = "";
            String sql = "";
            int    chk = 0;


            chkNull(p);
            sql = "Update " + pttI.table + " Set " +
                  " " + pttI.desc1 + " = '" + p.desc1 + "'" +
                  "," + pttI.desc2 + " = '" + p.desc2.Replace("'", "''") + "'" +
                  "," + pttI.desc3 + " = '" + p.desc3 + "'" +
                  "," + pttI.desc4 + " = '" + p.desc4 + "'" +
                  "," + pttI.remark + " = '" + p.remark + "'" +
                  "," + pttI.image_path + " = '" + p.image_path + "'" +
                  "," + pttI.status_image + " = '" + p.status_image + "'" +
                  "," + pttI.date_modi + " = now()" +
                  "," + pttI.user_modi + " = '" + userId + "'" +
                  "," + pttI.status_document + " = '" + p.status_document + "'" +
                  "," + pttI.dept_id + " = '" + p.dept_id + "'" +
                  "Where " + pttI.pkField + "='" + p.patient_image_id + "'"
            ;

            try
            {
                re = conn.ExecuteNonQuery(conn.conn, sql);
            }
            catch (Exception ex)
            {
                sql = ex.Message + " " + ex.InnerException;
            }

            return(re);
        }
Пример #6
0
        private void initConfig()
        {
            pttI = new PatientImage();
            pttI.patient_image_id = "patient_image_id";
            pttI.t_patient_id     = "t_patient_id";
            pttI.t_visit_id       = "t_visit_id";
            pttI.desc1            = "desc1";
            pttI.desc2            = "desc2";
            pttI.desc3            = "desc3";
            pttI.desc4            = "desc4";
            pttI.active           = "active";
            pttI.remark           = "remark";
            pttI.date_create      = "date_create";
            pttI.date_modi        = "date_modi";
            pttI.date_cancel      = "date_cancel";
            pttI.user_create      = "user_create";
            pttI.user_modi        = "user_modi";
            pttI.user_cancel      = "user_cancel";
            pttI.image_path       = "image_path";
            pttI.status_image     = "status_image";
            pttI.status_document  = "status_document";
            pttI.dept_id          = "dept_id";

            pttI.table   = "t_patient_image";
            pttI.pkField = "patient_image_id";
        }
Пример #7
0
        /// <summary>
        /// Returns the time difference between a PatientImage and a ScanTask
        /// </summary>
        /// <param name="st">The ScanTask</param>
        /// <param name="img">the PatientImage</param>
        /// <returns></returns>
        public static double GetImageToTaskDifference(ScanTask st, PatientImage img)
        {
            var startStartDiffernece = Math.Abs((st.ValidCommencementTime - img.SeriesDateTime).TotalMinutes);
            var startEndDifference   = Math.Abs((st.ValidCommencementTime - img.ScanFinishedDateTime).TotalMinutes);
            var endStartDifference   = Math.Abs((st.ValidCompletionTime - img.SeriesDateTime).TotalMinutes);
            var endEndDifference     = Math.Abs((st.ValidCompletionTime - img.ScanFinishedDateTime).TotalMinutes);

            return(Math.Min(endEndDifference, Math.Min(endStartDifference, Math.Min(startStartDiffernece, startEndDifference))));
        }
Пример #8
0
        private void setControl(String vsid)
        {
            //vsOld = ic.ivfDB.ovsDB.selectByPk1(vsid);             //      -0020
            //pttOld = ic.ivfDB.pttOldDB.selectByPk1(vsOld.PID);      //      -0020
            //vs = ic.ivfDB.vsDB.selectByVn(vsid);              //      -0020
            vs  = ic.ivfDB.vsDB.selectByPk1(vsid);               //  +0020
            ptt = ic.ivfDB.pttDB.selectByPk1(vs.t_patient_id);

            //txtHn.Value = ptt.patient_hn;//      -0020
            txtHn.Value       = ic.showHN(ptt.patient_hn, ptt.patient_year);//  +0020
            txtVn.Value       = vs.visit_vn;
            txtPttNameE.Value = ptt.Name;
            txtPttName.Value  = ic.ivfDB.fpfDB.getList1(ptt.f_patient_prefix_id) + " " + ptt.patient_firstname + " " + ptt.patient_lastname;
            txtVnShow.Value   = ic.showVN(vs.visit_vn);

            txtDob.Value     = ic.datetoShow(ptt.patient_birthday) + " [" + ptt.AgeStringShort() + "]";
            txtAllergy.Value = ptt.allergy_description;
            txtIdOld.Value   = ptt.t_patient_id_old;
            txtVnOld.Value   = vs.visit_vn;
            txtVsId.Value    = vs.t_visit_id;
            txtPttId.Value   = ptt.t_patient_id;
            txtSex.Value     = ptt.f_sex_id.Equals("1") ? "ชาย" : "หญิง";
            txtBg.Value      = ptt.f_patient_blood_group_id.Equals("2140000005") ? "O"
                : ptt.f_patient_blood_group_id.Equals("2140000002") ? "A" : ptt.f_patient_blood_group_id.Equals("2140000003") ? "B"
                : ptt.f_patient_blood_group_id.Equals("2140000004") ? "AB" : "ไม่ระบุ";
            txtVisitHeight.Value = vs.height;
            txtVisitBW.Value     = vs.bw;
            txtVisitBP.Value     = vs.bp;
            txtVisitPulse.Value  = vs.pulse;
            chkChronic.Checked   = ptt.status_congenial.Equals("1") ? true : false;
            ic.setC1Combo(cboDoctor, vs.doctor_id);
            Patient ptt1 = new Patient();

            ptt1 = ic.ivfDB.pttDB.selectByHn(vs.patient_hn_male);
            txtNameMale.Value = ptt1.Name;
            stt.Show("<p><b>สวัสดี</b></p>คุณ " + ptt.congenital_diseases_description + "<br> กรุณา ป้อนรหัสผ่าน", chkChronic);
            txtCongenital.Value = ptt.congenital_diseases_description;
            if (!ptt.t_patient_id.Equals(""))
            {
                PatientImage pttI = new PatientImage();
                pttI        = ic.ivfDB.pttImgDB.selectByPttIDStatus4(ptt.t_patient_id);
                filenamepic = pttI.image_path;
                Thread threadA = new Thread(new ParameterizedThreadStart(ExecuteA));
                threadA.Start();
            }
            //if (!vsOld.VSID.Equals("166"))            //      -0020

            //  ต้องการ พิมพ์ sticker ย้อยหลัง
            //if (!vs.vsid.Equals("166"))               //  ต้องการ พิมพ์ sticker ย้อยหลัง
            //{                                         //  ต้องการ พิมพ์ sticker ย้อยหลัง
            //    btnPrnSticker.Enabled = false;        //  ต้องการ พิมพ์ sticker ย้อยหลัง
            //}                                         //  ต้องการ พิมพ์ sticker ย้อยหลัง

            //txtBg.Value = pttOld.b
            //txtAllergy.Value =
        }
Пример #9
0
        public PatientImage selectByPk1(String copId)
        {
            PatientImage cop1 = new PatientImage();
            DataTable    dt   = new DataTable();
            String       sql  = "select pttI.* " +
                                "From " + pttI.table + " pttI " +
                                "Where pttI." + pttI.pkField + " ='" + copId + "' ";

            dt   = conn.selectData(conn.conn, sql);
            cop1 = setPatientImage(dt);
            return(cop1);
        }
Пример #10
0
        public PatientImage selectByPttIDStatus1(String pttid)
        {
            PatientImage cop1 = new PatientImage();
            DataTable    dt   = new DataTable();
            String       sql  = "select pttI.* " +
                                "From " + pttI.table + " pttI " +
                                "Where pttI." + pttI.t_patient_id + " ='" + pttid + "' and status_image='1' and active = '1' ";

            dt   = conn.selectData(conn.conn, sql);
            cop1 = setPatientImage(dt);
            return(cop1);
        }
Пример #11
0
        public String insertpatientImage(PatientImage p, String userId)
        {
            String re = "";

            if (p.patient_image_id.Equals(""))
            {
                re = insert(p, userId);
            }
            else
            {
                re = update(p, userId);
            }

            return(re);
        }
Пример #12
0
        private void setControl1()
        {
            LabFormA lFormA  = new LabFormA();
            Patient  pttmale = new Patient();

            lFormA  = ic.ivfDB.lFormaDB.selectByVnOld(vs.visit_vn);
            pttmale = ic.ivfDB.pttDB.selectByHn(vs.patient_hn_male);
            ptt.patient_birthday = pttOld.DateOfBirth;
            txtHn.Value          = vsOld.PIDS;
            txtVn.Value          = vsOld.VN;
            txtPttNameE.Value    = vsOld.PName;
            txtDob.Value         = ic.datetoShow(pttOld.DateOfBirth) + " [" + ptt.AgeStringShort() + "]";
            txtAllergy.Value     = ptt.allergy_description;
            txtPttPID.Value      = pttOld.PID;
            txtVnOld.Value       = vsOld.VN;
            txtSex.Value         = ptt.f_sex_id.Equals("1") ? "ชาย" : "หญิง";
            txtBg.Value          = ptt.f_patient_blood_group_id.Equals("2140000005") ? "O"
                : ptt.f_patient_blood_group_id.Equals("2140000002") ? "A" : ptt.f_patient_blood_group_id.Equals("2140000003") ? "B"
                : ptt.f_patient_blood_group_id.Equals("2140000004") ? "AB" : "ไม่ระบุ";
            txtVisitHeight.Value       = ptt.patient_height;
            txtVisitBW.Value           = vs.bw;
            txtVisitBP.Value           = vs.bp;
            txtVisitPulse.Value        = vs.pulse;
            txtPttId.Value             = ptt.t_patient_id;
            txtVsId.Value              = vs.t_visit_id;
            txtG.Value                 = ptt.g;
            txtP.Value                 = ptt.p;
            txtA.Value                 = ptt.a;
            txtVisitLMP.Value          = vs.lmp;
            txtOPUDate.Value           = lFormA.opu_date;
            txtOPUTime.Value           = lFormA.opu_time;
            txtEmbryoTranferDate.Value = lFormA.embryo_tranfer_date;
            ic.setC1Combo(cboDoctor, vs.doctor_id);
            txtNameMale.Value = pttmale.Name;

            chkChronic.Checked = ptt.status_congenial.Equals("1") ? true : false;
            stt.Show("<p><b>สวัสดี</b></p>คุณ " + ptt.congenital_diseases_description + "<br> กรุณา ป้อนรหัสผ่าน", chkChronic);

            if (!ptt.t_patient_id.Equals(""))
            {
                PatientImage pttI = new PatientImage();
                pttI        = ic.ivfDB.pttImgDB.selectByPttIDStatus4(ptt.t_patient_id);
                filenamepic = pttI.image_path;
                Thread threadA = new Thread(new ParameterizedThreadStart(ExecuteA));
                threadA.Start();
            }
        }
Пример #13
0
        private void ImageSetCollection(ImageDataset dataSet)
        {
            ObservableCollection <PatientImage> imageCollection = new ObservableCollection <PatientImage>();

            dataSet.relatedImages = imageCollection;

            SqlCommand cmd = new SqlCommand("spr_SubTreeView_v001", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@seriesID", SqlDbType.Int).Value = dataSet.seriesID;
            SqlDataReader data = cmd.ExecuteReader();

            while (data.Read())
            {
                PatientImage image = new PatientImage(data.GetInt32(data.GetOrdinal("fileID")));
                imageCollection.Add(image);
            }
            data.Close();
        }
Пример #14
0
        public static Tuple <bool, PatientImage> GetPatientImage(string hn, CacheConnection con)
        {
            try
            {
                var ptImg = new PatientImage();

                var dt = InterSystemsDa.DtBindDataCommand(QueryString.GetPatientImage(hn), con);

                var isImage = Helper.CheckPatientImage(dt);

                //ptImg.Image = isImage ? Helper.DataTableToBase64(dt, 500, 500) : "";

                return(new Tuple <bool, PatientImage>(isImage, ptImg));
            }
            catch (Exception)
            {
                return(new Tuple <bool, PatientImage>(false, new PatientImage()));
            }
        }
Пример #15
0
 private PatientImage setPatientImage1(PatientImage stf1)
 {
     stf1.patient_image_id = "";
     stf1.t_patient_id     = "";
     stf1.t_visit_id       = "";
     stf1.desc1            = "";
     stf1.desc2            = "";
     stf1.desc3            = "";
     stf1.desc4            = "";
     stf1.active           = "";
     stf1.remark           = "";
     stf1.date_create      = "";
     stf1.date_modi        = "";
     stf1.date_cancel      = "";
     stf1.user_create      = "";
     stf1.user_modi        = "";
     stf1.user_cancel      = "";
     stf1.image_path       = "";
     stf1.status_image     = "";
     stf1.status_document  = "";
     stf1.dept_id          = "";
     return(stf1);
 }
Пример #16
0
        private void setControlPtt(Patient ptt)
        {
            txtHn.Value        = ptt.patient_hn;
            txtPttId.Value     = ptt.t_patient_id;
            txtPttName.Value   = ptt.patient_firstname;
            txtPttLName.Value  = ptt.patient_lastname;
            txtPttNameE.Value  = ptt.patient_firstname_e;
            txtPttLNameE.Value = ptt.patient_lastname_e;
            txtRemark.Value    = ptt.remark;
            txtLineID.Value    = ptt.line_id;
            txtEmail.Value     = ptt.email;
            txtMobile1.Value   = ptt.mobile1;
            txtMobile2.Value   = ptt.mobile2;
            txtPid.Value       = ptt.pid;
            txtPaasport.Value  = ptt.passport;

            txtRemark.Value = ptt.remark;
            txtDob.Value    = ptt.patient_birthday;

            ic.setC1Combo(cboPrefix, ptt.f_patient_prefix_id);
            ic.setC1Combo(cboSex, ptt.f_sex_id);
            ic.setC1Combo(cboMarital, ptt.f_patient_marriage_status_id);
            ic.setC1Combo(cboBloodG, ptt.f_patient_blood_group_id);
            ic.setC1Combo(CboNation, ptt.f_patient_nation_id);
            ic.setC1Combo(CboEduca, ptt.f_patient_education_type_id);
            ic.setC1Combo(cboRace, ptt.f_patient_race_id);
            ic.setC1Combo(cboRg, ptt.f_patient_religion_id);
            ic.setC1Combo(cboPttType, ptt.patient_type);
            ic.setC1Combo(cboAgent, ptt.agent);
            txtAgent.Value  = ptt.agent;
            txtAgent1.Value = ptt.agent;
            //ic.setC1Combo(cboBsp, ptt.patient_type);cboAgent

            //ic.setC1Combo(cboCouPrefix, ptt.f_patient_religion_id);
            //ic.setC1Combo(cboRg, ptt.f_patient_religion_id);
            //ic.setC1Combo(cboRg, ptt.f_patient_religion_id);
            chkChronic.Checked      = ptt.status_chronic.Equals("1") ? true : false;
            chkDenyAllergy.Checked  = ptt.status_deny_allergy.Equals("1") ? true : false;
            chkDenyAllergy1.Checked = chkDenyAllergy.Checked;
            chkOPU.Checked          = ptt.status_opu.Equals("1") ? true : false;
            chkOPU1.Checked         = chkOPU.Checked;
            chkOR.Checked           = ptt.status_or.Equals("1") ? true : false;
            chkOR1.Checked          = chkOR.Checked;
            chkCongenital.Checked   = ptt.status_congenial.Equals("1") ? true : false;
            chkCongenital1.Checked  = chkCongenital.Checked;
            txtCongenital.Value     = ptt.congenital_diseases_description;
            txtCongenital1.Value    = ptt.congenital_diseases_description;
            txtORDescription1.Value = ptt.or_description;
            stt.SetToolTip(chkOR, ptt.or_description);
            stt.SetToolTip(chkDenyAllergy, ptt.allergy_description);
            stt.SetToolTip(chkCongenital, ptt.congenital_diseases_description);
            txtNickName.Value  = ptt.patient_nickname;
            txtNickName1.Value = txtNickName.Text;
            txtMobile11.Value  = txtMobile1.Text;
            txtHeight.Value    = ptt.patient_height;
            txtHeight1.Value   = txtHeight.Text;

            vs          = ic.ivfDB.vsDB.selectByPk1(vsid);
            txtID.Value = vs.t_visit_id;
            ic.setC1Combo(cboBsp, vs.b_service_point_id);
            txtComment.Value  = vs.visit_notice;
            txtBP.Value       = vs.bp;
            txtBW.Value       = vs.bw;
            txtBP1.Value      = txtBP.Text;
            txtBW1.Value      = txtBW1.Text;
            txtPulse.Value    = vs.pulse;
            txtPulse1.Value   = txtPulse.Text;
            txtAllergy.Value  = ptt.allergy_description;
            txtHnMale.Value   = vs.patient_hn_male;
            txtHnFemale.Value = vs.patient_hn_1;
            PatientImage ptti = new PatientImage();

            ptti = ic.ivfDB.pttImgDB.selectByPttIDStatus1(txtPttId.Text);

            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                Image loadedImage          = null, resizedImage;
                String aaa                 = ptti.image_path;
                FtpWebRequest ftpRequest   = null;
                FtpWebResponse ftpResponse = null;
                Stream ftpStream           = null;
                int bufferSize             = 2048;
                MemoryStream stream        = new MemoryStream();
                string host                = null;
                string user                = null;
                string pass                = null; //iniC.hostFTP, iniC.userFTP, iniC.passFTP
                host = ic.iniC.hostFTP; user = ic.iniC.userFTP; pass = ic.iniC.passFTP;
                try
                {
                    ftpRequest             = (FtpWebRequest)FtpWebRequest.Create(host + "/" + aaa);
                    ftpRequest.Credentials = new NetworkCredential(user, pass);
                    ftpRequest.UseBinary   = true;
                    ftpRequest.UsePassive  = ic.ftpUsePassive;
                    ftpRequest.KeepAlive   = true;
                    ftpRequest.Method      = WebRequestMethods.Ftp.DownloadFile;
                    ftpResponse            = (FtpWebResponse)ftpRequest.GetResponse();
                    ftpStream         = ftpResponse.GetResponseStream();
                    byte[] byteBuffer = new byte[bufferSize];
                    int bytesRead     = ftpStream.Read(byteBuffer, 0, bufferSize);
                    try
                    {
                        while (bytesRead > 0)
                        {
                            stream.Write(byteBuffer, 0, bytesRead);
                            bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize);
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
                    loadedImage = new Bitmap(stream);
                    ftpStream.Close();
                    ftpResponse.Close();
                    ftpRequest = null;

                    if (loadedImage != null)
                    {
                        String filename1  = "check_list_1.jpg";
                        int originalWidth = loadedImage.Width;
                        int newWidth      = 180;
                        resizedImage      = loadedImage.GetThumbnailImage(newWidth, (newWidth * loadedImage.Height) / originalWidth, null, IntPtr.Zero);
                        //Column col = grfImg.Cols[colImg];
                        //col.DataType = typeof(Image);
                        picImg.Image = loadedImage;
                        if (File.Exists(filename1))
                        {
                            File.Delete(filename1);
                            System.Threading.Thread.Sleep(200);
                        }
                        loadedImage.Save(filename1);
                        txtFileName.Value = filename1;
                        //loadedImage.sa
                        //flagImg = true;
                    }
                }
                catch (Exception ex) { Console.WriteLine(ex.ToString()); }
                //grfImg.Cols[colImg].ImageAndText = true;
            }).Start();
        }
Пример #17
0
        public static ScanTask GetScanTaskForImage(PatientImage img, int tolerance)
        {
            logger.Info("GetScanTaskForImage(PatientImage.ID = " + img.ID);
            if (img.ID == 0)
            {
                logger.Error("Cannot assign a scan task to a PatientImage with ID = 0");
                return(null);
            }
            if (img.ScanTask != null)
            {
                return(img.ScanTask);
            }

            Appointment a    = img.Appointment;
            Room        room = GetRoom(img);

            if (a == null)
            {
                logger.Error("Cannot assign image to scantask when appointment is null");
                return(null);
            }
            if (room == null)
            {
                logger.Error("Cannot assign image to scan task when image room is null");
                return(null);
            }

            if (img.SeriesDateTime == null)
            {
                logger.Error("Cannot assign image to scan task when image SeriesDateTime is null");
                return(null);
            }

            if (img is SPECTNMImage)
            {
                logger.Error("Scan tasks are not assigned to Recon images");
                return(null);
            }

            ///Are there any tasks available in the appointment
            if (a.Tasks.Where(x => x is ScanTask && x.IsCancelled == false && x.Deleted == false).Any())
            {
                ///Valid tasks are those scan taks which have not been deleted or cancelled;
                var validTasks = a.Tasks.Where(x => x is ScanTask && x.IsCancelled == false && x.Deleted == false).ToList();

                ///Non-empty valid tasks are those which already have at least one patient image in them - THEY CANNOT BE MOVED
                var nonEmptyValidTasks = validTasks.Where(z => (z as ScanTask).PatientImages.Any() && z.Room != null).ToList();

                ///Empty valid tasks are those which do not have any patient images in them - THEY CAN BE MOVED AND RESCHEDULED
                var emptyValidTasks = validTasks.Where(j => (j as ScanTask).PatientImages.Any() == false && j.Room != null).ToList();

                ///Are there any non-empty valid tasks on the same camera is the img that start before the paitent image and finish no more than 15 minutes before we start
                if (nonEmptyValidTasks.Where(b => (b as ScanTask).Room.ID == room.ID && GetImageToTaskDifference((b as ScanTask), img) < tolerance).Any())
                {
                    //grab the first one

                    ScanTask st = nonEmptyValidTasks.Where(b => (b as ScanTask).Room.ID == room.ID && GetImageToTaskDifference((b as ScanTask), img) < tolerance).First() as ScanTask;
                    logger.Info("Image being added to Scan task " + st.ID + " which already has images");
                    st.PatientImages.Add(img);
                    if (img.ScanFinishedDateTime.AddMinutes(3) > st.CompletionTime)
                    {
                        st.CompletionTime = img.ScanFinishedDateTime.AddMinutes(3);
                        if (st.CompletionTime < DateTime.Now.AddMinutes(10))
                        {
                            st.Completed = false;
                            logger.Info("ScanTask " + st.ID + " being mark as incomplete because last image was finished less than 10 minutes ago");
                        }
                        else
                        {
                            st.Completed = true;
                        }
                    }
                    Platform.Retriever.SaveItem(st);
                    return(st);
                }
                else if (emptyValidTasks.Any())
                {
                    logger.Info("Image being added to empty ScanTask");
                    ScanTask st = emptyValidTasks.First() as ScanTask;
                    st.Room = room;
                    st.PatientImages.Add(img);
                    st.Commenced      = true;
                    st.CommencentTime = img.SeriesDateTime.AddMinutes(-3);
                    if (img.ScanFinishedDateTime < DateTime.Now.AddMinutes(10))
                    {
                        st.Completed      = false;
                        st.CompletionTime = img.ScanFinishedDateTime.AddMinutes(3);
                    }
                    else
                    {
                        st.Completed = true;
                    }
                    Platform.Retriever.SaveItem(st);
                    return(st);
                }
                else
                {
                    logger.Info("New ScanTask created for PatientImage.ID = " + img.ID);
                    ScanTask st = new ScanTask();
                    a.Tasks.Add(st);
                    st.Appointment = a;
                    st.Room        = room;
                    st.PatientImages.Add(img);
                    st.Commenced      = true;
                    st.CommencentTime = img.SeriesDateTime.AddMinutes(-3);
                    if (img.ScanFinishedDateTime < DateTime.Now.AddMinutes(10))
                    {
                        st.Completed      = false;
                        st.CompletionTime = img.ScanFinishedDateTime.AddMinutes(3);
                    }
                    else
                    {
                        st.Completed = true;
                    }
                    Platform.Retriever.SaveItem(st);
                    return(st);
                }
            }
            else//if not we will make a new task
            {
                logger.Info("New ScanTask created for PatientImage.ID = " + img.ID);
                ScanTask st = new ScanTask();
                a.Tasks.Add(st);
                st.Appointment = a;
                st.Room        = room;
                st.PatientImages.Add(img);
                st.Commenced      = true;
                st.CommencentTime = img.SeriesDateTime.AddMinutes(-3);
                if (img.ScanFinishedDateTime < DateTime.Now.AddMinutes(10))
                {
                    st.Completed      = false;
                    st.CompletionTime = img.ScanFinishedDateTime.AddMinutes(3);
                }
                else
                {
                    st.Completed = true;
                }
                Platform.Retriever.SaveItem(st);
                return(st);
            }
        }
Пример #18
0
        private void initConfig()
        {
            //Set up the form.
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.BackColor   = Color.White;
            this.ForeColor   = Color.Black;

            pttOld = new PatientOld();
            pttImg = new PatientImage();
            pttOld = ic.ivfDB.pttOldDB.selectByPk1(pttOldId);
            pttImg = ic.ivfDB.pttImgDB.selectByPk1(pttImgId);

            this.Size = new System.Drawing.Size(1224, 768);
            fEdit     = new Font(ic.iniC.grdViewFontName, ic.grdViewFontSize, FontStyle.Regular);

            //this.Location = pp;
            this.Text            = "Run-time Controls";
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.StartPosition   = FormStartPosition.CenterParent;
            //this.StartPosition = FormStartPosition.CenterParent;
            panel1      = new Panel();
            panel1.Dock = DockStyle.Fill;
            pnR         = new Panel();
            pnR.Dock    = DockStyle.Right;
            pnR.Width   = newWidth;
            pnL         = new Panel();
            pnL.Dock    = DockStyle.Fill;

            lb2          = new Label();
            lb2.Font     = fEdit;
            lb2.Text     = "Description";
            lb2.AutoSize = true;
            pnR.Controls.Add(lb2);
            lb2.Location = new System.Drawing.Point(grd1, gapLine);

            txtId = new TextBox();

            txtDesc      = new TextBox();
            txtDesc.Font = fEdit;
            txtDesc.Text = "";
            txtDesc.Size = new System.Drawing.Size(200, ControlHeight);
            pnR.Controls.Add(txtDesc);
            txtDesc.Location = new System.Drawing.Point(grd1, lb2.Height + gapLine + gapLine);

            btnSend      = new Button();
            btnSend.Font = fEdit;
            btnSend.Text = "Save";
            btnSend.Size = new System.Drawing.Size(120, ControlHeight);
            pnR.Controls.Add(btnSend);
            btnSend.Location = new System.Drawing.Point(grd1, line3);
            btnSend.Click   += BtnSend_Click;

            btnPrn      = new Button();
            btnPrn.Font = fEdit;
            btnPrn.Text = "Print";
            btnPrn.Size = new System.Drawing.Size(120, ControlHeight);
            pnR.Controls.Add(btnPrn);
            btnPrn.Location = new System.Drawing.Point(grd1, line4);
            btnPrn.Click   += BtnPrn_Click;

            pic      = new C1PictureBox();
            pic.Dock = DockStyle.Fill;
            panel1.Controls.Add(pnR);
            panel1.Controls.Add(pnL);
            pnL.Controls.Add(pic);

            pnR.Controls.Add(btnSend);
            Controls.Add(panel1);
            String ext = Path.GetExtension(filename);

            //String[] sur = filename.Split('.');
            //String ex = "";
            //if (sur.Length == 2)
            //{
            //    ex = sur[1];
            //}
            stream = new MemoryStream();
            if (ext.IndexOf("pdf") < 0)
            {
                try
                {
                    //loadedImage = Image.FromFile(filename);
                    stream = ic.ftpC.download(filename);
                    Bitmap bitmap = new Bitmap(stream);
                    loadedImage = bitmap;
                    int originalWidth = loadedImage.Width;
                    int newWidth      = 1000;
                    if (originalWidth > newWidth)
                    {
                        resizedImage = loadedImage.GetThumbnailImage(newWidth, (newWidth * loadedImage.Height) / originalWidth, null, IntPtr.Zero);
                    }
                    else
                    {
                        resizedImage = loadedImage;
                    }
                }
                catch (Exception ex1)
                {
                }
            }
            else
            {
                resizedImage = Resources.pdf_symbol_300;
            }

            //loadedImage = Image.FromFile(filename);

            //int originalWidth = loadedImage.Width;
            //resizedImage = loadedImage.GetThumbnailImage(newWidth, (newWidth * loadedImage.Height) / originalWidth, null, IntPtr.Zero);
            //pic.Image = resizedImage;
            if (stream.Length > 0)
            {
                pic.Image    = Image.FromStream(stream);
                pic.SizeMode = PictureBoxSizeMode.StretchImage;
            }
        }
Пример #19
0
 public TreeViewImageViewModel(PatientImage image, TreeViewImageDatasetViewModel parent) : base(parent, true)
 {
     _image = image;
 }