コード例 #1
0
    /// <summary>
    /// US:1883 US:834 refresh a patient checklist
    /// </summary>
    /// <param name="strPatientID"></param>
    /// <param name="strPatChecklistID"></param>
    /// <returns></returns>
    public CStatus RefreshPatientCheckList(CDataConnection conn,
                                           CData data,
                                           string strPatientID,
                                           long lPatChecklistID)
    {
        //todo: check conn and data before continuing

        //get all the items for this patient checklist
        DataSet         dsChecklistItems = null;
        CVAPPCTCommData commData         = new CVAPPCTCommData(data);
        CStatus         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);
    }
コード例 #2
0
    /// <summary>
    /// US:834 writes an event to the communicator event table
    /// </summary>
    /// <param name="strEventName"></param>
    /// <param name="strEventDetails"></param>
    public void WriteEvent(CData data,
                           string strEventName,
                           string strEventDetails)
    {
        //comm data class
        CVAPPCTCommData commData = new CVAPPCTCommData(data);

        CStatus status = new CStatus();

        //com data object for logging etc...
        status = commData.SaveCommEvent(strEventName, strEventDetails);
    }
コード例 #3
0
    /// <summary>
    /// US:1883 US:834 loops through the checklist and moves data from MDWS to
    /// the VAPPCT database
    /// </summary>
    /// <returns></returns>
    public CStatus ProcessOpenChecklistItems()
    {
        //get a connection to the vappct database and MDWS
        CData            data           = null;
        EmrSvcSoapClient mdwsSOAPClient = null;
        CCommDBConn      conn           = null;
        CStatus          status         = GetConnections(
            out conn,
            out data,
            out mdwsSOAPClient);

        if (!status.Status)
        {
            conn.Close();
            mdwsSOAPClient.disconnect();

            WriteEvent(data, "GetConnections", status.StatusComment);
            return(status);
        }

        //-----------------------------------------------------
        //do the work TODO: threading will come later
        //-----------------------------------------------------

        //1. get all of the open checklists
        DataSet         dsChecklistItems = null;
        CVAPPCTCommData commData         = new CVAPPCTCommData(data);

        status = commData.GetOpenPatChecklistItemDS(out dsChecklistItems);
        if (!status.Status)
        {
            conn.Close();
            mdwsSOAPClient.disconnect();

            //write the event to the event table
            WriteEvent(data, "GetOpenPatChecklistItemDS", status.StatusComment);
            return(status);
        }

        //refresh the checklist items
        //status = RefreshPatientCheckList(
        //    conn,
        //    data,
        //    dsChecklistItems);
        status = CommRefreshPatientCheckList(dsChecklistItems);
        if (!status.Status)
        {
            conn.Close();
            mdwsSOAPClient.disconnect();

            //write the event to the event table
            WriteEvent(data, "RefreshPatientCheckList", status.StatusComment);
            return(status);
        }

        //it could have taken a really long time for the first set
        //to process, so we reset the connections here before moving
        //to the collection items.

        //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);
        }

        CVAPPCTCommData commData2 = new CVAPPCTCommData(data);

        //refresh the checklist collection items
        DataSet dsCLCollectionItems = null;

        status = commData2.GetOpenPatCLCollectionItemDS(out dsCLCollectionItems);
        if (!status.Status)
        {
            conn.Close();
            mdwsSOAPClient.disconnect();

            //write the event to the event table
            WriteEvent(data, "GetOpenPatCLCollectionItemDS", status.StatusComment);
            return(status);
        }

        //refresh the checklist items
        //status = RefreshPatientCheckList(
        //    conn,
        //    data,
        //    dsCLCollectionItems);
        status = CommRefreshPatientCheckList(dsCLCollectionItems);
        if (!status.Status)
        {
            conn.Close();
            mdwsSOAPClient.disconnect();

            //write the event to the event table
            WriteEvent(data, "RefreshPatientCheckList", status.StatusComment);
            return(status);
        }

        //-----------------------------------------------------
        //end of work
        //-----------------------------------------------------
        //cleanup: close the database connection, disconnect from MDWS
        conn.Close();
        mdwsSOAPClient.disconnect();

        return(status);
    }
コード例 #4
0
    /// <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);
    }
コード例 #5
0
    /// <summary>
    /// do the actual work of assigning the checklist
    /// </summary>
    /// <param name="state"></param>
    public void DoWork(Object state)
    {
        //thread hashcount work
        lock (HashCount)
        {
            if (!HashCount.ContainsKey(Thread.CurrentThread.GetHashCode()))
            {
                HashCount.Add(Thread.CurrentThread.GetHashCode(), 0);
            }

            HashCount[Thread.CurrentThread.GetHashCode()] = ((int)HashCount[Thread.CurrentThread.GetHashCode()]) + 1;
        }

        //create a new connection for the thread
        CDataDBConn conn = new CDataDBConn();

        conn.Connect();
        CData data = new CData(conn,
                               this.ClientIP,
                               this.UserID,
                               this.SessionID,
                               this.WebSession,
                               this.MDWSTransfer);
        //do real work here

        //get the items for this pat checklist id
        CStatus         status           = new CStatus();
        DataSet         dsChecklistItems = null;
        CVAPPCTCommData commData         = new CVAPPCTCommData(data);

        status = commData.GetPatChecklistItemDS(PatientChecklistID,
                                                out dsChecklistItems);
        if (!status.Status)
        {
            //todo
        }
        else
        {
            CCommunicator comm = new CCommunicator();

            //refresh the checklist items
            status = comm.RefreshPatientCheckList(conn,
                                                  data,
                                                  dsChecklistItems);
            if (!status.Status)
            {
                //todo:
            }
            else
            {
                //refresh the checklist collection items
                DataSet dsCLCollectionItems = null;
                status = commData.GetPatientCLCollectionItemDS(PatientChecklistID,
                                                               out dsCLCollectionItems);
                if (!status.Status)
                {
                    //todo:
                }
                else
                {
                    //refresh the checklist items
                    status = comm.RefreshPatientCheckList(conn,
                                                          data,
                                                          dsCLCollectionItems);
                    if (!status.Status)
                    {
                        //todo
                    }
                }
            }
        }

        //cleanup the database connection
        conn.Close();

        //signals we are done.
        Interlocked.Increment(ref ThreadCount);
        if (ThreadCount == ThreadMax)
        {
            if (eventX != null)
            {
                eventX.Set();
                ThreadCount = 0;
                ThreadMax   = 0;
            }
        }
    }
コード例 #6
0
ファイル: CCommDBConn.cs プロジェクト: whitten/CheckListTool
    /// <summary>
    /// US:834 Connect to the database using info from the
    /// app.config file will also load a CData object for use
    /// by other data classes and setup the connectsion to MDWS and
    /// return a mdwsSOAPClient for accessing MDWD methods
    /// </summary>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus Connect(out CData data,
                           out EmrSvcSoapClient mdwsSOAPClient)
    {
        data           = null;
        mdwsSOAPClient = null;

        //initialize parameters
        string strConnString = String.Empty;
        bool   bAudit        = false;

        //get the connection info from the web.config
        CStatus status = new CStatus();

        status = GetConnectionInfo(out strConnString, out bAudit);
        if (!status.Status)
        {
            return(status);
        }

        //Connect to the db, if successful caller can use the
        //CDataConnection::Conn property for access to the DB connection
        status = Connect(strConnString, bAudit);
        if (!status.Status)
        {
            //todo handle error
            return(status);
        }

        //create a new base data object
        //todo: more later
        //
        //get the ipaddress
        string      strIPAddress = String.Empty;
        string      strHost      = System.Net.Dns.GetHostName();
        IPHostEntry host;

        host = Dns.GetHostEntry(strHost);
        foreach (IPAddress ip in host.AddressList)
        {
            strIPAddress = ip.ToString();
        }

        //build the base data item used by data classes
        string strNow = CDataUtils.GetDateTimeAsString(DateTime.Now);

        data = new CData(this,
                         strIPAddress,
                         0,
                         "VAPPCTCOMM_" + strNow,
                         null,
                         true);

        //comm data class
        CVAPPCTCommData commData = new CVAPPCTCommData(data);

        //login to MDWS
        long     lUserID = 0;
        CMDWSOps ops     = new CMDWSOps(data);

        //uid and pwd need come from config file:
        //TODO: they need to be encrypted
        status = ops.MDWSLogin(ConfigurationSettings.AppSettings["MDWSEmrSvcUID"],
                               ConfigurationSettings.AppSettings["MDWSEmrSvcPWD"],
                               CDataUtils.ToLong(ConfigurationSettings.AppSettings["MDWSEmrSvcSiteList"]),
                               out lUserID,
                               out mdwsSOAPClient);
        if (!status.Status)
        {
            commData.SaveCommEvent("MDWSLogin_FAILED",
                                   status.StatusComment);
            return(status);
        }

        //set the user id on the CData object
        data.UserID = lUserID;

        //create the session so that we can call stored proc
        CUserData ud             = new CUserData(data);
        string    strFXSessionID = String.Empty;

        status = ud.CreateFXSession(out strFXSessionID);
        if (!status.Status)
        {
            commData.SaveCommEvent("MDWSSessionCreate_FAILED",
                                   status.StatusComment);
            return(status);
        }

        return(status);
    }