Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
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.");
            }
        }
Exemplo n.º 3
0
        public static APIResult SubmitAPIRequestMessage(JObject requestMessage)
        {
            var apiURL = ConnectEnvironment.Instance.ApiUrl;
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(apiURL);            
            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method = "POST";

            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                string msg = requestMessage.ToString();
                streamWriter.Write(requestMessage.ToString());
            }

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                JObject responseMessage = JObject.Parse(streamReader.ReadToEnd());
                APIResult apiResult = new APIResult(requestMessage, responseMessage);                
                return apiResult;
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
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.");
                }
            }
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
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);
        }