public List <PatientAllergies> FillAllergies(IEntryCollection entryCollection)
        {
            List <PatientAllergies> alleryies = new List <PatientAllergies>();

            foreach (IEntry entryitem in entryCollection)
            {
                IAct entryact = entryitem.AsAct;
                IEntryRelationship entryRelationship  = entryact.EntryRelationship[0];
                IObservation       entryobservation   = entryRelationship.AsObservation;
                IIVL_TS            effectivetime      = entryact.EffectiveTime;
                IParticipant2      allergyParticipant = entryobservation.Participant[0];
                IParticipantRole   participantRole    = allergyParticipant.ParticipantRole;
                IPlayingEntity     playingEntity      = participantRole.AsPlayingEntity;
                ICE              code        = playingEntity.Code;
                IPNCollection    name        = playingEntity.Name;
                string           substance   = name != null && name.Count() > 0 ? name[0].Text : code.DisplayName;
                PatientAllergies ptallergies = new PatientAllergies();
                ptallergies.substance = substance;
                IEntryRelationship entryRelationshipMFST = entryobservation.EntryRelationship.Where(r => r.TypeCode.ToString() == "MFST").FirstOrDefault();
                if (entryRelationshipMFST != null && entryRelationshipMFST.AsObservation.Value != null)
                {
                    IANY Reactionvaluecollection = entryRelationshipMFST.AsObservation.Value.FirstOrDefault();
                    CD   valuesReaction          = (CD)Reactionvaluecollection;
                    ptallergies.reaction = valuesReaction.DisplayName;
                }
                ptallergies.rxNorm = code.Code;
                IEntryRelationship entryRelationshipSUBJ = entryobservation.EntryRelationship.Where(r => r.TypeCode.ToString() == "SUBJ").FirstOrDefault();
                if (entryRelationshipSUBJ != null && entryRelationshipSUBJ.AsObservation.Value != null)
                {
                    IANY Statusvaluecollection = entryRelationshipSUBJ.AsObservation.Value.FirstOrDefault();
                    ICE  values = (ICE)Statusvaluecollection;
                    ptallergies.status = values.DisplayName;
                }
                if (effectivetime != null && effectivetime.Value != null)
                {
                    ptallergies.allergyDate = effectivetime.AsDateTime.ToString();
                }
                alleryies.Add(ptallergies);
            }

            return(alleryies);
        }
Пример #2
0
        public override async Task <IActionResult> PatchAsync(int id, [FromBody] PatientAllergies patientAllergies)
        {
            //var attrToUpdate = _jsonApiContext.AttributesToUpdate;
            //var patientPastIllnessOld = _dbContextResolver.GetDbSet<PatientPastIllness>().Where(m => m.Id == id).FirstOrDefault();

            //CommonMethods commonMethods = new CommonMethods();
            ////List<AuditLogs> auditLogs = commonMethods.GetAuditLogValues(patientPastIllnessOld, patientAllergies, "PatientPastIllness", attrToUpdate)
            ////    //.Where(i => attrToUpdate.Keys.Any(a1 => a1.InternalAttributeName == i.PropertyName))
            ////    .Select(q => new AuditLogs() { NewValue = q.NewValue, OldValue = q.OldValue, PrimaryKeyID = q.PrimaryKeyID, TableName = q.TableName, PropertyName = q.PropertyName }).ToList();
            ////await _dbContextResolver.GetDbSet<AuditLogs>().AddRangeAsync(auditLogs);
            ////return await base.PatchAsync(id, patientAllergies);

            ////var patientPastIllnessInfo = await base.PatchAsync(id, patientAllergies);

            //int eventID = _dbContextResolver.GetDbSet<Event>().LastOrDefault().Id + 1;
            //List<AuditLogs> auditLogs = commonMethods.GetAuditLogValues(patientPastIllnessOld, patientAllergies, "PatientPastIllness", attrToUpdate)
            //    //.Where(i => attrToUpdate.Keys.Any(a1 => a1.InternalAttributeName == i.PropertyName))
            //    .Select(q => new AuditLogs() { NewValue = q.NewValue, OldValue = q.OldValue, PrimaryKeyID = q.PrimaryKeyID, TableName = q.TableName, PropertyName = q.PropertyName, EventID = eventID }).ToList();
            //await _dbContextResolver.GetDbSet<AuditLogs>().AddRangeAsync(auditLogs);
            return(await base.PatchAsync(id, patientAllergies));
        }
        /// <summary>
        /// Get Patient Alleries
        /// </summary>
        /// <param name="dataArr"></param>
        /// <returns></returns>
        public List <PatientAllergies> GetAllergies(Dictionary <string, ArrayList> dataArr)
        {
            List <PatientAllergies> alleryies = new List <PatientAllergies>();

            if (dataArr.Count > 0)
            {
                for (int i = 0; i < dataArr.Count; i++)
                {
                    PatientAllergies ptall         = new PatientAllergies();
                    ArrayList        itemalleryies = dataArr[i.ToString()];
                    ptall.substance   = itemalleryies[1].ToString();
                    ptall.reaction    = itemalleryies[5].ToString();
                    ptall.status      = itemalleryies[3].ToString();
                    ptall.allergyDate = itemalleryies[0].ToString();

                    alleryies.Add(ptall);
                }
            }

            return(alleryies);
        }
Пример #4
0
    public void Set_Pat_Allergies(string userID,PatientAllergies pAllergyDetails)
    {
        bool successFlag = false;
        SqlConnection sqlCon = new SqlConnection(conStr);
        objNLog.Info("Function Started with parameter pAllergyDetails");
        try
        {
            SqlCommand sqlCmd = new SqlCommand("sp_Set_Pat_Allergies", sqlCon);
            sqlCmd.CommandType = CommandType.StoredProcedure;

            SqlParameter Pat_ID = sqlCmd.Parameters.Add("@Pat_ID", SqlDbType.Int);
            Pat_ID.Value = pAllergyDetails.PatID;

            SqlParameter PI_GroupNo = sqlCmd.Parameters.Add("@AllergicTo", SqlDbType.VarChar, 255);
            PI_GroupNo.Value = pAllergyDetails.AllergicTo;

            SqlParameter PI_PolicyID = sqlCmd.Parameters.Add("@AllergyDesc", SqlDbType.VarChar, 255);
            PI_PolicyID.Value = pAllergyDetails.AllergyDescription;

            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();

            objNLog.Info("Allergy Info Added Successfully...");
            objNLog.Info("<sp_Set_Pat_Allergies>Stored Procedure Executed Successfully...");
            successFlag = true;
            objUALog.LogUserActivity(conStr, userID, "Added New Allergy Info. for the Patient(PatID)=" + pAllergyDetails.PatID, "Patient_Allergies", pAllergyDetails.PatID);
        }
        catch (SqlException SqlEx)
        {
            objNLog.Error("SQLException : " + SqlEx.Message);
            throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " while Adding Allergy.", SqlEx);
        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
            throw new Exception("**Error occured while Adding Allergy.", ex);
        }
        finally
        {
            sqlCon.Close();
            objNLog.Info("Finally Block: " + successFlag);
        }
        objNLog.Info("Status: " + successFlag);
        objNLog.Info("Function Terminated...");
    }
Пример #5
0
    protected void btnSaveAllergy_Click(object sender, EventArgs e)
    {
        objNLog.Info("Save Allergry Click Event Started");
        try
        {
            string userID = (string)Session["User"];
            PatientAllergies pAllergyDetails = new PatientAllergies();
            pAllergyDetails.PatID = Int32.Parse(hidPatID.Value.ToString());
            pAllergyDetails.AllergicTo = txtAllergyTo.Text;
            pAllergyDetails.AllergyDescription = txtAllergyDesc.Text;
            objPat_Info.Set_Pat_Allergies(userID,pAllergyDetails);
            FillgridPatAllergies();

        }
        catch (Exception ex)
        {
            objNLog.Error("Exception : " + ex.Message);
        }
        objNLog.Error("Function Terminated...");
    }
Пример #6
0
        public override async Task <IActionResult> PostAsync([FromBody] PatientAllergies patientInfo)
        {
            var Token = HttpContext.Request.Headers.Skip(7).FirstOrDefault().Value; //

            return(await base.PostAsync(patientInfo));
        }
Пример #7
0
        public void GenerateAllergyEntry(PatientAllergies patientAllergies, III hl7III, Factory hl7factory)
        {
            IEntry entry = functionalStatus.Section.Entry.Append();

            entry.TypeCode        = x_ActRelationshipEntry.DRIV;
            entry.AsAct.ClassCode = x_ActClassDocumentEntryAct.ACT;
            entry.AsAct.MoodCode  = x_DocumentActMood.EVN;
            hl7III = entry.AsAct.Id.Append();
            hl7III.Init("36e3e930-7b14-11db-9fe1-0800200c9a66");
            hl7III = entry.AsAct.TemplateId.Append();
            hl7III.Init("2.16.840.1.113883.10.20.22.4.30");
            entry.AsAct.Code.Code           = "48765-2";
            entry.AsAct.Code.CodeSystem     = "2.16.840.1.113883.6.1";
            entry.AsAct.Code.CodeSystemName = "LOINC";

            entry.AsAct.Code.DisplayName = "Allergies, adverse reactions, alerts";

            entry.AsAct.StatusCode.Code = Convert.ToString(patientAllergies.status).ToLower();

            if (Convert.ToString(patientAllergies.status) == "Active")
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(low: new IVXB_TS());
                // If Status Active
            }
            else
            {
                entry.AsAct.EffectiveTime = new IVL_TS().Init(high: new IVXB_TS());
                // If Status is Not Active
            }

            IEntryRelationship entryRel = entry.AsAct.EntryRelationship.Append();

            entryRel.TypeCode = x_ActRelationshipEntryRelationship.SUBJ;
            entryRel.AsObservation.ClassCode = "OBS";
            entryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            III TempId = entryRel.AsObservation.TemplateId.Append();

            TempId.Root = "2.16.840.1.113883.10.20.22.4.7";
            entryRel.AsObservation.StatusCode.Code = "completed";
            hl7III      = entryRel.AsObservation.Id.Append();
            hl7III.Root = "4adc1020-7b14-11db-9fe1-0800200c9a66";
            entryRel.AsObservation.Code.Code       = "ASSERTION";
            entryRel.AsObservation.Code.CodeSystem = "2.16.840.1.113883.5.4";
            ICS CS = hl7factory.CreateCS();

            CS.Init("completed");

            entryRel.AsObservation.EffectiveTime.NullFlavor = "UNK";
            // Because Allergy Start Date is Missing.
            CD obsValueAsCD = new CD();
            CE obsValueAsCE = new CE();

            //obsValueAsCD.Code = patientAllergies.AllergyType == "Medication" ? "416098002" : patientAllergies.AllergyType == "Food" ? "414285001" : patientAllergies.AllergyType == "Environmental" ? "419199007" : "420134006";//(patientAllergies.AllergyType == "Medication" ? "416098002" : (patientAllergies.AllergyType == "Food" ? "414285001" : (patientAllergies.AllergyType == "Environmental" ? "426232007" : "106190000")));
            //// Allergy Type SNOMED Code(Environmental Alergy:426232007, Food Allergy: 414285001, Medication Allergy: 416098002, Other Allergy: 106190000)
            //obsValueAsCD.DisplayName = (patientAllergies.AllergyType == "Medication" ? "Drug allergy" : (patientAllergies.AllergyType == "Food" ? "Food allergy" : (patientAllergies.AllergyType == "Environmental" ? "Environmental allergy" : "Other allergy")));

            obsValueAsCD.CodeSystem     = "2.16.840.1.113883.6.96";
            obsValueAsCD.CodeSystemName = "SNOMED CT";
            obsValueAsCD.OriginalText.Reference.Value = "#" + Convert.ToString(patientAllergies.allergyId);
            // "#reaction1" ' Dynamic Value
            entryRel.AsObservation.Value.Add(obsValueAsCD);
            PN pn = new PN();

            pn.Text = patientAllergies.substance;
            IParticipant2 parti = hl7factory.CreateParticipant2();

            parti.TypeCode = "CSM";
            parti.ParticipantRole.ClassCode = "MANU";
            parti.ParticipantRole.AsPlayingEntity.ClassCode = "MMAT";
            parti.ParticipantRole.AsPlayingEntity.Code.Code = Convert.ToString(patientAllergies.rxNorm);
            //"314422" ' Dynamic Value
            parti.ParticipantRole.AsPlayingEntity.Code.DisplayName = patientAllergies.substance;
            //"ALLERGENIC EXTRACT, PENICILLIN" ' Dynamic Value
            parti.ParticipantRole.AsPlayingEntity.Code.CodeSystem     = "2.16.840.1.113883.6.88";
            parti.ParticipantRole.AsPlayingEntity.Code.CodeSystemName = "RxNorm";
            parti.ParticipantRole.AsPlayingEntity.Code.OriginalText.Reference.Value = "";
            //"#" & Convert.ToString(dtRow("ReactionID"))
            parti.ParticipantRole.AsPlayingEntity.Name.Add(pn);
            entryRel.AsObservation.Participant.Add(parti);

            ///'' Allergy Status Observation '''''''''''
            IEntryRelationship obs_EntryRel = entryRel.AsObservation.EntryRelationship.Append();

            obs_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.SUBJ;
            obs_EntryRel.InversionInd            = true;
            obs_EntryRel.InversionIndSpecified   = true;
            obs_EntryRel.AsObservation.ClassCode = "OBS";
            obs_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
            hl7III      = obs_EntryRel.AsObservation.TemplateId.Append();
            hl7III.Root = "2.16.840.1.113883.10.20.22.4.28";
            obs_EntryRel.AsObservation.Code.Code           = "33999-4";
            obs_EntryRel.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.6.1";
            obs_EntryRel.AsObservation.Code.CodeSystemName = "LOINC";
            obs_EntryRel.AsObservation.Code.DisplayName    = "Status";
            obs_EntryRel.AsObservation.StatusCode.Code     = "completed";


            obsValueAsCE             = new CE();
            obsValueAsCE.Code        = Convert.ToString(patientAllergies.status) == "Active" ? "55561003" : patientAllergies.status == "Inactive" ? "73425007" : "413322009";
            obsValueAsCE.DisplayName = Convert.ToString(patientAllergies.status);
            obsValueAsCE.CodeSystem  = "2.16.840.1.113883.6.96";

            obs_EntryRel.AsObservation.Value.Add(obsValueAsCE);
            obs_EntryRel.InversionInd          = true;
            obs_EntryRel.InversionIndSpecified = true;
            ///' Allergy Reaction Observation
            if (!string.IsNullOrEmpty(patientAllergies.reaction))
            {
                obs_EntryRel                         = entryRel.AsObservation.EntryRelationship.Append();
                obs_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.MFST;
                obs_EntryRel.InversionInd            = true;
                obs_EntryRel.InversionIndSpecified   = true;
                obs_EntryRel.AsObservation.ClassCode = "OBS";
                obs_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                hl7III = obs_EntryRel.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.9");
                hl7III = obs_EntryRel.AsObservation.Id.Append();
                hl7III.Init("4adc1020-7b14-11db-9fe1-0800200c9a64");
                obs_EntryRel.AsObservation.Code.NullFlavor = "UNK";
                //obs_EntryRel.AsObservation.Text.Reference.Value = "#" & Convert.ToString(dtRow("ReactionID")) '"#reaction1"
                obs_EntryRel.AsObservation.StatusCode.Code = "completed";
                obs_EntryRel.AsObservation.EffectiveTime   = new IVL_TS().Init(low: new IVXB_TS(), high: new IVXB_TS());
                obsValueAsCD = new CD();
                if (!string.IsNullOrEmpty(GetSNOMED(patientAllergies.reaction)))
                {
                    obsValueAsCD.Code = GetSNOMED(patientAllergies.reaction);
                    // Dynamic Value ''
                }

                obsValueAsCD.DisplayName = patientAllergies.reaction;
                //"Hives"
                obsValueAsCD.CodeSystem = "2.16.840.1.113883.6.96";
                obsValueAsCD.OriginalText.Reference.Value = "#" + Convert.ToString(patientAllergies.allergyId);
                obs_EntryRel.AsObservation.Value.Add(obsValueAsCD);
            }

            ///' Allergy Severity Observation
            if (!string.IsNullOrEmpty(patientAllergies.reaction))
            {
                obs_EntryRel                         = entryRel.AsObservation.EntryRelationship.Append();
                obs_EntryRel.TypeCode                = x_ActRelationshipEntryRelationship.SUBJ;
                obs_EntryRel.InversionInd            = true;
                obs_EntryRel.InversionIndSpecified   = true;
                obs_EntryRel.AsObservation.ClassCode = "OBS";
                obs_EntryRel.AsObservation.MoodCode  = x_ActMoodDocumentObservation.EVN;
                hl7III = obs_EntryRel.AsObservation.TemplateId.Append();
                hl7III.Init("2.16.840.1.113883.10.20.22.4.8");
                obs_EntryRel.AsObservation.Code.Code           = "SEV";
                obs_EntryRel.AsObservation.Code.DisplayName    = "Severity Observation";
                obs_EntryRel.AsObservation.Code.CodeSystem     = "2.16.840.1.113883.5.4";
                obs_EntryRel.AsObservation.Code.CodeSystemName = "ActCode";
                //obs_EntryRel.AsObservation.Text.Reference.Value = "#severity1"
                obs_EntryRel.AsObservation.StatusCode.Code = "completed";
                obsValueAsCD             = new CD();
                obsValueAsCD.Code        = (Convert.ToString(patientAllergies.reaction) == "Mild" ? "255604002" : (Convert.ToString(patientAllergies.reaction) == "Moderate" ? "6736007" : "24484000"));
                obsValueAsCD.DisplayName = patientAllergies.reaction;
                // Moderate or Mild or severe"
                obsValueAsCD.CodeSystem     = "2.16.840.1.113883.6.96";
                obsValueAsCD.CodeSystemName = "SNOMED CT";
                obsValueAsCD.OriginalText.Reference.Value = "#" + Convert.ToString(patientAllergies.allergyId);
                obs_EntryRel.AsObservation.Value.Add(obsValueAsCD);
            }
        }
Пример #8
0
    public string Update_Patient(PatientName Pat_Name, PatientPersonalDetails Pat_Per_Details, PatientAddress Pat_Add,
                           PatientInsuranceDetails Pat_Ins_Details, PatientAllergies Pat_Allergies,
                           FacilityInfo Fac_Info, PharmacyInfo Phrm_Info,ProviderInfo Prov_Info)
    {
        SqlConnection sqlCon = new SqlConnection(ConStr);
        SqlCommand sqlCmd = new SqlCommand("sp_update_Patient", sqlCon);
        sqlCmd.CommandType = CommandType.StoredProcedure;

        SqlParameter P_ID = sqlCmd.Parameters.Add("@Pat_ID", SqlDbType.Int);
        P_ID.Value = Pat_Name.Pat_ID;

        SqlParameter P_MName = sqlCmd.Parameters.Add("@Pat_MName", SqlDbType.VarChar, 50);
        if (Pat_Name.MiddleName != null)
            P_MName.Value = Pat_Name.MiddleName;
        else
            P_MName.Value = Convert.DBNull;

        SqlParameter P_Gender = sqlCmd.Parameters.Add("@Pat_Gender", SqlDbType.Char, 1);
        if (Pat_Per_Details.Gender != null)
            P_Gender.Value = Pat_Per_Details.Gender;
        else
            P_Gender.Value = Convert.DBNull;

        SqlParameter P_DOB = sqlCmd.Parameters.Add("@Pat_DOB", SqlDbType.DateTime);
        if (Pat_Per_Details.DOB != null)
            P_DOB.Value = DateTime.Parse(Pat_Per_Details.DOB);
        else
        {
            Nullable<DateTime> NullDate = null;
            P_DOB.Value = NullDate;
        }

        SqlParameter P_SSN = sqlCmd.Parameters.Add("@Pat_SSN", SqlDbType.VarChar, 50);
        if (Pat_Per_Details.SSN != null)
            P_SSN.Value = Pat_Per_Details.SSN;
        else
            P_SSN.Value = Convert.DBNull;

        SqlParameter P_Address1 = sqlCmd.Parameters.Add("@Pat_Address1", SqlDbType.VarChar, 50);
        if (Pat_Add.Address1 != null)
            P_Address1.Value = Pat_Add.Address1;
        else
            P_Address1.Value = Convert.DBNull;

        SqlParameter P_Address2 = sqlCmd.Parameters.Add("@Pat_Address2", SqlDbType.VarChar, 50);
        if (Pat_Add.Address2 != null)
            P_Address2.Value = Pat_Add.Address2;
        else
            P_Address2.Value = Convert.DBNull;

        SqlParameter P_City = sqlCmd.Parameters.Add("@Pat_City", SqlDbType.VarChar, 50);
        if (Pat_Add.City != null)
            P_City.Value = Pat_Add.City;
        else
            P_City.Value = Convert.DBNull;
        SqlParameter P_State = sqlCmd.Parameters.Add("@Pat_State", SqlDbType.VarChar, 50);
        if (Pat_Add.State != null)
            P_State.Value = Pat_Add.State;
        else
            P_State.Value = Convert.DBNull;
        SqlParameter P_ZIP = sqlCmd.Parameters.Add("@Pat_Zip", SqlDbType.VarChar, 50);
        if (Pat_Add.Zip != null)
            P_ZIP.Value = Pat_Add.Zip;
        else
            P_ZIP.Value = Convert.DBNull;
        SqlParameter P_PDoc = sqlCmd.Parameters.Add("@Pat_PDoc", SqlDbType.VarChar, 50);
        if (Pat_Per_Details.Pat_Pre_Doc != null)
            P_PDoc.Value = Pat_Per_Details.Pat_Pre_Doc;
        else
            P_PDoc.Value = Convert.DBNull;

        SqlParameter P_MRN = sqlCmd.Parameters.Add("@Pat_MRN", SqlDbType.VarChar, 15);
        if (Pat_Per_Details.MRN != null)
            P_MRN.Value = Pat_Per_Details.MRN;
        else
            P_MRN.Value = Convert.DBNull;

        SqlParameter Fac_ID = sqlCmd.Parameters.Add("@Fac_ID", SqlDbType.Int);
        if (Fac_Info.FacilityNO != null)
            Fac_ID.Value = Fac_Info.FacilityNO;
        else
            Fac_ID.Value = Convert.DBNull;

        SqlParameter Phrm_ID = sqlCmd.Parameters.Add("@Phrm_ID", SqlDbType.Int);
        if (Phrm_Info.PhrmID != null)
            Phrm_ID.Value = Phrm_Info.PhrmID;
        else
            Phrm_ID.Value = Convert.DBNull;

        //SqlParameter PI_InsName = sqlCmd.Parameters.Add("@Ins_Name", SqlDbType.VarChar, 50);
        //if (Pat_Ins_Details.InsuranceName != null)
        //    PI_InsName.Value = Pat_Ins_Details.InsuranceName;
        //else
        //    PI_InsName.Value = Convert.DBNull;

        int InsID = getInsuranceID(Pat_Ins_Details);
        Pat_Ins_Details.InsuranceID = InsID;

        SqlParameter Ins_ID = sqlCmd.Parameters.Add("@Ins_ID", SqlDbType.Int);
        if (Pat_Ins_Details.InsuranceID.ToString() != "0")
            Ins_ID.Value = Pat_Ins_Details.InsuranceID;
        else
            Ins_ID.Value = Convert.DBNull;

        SqlParameter PI_No = sqlCmd.Parameters.Add("@PI_Number", SqlDbType.Int);
        if (Pat_Ins_Details.PI_PolicyNo.ToString() != "0")
            PI_No.Value = Pat_Ins_Details.PI_PolicyNo;
        else
            PI_No.Value = Convert.DBNull;

        SqlParameter PI_PolicyID = sqlCmd.Parameters.Add("@PI_PolicyID", SqlDbType.Int);
        if (Pat_Ins_Details.PI_PolicyID.ToString() != "0")
            PI_PolicyID.Value = Pat_Ins_Details.PI_PolicyID;
        else
            PI_PolicyID.Value = Convert.DBNull;

        SqlParameter PI_GroupNo = sqlCmd.Parameters.Add("@PI_GroupNo", SqlDbType.Int);
        if (Pat_Ins_Details.PI_GroupNo.ToString() != "0")
            PI_GroupNo.Value = Pat_Ins_Details.PI_GroupNo;
        else
            PI_GroupNo.Value = Convert.DBNull;

        SqlParameter PI_BINNo = sqlCmd.Parameters.Add("@PI_BINNo", SqlDbType.Int);
        if (Pat_Ins_Details.PI_BINNo.ToString() != "0")
            PI_BINNo.Value = Pat_Ins_Details.PI_BINNo;
        else
            PI_BINNo.Value = Convert.DBNull;

        SqlParameter PI_InsdName = sqlCmd.Parameters.Add("@PI_InsdName", SqlDbType.VarChar, 50);
        if (Pat_Ins_Details.InsuredName != null)
            PI_InsdName.Value = Pat_Ins_Details.InsuredName;
        else
            PI_InsdName.Value = Convert.DBNull;

        SqlParameter PI_InsdDOB = sqlCmd.Parameters.Add("@PI_InsdDOB", SqlDbType.DateTime);
        if (Pat_Ins_Details.InsuredDOB != null)
            PI_InsdDOB.Value = DateTime.Parse( Pat_Ins_Details.InsuredDOB);
        else
        {
            Nullable<DateTime> NullDate = null;
            PI_InsdDOB.Value = NullDate;
        }
        SqlParameter PI_InsdSSN = sqlCmd.Parameters.Add("@PI_InsdSSN", SqlDbType.VarChar, 50);
        if (Pat_Ins_Details.InsuredSSN != null)
            PI_InsdSSN.Value = Pat_Ins_Details.InsuredSSN;
        else
            PI_InsdSSN.Value = Convert.DBNull;
        SqlParameter PI_InsdRel = sqlCmd.Parameters.Add("@PI_InsdRel", SqlDbType.VarChar, 50);
        if (Pat_Ins_Details.InsuredRelation != null)
            PI_InsdRel.Value = Pat_Ins_Details.InsuredRelation;
        else
            PI_InsdRel.Value = Convert.DBNull;

        SqlParameter PA_Desc = sqlCmd.Parameters.Add("@PA_Desc", SqlDbType.VarChar, 200);
        if (Pat_Allergies.AllergyDescription != null)
            PA_Desc.Value = Pat_Allergies.AllergyDescription;
        else
            PA_Desc.Value = Convert.DBNull;

        try
        {
            sqlCon.Open();
            sqlCmd.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            return ex.ToString();
        }
        finally
        {
            sqlCon.Close();
        }

        return "Updated Patient Information Successfully";
    }