public int CreateSupplementalDiagnosis(SupplementalDiagnosisModel model)
        {
            var repo = new SupplementalDiagnosisRepository();
            var dataModel = new HealthInformationProgram.Data.Tables.lkup_splmtl_diag();
            //dataModel.splmtl_diag_id = null;// Convert.ToDecimal(model.SupplementalDiagnosisId);
            dataModel.diag_id = Convert.ToDecimal(model.DiagnosisId);
            dataModel.splmtl_diag_stat = model.Status;
            dataModel.splmtl_diag_descn = model.SupplementalDiagnosisDescription;
            dataModel.user_intrfc_sort_ord = Convert.ToDecimal(model.SortOrder);
            dataModel.splmtl_diag_strt_eff_dt = Convert.ToDateTime(model.SupplementalDiagnosisEffectiveStartDate);
            dataModel.splmtl_diag_end_eff_dt = Convert.ToDateTime(model.SupplementalDiagnosisEffectiveEndDate);
            dataModel.rec_creat_dt = DateTime.Now;
            dataModel.rec_creat_user_id_cd = model.CreatedBy;
            dataModel.rec_updt_dt = DateTime.Now;
            dataModel.rec_updt_user_id_cd = model.UpdatedBy;

            try
            {

                var returnCode = repo.CreateSupplementalDiagnosis(dataModel);
                return returnCode;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public SupplementalDiagnosisModel GetSupplementalDiagnosisByDescription(string description)
        {
            var repo = new HealthInformationProgram.Data.Repositories.SupplementalDiagnosisRepository();
            var dataItem = repo.GetSupplementalDiagnosis(description);

            var cat = new SupplementalDiagnosisModel();

            cat.SupplementalDiagnosisId = GetDataValue(dataItem.splmtl_diag_id);
            cat.SupplementalDiagnosisDescription = GetDataValue(dataItem.splmtl_diag_descn);
            cat.SortOrder = GetDataValue(dataItem.user_intrfc_sort_ord);
            cat.Status = GetDataValue(dataItem.splmtl_diag_stat);
            cat.SupplementalDiagnosisEffectiveStartDate = GetDataValue(dataItem.splmtl_diag_strt_eff_dt);
            cat.SupplementalDiagnosisEffectiveEndDate = GetDataValue(dataItem.splmtl_diag_end_eff_dt);
            cat.UpdatedBy = GetDataValue(dataItem.rec_updt_user_id_cd);
            cat.UpdateDate = GetDataValue(dataItem.rec_updt_dt);
            cat.CreatedBy = GetDataValue(dataItem.rec_creat_user_id_cd);
            cat.CreateDate = GetDataValue(dataItem.rec_creat_dt);

            return cat;
        }
        public List<SupplementalDiagnosisModel> GetAllSupplementalDiagnosisForGivenDiagnosisId(decimal diagnosisId)
        {
            var categories = new List<SupplementalDiagnosisModel>();
            var repo = new HealthInformationProgram.Data.Repositories.SupplementalDiagnosisRepository();

            var dataList = repo.GetAllSupplementalDiagnosisForGivenDiagnosisId(diagnosisId);
            foreach (var item in dataList)
            {
                var cat = new SupplementalDiagnosisModel();

                cat.SupplementalDiagnosisId = GetDataValue(item.splmtl_diag_id);
                cat.SupplementalDiagnosisDescription = GetDataValue(item.splmtl_diag_descn);
                cat.DiagnosisId = GetDataValue(item.diag_id);
                cat.Diagnosis = GetDiagnosis(item.diag_id).DiagnosisDescription;
                cat.SortOrder = GetDataValue(item.user_intrfc_sort_ord);
                cat.Status = GetDataValue(item.splmtl_diag_stat);
                cat.SupplementalDiagnosisEffectiveStartDate = GetDataValue(item.splmtl_diag_strt_eff_dt);
                cat.SupplementalDiagnosisEffectiveEndDate = GetDataValue(item.splmtl_diag_end_eff_dt);
                cat.UpdatedBy = GetDataValue(item.rec_updt_user_id_cd);
                cat.UpdateDate = GetDataValue(item.rec_updt_dt);
                cat.CreatedBy = GetDataValue(item.rec_creat_user_id_cd);
                cat.CreateDate = GetDataValue(item.rec_creat_dt);

                categories.Add(cat);
            }
            return categories;
        }