Esempio n. 1
0
        public static void SetCollection()
        {
            string commandText = "select ph.PhysicianId, ph.DisplayName, c.ClientName, c.ClientId " +
                                 "from tblClient c " +
                                 "join tblPhysicianClient pc on c.ClientId = pc.ClientId " +
                                 "join tblPhysician ph on pc.PhysicianId = ph.PhysicianId " +
                                 "where c.ClientId in (141, 34, 104, 179, 660, 1556, 225, 1763, 1764, 1160, 1541, 587) order by c.ClientName, ph.DisplayName";

            /*
             * string commandText = "select ph.PhysicianId, ph.DisplayName, c.ClientName, c.ClientId " +
             *  "from tblClient c " +
             *  "join tblPhysicianClient pc on c.ClientId = pc.ClientId " +
             *  "join tblPhysician ph on pc.PhysicianId = ph.PhysicianId " +
             *  "where c.ClientId in (141, 34, 104, 179, 660, 1556, 225, 1763, 1764) " +
             *  "or (pc.ClientId = 558 and pc.PhysicianId in (select physicianId from tblPhysicianClient where clientId = 54)) " +
             *  "order by c.ClientName, ph.DisplayName;";
             */

            JObject   request   = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(request);

            PhysicianClientCollection result = new PhysicianClientCollection();

            Build(apiResult, result);
            PhysicianClientCollection.Instance = result;
        }
        public static MethodResult GetByPatientName(PatientName patientName)
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            ClientOrderCollection clientOrderCollection = new ClientOrderCollection();
            string commandText = $"Select * from tblClientOrder where ClientId in ({clientIdList}) and PanelSetId = 400 ";

            if (patientName.LastName != null && patientName.FirstName != null)
            {
                commandText = commandText + "and PLastName like '" + patientName.LastName + "%' and pFirstName like '" + patientName.FirstName + "%' order by OrderDate desc";
            }

            if (patientName.LastName != null && patientName.FirstName == null)
            {
                commandText = commandText + "and PLastName like '" + patientName.LastName + "%' order by OrderDate desc;";
            }

            if (patientName.LastName != null)
            {
                JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
                APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);
                ClientOrderCollection.Build(apiResult, clientOrderCollection);

                MethodResult methodResult = new MethodResult();
                methodResult.AddResult(apiResult.JSONResult, clientOrderCollection);
                return(methodResult);
            }
            else
            {
                MethodResult methodResult = new MethodResult();
                methodResult.Success = false;
                methodResult.Messages.Add("Invalid patient name.");
                return(methodResult);
            }
        }
        public static ClientOrderCollection GetNotAccessionedOrders(string clientIdList)
        {
            string                commandText           = $"Select * from tblClientOrder where ClientId in ({clientIdList}) and PanelSetId = 400 and IsMasterOrder = 0 and Accessioned = 0 order by OrderTime desc limit 1000;";
            JObject               request               = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult             apiResult             = APIRequestHelper.SubmitAPIRequestMessage(request);
            ClientOrderCollection clientOrderCollection = new ClientOrderCollection();

            Build(apiResult, clientOrderCollection);
            return(clientOrderCollection);
        }
        public static PanelSetOrderCPTCodeBillCollection GetChargesByReportNo(string reportNo)
        {
            string    commandText = $"Select * from tblPanelSetOrderCPTCodeBill where reportNo = '{reportNo}';";
            JObject   request     = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(request);
            PanelSetOrderCPTCodeBillCollection panelSetOrderCPTCodeBillCollection = new PanelSetOrderCPTCodeBillCollection();

            Build(apiResult, panelSetOrderCPTCodeBillCollection);
            return(panelSetOrderCPTCodeBillCollection);
        }
        public static void SetCollection(string clientIdList)
        {
            string    commandText = $"Select * from tblPhysician p where active = 1 and exists(select null from tblPhysicianClient where physicianId = p.PhysicianId and clientId in ({clientIdList})) order by LastName, FirstName;";
            JObject   request     = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(request);

            PhysicianCollection result = new PhysicianCollection();

            Build(apiResult, result);
            PhysicianCollection.Instance = result;
        }
Esempio n. 6
0
        public static Client GetByClientId(int clientId)
        {
            string    commandText = $"Select * from tblClient where ClientId = {clientId.ToString()};";
            JObject   request     = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(request);

            Client client = new Client();

            client.FromSql((JObject)apiResult.JSONResult["result"]["results"][0]);

            return(client);
        }
 private void HyperLinkSendTestEmail_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(this.m_ClientOrderClone.EmailAddress) == false)
     {
         JObject   jsonRequest = APIRequestHelper.GetSendEmailMessage(this.m_ClientOrderClone.EmailAddress, "A SARS-CoV-2 test has been ordered with Yellowstone Pathology Institute.", "This email is to confirm that a SARS-CoV-2 test has been ordered with Yellowstone Pathology Institute.  You will receive an email at this address when your result is complete.");
         APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);
         MessageBox.Show($"An email was sent to {this.m_ClientOrderClone.EmailAddress}");
     }
     else
     {
         MessageBox.Show("You must enter an email address to use this function.");
     }
 }
 private void HyperLinkSendTestText_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(this.m_ClientOrderClone.PPhone) == false)
     {
         JObject   jsonRequest = APIRequestHelper.GetSendTextMessage(this.m_ClientOrderClone.PPhone, "This text is to confirm that a SARS-CoV-2 test has been ordered with Yellowstone Pathology Institute.  You will receive a text at this number when your result is complete.");
         APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);
         MessageBox.Show($"A text was sent to {this.m_ClientOrderClone.PPhone}");
     }
     else
     {
         MessageBox.Show("You must enter a phone number to use this function.");
     }
 }
Esempio n. 9
0
        public APIResult Save()
        {
            StringBuilder commandText = new StringBuilder();

            commandText.Append(SQLHelper.GetSaveCommandText(typeof(PanelSetOrderCPTCodeBill), this, this.m_RowOperationType));

            //string xx = commandText.ToString();
            JObject   apiRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText.ToString());
            APIResult apiResult  = APIRequestHelper.SubmitAPIRequestMessage(apiRequest);

            this.m_RowOperationType = RowOperationTypeEnum.Update;
            return(apiResult);
        }
Esempio n. 10
0
        private void DoAuthenticateUser()
        {
            if (string.IsNullOrEmpty(this.PasswordBoxPassword.Password) == false &&
                string.IsNullOrEmpty(this.m_AuthenticatedUser.Password) == false &&
                string.IsNullOrEmpty(this.m_AuthenticatedUser.AuthenticatorToken) == false)
            {
                JObject   apiRequest  = APIRequestHelper.GetTokenMessage(this.m_AuthenticatedUser.UserName, this.PasswordBoxPassword.Password, this.m_AuthenticatedUser.AuthenticatorToken);
                APIResult apiResponse = APIRequestHelper.SubmitAPIRequestMessage(apiRequest);
                if (Convert.ToBoolean(apiResponse.JSONResult["result"]["isAuthenticated"].ToString()) == true)
                {
                    string tkn = apiResponse.JSONResult["result"]["token"].ToString();

                    this.m_AuthenticatedUser.WebServiceAccount       = (JObject)apiResponse.JSONResult["result"]["webServiceAccount"];
                    this.m_AuthenticatedUser.WebServiceAccountClient = (JArray)apiResponse.JSONResult["result"]["webServiceAccountClient"];
                    this.m_AuthenticatedUser.ClientCollection        = ClientCollection.Build((JArray)apiResponse.JSONResult["result"]["clientsAllowed"]);

                    JwtSecurityToken token = new JwtSecurityToken(tkn);
                    this.m_AuthenticatedUser.IsAuthenticated = true;
                    this.m_AuthenticatedUser.Token           = token;

                    if (apiResponse.JSONResult["result"]["clientGroupClient"] != null)
                    {
                        JArray clientGroups = (JArray)apiResponse.JSONResult["result"]["clientGroupClient"];
                        if (clientGroups.Count > 0)
                        {
                            this.m_AuthenticatedUser.ClientGroupId = apiResponse.JSONResult["result"]["clientGroupClient"][0]["ClientGroupId"].ToString();
                        }
                        else
                        {
                            this.m_AuthenticatedUser.ClientGroupId = "0";
                        }
                    }

                    LocalSettings.Instance.UpdateUserNamePassword(m_AuthenticatedUser);
                    LocalSettings.Instance.Serialize();

                    PhysicianCollection.SetCollection(this.m_AuthenticatedUser.GetSQLClientIdInList());
                    PhysicianClientCollection.SetCollection();
                    this.Close();
                }
                else
                {
                    this.m_AuthenticatedUser.IsAuthenticated = true;
                    MessageBox.Show("The Authenticator Token provided is not valid.");
                }
            }
            else
            {
                MessageBox.Show("The username, password and authenticator code cannot be blank.");
            }
        }
        public static ClientOrder GetByClientOrderId(string clientOrderId)
        {
            string commandText = $"Select * from tblClientOrder where ClientOrderId = '{clientOrderId}';";

            commandText += $"Select * from tblClientOrderDetail where ClientOrderId = '{clientOrderId}';";
            JObject     request     = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult   apiResult   = APIRequestHelper.SubmitAPIRequestMessage(request);
            string      xx          = apiResult.JSONResult.ToString();
            ClientOrder clientOrder = new ClientOrder();

            clientOrder.FromSql((JObject)apiResult.JSONResult["result"]["results"][0][0]);
            clientOrder.ClientOrderDetailCollection.FromSql((JArray)apiResult.JSONResult["result"]["results"][1]);
            return(clientOrder);
        }
Esempio n. 12
0
        public APIResult Save()
        {
            StringBuilder commandText = new StringBuilder();

            commandText.Append(SQLHelper.GetSaveCommandText(typeof(ClientOrder), this, this.m_RowOperationType));
            commandText.Append(this.m_ClientOrderDetailCollection.GetSQLSaveCommands());

            string    xx         = commandText.ToString();
            JObject   apiRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText.ToString());
            APIResult apiResult  = APIRequestHelper.SubmitAPIRequestMessage(apiRequest);

            this.m_RowOperationType = RowOperationTypeEnum.Update;
            return(apiResult);
        }
        public static MethodResult GetAll()
        {
            string    commandText = "Select * from country_code order by name;";
            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            CountryCodeCollection clientCollection = new CountryCodeCollection();

            Build(apiResult.JSONResult, clientCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, clientCollection);
            return(methodResult);
        }
Esempio n. 14
0
        public APIResult Delete()
        {
            StringBuilder commandText = new StringBuilder();

            if (this.m_ClientOrderDetailCollection.Count > 0)
            {
                commandText.Append($"delete from tblClientOrderDetail where clientOrderId = '{this.ClientOrderId}';");
            }

            commandText.Append($"delete from tblClientOrder where clientOrderId = '{this.ClientOrderId}';");
            JObject   apiRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText.ToString());
            APIResult apiResult  = APIRequestHelper.SubmitAPIRequestMessage(apiRequest);

            this.m_RowOperationType = RowOperationTypeEnum.Delete;
            return(apiResult);
        }
Esempio n. 15
0
        private void MenuItemAcknowledge_Click(object sender, RoutedEventArgs e)
        {
            if (this.ListViewReportDistributionLog.SelectedItems.Count > 0)
            {
                JArray idList = new JArray();
                foreach (DistributionLog distributionLog in this.ListViewReportDistributionLog.SelectedItems)
                {
                    idList.Add(distributionLog.TestOrderReportDistributionId);
                }

                JObject   jsonRequest = APIRequestHelper.GetAcknowledgeDistributionsMessage(idList);
                APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

                MethodResult methodResult = DistributionLogCollection.GetByNotAcknowledged();
                if (methodResult.Success == true)
                {
                    this.m_DistributionLog = (DistributionLogCollection)methodResult.Result;
                    this.NotifyPropertyChanged(string.Empty);
                }
            }
        }
Esempio n. 16
0
        private void HyperLinkGetQRCode_Click(object sender, RoutedEventArgs e)
        {
            this.m_LocalSettings.Password = this.PasswordBoxPassword.Password;
            JObject   apiRequest  = APIRequestHelper.GetQRCodeMessage(this.m_LocalSettings.UserName, this.m_LocalSettings.Password);
            APIResult apiResponse = APIRequestHelper.SubmitAPIRequestMessage(apiRequest);

            bool isAuthenticated = Convert.ToBoolean(apiResponse.JSONResult["result"]["isAuthenticated"].ToString());

            if (isAuthenticated == true)
            {
                string base64String = apiResponse.JSONResult["result"]["qrCodeImage"].ToString().Replace("data:image/png;base64,", string.Empty);
                this.m_LocalSettings.QRCodeImage = base64String;
                this.m_LocalSettings.Serialize();

                this.LoadQRCodeImage(base64String);
            }
            else
            {
                MessageBox.Show("We were unable to find a match for that Username and Password combination.");
            }
        }
        public static MethodResult GetByPatientName(PatientName patientName)
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            BillingLogCollection billingLogCollection = new BillingLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblAccessionOrder ao ";
            commandText += "join tblPanelSetOrder pso on ao.MasterAccessionNo = pso.MasterAccessionNo ";
            commandText += "join tblPanelSetOrderCPTCodeBill psoc on pso.ReportNo = psoc.ReportNo ";
            commandText += "where ao.ClientId in (" + clientIdList + ") ";

            if (patientName.LastName != null && patientName.FirstName != null)
            {
                commandText = commandText + "and PLastName like '" + patientName.LastName + "%' and pFirstName like '" + patientName.FirstName + "%' order by ao.AccessionDate desc";
            }

            if (patientName.LastName != null && patientName.FirstName == null)
            {
                commandText = $"{commandText} and PLastName like '{patientName.LastName}%' order by ao.AccessionDate desc;";
            }

            if (patientName.LastName != null)
            {
                JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
                APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);
                BillingLogCollection.Build(apiResult.JSONResult, billingLogCollection);

                MethodResult methodResult = new MethodResult();
                methodResult.AddResult(apiResult.JSONResult, billingLogCollection);
                return(methodResult);
            }
            else
            {
                MethodResult methodResult = new MethodResult();
                methodResult.Success = false;
                methodResult.Messages.Add("Invalid patient name.");
                return(methodResult);
            }
        }
Esempio n. 18
0
        private void ListViewReportDistributionLog_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (this.ListViewReportDistributionLog.SelectedItems.Count != 0)
            {
                DistributionLog distributionLog = (DistributionLog)this.ListViewReportDistributionLog.SelectedItem;
                string          fileName        = distributionLog.GetXPSFilePath();

                JObject   jsonRequest = APIRequestHelper.GetCaseDocumentMessage(fileName);
                APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

                if (apiResult.Status != "ERROR")
                {
                    int    count  = apiResult.JSONResult["result"]["message"]["data"].Count();
                    byte[] buffer = new byte[count];
                    for (int i = 0; i < count; i++)
                    {
                        buffer[i] = (byte)Convert.ToInt32(apiResult.JSONResult["result"]["message"]["data"][i].ToString());
                    }

                    if (this.m_CurrentPackageUri != null)
                    {
                        PackageStore.RemovePackage(this.m_CurrentPackageUri);
                    }
                    this.m_CurrentPackageUri = new Uri("memorystream://20-1234.S");

                    MemoryStream memoryStream = new MemoryStream();
                    memoryStream.Write(buffer, 0, buffer.Length);

                    Package package = Package.Open(memoryStream);
                    PackageStore.AddPackage(this.m_CurrentPackageUri, package);
                    XpsDocument           document = new XpsDocument(package, CompressionOption.Maximum, this.m_CurrentPackageUri.ToString());
                    FixedDocumentSequence fixedDocumentSequence = document.GetFixedDocumentSequence();
                    this.Viewer.Document = fixedDocumentSequence as IDocumentPaginatorSource;
                }
                else
                {
                    MessageBox.Show("The result document for this patient has not been published yet.");
                }
            }
        }
        public static MethodResult GetByDateOfBirth(DateTime dateOfBirth)
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            BillingLogCollection billingLogCollection = new BillingLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblAccessionOrder ao ";
            commandText += "join tblPanelSetOrder pso on ao.MasterAccessionNo = pso.MasterAccessionNo ";
            commandText += "join tblPanelSetOrderCPTCodeBill psoc on pso.ReportNo = psoc.ReportNo ";
            commandText += "where ao.ClientId in (" + clientIdList + ") and ao.PBirthDate = '" + dateOfBirth.ToString("yyyyMMdd") + "';";

            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            BillingLogCollection.Build(apiResult.JSONResult, billingLogCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, billingLogCollection);
            return(methodResult);
        }
Esempio n. 20
0
        public static MethodResult GetByNotAcknowledged()
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            DistributionLogCollection distributionLogCollection = new DistributionLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblTestOrderReportDistribution tord ";
            commandText += "join tblPanelSetOrder pso on tord.ReportNo = pso.ReportNo ";
            commandText += "join tblAccessionOrder ao on pso.MasterAccessionNo = ao.MasterAccessionNo ";
            commandText += "where tord.ClientId in (" + clientIdList + ") and tord.DistributionType = 'Web Service' and tord.Distributed = 1 and tord.Acknowledged = 0 limit 500;";

            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            DistributionLogCollection.Build(apiResult.JSONResult, distributionLogCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, distributionLogCollection);
            return(methodResult);
        }
        public static MethodResult GetByRecentPostedCases()
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            BillingLogCollection billingLogCollection = new BillingLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblAccessionOrder ao ";
            commandText += "join tblPanelSetOrder pso on ao.MasterAccessionNo = pso.MasterAccessionNo ";
            commandText += "join tblPanelSetOrderCPTCodeBill psoc on pso.ReportNo = psoc.ReportNo ";
            commandText += $"where ao.ClientId in ({clientIdList}) ";
            commandText += $"and psoc.PostDate >= '{DateTime.Today.AddDays(-45).ToString("yyyy-MM-dd")}' order by ao.AccessionDate desc;";

            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            BillingLogCollection.Build(apiResult.JSONResult, billingLogCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, billingLogCollection);
            return(methodResult);
        }
Esempio n. 22
0
        public static MethodResult GetByRecentPostedCases()
        {
            string clientIdList = AuthenticatedUser.Instance.GetSQLClientIdInList();

            DistributionLogCollection distributionLogCollection = new DistributionLogCollection();
            string commandText = FIELDLIST;

            commandText += "from tblTestOrderReportDistribution tord ";
            commandText += "join tblPanelSetOrder pso on tord.ReportNo = pso.ReportNo ";
            commandText += "join tblAccessionOrder ao on pso.MasterAccessionNo = ao.MasterAccessionNo ";
            commandText += $"where tord.ClientId in ({clientIdList}) and tord.Distributed = 1 ";
            commandText += "and tord.DistributionType = 'Web Service' ";
            commandText += $"and tord.timeOfLastDistribution >= '{DateTime.Today.AddDays(-45).ToString("yyyy-MM-dd")}' order by tord.timeOfLastDistribution desc;";

            JObject   jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText);
            APIResult apiResult   = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest);

            DistributionLogCollection.Build(apiResult.JSONResult, distributionLogCollection);

            MethodResult methodResult = new MethodResult();

            methodResult.AddResult(apiResult.JSONResult, distributionLogCollection);
            return(methodResult);
        }