예제 #1
0
        public ChecklistItemsResult GetItems(string ien, int page, int itemsPerPage)
        {
            ChecklistItemsResult result = new ChecklistItemsResult();

            if (this.broker != null)
            {
                DsioGetMccChecklistCommand command = new DsioGetMccChecklistCommand(this.broker);

                command.AddCommandArguments(ien, page, itemsPerPage);

                RpcResponse response = command.Execute();

                result.SetResult(response.Status == RpcResponseStatus.Success, response.InformationalMessage);

                if (result.Success)
                {
                    result.TotalResults = command.TotalResults;

                    //XmlSerializer serializer = new XmlSerializer(typeof(List<DsioChecklistItem>));

                    //XmlWriter writer = XmlWriter.Create("\\va.gov.artemis.ui\\Content\\default_checklist.xml");

                    //serializer.Serialize(writer, command.ChecklistItems);

                    //writer.Close();

                    if (command.ChecklistItems != null)
                    {
                        foreach (DsioChecklistItem dsioItem in command.ChecklistItems)
                        {
                            ChecklistItem item = GetChecklistItem(dsioItem);

                            result.Items.Add(item);
                        }
                    }
                }
            }

            return(result);
        }
예제 #2
0
        public BrokerOperationResult AddDefaultPregnancyItems(string dfn, string pregIen)
        {
            BrokerOperationResult result = new BrokerOperationResult();

            ChecklistItemsResult getResult = this.GetItems("", 1, 1000);

            if (string.IsNullOrWhiteSpace(dfn))
            {
                result.Message = "The patient could not be identified";
            }
            else
            {
                if (string.IsNullOrWhiteSpace(pregIen))
                {
                    result.Message = "The pregnancy could not be identified";
                }
                else
                {
                    if (!getResult.Success)
                    {
                        result.SetResult(getResult.Success, getResult.Message);
                    }
                    else
                    {
                        if (getResult.Items != null)
                        {
                            if (getResult.Items.Count == 0)
                            {
                                result.SetResult(false, "There are no default checklist items to add");
                            }
                            else
                            {
                                foreach (ChecklistItem item in getResult.Items)
                                {
                                    PregnancyChecklistItem patItem = new PregnancyChecklistItem(item);

                                    patItem.PatientDfn       = dfn;
                                    patItem.PregnancyIen     = pregIen;
                                    patItem.CompletionStatus = DsioChecklistCompletionStatus.NotComplete;
                                    patItem.Ien = "";

                                    if (item.DueCalculationType == DsioChecklistCalculationType.Initial)
                                    {
                                        patItem.SpecificDueDate = DateTime.Now;
                                    }

                                    IenResult saveResult = this.SavePregnancyItem(patItem);

                                    if (!saveResult.Success)
                                    {
                                        result.SetResult(saveResult.Success, saveResult.Message);
                                        break;
                                    }
                                    else
                                    {
                                        result.SetResult(saveResult.Success, saveResult.Message);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(result);
        }