Beispiel #1
0
 public void Initialize(ReleaseOfInformation ROI)
 {
     //this.OptionData.Add(new OptionData()
     //{
     //    ClientId = ROI.ClientId,
     //    Record = new Record()
     //    {
     //        ContactName = new ContactName()
     //        {
     //            First = ROI
     //        }
     //    }
     //});
 }
        public OptionObject RunScript(OptionObject optionObject, string scriptName)
        {
            OptionObjectHelper OOHelper = new OptionObjectHelper();
            var currentTime = DateTime.Now.ToString("hh:mm tt");
            OptionObject returnOptionObject = new OptionObject();
            //initialize the option object
            returnOptionObject.EntityID = optionObject.EntityID;
            returnOptionObject.OptionId = optionObject.OptionId;
            returnOptionObject.Facility = optionObject.Facility;
            returnOptionObject.SystemCode = optionObject.SystemCode;
            returnOptionObject.OptionUserId = optionObject.OptionUserId;
            var medicalNote = new MedicalNote(optionObject);
            switch (scriptName.Split(',')[0])
            {
                #region CASES < 11-09-2015
                case "EmailPsychcareAuthorization":
                    returnOptionObject = EmailPsychcareAuthorization(optionObject);
                    break;
                case "EmailUMBHRequest":
                    returnOptionObject = EmailUMBHRequest(optionObject);
                    break;
                //case "AddNewClientContact":
                //    returnOptionObject = AddNewClientContact(optionObject);
                //    break;
                case "CreateNonClientCharge":
                    var service = new Service();
                    if (service.PopulateService(optionObject))
                    {
                        var serviceRepository = new ServiceRepository();
                        var response = serviceRepository.FileService(service);
                        if (response.Status != 1)
                            Helper.sendEmail(ConfigurationManager.AppSettings["ErrorSender"].ToString(),
                                "Error while filing non client charge",
                                String.Format("Staff: {0}\nService Code: {1}\nProgram: {2}\nNote Status:{3}\nEntry: {4}",
                                optionObject.EntityID, service.ServiceCodeField.FieldValue,
                                service.ProgramCodeField.FieldValue, service.NoteStatus.FieldValue,
                                DateTime.Now.ToShortDateString()),
                                new List<string> { ConfigurationManager.AppSettings["ErrorRecipient"].ToString() });

                    }
                    else
                    {
                        returnOptionObject = Helper.ReturnOptionObject(optionObject);
                    }
                    break;
                case "MedicalServicesProgressNoteLoadCC":
                    medicalNote.CreateChiefComplaint();
                    medicalNote.DefaultCurrentProgram();
                    medicalNote.DefaultMostRecentProblem();
                    medicalNote.DefaultMGAF();
                    returnOptionObject = medicalNote.ReturnOptionObject;
                    break;
                case "UpdateMedicalServicesProgressNoteCC":
                    medicalNote.UpdateChiefComplaint();
                    returnOptionObject = medicalNote.ReturnOptionObject;
                    break;
                case "CreateNoteSummary":
                    medicalNote.CreateNoteSummary();
                    returnOptionObject = medicalNote.ReturnOptionObject;
                    break;
                case "DefaultVitalSigns":
                    medicalNote.DefaultVitalSigns();
                    returnOptionObject = medicalNote.ReturnOptionObject;
                    break;
                case "CopyProblem":
                    medicalNote.CopyProblem();
                    returnOptionObject = medicalNote.ReturnOptionObject;
                    break;
                case "CalculateServiceCode":
                    medicalNote.GetServiceCode();
                    returnOptionObject = medicalNote.ReturnOptionObject;
                    break;
                case "CreateClientContact":
                    var ROI = new ReleaseOfInformation();
                    ROI.Initialize(optionObject);
                    var ClientContactRepository = new ClientContactRepository();
                    break;
                case "UpdateDemographics":
                    var Demo = new ClientDemographics(optionObject);
                    string fieldNumber = null;
                    if (Helper.SplitAndGetValueAt(scriptName, ',', 1, out fieldNumber))
                    {
                        var LGBTField = Demo.GetField(fieldNumber);
                        if (LGBTField != null && !String.IsNullOrEmpty(LGBTField.FieldValue))
                        {
                            var client = new ClientDemographicsWebSvc.ClientDemographicsObject()
                            {
                                SSDemographicsDict8 = LGBTField.FieldValue
                            };
                            Demo.UpdateDemographics(client);
                        }
                        returnOptionObject = Demo.ReturnOptionObject;
                    }
                    break;
                case "CopyFieldValue":
                    var copyField = new FieldCopy(optionObject, scriptName);
                    copyField.PerformCopy();
                    copyField.PopulateReturnOptionObject();
                    returnOptionObject = copyField.ReturnOptionObject;
                    break;
                case "MakeRequiredCond":
                    var fieldsRequired = new FieldsRequiredConditionally(optionObject, scriptName);
                    fieldsRequired.MakeFieldsRequired();
                    fieldsRequired.PopulateReturnOptionObject();
                    returnOptionObject = fieldsRequired.ReturnOptionObject;
                    break;
                case "CrisisWalkinDisposition":
                    var crisisWalkin = new CrisisWalkin(optionObject, scriptName);
                    crisisWalkin.UpdateFieldState();
                    crisisWalkin.PopulateReturnOptionObject();
                    returnOptionObject = crisisWalkin.ReturnOptionObject;
                    break;
                case "AuthorizationROI":
                    var authROI = new AuthorizationROI(optionObject, scriptName);
                    authROI.UpdateFieldState();
                    authROI.PopulateReturnOptionObject();
                    returnOptionObject = authROI.ReturnOptionObject;
                    break;
                #endregion

                #region UpdDemo
                case "UpdDemo":
                    //Use BusinessLayer.UpdateData() to add more fields in case they are added to the form
                    #region Local Variables
                    List<string> fieldNumbers = new List<string>();
                    string LGBTCode = scriptName.Split(',')[2];
                    string SmokerCode = scriptName.Split(',')[3];
                    string AssessingDateCode = scriptName.Split(',')[4];
                    string formId = scriptName.Split(',')[1];
                    string LGBTValue = OOHelper.getFieldValue(optionObject, formId, LGBTCode);
                    string SmokerValue = OOHelper.getFieldValue(optionObject, formId, SmokerCode);
                    string SmokingAssessmentDateValue = OOHelper.getFieldValue(optionObject, formId, AssessingDateCode);
                    DateTime dt = DateTime.Parse(SmokingAssessmentDateValue);
                    string clientId = optionObject.EntityID;
                    #endregion
                    Dictionary<string, dynamic> fieldsChanged = new Dictionary<string, dynamic>();
                    fieldNumbers.Add(LGBTCode);
                    fieldNumbers.Add(SmokerCode);

                    NTST.ScriptLinkService.Web.WebServicesProjects.UpdateClientDemoFromSCSAssessment.BusinessLayer bl = new NTST.ScriptLinkService.Web.WebServicesProjects.UpdateClientDemoFromSCSAssessment.BusinessLayer(
                          returnOptionObject,
                          formId,
                          fieldNumbers.ToArray());
                    //Populate Dictionary and pass it to the method below
                    bl.UpdateData(LGBTValue, SmokerValue, dt.Date, clientId);
                    break;
                #endregion
                #region ReportHelper
                case "GetPrgParam":
                    returnOptionObject = GetProgramsSelectedForReportParameters(optionObject, scriptName, returnOptionObject);
                    break;
                #endregion
                #region Admission, Homeless Indicator, Resident Code
                case "ResidentCode":
                    AdmissionOption admissionOutPatient = new AdmissionOption(optionObject);
                    returnOptionObject = admissionOutPatient.RunAdmissionScript(optionObject);
                    break;
                case "HomelessIndicator":
                    AdmissionOption admissionOutPatient1 = new AdmissionOption(optionObject);
                    returnOptionObject.ErrorCode = Convert.ToInt32(admissionOutPatient1.HomelessIndicatorMethod(optionObject).Split('|')[0]);
                    returnOptionObject.ErrorMesg = admissionOutPatient1.HomelessIndicatorMethod(optionObject).Split('|')[1];
                    break;
                #endregion
                #region EmailVoidPN
                case "EmailVoidPN":
                        TestScriptLink2.VoidProgressNote.VoidedNote_BusinessLayer vnbl = new VoidProgressNote.VoidedNote_BusinessLayer();
                        vnbl.SetFieldValues(optionObject, currentTime);
                        vnbl.BuildAndSendEmail();
                    break;
                #endregion

                case "FFSIN":
                    string SSINformId = scriptName.Split(',')[1];
                    string SSINfieldNumber = scriptName.Split(',')[2];
                    string fieldVal = "F" + optionObject.EntityID;
                    string cmd = SSINformId + "|" + SSINfieldNumber + "|" + fieldVal + "|0|0|0";
                    List<string> cmds = new List<string>();
                    cmds.Add(cmd);
                    OptionObjectHelper OOHelperAdm = new OptionObjectHelper(optionObject, cmds);
                    returnOptionObject = OOHelperAdm.returnOptionObject;
                    break;

                default:
                    break;
            }
            return returnOptionObject;
        }