Exemplo n.º 1
0
        public void InsertConsultation(ConsultationModel consultation)
        {
            consultation.IdConsultation = Guid.NewGuid();

            dbContext.Consultations.InsertOnSubmit(MapModelToDbObject(consultation));
            dbContext.SubmitChanges();
        }
Exemplo n.º 2
0
        public async Task <IActionResult> UpdateConsultation([FromRoute] int id, [FromBody] ConsultationModel consultation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var findConsultation = _db.Consultations.FirstOrDefault(d => d.cons_id == id);

            var findReport = _db.Reports.FirstOrDefault(r => r.report_cons_id == id);

            if (findConsultation == null)
            {
                return(NotFound());
            }

            // If the consultation was found
            findConsultation.cons_title                  = consultation.cons_title;
            findConsultation.cons_date                   = consultation.cons_date;
            findConsultation.cons_type                   = consultation.cons_type;
            findConsultation.cons_symptoms               = consultation.cons_symptoms;
            findConsultation.cons_blood_pressure         = consultation.cons_blood_pressure;
            findConsultation.cons_cost                   = consultation.cons_cost;
            findConsultation.cons_temp                   = consultation.cons_temp;
            findConsultation.cons_diagnosis              = consultation.cons_diagnosis;
            findConsultation.cons_treatment              = consultation.cons_treatment;
            findConsultation.cons_insurance_confirmation = consultation.cons_insurance_confirmation;

            _db.Entry(findConsultation).State = EntityState.Modified;

            await _db.SaveChangesAsync();

            return(Ok(new JsonResult("The Consultation with id " + id + " is updated")));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Subject,Description")] ConsultationModel consultationModel)
        {
            if (id != consultationModel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(consultationModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConsultationModelExists(consultationModel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(consultationModel));
        }
        public Task AddConsultation(ConsultationModel consultation)
        {
            string sql = $@"INSERT INTO consultation (Date, Notes, Medicines, Days, MaramTherapyDone, AmountCharged, AmountReceived, PatientId) 
                           VALUES (@Date, @Notes, @Medicines, @Days, {(consultation.MaramTherapyDone ? 1 : 0)}, @AmountCharged, @AmountReceived, @PatientId);";

            return(_db.SaveData(sql, consultation));
        }
Exemplo n.º 5
0
        public IActionResult GetConsultationById([FromRoute] int id)
        {
            var findConsultation = _db.Consultations.FirstOrDefault(c => c.cons_id == id);

            if (findConsultation != null)
            {
                ConsultationModel consultation = new ConsultationModel();
                consultation.cons_title                  = findConsultation.cons_title;
                consultation.cons_date                   = findConsultation.cons_date;
                consultation.cons_type                   = findConsultation.cons_type;
                consultation.cons_symptoms               = findConsultation.cons_symptoms;
                consultation.cons_diagnosis              = findConsultation.cons_diagnosis;
                consultation.cons_temp                   = findConsultation.cons_temp;
                consultation.cons_blood_pressure         = findConsultation.cons_blood_pressure;
                consultation.cons_cost                   = findConsultation.cons_cost;
                consultation.cons_treatment              = findConsultation.cons_treatment;
                consultation.cons_insurance_confirmation = findConsultation.cons_insurance_confirmation;

                return(Ok(new JsonResult(consultation)));
            }

            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 6
0
        public bool SaveConsultation(ConsultationModel model)
        {
            try
            {
                DBResource newConnection = new DBResource();
                newConnection.DBOpen();

                SqlCommand comm = new SqlCommand();
                comm.Connection  = DBResource.conn;
                comm.CommandText = "dbo.SaveConsultation";
                comm.CommandType = CommandType.StoredProcedure;

                comm.Parameters.AddWithValue("@consultaton_id", model.ConsultatonId);
                comm.Parameters.AddWithValue("@member_code", model.MemberCOde);
                comm.Parameters.AddWithValue("@time_in", model.TimeIn);
                comm.Parameters.AddWithValue("@time_out", model.TimeOut);
                comm.Parameters.AddWithValue("@complaints", model.Complaints);
                comm.Parameters.AddWithValue("@medicine", model.Medicine);
                comm.Parameters.AddWithValue("@quantity", model.Quantity);
                comm.Parameters.AddWithValue("@disposition", model.Disposition);
                comm.Parameters.AddWithValue("@diag_code", model.DiagCode);
                comm.Parameters.AddWithValue("@created_by", model.CreatedBy);
                comm.Parameters.AddWithValue("@created_date", model.CreatedDate);

                comm.ExecuteNonQuery();
                newConnection.DBClose();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 7
0
        private List <Parameter> GetConsultationParamsForStatusUpdate(ConsultationModel model)
        {
            List <Parameter> param = new List <Parameter>();

            param.Add(new Parameter("@ConsultationID", model.Id));
            param.Add(new Parameter("@ConsultationStatusID", model.ConsultationStatusID));
            param.Add(new Parameter("@TenantID", model.TenantID));
            param.Add(new Parameter("@CreatedUserID", model.CreatedBy));
            param.Add(new Parameter("@CreatedByEntity", model.CreatedByEntity));
            return(param);
        }
        public async Task <IActionResult> Create([Bind("Id,Subject,Description")] ConsultationModel consultationModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(consultationModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(consultationModel));
        }
Exemplo n.º 9
0
 public bool saveConsultation(ConsultationModel model)
 {
     try
     {
         _dataAccess.SaveConsultation(model);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 10
0
        public IActionResult Add(int id, [FromForm] ConsultationModel consult)
        {
            consult.CustomerID = id;
            if (ModelState.IsValid)
            {
                Context.Add <ConsultationModel>(consult);
                Context.SaveChanges();
                return(RedirectToAction("Index", new { id }));
            }

            return(View(consult));
        }
Exemplo n.º 11
0
        private ConsultationModel MapConsultation(DataRow row, int tanentId)
        {
            ConsultationModel consultationModel = null;

            if (row != null)
            {
                consultationModel             = new ConsultationModel();
                consultationModel.Id          = Convert.ToInt32(row["ConsultationID"]);
                consultationModel.Description = row["ConsultationDescription"] != null?Convert.ToString(row["ConsultationDescription"]) : string.Empty;

                consultationModel.ConsultationTime = new InternalDateTime(Convert.ToInt64(row["PreferredTime"]));
                consultationModel.PatientId        = Convert.ToInt32(row["PatientID"]);
                consultationModel.DoctorId         = row["DoctorID"] != null?Convert.ToInt64(row["DoctorID"]) : 0;

                consultationModel.ConsultationModeID = row["ConsultationModeID"] != null?Convert.ToInt32(row["ConsultationModeID"]) : 0;

                consultationModel.ConsultationMode = row["ModeDescription"] != null?Convert.ToString(row["ModeDescription"]) : string.Empty;

                consultationModel.ConsultationStatusID = row["ConsultationStatusID"] != null?Convert.ToInt32(row["ConsultationStatusID"]) : 0;

                consultationModel.ConsultationStatus = row["ConsultationStatusDesc"] != null?Convert.ToString(row["ConsultationStatusDesc"]) : string.Empty;

                consultationModel.CreatedBy       = Convert.ToInt32(row["CreatedBy"]);
                consultationModel.CreatedByEntity = Convert.ToInt32(row["CreatedByEntity"]);
                consultationModel.CreatedOn       = new InternalDateTime(Convert.ToInt64(row["CreatedOn"]));
                consultationModel.ModifiedBy      = row["ModifiedBy"] != null?Convert.ToInt32(row["ModifiedBy"]) : 0;

                consultationModel.ModifiedByEntity = row["ModifiedByEntity"] != null?Convert.ToInt32(row["ModifiedByEntity"]) : 0;

                consultationModel.ModifiedOn = new InternalDateTime(Convert.ToInt64(row["ModifiedOn"]));
                consultationModel.TenantID   = row["TenantID"] != null?Convert.ToInt32(row["TenantID"]) : 0;

                if (consultationModel.PatientId > 0)
                {
                    consultationModel.Patient = new PatientDetail()
                    {
                        //Id = consultationModel.PatientId,(base Model ID shouls be long currently all IDs Type are not in sync)
                        PatientName = row["PatientName"] != null?Convert.ToString(row["PatientName"]) : string.Empty,
                                          PatientGender = row["PatientGender"] != null?Convert.ToChar(row["PatientGender"]) : ' ',
                                                              Complaints = row["Complaints"] != null?Convert.ToString(row["Complaints"]) : string.Empty,
                                                                               ConsultationType = row["ConsultationType"] != null?Convert.ToInt32(row["ConsultationType"]) : 0,
                                                                                                      PatientPhone = row["PatientPhone"] != null?Convert.ToString(row["PatientPhone"]) : string.Empty,
                                                                                                                         PatientAge                                                          = row["PatientAge"] != null?Convert.ToInt16(row["PatientAge"]) : (short)0,
                                                                                                                                                                 Files                       = row["PatientFileIds"] != null?Convert.ToString(row["PatientFileIds"]) : string.Empty,
                                                                                                                                                                                        Case = row["Case"] != null?Convert.ToInt16(row["Case"]) : (short)0,
                                                                                                                                                                                                   PreferredTime = row["PatientPreferredTime"] != null?Convert.ToInt16(row["PatientPreferredTime"]) : (short)0
                    };
                }
            }
            return(consultationModel);
        }
        private ConsultationModel MapMyConsultation(DataRow row, int tanentId)
        {
            ConsultationModel consultationModel = null;

            if (row != null)
            {
                consultationModel             = new ConsultationModel();
                consultationModel.Id          = Convert.ToInt32(row["ConsultationID"]);
                consultationModel.Description = row["ConsultationDescription"] != null?Convert.ToString(row["ConsultationDescription"]) : string.Empty;

                consultationModel.ConsultationTime = new InternalDateTime(Convert.ToInt64(row["PreferredTime"]));
                consultationModel.PatientId        = Convert.ToInt32(row["PatientID"]);
                consultationModel.DoctorId         = row["DoctorID"] != null?Convert.ToInt64(row["DoctorID"]) : 0;

                consultationModel.ConsultationModeID = row["ConsultationModeID"] != null?Convert.ToInt32(row["ConsultationModeID"]) : 0;

                consultationModel.ConsultationMode = row["ModeDescription"] != null?Convert.ToString(row["ModeDescription"]) : string.Empty;

                consultationModel.ConsultationStatusID = row["ConsultationStatusID"] != null?Convert.ToInt32(row["ConsultationStatusID"]) : 0;

                consultationModel.ConsultationStatus = row["ConsultationStatusDesc"] != null?Convert.ToString(row["ConsultationStatusDesc"]) : string.Empty;

                consultationModel.CreatedBy       = Convert.ToInt32(row["CreatedBy"]);
                consultationModel.CreatedByEntity = Convert.ToInt32(row["CreatedByEntity"]);
                consultationModel.CreatedOn       = new InternalDateTime(Convert.ToInt64(row["CreatedOn"]));
                consultationModel.ModifiedBy      = row["ModifiedBy"] != null?Convert.ToInt32(row["ModifiedBy"]) : 0;

                consultationModel.ModifiedByEntity = row["ModifiedByEntity"] != null?Convert.ToInt32(row["ModifiedByEntity"]) : 0;

                consultationModel.ModifiedOn = new InternalDateTime(Convert.ToInt64(row["ModifiedOn"]));
                consultationModel.TenantID   = row["TenantID"] != null?Convert.ToInt32(row["TenantID"]) : 0;

                if (consultationModel.PatientId > 0)
                {
                    consultationModel.Patient = new PatientDetail()
                    {
                        PatientName = row["PatientName"] != null?Convert.ToString(row["PatientName"]) : string.Empty
                    };
                }
                if (consultationModel.DoctorId > 0)
                {
                    consultationModel.Doctor = new DoctorModel()
                    {
                        FirstName = row["DoctorFirstName"] != null?Convert.ToString(row["DoctorFirstName"]) : string.Empty,
                                        LastName = row["DoctorLastName"] != null?Convert.ToString(row["DoctorLastName"]) : string.Empty
                    };
                }
            }
            return(consultationModel);
        }
        public Task EditConsultation(ConsultationModel consultation)
        {
            string sql = $@"UPDATE consultation
                           SET
                           Date = @Date,
                           Notes = @Notes,
                           Medicines = @Medicines,
                           Days = @Days,
                           MaramTherapyDone = {(consultation.MaramTherapyDone ? 1 : 0)},
                           AmountCharged = @AmountCharged,
                           AmountReceived = @AmountReceived
                           WHERE Id = @Id;";

            return(_db.SaveData(sql, consultation));
        }
Exemplo n.º 14
0
        private List <Parameter> GetConsultationParams(ConsultationModel model)
        {
            List <Parameter> param = new List <Parameter>();

            param.Add(new Parameter("@Description", model.Description));
            param.Add(new Parameter("@PreferredTime", model.ConsultationTime.DateTimeInLong));
            param.Add(new Parameter("@PatientID", model.PatientId));
            param.Add(new Parameter("@DoctorID", model.DoctorId));
            param.Add(new Parameter("@ConsultationModeID", model.ConsultationModeID));
            param.Add(new Parameter("@ConsultationStatusID", model.ConsultationStatusID));
            param.Add(new Parameter("@TenantID", model.TenantID));
            param.Add(new Parameter("@CreatedUserID", model.CreatedBy));
            param.Add(new Parameter("@CreatedByEntity", model.CreatedByEntity));
            return(param);
        }
Exemplo n.º 15
0
        public ActionResult Edit(Guid id, FormCollection collection)
        {
            try
            {
                ConsultationModel consultationModel = new ConsultationModel();
                UpdateModel(consultationModel);
                consultationRepository.UpdateConsultation(consultationModel);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("EditConsultation"));
            }
        }
Exemplo n.º 16
0
        public void UpdateConsultation(ConsultationModel consultation)
        {
            Consultation dbConsultation = dbContext.Consultations.FirstOrDefault(x => x.IdConsultation == consultation.IdConsultation);

            if (consultation != null)
            {
                dbConsultation.IdConsultation = consultation.IdConsultation;
                dbConsultation.IdVet          = consultation.IdVet;
                dbConsultation.IdPet          = consultation.IdPet;
                dbConsultation.Description    = consultation.Description;
                dbConsultation.Recomandation  = consultation.Recomandation;
                dbConsultation.EventDate      = consultation.EventDate;
                dbConsultation.IdOwner        = consultation.IdOwner;
                dbContext.SubmitChanges();
            }
        }
Exemplo n.º 17
0
        private Consultation MapModelToDbObject(ConsultationModel consultation)
        {
            Consultation dbConsultation = new Consultation();

            if (consultation != null)
            {
                dbConsultation.IdConsultation = consultation.IdConsultation;
                dbConsultation.IdVet          = consultation.IdVet;
                dbConsultation.IdPet          = consultation.IdPet;
                dbConsultation.Description    = consultation.Description;
                dbConsultation.Recomandation  = consultation.Recomandation;
                dbConsultation.EventDate      = consultation.EventDate;
                dbConsultation.IdOwner        = consultation.IdOwner;
                return(dbConsultation);
            }
            return(null);
        }
Exemplo n.º 18
0
        private ConsultationModel MapDbObjectToModel(Consultation dbConsultation)
        {
            ConsultationModel consultation = new ConsultationModel();

            if (dbConsultation != null)
            {
                consultation.IdConsultation = dbConsultation.IdConsultation;
                consultation.IdVet          = dbConsultation.IdVet;
                consultation.IdPet          = dbConsultation.IdPet;
                consultation.Description    = dbConsultation.Description;
                consultation.Recomandation  = dbConsultation.Recomandation;
                consultation.EventDate      = dbConsultation.EventDate;
                consultation.IdOwner        = dbConsultation.IdOwner;
                return(consultation);
            }
            return(null);
        }
Exemplo n.º 19
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                ConsultationModel consultationModel = new ConsultationModel();
                consultationModel.IdVet   = Guid.Parse(Request.Form["FirstName"]);
                consultationModel.IdPet   = Guid.Parse(Request.Form["Name"]);
                consultationModel.IdOwner = Guid.Parse(Request.Form["LastName"]);
                UpdateModel(consultationModel);
                consultationRepository.InsertConsultation(consultationModel);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("CreateConsultation"));
            }
        }
Exemplo n.º 20
0
        public bool SaveConsultation(ConsultationModel model)
        {
            try
            {
                DBResource newConnection = new DBResource();
                newConnection.DBOpen();

                SqlCommand comm = new SqlCommand();
                comm.Connection  = DBResource.conn;
                comm.CommandText = "dbo.SaveConsultation";
                comm.CommandType = CommandType.StoredProcedure;

                comm.Parameters.AddWithValue("@consultaton_id", model.ConsultatonId);
                comm.Parameters.AddWithValue("@GEID", model.GEID);
                comm.Parameters.AddWithValue("@member_code", model.MemberCode);
                comm.Parameters.AddWithValue("@time_in", model.TimeIn);
                comm.Parameters.AddWithValue("@time_out", model.TimeOut);
                comm.Parameters.AddWithValue("@complaints", model.Complaints);
                comm.Parameters.AddWithValue("@medicine", model.Medicine);
                comm.Parameters.AddWithValue("@disposition", model.Disposition);
                comm.Parameters.AddWithValue("@diag_code", model.DiagCode);

                if (Class.clsGlobal.lblrole == "Nurse")
                {
                    comm.Parameters.AddWithValue("@update_by_nurse", model.CreatedBy);
                    comm.Parameters.AddWithValue("@update_date_nurse", model.CreatedDate);
                }
                else
                {
                    comm.Parameters.AddWithValue("@update_by_doctor", model.CreatedBy);
                    comm.Parameters.AddWithValue("@update_date_doctor", model.CreatedDate);
                }

                comm.Parameters.AddWithValue("@role", Class.clsGlobal.lblrole);

                comm.ExecuteNonQuery();
                newConnection.DBClose();
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 21
0
        private void MapAndCreateConsultation(Patient patient, ConsultationModel model)
        {
            if (model == null)
            {
                return;
            }

            var consultation = new Consultation(patient, DateTime.Now, model.ComplementaryMethodRequested,
                                                model.Length, model.Weight, model.Alimentation, model.Comments, model.DefecatoryHabit,
                                                model.Evolution, model.SchoolPerformance, model.PhysicalExam, model.PhysicalActivity);

            var consultationId = _genericService.Create(consultation).Result;

            if (model.ComplementaryMethodRequested)
            {
                var complement = new Complement(consultationId, DateTime.Now);
                _genericService.Create(complement);
            }
        }
 public ConsultationViewModel MapDoctorConsultationModel(ConsultationModel model)
 {
     return(new ConsultationViewModel
     {
         Id = model.Id,
         DoctorId = model.DoctorId,
         PatientId = model.PatientId,
         ConsultationMode = model.ConsultationMode,
         ConsultationModeID = model.ConsultationModeID,
         ConsultationStatus = model.ConsultationStatus,
         ConsultationStatusID = model.ConsultationStatusID,
         ConsultationTime = model.ConsultationTime,
         Description = model.Description,
         CreatedBy = model.CreatedBy,
         CreatedByEntity = model.CreatedByEntity,
         ModifiedBy = model.ModifiedBy,
         ModifiedEntity = model.ModifiedByEntity,
         AmountCharged = model.AmountCharged,
         TanentId = model.TenantID,
         PrescriptionList = model.PrescriptionList != null?model.PrescriptionList.Split(';').ToList <string>() : new List <string>(),
         CaseNoteList = model.CaseNotesList != null?model.CaseNotesList.Split(';').ToList <string>() : new List <string>(),
         Patient = new PatientDetailViewModel()
         {
             Id = model.Patient.Id,
             PatientName = model.Patient.PatientName,
             PatientGender = model.Patient.PatientGender,
             PatientAge = model.Patient.PatientAge,
             PatientPhone = model.Patient.PatientPhone,
             Complaints = model.Patient.Complaints,
             UserID = model.Patient.UserID,
             CreatedBy = model.Patient.CreatedBy,
             CreatedByEntity = model.Patient.CreatedByEntity,
             ModifiedBy = model.Patient.ModifiedBy,
             ModifiedEntity = model.Patient.ModifiedByEntity,
             IsDeleted = model.Patient.IsDeleted,
             TanentId = model.Patient.TenantID,
             Files = model.Patient.Files != null?model.Patient.Files.Split(',').ToList <string>() : new List <string>(),
                         Case = model.Patient.Case,
                         PreferredTime = model.Patient.PreferredTime
         }
     });
 }
Exemplo n.º 23
0
        public void saveConsultation()
        {
            ConsultationBusiness _bll = new ConsultationBusiness();
            var db = new ConsultationModel();

            db.ConsultatonId = "123GG";
            db.MemberCode    = "12345678";
            db.TimeIn        = DateTime.Now;
            db.TimeOut       = DateTime.Now;
            db.Complaints    = "head ache";
            db.Medicine      = "biogesic";
            db.Disposition   = "n/a";
            db.DiagCode      = "Dx8252"; //head ache due to sleep deprivation
            db.CreatedBy     = "knguardian";
            db.CreatedDate   = DateTime.Now;

            _bll.saveConsultation(db);

            Assert.AreEqual(true, true);
        }
 public ConsultationViewListModel MapUserListViewConsultation(ConsultationModel model)
 {
     return(new ConsultationViewListModel
     {
         Id = model.Id,
         ConsultationMode = model.ConsultationMode,
         ConsultationStatus = model.ConsultationStatus,
         ConsultationTime = model.ConsultationTime,
         Description = model.Description,
         CreatedBy = model.CreatedBy,
         CreatedByEntity = model.CreatedByEntity,
         ModifiedBy = model.ModifiedBy,
         ModifiedEntity = model.ModifiedByEntity,
         TanentId = model.TenantID,
         PrescriptionList = model.PrescriptionList != null?model.PrescriptionList.Split(';').ToList <string>() : new List <string>(),
                                CaseNoteList = model.CaseNotesList != null?model.CaseNotesList.Split(';').ToList <string>() : new List <string>(),
                                                   PatientName = model.Patient != null ? model.Patient.PatientName : string.Empty,
                                                   DoctorFirstName = model.Doctor != null ? model.Doctor.FirstName : string.Empty,
                                                   DoctorLastName = model.Doctor != null ? model.Doctor.LastName : string.Empty
     });
 }
 public ConsultationViewModel MapMyConsultations(ConsultationModel model)
 {
     return(new ConsultationViewModel
     {
         Id = model.Id,
         Description = model.Description,
         ConsultationTime = model.ConsultationTime,
         PatientId = model.PatientId,
         DoctorId = model.DoctorId,
         ConsultationModeID = model.ConsultationModeID,
         ConsultationMode = model.ConsultationMode,
         ConsultationStatusID = model.ConsultationStatusID,
         ConsultationStatus = model.ConsultationStatus,
         CreatedBy = model.CreatedBy,
         CreatedByEntity = model.CreatedByEntity,
         CreatedOn = model.CreatedOn,
         ModifiedBy = model.ModifiedBy,
         ModifiedEntity = model.ModifiedByEntity,
         ModifiedOn = model.ModifiedOn,
         TanentId = model.TenantID
     });
 }
Exemplo n.º 26
0
        public async Task <IActionResult> AddConsultation([FromBody] ConsultationModel consultation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            string id = _userManager.GetUserId(HttpContext.User);

            var findDoctor = _db.Doctors.FirstOrDefault(d => d.dr_user_id == id);

            var newConsultation = new Consultation
            {
                cons_title                  = consultation.cons_title,
                cons_date                   = consultation.cons_date,
                cons_type                   = consultation.cons_type,
                cons_symptoms               = consultation.cons_symptoms,
                cons_blood_pressure         = consultation.cons_blood_pressure,
                cons_cost                   = consultation.cons_cost,
                cons_pat_id                 = consultation.cons_pat_id,
                cons_temp                   = consultation.cons_temp,
                cons_diagnosis              = consultation.cons_diagnosis,
                cons_treatment              = consultation.cons_treatment,
                cons_insurance_confirmation = consultation.cons_insurance_confirmation,
                cons_dr_id                  = findDoctor.dr_id
            };

            var addConsultation = await _db.Consultations.AddAsync(newConsultation);

            if (addConsultation != null)
            {
                var addReport = new ReportsController(_db).AddReport(newConsultation);
                await _db.SaveChangesAsync();

                return(Ok(new { ConsultationId = newConsultation.cons_id, Doctorid = newConsultation.cons_dr_id, Patientid = newConsultation.cons_pat_id, status = 1, message = "Registration of consultation Succeded on " + newConsultation.cons_date }));
            }
            return(BadRequest(new JsonResult("Can't add this consultation")));
        }
Exemplo n.º 27
0
        public ConsultationModel UpdateConsultationTime(ConsultationModel consultationModel)
        {
            List <Parameter> param      = GetConsultationParamsForTimeUpdate(consultationModel);
            Parameter        p_IsError  = new Parameter("@IsError", DBNull.Value, ParameterDirection.Output, DbType.Int16, 1);
            Parameter        p_ErrorMsg = new Parameter("@ErrorMsg", DBNull.Value, ParameterDirection.Output, DbType.String, 100);

            param.Add(p_IsError);
            param.Add(p_ErrorMsg);
            var r  = dataBaseService.ExecuteScalar(StoredProcedures.UpdateConsultationTime, DBCommandType.Procedure, param.ToArray());
            int Id = Convert.ToInt32(r);

            if (Id > 0)
            {
                consultationModel.Success = true;
                consultationModel.Id      = Id;
            }
            else
            {
                consultationModel.Success      = false;
                consultationModel.ErrorMessage = "Error in insert or update consultation time";
            }
            return(consultationModel);
        }
 public ConsultationViewModel MapConsultation(ConsultationModel model)
 {
     return(new ConsultationViewModel
     {
         Id = model.Id,
         IsDeleted = model.IsDeleted,
         CreatedBy = model.CreatedBy,
         CreatedByEntity = model.CreatedByEntity,
         CreatedOn = model.CreatedOn,
         ModifiedBy = model.ModifiedBy,
         ModifiedEntity = model.ModifiedByEntity,
         ModifiedOn = model.ModifiedOn,
         ConsultationModeID = model.ConsultationModeID,
         ConsultationStatusID = model.ConsultationStatusID,
         ConsultationTime = model.ConsultationTime,
         Description = model.Description,
         DoctorId = model.DoctorId,
         PatientId = model.PatientId,
         TanentId = model.TenantID,
         Prescriptions = MapConsultationPrescriptions(model.Prescriptions).ToList(),
         CaseNotes = MapConsultationNotes(model.CaseNotes).ToList(),
         Patient = MapPatient(model.Patient)
     });
 }
Exemplo n.º 29
0
        private void btnSaveConsultation_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.AppStarting;
            try
            {
                ConsultationModel consultationModel = new ConsultationModel();

                consultationModel.ConsultatonId = consultationID;
                consultationModel.GEID          = GEID;
                consultationModel.MemberCode    = membercode;
                consultationModel.TimeIn        = Convert.ToDateTime(txtTimeIn.Text);
                consultationModel.TimeOut       = Convert.ToDateTime(dtpTimeOut.Text + " " + dtpTimeOutTime.Text);
                consultationModel.Disposition   = cmbDisposition.Text.ToString();

                //getting listBoxComplaint items
                string complaints = "";
                foreach (var item in listComplaint.Items)
                {
                    complaints += item.ToString() + ",";
                }
                if (complaints == "")
                {
                    complaints = "";
                    consultationModel.Complaints = complaints;
                }
                else
                {
                    complaints = complaints.Remove(complaints.Length - 1);
                    consultationModel.Complaints = complaints;
                }

                //getting listViewMed items
                string medicine = "";
                foreach (ListViewItem itemRow in this.lvMedicine.Items)
                {
                    for (int i = 0; i < itemRow.SubItems.Count - 1; i++)
                    {
                        medicine += itemRow.Text + "," + itemRow.SubItems[1].Text + ",";
                    }
                }
                if (medicine == "")
                {
                    medicine = "";
                    consultationModel.Medicine = medicine;
                }
                else
                {
                    medicine = medicine.Remove(medicine.Length - 1);
                    consultationModel.Medicine = medicine;
                }

                consultationModel.CreatedBy   = clsGlobal.usercode;
                consultationModel.CreatedDate = DateTime.Now;

                if (clsGlobal.lblrole == "Doctor")
                {
                    //getting listViewMed items
                    string diagnosis = "";
                    foreach (ListViewItem itemRow in this.lvDiagnosis.Items)
                    {
                        for (int i = 0; i < itemRow.SubItems.Count - 1; i++)
                        {
                            diagnosis += itemRow.SubItems[1].Text + ",";
                        }
                    }
                    if (diagnosis == "")
                    {
                        diagnosis = "";
                        consultationModel.DiagCode = diagnosis;
                    }
                    else
                    {
                        diagnosis = diagnosis.Remove(diagnosis.Length - 1);
                        consultationModel.DiagCode = diagnosis;
                    }
                }

                _bll.saveConsultation(consultationModel);
                MessageBox.Show("Successfully saved!", "OCMS", MessageBoxButtons.OK);
                ClearAllText();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to saved" + ex.Message, "OCMS", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Cursor.Current = Cursors.Default;
        }
 public ConsultationViewModel MapUserConsultation(ConsultationModel model)
 {
     return(new ConsultationViewModel
     {
         Id = model.Id,
         ConsultationMode = model.ConsultationMode,
         ConsultationModeID = model.ConsultationModeID,
         ConsultationStatus = model.ConsultationStatus,
         ConsultationStatusID = model.ConsultationStatusID,
         ConsultationTime = model.ConsultationTime,
         Description = model.Description,
         CreatedBy = model.CreatedBy,
         CreatedByEntity = model.CreatedByEntity,
         ModifiedBy = model.ModifiedBy,
         ModifiedEntity = model.ModifiedByEntity,
         TanentId = model.TenantID,
         PrescriptionList = model.PrescriptionList != null?model.PrescriptionList.Split(';').ToList <string>() : new List <string>(),
         CaseNoteList = model.CaseNotesList != null?model.CaseNotesList.Split(';').ToList <string>() : new List <string>(),
         DoctorId = model.DoctorId,
         PatientId = model.PatientId,
         AmountCharged = model.AmountCharged,
         Patient = new PatientDetailViewModel()
         {
             Id = model.Patient.Id,
             PatientName = model.Patient.PatientName,
             PatientGender = model.Patient.PatientGender,
             PatientAge = model.Patient.PatientAge,
             PatientPhone = model.Patient.PatientPhone,
             Complaints = model.Patient.Complaints,
             UserID = model.Patient.UserID,
             CreatedBy = model.Patient.CreatedBy,
             CreatedByEntity = model.Patient.CreatedByEntity,
             ModifiedBy = model.Patient.ModifiedBy,
             ModifiedEntity = model.Patient.ModifiedByEntity,
             IsDeleted = model.Patient.IsDeleted,
             TanentId = model.Patient.TenantID,
             PreferredTime = model.Patient.PreferredTime,
             Case = model.Patient.Case,
             Files = model.Patient.Files != null?model.Patient.Files.Split(',').ToList <string>() : new List <string>()
         },
         Doctor = new DoctorViewModel()
         {
             FirstName = model.Doctor.FirstName,
             LastName = model.Doctor.LastName,
             Address1 = model.Doctor.Address1,
             CityID = model.Doctor.CityID,
             PhoneNumber = model.Doctor.PhoneNumber,
             DoctorCode = model.Doctor.DoctorCode,
             DoctorDescription = model.Doctor.DoctorDescription,
             DoctorDegree = model.Doctor.DoctorDegree.ToList(),
             DoctorDesease = model.Doctor.DoctorDesease.ToList(),
             DoctorHospital = model.Doctor.DoctorHospital.ToList(),
             DoctorSpecialization = model.Doctor.DoctorSpecialization.ToList(),
             EmailAddress = model.Doctor.EmailAddress,
             OtherInformation = model.Doctor.OtherInformation,
             Id = model.Doctor.Id,
             IsDeleted = model.Doctor.IsDeleted,
             CreatedBy = model.Doctor.CreatedBy,
             CreatedByEntity = model.Doctor.CreatedByEntity,
             CreatedOn = model.Doctor.CreatedOn,
             ModifiedBy = model.Doctor.ModifiedBy,
             ModifiedEntity = model.Doctor.ModifiedByEntity,
             ModifiedOn = model.Doctor.ModifiedOn,
             Pincode = model.Doctor.Pincode,
             ProfilePhotoID = model.Doctor.ProfilePhotoID,
             RegistrationNumber = model.Doctor.RegistrationNumber,
             TanentId = model.Doctor.TenantID,
             PersonalConsultationFee = model.Doctor.PersonalConsultationFee,
             TextConsultationFee = model.Doctor.TextConsultationFee,
             VideoConsultationFee = model.Doctor.VideoConsultationFee,
             PhoneConsultationFee = model.Doctor.PhoneConsultationFee
         }
     });
 }