示例#1
0
        public DataSet SavePregnancyHistory(PregnancyHistory pregnancyHistory)
        {
            DataSet dataSet = new DataSet();

            try
            {
                string storedProcedure = "pSRGs_PreganancyHistory";
                string parameterName   = "@aXMLString";
                string parameterValue  = ObjectHelper.GetXMLFromObject(pregnancyHistory);
                sqlCommand = new SqlCommand(storedProcedure, sqlConnection);
                sqlCommand.Parameters.AddWithValue(parameterName, parameterValue);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlConnection.Open();
                sqlDataAdapter.SelectCommand = sqlCommand;
                sqlDataAdapter.Fill(dataSet);
                dataSet.Tables[0].TableName = "PREGNANCYHISTORY";
            }
            catch (Exception)
            {
                throw;
            }

            finally
            {
                sqlConnection.Close();
            }

            return(dataSet);
        }
 /// <summary>
 /// Initialize a new instance of type <see cref="PregnancyJournal"/> with its <see langword="default"/> values. An ID will be generated if one is not provided
 /// </summary>
 /// <param name="_id">The ID to assign the new <see cref="IJournal"/> <see langword="object"/></param>
 public PregnancyJournal(int?_id = null) : base(_id)
 {
     Pregnancies           = new PregnancyHistory();
     Abortions             = new AbortionHistory();
     Anamnese              = new Anamnese();
     Investegations        = new Investigation();
     ResAndRiskAssessement = new RRAssessement();
     Pregnancies           = new PregnancyHistory();
     Abortions             = new AbortionHistory();
 }
        //public PregnancyResult GetMostRecentPregnancy(string patientDfn)
        //{
        //    PregnancyResult result = new PregnancyResult();

        //    PregnancyListResult listResult = GetPregnancies(patientDfn, "");


        //    if (listResult.Success)
        //    {
        //        if (listResult.Pregnancies != null)
        //        {
        //            Pregnancy mostRecent;
        //            foreach (Pregnancy preg in listResult.Pregnancies)
        //            {

        //                if (mostRecent == null)
        //                    mostRecent = preg;
        //                else if (preg.RecordType == PregnancyRecordType.Current)
        //                    mostRecent = preg;

        //            }
        //        }
        //    }

        //    return result;
        //}

        private List <DsioObservation> GetObservationsToSave(string patientDfn, PregnancyHistory pregnancyHistory)
        {
            PregnancyHistory origHist = null;

            // *** Get original history ***
            PregnancyHistoryResult histResult = this.GetPregnancyHistory(patientDfn);

            // *** Create a list of items that need to be saved ***
            List <DsioObservation> observationsToSave = new List <DsioObservation>();

            // *** Set original history ***
            if (histResult.Success)
            {
                origHist = histResult.PregnancyHistory;
            }

            // *** Loop through all the observations ***
            foreach (Observation newObservation in pregnancyHistory.Observations.Values)
            {
                if (!string.IsNullOrWhiteSpace(newObservation.Value)) // *** Add if there's something there
                {
                    // *** If we have previous entries ***
                    if (origHist != null)
                    {
                        // *** Compare current with previous and only save if different ***

                        string origVal = origHist.GetValue(newObservation.Code);

                        if (origVal == null)
                        {
                            origVal = "";
                        }

                        if (origVal != newObservation.Value)
                        {
                            DsioObservation dsioObs = ObservationUtility.GetDsioObservation(newObservation);
                            observationsToSave.Add(dsioObs);
                        }
                    }
                    else
                    {
                        DsioObservation dsioObs = ObservationUtility.GetDsioObservation(newObservation);
                        observationsToSave.Add(dsioObs);
                    }
                }
            }

            return(observationsToSave);
        }
示例#4
0
        public PregnancyHistory SavePregnancyHistory(PregnancyHistory pregnancyHistory)
        {
            PregnancyHistory localsurrogacyhistory = new PregnancyHistory();
            SurrogateData    pregnancyhistorydata  = new SurrogateData();
            DataSet          dataSet = new DataSet();

            try
            {
                dataSet = pregnancyhistorydata.SavePregnancyHistory(pregnancyHistory);

                if (dataSet.Tables["PregnancyHistory"].Rows.Count > 0)
                {
                    localsurrogacyhistory = new PregnancyHistory();
                    localsurrogacyhistory.PregnancyHistoryID = dataSet.Tables["PregnancyHistory"].Rows[0]["PREGNANCYHISTORYID"].ToString();
                    localsurrogacyhistory.UserID             = dataSet.Tables["PregnancyHistory"].Rows[0]["USERID"].ToString();
                    localsurrogacyhistory.NoOfPregnancy      = Convert.ToInt16(dataSet.Tables["PregnancyHistory"].Rows[0]["NOOFPREGNANCY"].ToString());
                    localsurrogacyhistory.NoStillBirth       = Convert.ToInt16(dataSet.Tables["PregnancyHistory"].Rows[0]["NOSTILLBIRTH"].ToString());
                    localsurrogacyhistory.NoMisCarriage      = Convert.ToInt16(dataSet.Tables["PregnancyHistory"].Rows[0]["NOMISCARRIAGE"].ToString());
                    localsurrogacyhistory.NoLiveBirth        = Convert.ToInt16(dataSet.Tables["PregnancyHistory"].Rows[0]["NOLIVEBIRTH"].ToString());
                    localsurrogacyhistory.NoAbortion         = Convert.ToInt16(dataSet.Tables["PregnancyHistory"].Rows[0]["NOABORTION"].ToString());
                    localsurrogacyhistory.List         = dataSet.Tables["PregnancyHistory"].Rows[0]["LIST"].ToString();
                    localsurrogacyhistory.Treatment    = dataSet.Tables["PregnancyHistory"].Rows[0]["TREATMENT"].ToString();
                    localsurrogacyhistory.Complication = dataSet.Tables["PregnancyHistory"].Rows[0]["COMPLICATION"].ToString();
                    localsurrogacyhistory.Desc         = dataSet.Tables["PregnancyHistory"].Rows[0]["DESC"].ToString();
                    localsurrogacyhistory.ChildDeath   = dataSet.Tables["PregnancyHistory"].Rows[0]["CHILDDEATH"].ToString();
                    localsurrogacyhistory.Problem      = dataSet.Tables["PregnancyHistory"].Rows[0]["PROBLEM"].ToString();
                    localsurrogacyhistory.IsSubmit     = Convert.ToInt32(dataSet.Tables["PregnancyHistory"].Rows[0]["ISSUBMIT"].ToString());
                }
            }
            catch (SqlException sqlEx)
            {
                localsurrogacyhistory.responseDetail.responseType    = ResponseType.Error;
                localsurrogacyhistory.responseDetail.ResponseMessage = sqlEx.Message;
            }
            catch (Exception ex)
            {
                localsurrogacyhistory.responseDetail.responseType    = ResponseType.Error;
                localsurrogacyhistory.responseDetail.ResponseMessage = ApplicationManager.GenericErrorMessage;

                LoggerHelper.WriteToLog(ex);
            }

            return(localsurrogacyhistory == null ? new PregnancyHistory() : localsurrogacyhistory);
        }
示例#5
0
        private bool ValidatePregnancyHistoryInfoForm(PregnancyHistory pregnancyhistory, out string responseMessage)
        {
            bool boolResponse = true;

            responseMessage = "<ul>";

            List <FormData> IspregnancyhistoryFormData = new List <FormData>();

            IspregnancyhistoryFormData.Add(new FormData(FormInputType.NumericOrZero, Convert.ToString(pregnancyhistory.NoOfPregnancy), "NOOFPREGNANCY", "No Of Pregnancy", true));
            IspregnancyhistoryFormData.Add(new FormData(FormInputType.NumericOrZero, Convert.ToString(pregnancyhistory.NoStillBirth), "NOSTILLBIRTH", "No Of Still Birth", true));
            IspregnancyhistoryFormData.Add(new FormData(FormInputType.NumericOrZero, Convert.ToString(pregnancyhistory.NoMisCarriage), "NOMISCARRIAGE", "No Of Miscarriage", true));
            IspregnancyhistoryFormData.Add(new FormData(FormInputType.NumericOrZero, Convert.ToString(pregnancyhistory.NoLiveBirth), "NOLIVEBIRTH", "No Of Live Birth", true));
            IspregnancyhistoryFormData.Add(new FormData(FormInputType.NumericOrZero, Convert.ToString(pregnancyhistory.NoAbortion), "NOABORTION", "No Of Abortion", true));
            IspregnancyhistoryFormData.Add(new FormData(FormInputType.DropDownListValue, Convert.ToString(pregnancyhistory.Treatment), "TREATMENT", "Have you ever received fertility treatment in an effort to become pregnant?", true));
            IspregnancyhistoryFormData.Add(new FormData(FormInputType.DropDownListValue, Convert.ToString(pregnancyhistory.Complication), "COMPLICATION", "Did you have any severe complications with any of your pregnancies or births?", true));

            boolResponse = FormValidator.validateForm(IspregnancyhistoryFormData, out responseMessage);
            return(boolResponse);
        }
示例#6
0
        public ActionResult PregnancyHistory()
        {
            SurrogateService pregnancyhistoryService = new SurrogateService();
            PregnancyHistory pregnancyhistory        = new PregnancyHistory();

            try
            {
                pregnancyhistory.UserID      = ApplicationManager.LoggedInUser.UserID;
                pregnancyhistory.EntityState = EntityState.View;

                pregnancyhistory = pregnancyhistoryService.SavePregnancyHistory(pregnancyhistory);
            }
            catch (Exception ex)
            {
                WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000");
                LoggerHelper.WriteToLog(ex);
            }

            return(View("PregnancyHistory", pregnancyhistory));
        }
        public async Task <Response <string> > UpdatePregnancyHistory(PregnancyHistoryRequest request, UpdatePregnancyHistoryRequest updateRequest)
        {
            DateTimeOffset dataDate = DateTimeOffset.ParseExact(request.Date, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToOffset(new TimeSpan(7, 0, 0));

            var pregnancyHistory = await _unitOfWork.PregnancyHistoryRepository.FirstAsync(x => x.ChildId == request.ChildId && x.Date == dataDate.Date.ToString("dd'/'MM'/'yyyy"));

            if (pregnancyHistory != null)
            {
                pregnancyHistory.PregnancyWeek      = updateRequest.PregnancyWeek;
                pregnancyHistory.Weight             = updateRequest.Weight;
                pregnancyHistory.BiparietalDiameter = updateRequest.BiparietalDiameter;
                pregnancyHistory.HeadCircumference  = updateRequest.HeadCircumference;
                pregnancyHistory.FemurLength        = updateRequest.FemurLength;
                pregnancyHistory.FetalHeartRate     = updateRequest.FetalHeartRate;
                pregnancyHistory.MotherWeight       = updateRequest.MotherWeight;

                _unitOfWork.PregnancyHistoryRepository.UpdateAsync(pregnancyHistory);
                await _unitOfWork.SaveAsync();

                return(new Response <string>(pregnancyHistory.ChildId, $"Cập nhật thông tin em bé thành công, id: {pregnancyHistory.Id}"));
            }

            pregnancyHistory = new PregnancyHistory
            {
                ChildId            = request.ChildId,
                Date               = dataDate.ToString("dd'/'MM'/'yyyy"),
                PregnancyWeek      = updateRequest.PregnancyWeek,
                Weight             = updateRequest.Weight,
                BiparietalDiameter = updateRequest.BiparietalDiameter,
                HeadCircumference  = updateRequest.HeadCircumference,
                FemurLength        = updateRequest.FemurLength,
                FetalHeartRate     = updateRequest.FetalHeartRate,
                MotherWeight       = updateRequest.MotherWeight
            };

            await _unitOfWork.PregnancyHistoryRepository.AddAsync(pregnancyHistory);

            await _unitOfWork.SaveAsync();

            return(new Response <string>(null, $"Thêm thông tin thành công, id: \'{request.ChildId}\'"));
        }
示例#8
0
        public ActionResult PregnancyHistory(PregnancyHistory pregnancyhistory)
        {
            SurrogateService pregnancyService  = new SurrogateService();
            string           validationMessage = string.Empty;

            try
            {
                if (ValidatePregnancyHistoryInfoForm(pregnancyhistory, out validationMessage))
                {
                    pregnancyhistory.EntityState = pregnancyhistory.PregnancyHistoryID != null ? EntityState.Edit : EntityState.Save;
                    pregnancyhistory.ChangeBy    = ApplicationManager.LoggedInUser.UserID;
                    pregnancyhistory.UserID      = ApplicationManager.LoggedInUser.UserID;

                    pregnancyhistory = pregnancyService.SavePregnancyHistory(pregnancyhistory);

                    if (pregnancyhistory.responseDetail.responseType == ResponseType.Error)
                    {
                        WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), pregnancyhistory.responseDetail.ResponseMessage, "5000");

                        return(View("PregnancyHistory", pregnancyhistory));
                    }
                    else
                    {
                        WebHelper.SetMessageBoxProperties(this, ResponseType.Success);
                    }
                }
                else
                {
                    WebHelper.SetMessageBoxProperties(this, ResponseType.Error, validationMessage);

                    return(View("PregnancyHistory", pregnancyhistory));
                }
            }
            catch (Exception ex)
            {
                WebHelper.SetMessageAlertProperties(this, ResponseType.Error.ToString(), ApplicationManager.GenericErrorMessage, "5000");
                LoggerHelper.WriteToLog(ex);
            }

            return(View("PregnancyHistory", pregnancyhistory));
        }
        public BrokerOperationResult SavePregnancyHistory(string patientDfn, PregnancyHistory pregnancyHistory)
        {
            // *** Save new pregnancy history observations ***

            BrokerOperationResult result = new BrokerOperationResult();

            List <DsioObservation> observationsToSave = GetObservationsToSave(patientDfn, pregnancyHistory);

            // *** If there's something to save ***
            if (observationsToSave.Count > 0)
            {
                // *** Create the command ***
                DsioSaveObservationCommand command = new DsioSaveObservationCommand(this.broker);

                // *** Set some loop values ***
                bool okToContinue = true;
                int  i            = 0;

                // TODO: Simplify and shorten...

                // *** Loop through the observations ***
                while ((i < observationsToSave.Count) && (okToContinue))
                {
                    // *** Get the current ***
                    DsioObservation observation = observationsToSave[i];

                    // *** Set the patient dfn ***
                    observation.PatientDfn = patientDfn;

                    // *** Set the date/time ***
                    observation.ExamDate = DateTime.Now.ToString(VistaDates.VistADateFormatFour);

                    // *** Add the command arguments ***
                    command.AddCommandArguments(observation);

                    // *** Execute the command ***
                    RpcResponse response = command.Execute();

                    // *** Set the return response ***
                    result.Success = (response.Status == RpcResponseStatus.Success);
                    result.Message = response.InformationalMessage;

                    // *** Continue if successful ***
                    okToContinue = result.Success;

                    // *** Set index to next ***
                    i++;
                }

                if (okToContinue)
                {
                    // *** Save G&P Summary ***
                    DsioObservation observation = new DsioObservation();
                    observation.Code.CodeSystemName = "NONE";
                    observation.Code.Code           = "GravidaParaSummary";
                    observation.Category            = "Pregnancy History";
                    observation.Code.DisplayName    = "Gravida & Para Summary";

                    // *** Set the patient dfn ***
                    observation.PatientDfn = patientDfn;

                    // *** Set the date/time ***
                    observation.ExamDate = DateTime.Now.ToString(VistaDates.VistADateFormatFour);

                    // *** Add the value ***
                    observation.Value = pregnancyHistory.GravidaPara;

                    // *** Add the command arguments ***
                    command.AddCommandArguments(observation);

                    // *** Execute the command ***
                    RpcResponse response = command.Execute();

                    // *** Set the return response ***
                    result.Success = (response.Status == RpcResponseStatus.Success);
                    result.Message = response.InformationalMessage;

                    // *** Continue if successful ***
                    okToContinue = result.Success;
                }
            }
            else
            {
                result.Success = true;
                result.Message = "Nothing to save";
            }

            return(result);
        }
 public PregnancyHistoryResult()
 {
     this.PregnancyHistory = new PregnancyHistory();
 }