/// <summary> /// US:838 /// gets clinics from MDWS and moves them to the checklist db /// </summary> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSClinics(out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //TODO: wire up target when I hear back from VA string strTarget = String.Empty; TaggedHospitalLocationArray thla = GetMDWSSOAPClient().getClinics(strTarget); if (thla == null || thla.fault != null) { //return new CMDWSStatus(thla.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the data to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferClinics(thla, out lCount); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// US:838 /// gets specialties from MDWS and moves them to the checklist db /// </summary> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSSpecialties(out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //get the specialties from MDWS TaggedText txtSpecialties = GetMDWSSOAPClient().getSpecialties(); if (txtSpecialties == null || txtSpecialties.fault != null) { //return new CMDWSStatus(txtSpecialties.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the data to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferSpecialties(txtSpecialties, out lCount); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// transfers users containing the specified search string /// </summary> /// <param name="strSearch"></param> /// <returns></returns> public CStatus GetMDWSUsers(string strSearch) { //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } UserArray ua = GetMDWSSOAPClient().cprsUserLookup(strSearch); if (ua == null || ua.fault != null) { //return CMDWSStatus(ua.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the patients to the checklist db long lCount = 0; CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferUserArray(ua, out lCount); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// get sites /// </summary> /// <param name="ra"></param> /// <returns></returns> public CStatus GetMDWSSites() { // CStatus status = IsMDWSValid(); // if (!status.Status) // { // return status; // } CStatus status = new CStatus(); //get the sites from MDWS RegionArray ra = GetMDWSSOAPClient().getVHA(); if (ra == null || ra.fault != null) { return(new CStatus(false, k_STATUS_CODE.Failed, "getVHA failed!")); } //transfer the patients to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferSites(ra); if (!status.Status) { return(status); } return(status); }
/// <summary> /// US:1945 US:852 US:1883 US:834 helper to process checklist items, called from multiple places /// </summary> /// <param name="conn"></param> /// <param name="data"></param> /// <param name="dsChecklistItems"></param> /// <returns></returns> public CStatus RefreshPatientCheckList(CDataConnection conn, CData data, DataSet dsChecklistItems) { CStatus status = new CStatus(); //this class is used to do all transfers //from MDWS to the VAPPCT database CMDWSTransfer xfer = new CMDWSTransfer(data); //2.loop over all items and process each one foreach (DataTable table in dsChecklistItems.Tables) { foreach (DataRow dr in table.Rows) { if (dr["item_type_id"] != null) { switch (Convert.ToInt32(dr["item_type_id"])) { case (int)k_ITEM_TYPE_ID.Collection: //WriteEvent(data, "Collection", "Collection"); break; case (int)k_ITEM_TYPE_ID.Laboratory: //WriteEvent(data, "Laboratory", "Laboratory"); status = ProcessLab(data, xfer, dr); if (!status.Status) { //write the start event to the event table WriteEvent(data, "ProcessLab", status.StatusComment); return(status); } break; case (int)k_ITEM_TYPE_ID.QuestionFreeText: //WriteEvent(data, "QuestionFreeText", "QuestionFreeText"); break; case (int)k_ITEM_TYPE_ID.QuestionSelection: //WriteEvent(data, "QuestionSelection", "QuestionSelection"); break; case (int)k_ITEM_TYPE_ID.NoteTitle: status = ProcessNoteTitle(data, xfer, dr); if (!status.Status) { //write the start event to the event table WriteEvent(data, "ProcessNoteTitle", status.StatusComment); return(status); } break; } } } } return(status); }
/// <summary> /// US:838 /// gets wards from MDWS and moves them to the checklist db /// </summary> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSWards(out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //todo: testing //////////////////////////////////////////////////////////////////////// //does not work crashes: TaggedMedicationArrays meds = GetMDWSSOAPClient().getAllMeds(); //does not work crashes: TaggedMedicationArrays meds = GetMDWSSOAPClient().getImoMeds(); //does not work crashes: TaggedMedicationArrays meds = GetMDWSSOAPClient().getIvMeds(); //does not work crashes: TaggedMedicationArrays meds = GetMDWSSOAPClient().getOtherMeds(); //does not work crashes: TaggedMedicationArrays meds = GetMDWSSOAPClient().getOutpatientMeds(); //does not work crashes: TaggedMedicationArrays meds = GetMDWSSOAPClient().getUnitDoseMeds(); //does not work crashes: TaggedAllergyArrays allergies = GetMDWSSOAPClient().getAllergies(); //TaggedPatientArray t = GetMDWSSOAPClient().getPatientsByClinic("64"); //tried for all clinics and get no patients back t = GetMDWSSOAPClient().getPatientsByClinic("133"); //triedTaggedTextArray ar = GetMDWSSOAPClient().getPastClinicVisitsReports("19990101", // "20120501", // 0); TaggedHospitalLocationArray thla = GetMDWSSOAPClient().getWards(); if (thla == null || thla.fault != null) { //return new CMDWSStatus(thla.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the data to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferWards(thla, out lCount); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// US:838 /// transfers patients by clinic to the checklist db /// </summary> /// <param name="lClinicID"></param> /// <param name="dtApptFrom"></param> /// <param name="dtApptTo"></param> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSClinicPatients( long lClinicID, DateTime dtApptFrom, DateTime dtApptTo, out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //get the wards from MDWS TaggedPatientArray tpa = GetMDWSSOAPClient().getPatientsByClinic(Convert.ToString(lClinicID)); if (tpa == null || tpa.fault != null) { //return new CMDWSStatus(tpa.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the patients to the checklist DB CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferPatientArray( string.Empty, 0, 0, 0, lClinicID, tpa, out lCount); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// US:840 /// login to MDWS and transfer user to the checklist db /// </summary> /// <param name="strUID"></param> /// <param name="strPWD"></param> /// <param name="lUserID"></param> /// <param name="mdwsSOAPClient"></param> /// <returns></returns> public CStatus MDWSLogin( string strUID, string strPWD, long lSiteID, out long lUserID, out EmrSvcSoapClient mdwsSOAPClient) { //status lUserID = 0; mdwsSOAPClient = null; //login to mdws UserTO toUser = null; CStatus status = Login( strUID, strPWD, lSiteID, out toUser, out mdwsSOAPClient); if (!status.Status) { return(status); } //transfer the user data to the checklist db if (status.StatusCode != k_STATUS_CODE.NothingToDo) { CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferUser(toUser, out lUserID); if (!status.Status) { mdwsSOAPClient.disconnect(); mdwsSOAPClient = null; return(status); } } //note: BaseMster.MDWSEmrSvcClient gets cached in session state //if the login was successful //if we get here we are logged in return(new CStatus()); }
/// <summary> /// US:866 gets MDWS security keys and transfers them to the database /// </summary> /// <param name="lUserID"></param> /// <param name="bTransfer"></param> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSSecurityKeys( long lUserID, bool bTransfer, out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //get the teams from MDWS //get the users security keys UserSecurityKeyArray usk = GetMDWSSOAPClient().getUserSecurityKeys(lUserID.ToString()); if (usk == null || usk.fault != null) { //return new CMDWSStatus(usk.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //in some cases we do not want to transfer the keys... if (bTransfer) { //transfer the patients to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferSecurityKeys( lUserID, usk, out lCount); if (!status.Status) { return(status); } } return(new CStatus()); }
/// <summary> /// US:838 /// tranfer MDWS patients that match criteria /// </summary> /// <param name="strMatchID"></param> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSMatchPatients(string strMatch, out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //get the teams from MDWS TaggedPatientArrays tpas = GetMDWSSOAPClient().match(strMatch); if (tpas == null || tpas.fault != null) { //return new CMDWSStatus(tpas.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } foreach (TaggedPatientArray tpa in tpas.arrays) { //transfer the patients to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferPatientArray( string.Empty, 0, 0, 0, 0, tpa, out lCount); if (!status.Status) { return(status); } } return(new CStatus()); }
/// <summary> /// US:838 /// retrieves a list of the users patients and transfers /// them to the checklist db /// </summary> /// <param name="lUserID"></param> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSUserPatients(long lUserID, out long lCount) { lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //get the patients from MDWS string strDUZ = Convert.ToString(lUserID); TaggedPatientArray tpa = GetMDWSSOAPClient().getPatientsByProvider(strDUZ); if (tpa == null || tpa.fault != null) { //return new CMDWSStatus(tpa.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the patients to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferPatientArray( strDUZ, 0, 0, 0, 0, tpa, out lCount); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// US:838 /// transfers patients by specialty to the checklist db /// </summary> /// <param name="lSpecialtyID"></param> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSSpecialtyPatients(long lSpecialtyID, out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //get the teams from MDWS TaggedPatientArray tpa = GetMDWSSOAPClient().getPatientsBySpecialty(lSpecialtyID.ToString()); if (tpa == null || tpa.fault != null) { //return new CMDWSStatus(tpa.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the patients to the checklist db CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferPatientArray( string.Empty, 0, lSpecialtyID, 0, 0, tpa, out lCount); if (!status.Status) { return(status); } return(new CStatus()); }
/// <summary> /// US:1945 US:834 helper to transfer matching note titles /// </summary> /// <param name="data"></param> /// <param name="xfer"></param> /// <param name="dr"></param> /// <returns></returns> public CStatus ProcessNoteTitle(CData data, CMDWSTransfer xfer, DataRow dr) { //check the data row if (dr == null) { WriteEvent(data, "ERROR_XFER_NOTETITLE", "DataRow is null"); return(new CStatus(false, k_STATUS_CODE.Failed, "ERROR_XFER_NOTETITLE: DataRow is null")); } //make sure we have data to process if (dr["patient_id"] == null || dr["map_id"] == null || dr["item_id"] == null || dr["lookback_time"] == null) { return(new CStatus()); } //transfer Patient notes CStatus status = xfer.TransferPatientNotes( dr["patient_id"].ToString(), dr["map_id"].ToString(), Convert.ToInt64(dr["item_id"]), Convert.ToInt32(dr["lookback_time"])); if (!status.Status) { WriteEvent( data, "ERROR_XFER_NOTETITLE", "patient:" + dr["patient_id"].ToString() + " note:" + dr["map_id"].ToString()); return(status); } return(status); }
/// <summary> /// US:1883 US:834 refresh multipatient view /// </summary> /// <param name="plistPatChecklistIDs"></param> /// <returns></returns> public CStatus RefreshMultiPatientChecklists(CDataConnection conn, CData data, DateTime dtFrom, DateTime dtTo, long lChecklistID, long lServiceID, long lChecklistStatus) { //this class is used to do all transfers //from MDWS to the VAPPCT database CMDWSTransfer xfer = new CMDWSTransfer(data); //get the multi patient checklist ds, uses the same filters // as the website form does DataSet dsMulti = null; CPatientData pd = new CPatientData(data); CStatus status = pd.GetMultiPatientSearchDS( dtFrom, dtTo, lChecklistID, lChecklistStatus, lServiceID, out dsMulti); if (!status.Status) { //write the event to the event table WriteEvent(data, "GetMultiPatientSearchDS", status.StatusComment); return(status); } foreach (DataTable table in dsMulti.Tables) { foreach (DataRow dr in table.Rows) { //checklist ID long lPatChecklistID = Convert.ToInt64(dr["pat_cl_id"].ToString()); //get the items for this pat checklist id DataSet dsChecklistItems = null; CVAPPCTCommData commData = new CVAPPCTCommData(data); status = commData.GetPatChecklistItemDS(lPatChecklistID, out dsChecklistItems); if (!status.Status) { //write the event to the event table WriteEvent(data, "GetPatChecklistItemDS", status.StatusComment); return(status); } //refresh the checklist items status = RefreshPatientCheckList( conn, data, dsChecklistItems); if (!status.Status) { //write the event to the event table WriteEvent(data, "RefreshPatientCheckList", status.StatusComment); return(status); } //refresh the checklist collection items DataSet dsCLCollectionItems = null; status = commData.GetPatientCLCollectionItemDS(lPatChecklistID, out dsCLCollectionItems); if (!status.Status) { //write the event to the event table WriteEvent(data, "GetPatientCLCollectionItemDS", status.StatusComment); return(status); } //refresh the checklist items status = RefreshPatientCheckList( conn, data, dsCLCollectionItems); if (!status.Status) { //write the event to the event table WriteEvent(data, "RefreshPatientCheckList", status.StatusComment); return(status); } } } return(status); }
/// <summary> /// US:1945 US:852 US:1883 US:834 helper to process checklist items, called from multiple places /// </summary> /// <param name="conn"></param> /// <param name="data"></param> /// <param name="dsChecklistItems"></param> /// <returns></returns> public CStatus CommRefreshPatientCheckList(DataSet dsChecklistItems) { CStatus status = new CStatus(); //get a connection to the vappct database and MDWS CData data = null; EmrSvcSoapClient mdwsSOAPClient = null; CCommDBConn conn = null; status = GetConnections( out conn, out data, out mdwsSOAPClient); if (!status.Status) { conn.Close(); mdwsSOAPClient.disconnect(); WriteEvent(data, "GetConnections", status.StatusComment); return(status); } //this class is used to do all transfers //from MDWS to the VAPPCT database CMDWSTransfer xfer = new CMDWSTransfer(data); //if we do too many items at once the connection to MDWS will //timeout. This is only an issue when running from communicator //because there can be a large number of items. // //current item we are processing int nCount = 0; //number of items to process before we re-connect int nBatch = 50; //2.loop over all items and process each one foreach (DataTable table in dsChecklistItems.Tables) { foreach (DataRow dr in table.Rows) { nCount++; //if ncount is >= batch then reconnect and reset if (nCount >= nBatch) { //reset the data data = null; //close the current mdws connection mdwsSOAPClient.disconnect(); mdwsSOAPClient = null; //close the connection to the database conn.Close(); //conn = null; //get a connection to the vappct database and MDWS status = GetConnections( out conn, out data, out mdwsSOAPClient); if (!status.Status) { conn.Close(); mdwsSOAPClient.disconnect(); WriteEvent(data, "GetConnections", status.StatusComment); return(status); } //reset the transfer object to use the new connection xfer = null; xfer = new CMDWSTransfer(data); //reset the record count nCount = 1; } //process the item if (dr["item_type_id"] != null) { switch (Convert.ToInt32(dr["item_type_id"])) { case (int)k_ITEM_TYPE_ID.Collection: //WriteEvent(data, "Collection", "Collection"); break; case (int)k_ITEM_TYPE_ID.Laboratory: //WriteEvent(data, "Laboratory", "Laboratory"); status = ProcessLab(data, xfer, dr); if (!status.Status) { //write the start event to the event table WriteEvent(data, "ProcessLab", status.StatusComment); //dont return or other records will not update return status; } break; case (int)k_ITEM_TYPE_ID.QuestionFreeText: //WriteEvent(data, "QuestionFreeText", "QuestionFreeText"); break; case (int)k_ITEM_TYPE_ID.QuestionSelection: //WriteEvent(data, "QuestionSelection", "QuestionSelection"); break; case (int)k_ITEM_TYPE_ID.NoteTitle: status = ProcessNoteTitle(data, xfer, dr); if (!status.Status) { //write the start event to the event table WriteEvent(data, "ProcessNoteTitle", status.StatusComment); //dont return or other records will not process return status; } break; } } } } return(status); }
/// <summary> /// handle page load events /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { ucTemporalState.BaseMstr = Master; ucOutcomeState.BaseMstr = Master; ucDecisionState.BaseMstr = Master; ucItemGroup.BaseMstr = Master; ucService.BaseMstr = Master; //load data on the 1st visit to the form if (!IsPostBack) { Master.PageTitle = "Variable Editor"; //load all the gridviews with data CStatus status = ucTemporalState.LoadControl(k_EDIT_MODE.INITIALIZE); if (!status.Status) { Master.ShowStatusInfo(status); } status = ucOutcomeState.LoadControl(k_EDIT_MODE.INITIALIZE); if (!status.Status) { Master.ShowStatusInfo(status); } status = ucDecisionState.LoadControl(k_EDIT_MODE.INITIALIZE); if (!status.Status) { Master.ShowStatusInfo(status); } status = ucItemGroup.LoadControl(k_EDIT_MODE.INITIALIZE); if (!status.Status) { Master.ShowStatusInfo(status); } status = ucService.LoadControl(k_EDIT_MODE.INITIALIZE); if (!status.Status) { Master.ShowStatusInfo(status); } } //todo: testing... //pulls out 44 at a time... //CMDWSOps ops = new CMDWSOps(Master.BaseData); //ops.GetMDWSLabTests("C1 ESTERASE INHIBIT."); //ops.GetMDWSLabTests("CHEMISTRY FLUIDS"); //CStatus status = new CStatus(); //DataSet dsLabTests = null; //CLabData ld = new CLabData(Master.BaseData); //status = ld.GetLabTestDS("CHEMISTRY FLUIDS", out dsLabTests); //CMDWSTransfer t = new CMDWSTransfer(Master.BaseData); //t.LoopPatientRads(); //t.LoopPatientLabs(); //CMDWSOps ops = new CMDWSOps(Master.BaseData); //string strRPCs = String.Empty; //ops.GetRPCs(out strRPCs); CMDWSTransfer xfer = new CMDWSTransfer(Master.BaseData); //xfer.LoopPatientRads(); //xfer.LoopPatientMeds(); //xfer.LoopPatientICD(); //xfer.LoopOrders(); }
/// <summary> /// US:1945 US:1880 US:885 /// gets note titles from MDWS and transfers them to the db /// </summary> /// <param name="lCount"></param> /// <returns></returns> public CStatus GetMDWSNoteTitles(out long lCount) { //status lCount = 0; //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } //per Joel: You pass text to those calls corresponding to the //name of the clinic/not title where you want to begin searching. //So, say I wanted to get note titles for comp and pen notes, //I would enter “comp” or something like that. //The list appears longer because CPRS is automagically //executing the same call over and over transparently to you //as you scroll through the names. By default, those RPCs //usually return 44 records per search starting with the name //of the argument you supplied. // //get the first batch of notes TaggedTextArray tta = GetMDWSSOAPClient().getNoteTitles(string.Empty, "1"); //return if tta is null if (tta == null || tta.fault != null) { return(new CStatus(false, k_STATUS_CODE.Failed, "Failed to retrieve note titles!")); } //loop and continue to get data until we have them all string strCurrentTarget = String.Empty; string strPreviousTarget = String.Empty; while (tta != null && tta.fault == null) { //get the next target for the search //if the current target = the previous target we are done //processing the array GetNextNoteTitleTarget(tta, out strCurrentTarget); if (strCurrentTarget == strPreviousTarget) { break; } //transfer this block of note titles long lCnt = 0; CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferNoteTitles(tta, out lCnt); if (!status.Status) { return(status); } lCount += lCnt; //make the call again with the target and direction = "1" = forward tta = GetMDWSSOAPClient().getNoteTitles(strCurrentTarget, "1"); //set the previous target = the current target strPreviousTarget = strCurrentTarget; } return(new CStatus()); }
/// <summary> /// US:852 /// transfers static lab test information from mdws to the vappct database /// </summary> /// <param name="strSearch"></param> /// <returns></returns> public CStatus GetMDWSLabTests(string strSearch) { if (String.IsNullOrEmpty(strSearch)) { return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //check to make sure the MDWS connection is valid CStatus status = IsMDWSValid(); if (!status.Status) { return(status); } string strNextSearch = strSearch.Substring(0, 1).ToUpper(); string strSrch = strNextSearch; while (true) { TaggedLabTestArrays la = GetMDWSSOAPClient().getLabTests(strSrch); if (la == null || la.fault != null) { //return new CMDWSStatus(la.fault); return(new CStatus(false, k_STATUS_CODE.Failed, "TODO")); } //transfer the patients to the checklist db long lCount = 0; CMDWSTransfer transfer = new CMDWSTransfer(this); status = transfer.TransferLabTestArray( la, out lCount, out strNextSearch); if (!status.Status) { return(status); } /* * this was not working? * if (String.IsNullOrEmpty(strNextSearch) || strNextSearch.Substring(0, 1).ToUpper() == strSearch.Substring(0, 1).ToUpper()) ||{ || break; ||}*/ if (String.IsNullOrEmpty(strNextSearch)) { break; } if (strNextSearch.Substring(0, 1).ToUpper() != strSearch.Substring(0, 1).ToUpper()) { break; } strSrch = strNextSearch; } return(status); }