void AddProcSearchedFromMWL(string Patient_Code) { try { DataTable APParams_DataSource = new DoctorController().GetAnatomyProjectionParams().Tables[0]; if (m_dtAcquisitionDataSource == null || m_dtAcquisitionDataSource.Columns.Count <= 0 || m_dtAcquisitionDataSource.Rows.Count <= 0) { m_dtAcquisitionDataSource = new RegDetailController().GetAllData(-1).Tables[0]; } DataRow dr; m_dtAcquisitionDataSource.Rows.Clear(); if (m_dtAcquisitionDataSource.Rows.Count > 0) { dr = m_dtAcquisitionDataSource.Rows[0]; if (dr["reg_id"].ToString() == "-1") dr["REG_ID"] = currREGID; } else { dr = m_dtAcquisitionDataSource.NewRow(); dr["STATUS"] = 0; dr["IMGNAME"] = ""; dr["PRINTCOUNT"] = 0; dr["EXPOSURECOUNT"] = 0; dr["HOST"] = "127.0.0.1"; dr["UsingGrid"] = 0; dr["IMGDATA"] = DBNull.Value; dr["REG_NUMBER"] = txtRegNumber2.Text.Trim(); dr["REG_ID"] = currREGID; } DataTable dtAP = new DoctorController().GetAnatomyProjection(-1).Tables[0]; DataTable dtDefaultAP = new ProcedureController().GetEmerencyData().Tables[0]; //Lọc chỉ các dịch vụ được gửi từ worklistServer dtAP = GetAPfromMWL(dtAP, Patient_Code); if (dtAP != null && dtDefaultAP != null && dtAP.Columns.Count > 0 && dtDefaultAP.Columns.Count > 0) { try { foreach (DataRow drDefaultAP in dtDefaultAP.Rows) { if (dtAP.Select("ANATOMY_CODE='" + drDefaultAP["ANATOMY_CODE"].ToString() + "' AND PROJECTION_CODE='" + drDefaultAP["PROJECTION_CODE"].ToString() + "'").Length <= 0) dtAP.ImportRow(drDefaultAP); } } catch { } } DataRow newdr = m_dtAcquisitionDataSource.NewRow(); Utility.CopyData(dr, ref newdr); if (dtAP != null) { string SeriesInstanceUID = ""; foreach (DataRow drAP in dtAP.Rows) { RegDetailInfor infor = new RegDetailInfor(); int NextSeriesInstanceUID = MaxSeriesInstanceUID + 1; SeriesInstanceUID = CurrStudyInstanceUID + "." + NextSeriesInstanceUID.ToString(); MaxSeriesInstanceUID = NextSeriesInstanceUID; newdr["DETAIL_ID"] = -1; //SeriesInstanceUID=StudyInstanceUID+Số thứ tự dịch vụ trong lần đăng ký đó newdr["SeriesInstanceUID"] = SeriesInstanceUID; //SOPInstanceUID=SeriesInstanceUID+Số lần chụp của dịch vụ đó. //SOPInstanceUID chỉ thay đổi khi dịch vụ này đang có ảnh và lại được chụp lại newdr["SOPInstanceUID"] = SeriesInstanceUID + ".1"; newdr["REG_ID"] = dr["REG_ID"]; newdr["ANATOMY_CODE"] = drAP["ANATOMY_CODE"]; newdr["BODYSIZE_CODE"] = BODYSIZE_CODE; newdr["UsingGrid"] = 0; newdr["PROJECTION_CODE"] = drAP["PROJECTION_CODE"]; newdr["DISPLAY_NAME"] = drAP["ANATOMY_CODE"]; newdr["STANDARD_NAME"] = drAP["ANATOMY_CODE"]; newdr["DirectionCapture"] = 0; newdr["STATUS"] = 0; newdr["STATUS_NAME"] = ""; Utility.MapValueFromEntityIntoObjectInfor(infor, newdr); if (new RegDetailController(infor).Insert() == ActionResult.Success) { newdr["DETAIL_ID"] = infor.DETAIL_ID; decimal _kVp = 0M; int _mA = 0; int _mAs = 0; GetAPParams(APParams_DataSource, infor.ANATOMY_CODE, infor.PROJECTION_CODE, infor.BODYSIZE_CODE, ref _kVp, ref _mA, ref _mAs); //Add new Scheduled Control ScheduledControl _Scheduled = new ScheduledControl(txtImgDir.Text.Trim() + @"\" + txtRegNumber2.Text.Trim() + "_" + infor.DETAIL_ID.ToString(), (int)infor.REG_ID, (int)infor.DETAIL_ID, CurrStudyInstanceUID, SeriesInstanceUID, newdr["SOPInstanceUID"].ToString(), infor.ANATOMY_CODE, infor.PROJECTION_CODE, infor.BODYSIZE_CODE, Utility.sDbnull(drAP["VN_ANATOMY_NAME"], ""), Utility.sDbnull(drAP["EN_ANATOMY_NAME"], ""), Utility.sDbnull(drAP["VN_PROJECTION_NAME"], ""), Utility.sDbnull(drAP["EN_PROJECTION_NAME"], ""), BODYSIZE_NAME, BODYSIZE_NAME, _kVp, _mA, _mAs, Utility.Int32Dbnull(drAP["A_STT"], 0), Utility.Int32Dbnull(drAP["P_STT"], 0), Utility.Int32Dbnull(dr["PRINTCOUNT"], 0), 0); _Scheduled._OnClick += new ScheduledControl.OnClick(_ScheduledControl__OnClick); _Scheduled.ContextMenuStrip = ctx; _Scheduled._OnNewScheduleClick += new ScheduledControl.OnNewScheduleClick(_ScheduledControl__OnNewScheduleClick); _Scheduled._OnRejectScheduleClick += new ScheduledControl.OnRejectScheduleClick(_ScheduledControl__OnRejectScheduleClick); _Scheduled._OnDelScheduleClick += new ScheduledControl.OnDelScheduleClick(_ScheduledControl__OnDelScheduleClick); _Scheduled._OnNewScheduleDoubleClick += new ScheduledControl.OnNewScheduleDoubleClick(_ScheduledControl__OnNewScheduleDoubleClick); _Scheduled._OnRejectScheduleDoubleClick += new ScheduledControl.OnRejectScheduleDoubleClick(_ScheduledControl__OnRejectScheduleDoubleClick); _Scheduled._OnDelScheduleDoubleClick += new ScheduledControl.OnDelScheduleDoubleClick(_ScheduledControl__OnDelScheduleDoubleClick); _Scheduled._OnKeyDown += new ScheduledControl.OnKeyDown(_ScheduledControl__OnKeyDown); pnlScheduled.Controls.Add(_Scheduled); } m_dtAcquisitionDataSource.Rows.Add(newdr); m_dtAcquisitionDataSource.AcceptChanges(); newdr = m_dtAcquisitionDataSource.NewRow(); } } if (!AcquisitionFromWL) { //string[] Img = Utility.sDbnull(currentStudyRow["Img"]).Split('/'); //currentStudyRow["Img"] = Img[0] + "/" + (Convert.ToInt64(Img[1]) + _newForm.arrProc.Count).ToString(); //currentStudyRow["Img1"] = currentStudyRow["Img"]; } //Update Procedure List to DB and Datasource string ProcedureList = GetProcedureList(); new RegDetailController().UpdateProcedureList(Convert.ToInt64(dr["REG_ID"]), ProcedureList); //Update Dataset DataRow[] drWL = m_dtWLDataSource.Select("Reg_ID=" + Convert.ToInt64(dr["REG_ID"])); DataRow[] drST = m_dtStudyListDataSource.Select("Reg_ID=" + Convert.ToInt64(dr["REG_ID"])); if (drWL.Length > 0) drWL[0]["ProcedureList"] = ProcedureList; if (drST.Length > 0) drST[0]["ProcedureList"] = ProcedureList; m_dtWLDataSource.AcceptChanges(); m_dtStudyListDataSource.AcceptChanges(); } catch { } }
void ShortCut2AddProc(string ACODE, string PCODE, bool AutoSelectNotDone, ref int _detailId) { try { using (frm_Choose_Anotomy_Projection _Choose_Anotomy_Projection = new frm_Choose_Anotomy_Projection(-1)) { _Choose_Anotomy_Projection.InitComponents(); bool _Success = false; _Choose_Anotomy_Projection.AutoSelectAnatomy(ACODE, PCODE, ref _Success); if (_Success) { if (m_dtAcquisitionDataSource == null || m_dtAcquisitionDataSource.Columns.Count <= 0 || m_dtAcquisitionDataSource.Rows.Count <= 0) { m_dtAcquisitionDataSource = new RegDetailController().GetAllData(-1).Tables[0]; } DataRow dr; if (m_dtAcquisitionDataSource.Rows.Count > 0) { dr = m_dtAcquisitionDataSource.Rows[0]; if (dr["reg_id"].ToString() == "-1") dr["REG_ID"] = currREGID; } else { dr = m_dtAcquisitionDataSource.NewRow(); dr["UsingGrid"] = 0; dr["STATUS"] = 0; dr["IMGNAME"] = ""; dr["PRINTCOUNT"] = 0; dr["EXPOSURECOUNT"] = 0; dr["HOST"] = "127.0.0.1"; dr["IMGDATA"] = DBNull.Value; dr["REG_NUMBER"] = txtRegNumber2.Text.Trim(); dr["REG_ID"] = currREGID; } DataTable dtAP = _Choose_Anotomy_Projection.AP_DataSource.Select("CHON=1").CopyToDataTable(); DataRow newdr = m_dtAcquisitionDataSource.NewRow(); Utility.CopyData(dr, ref newdr); if (dtAP != null) { string SeriesInstanceUID = ""; foreach (DataRow drAP in dtAP.Rows) { RegDetailInfor infor = new RegDetailInfor(); int NextSeriesInstanceUID = MaxSeriesInstanceUID + 1; SeriesInstanceUID = CurrStudyInstanceUID + "." + NextSeriesInstanceUID.ToString(); MaxSeriesInstanceUID = NextSeriesInstanceUID; newdr["DETAIL_ID"] = -1; newdr["StudyInstanceUID"] = CurrStudyInstanceUID; //SeriesInstanceUID=StudyInstanceUID+Số thứ tự dịch vụ trong lần đăng ký đó newdr["SeriesInstanceUID"] = SeriesInstanceUID; //SOPInstanceUID=SeriesInstanceUID+Số lần chụp của dịch vụ đó. //SOPInstanceUID chỉ thay đổi khi dịch vụ này đang có ảnh và lại được chụp lại newdr["SOPInstanceUID"] = SeriesInstanceUID + ".1"; newdr["REG_ID"] = dr["REG_ID"]; newdr["ANATOMY_CODE"] = drAP["ANATOMY_CODE"]; newdr["BODYSIZE_CODE"] = _Choose_Anotomy_Projection.BODYSIZE_CODE; newdr["UsingGrid"] = 0; newdr["PROJECTION_CODE"] = drAP["PROJECTION_CODE"]; newdr["DISPLAY_NAME"] = drAP["ANATOMY_CODE"]; newdr["STANDARD_NAME"] = drAP["ANATOMY_CODE"]; newdr["DirectionCapture"] = 0; newdr["STATUS"] = 0; newdr["STATUS_NAME"] = ""; Utility.MapValueFromEntityIntoObjectInfor(infor, newdr); if (new RegDetailController(infor).Insert() == ActionResult.Success) { newdr["DETAIL_ID"] = infor.DETAIL_ID; _detailId = Convert.ToInt32(infor.DETAIL_ID); decimal _kVp = 0M; int _mA = 0; int _mAs = 0; GetAPParams(_Choose_Anotomy_Projection.APParams_DataSource, infor.ANATOMY_CODE, infor.PROJECTION_CODE, infor.BODYSIZE_CODE, ref _kVp, ref _mA, ref _mAs); //Add new Scheduled Control ScheduledControl _Scheduled = new ScheduledControl(txtImgDir.Text.Trim() + @"\" + txtRegNumber2.Text.Trim() + "_" + infor.DETAIL_ID.ToString(), (int)infor.REG_ID, (int)infor.DETAIL_ID, CurrStudyInstanceUID, SeriesInstanceUID, newdr["SOPInstanceUID"].ToString(), infor.ANATOMY_CODE, infor.PROJECTION_CODE, infor.BODYSIZE_CODE, Utility.sDbnull(drAP["VN_ANATOMY_NAME"], ""), Utility.sDbnull(drAP["EN_ANATOMY_NAME"], ""), Utility.sDbnull(drAP["VN_PROJECTION_NAME"], ""), Utility.sDbnull(drAP["EN_PROJECTION_NAME"], ""), _Choose_Anotomy_Projection.BODYSIZE_NAME, _Choose_Anotomy_Projection.BODYSIZE_NAME, _kVp, _mA, _mAs, Utility.Int32Dbnull(drAP["A_STT"], 0), Utility.Int32Dbnull(drAP["P_STT"], 0), 0, 0); Size originalSize = _Scheduled.Size; _Scheduled._OnClick += new ScheduledControl.OnClick(_ScheduledControl__OnClick); _Scheduled.ContextMenuStrip = ctx; _Scheduled._OnNewScheduleClick += new ScheduledControl.OnNewScheduleClick(_ScheduledControl__OnNewScheduleClick); _Scheduled._OnRejectScheduleClick += new ScheduledControl.OnRejectScheduleClick(_ScheduledControl__OnRejectScheduleClick); _Scheduled._OnDelScheduleClick += new ScheduledControl.OnDelScheduleClick(_ScheduledControl__OnDelScheduleClick); _Scheduled._OnNewScheduleDoubleClick += new ScheduledControl.OnNewScheduleDoubleClick(_ScheduledControl__OnNewScheduleDoubleClick); _Scheduled._OnRejectScheduleDoubleClick += new ScheduledControl.OnRejectScheduleDoubleClick(_ScheduledControl__OnRejectScheduleDoubleClick); _Scheduled._OnDelScheduleDoubleClick += new ScheduledControl.OnDelScheduleDoubleClick(_ScheduledControl__OnDelScheduleDoubleClick); _Scheduled._OnKeyDown += new ScheduledControl.OnKeyDown(_ScheduledControl__OnKeyDown); AutoAddNewSchedule(_Scheduled); //pnlScheduled.Controls.Add(_Scheduled); _Scheduled.Size = new Size(124, 71); if (_Scheduled != null) { //Nếu chưa có kết quả thì tự động chọn và scroll tới AutoScroll2NewSchedule(_Scheduled); //pnlScheduled.ScrollControlIntoView(_Scheduled); _Scheduled._AnatomyObject.PerformClick(); } } m_dtAcquisitionDataSource.Rows.Add(newdr); m_dtAcquisitionDataSource.AcceptChanges(); newdr = m_dtAcquisitionDataSource.NewRow(); } } if (!AcquisitionFromWL) { //string[] Img = Utility.sDbnull(currentStudyRow["Img"]).Split('/'); //currentStudyRow["Img"] = Img[0] + "/" + (Convert.ToInt64(Img[1]) + _newForm.arrProc.Count).ToString(); //currentStudyRow["Img1"] = currentStudyRow["Img"]; } //Update Procedure List to DB and Datasource string ProcedureList = GetProcedureList(); new RegDetailController().UpdateProcedureList(Convert.ToInt64(dr["REG_ID"]), ProcedureList); //Update Dataset DataRow[] drWL = m_dtWLDataSource.Select("Reg_ID=" + Convert.ToInt64(dr["REG_ID"])); DataRow[] drST = m_dtStudyListDataSource.Select("Reg_ID=" + Convert.ToInt64(dr["REG_ID"])); if (drWL.Length > 0) drWL[0]["ProcedureList"] = ProcedureList; if (drST.Length > 0) drST[0]["ProcedureList"] = ProcedureList; m_dtWLDataSource.AcceptChanges(); m_dtStudyListDataSource.AcceptChanges(); } } } catch (Exception ex) { AppLogger.LogAction.AddLog2List(lstFPD560, "Action: Lỗi khi tạo DV mới-->" + ex.Message); } finally { if (AutoSelectNotDone) { ScheduledControl _reObj = GetSelectedScheduled_NOTDONE(); if (_reObj != null) { //Nếu chưa có kết quả thì tự động _reObj._AnatomyObject.PerformClick(); } } } }
public RegDetailController(RegDetailInfor Infor) { this.Infor = Infor; }