Пример #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 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 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);
        }
Пример #5
0
        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;
        }
Пример #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);
        }
Пример #7
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);
        }
Пример #8
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 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);
        }
Пример #10
0
        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);
        }
Пример #11
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);
        }
Пример #12
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);
            }
        }
Пример #13
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);
        }
Пример #14
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);
        }
Пример #15
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);
        }
Пример #16
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);
        }