コード例 #1
0
        public JsonResult IsPaid(int patientId, DateTime date)
        {
            var result = _receptionistService.ChangeIsPaid(patientId, date);

            if (result == true)
            {
                var   tokens  = _receptionistService.GetAllTokens();// lấy tất cả device token
                int[] roleIds =
                {
                    (int)RoleEnum.Receptionist,
                    (int)RoleEnum.Nurse,
                    (int)RoleEnum.Cashier,
                    //(int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Thanh toán hoàn tất"
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            return(Json(new
            {
                success = result
            }));
        }
コード例 #2
0
        public HttpResponseMessage UpdateAppointment(AppointmentDto appointmentDto)
        {
            var result = this._appointmentService.UpdateAppointment(appointmentDto.AppointmentId, appointmentDto.SampleGettingDtos);

            // push noti
            if (result.Success)
            {
                var   tokens  = _tokenService.GetAll();
                int[] roleIds =
                {
                    (int)RoleEnum.Receptionist,
                    (int)RoleEnum.Cashier,
                    (int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Có cuộc hẹn vừa được chỉnh sửa."
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, result);

            return(response);
        }
コード例 #3
0
        public JsonResult DeleteSampleGetting(int sgId)
        {
            var result = _receptionistService.DeleteSG(sgId);

            if (result == true)
            {
                var   tokens  = _receptionistService.GetAllTokens();// lấy tất cả device token
                int[] roleIds =
                {
                    (int)RoleEnum.Receptionist,
                    //(int)RoleEnum.Nurse,
                    //(int)RoleEnum.Cashier,
                    //(int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Xóa cuộc hẹn thành công"
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            return(Json(new
            {
                success = result
            }));
        }
コード例 #4
0
        public HttpResponseMessage Create(AppointmentDto appoinDto)
        {
            if (appoinDto.PatientId != null)
            {
                appoinDto.PatientId = appoinDto.PatientId;
            }
            // call to AppointmentService
            var result = _appointmentService.Create(appoinDto);

            // push noti
            if (result.Success)
            {
                var   tokens  = _tokenService.GetAll();
                int[] roleIds =
                {
                    (int)RoleEnum.Receptionist,
                    (int)RoleEnum.Cashier,
                    (int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Có cuộc hẹn vừa được thêm."
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, result);

            return(response);
        }
コード例 #5
0
        public HttpResponseMessage DeleteAppointment(int appointmentId)
        {
            var result = this._appointmentService.DeleteAppointment(appointmentId);

            // send noti
            if (result.Success)
            {
                var   tokens  = _tokenService.GetAll();
                int[] roleIds =
                {
                    (int)RoleEnum.Receptionist,
                    (int)RoleEnum.Cashier,
                    (int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Có cuộc hẹn vừa được hủy."
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            var response = Request.CreateResponse(HttpStatusCode.OK, result);

            return(response);
        }
コード例 #6
0
        public JsonResult IsGot(int sampleGettingId)
        {
            var result = _nurseService.ChangeIsGot(sampleGettingId);

            if (result == true)
            {
                var   tokens  = _nurseService.GetAllTokens();// lấy tất cả device token
                int[] roleIds =
                {
                    //(int)RoleEnum.Receptionist,
                    (int)RoleEnum.Nurse,
                    (int)RoleEnum.Cashier,
                    //(int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Hoàn tất lấy mẫu"
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            return(Json(new
            {
                success = result
            }));
        }
コード例 #7
0
        public IHttpActionResult SendMessage(string message)
        {
            var tokens = _appointmentService.GetAllTokens();

            foreach (var token in tokens)
            {
                var data = new
                {
                    to   = token.TokenString,
                    data = new
                    {
                        message = message,
                    }
                };
                try
                {
                    SendNotificationUtils.SendNotification(data);
                }
                catch (Exception ex)
                {
                    //
                }
            }
            return(Ok());
        }
コード例 #8
0
        public JsonResult CheckNDeleteUrine(DateTime dateTime)
        {
            var result = _cashierService.CheckAndDeleteUrine(dateTime);

            if (result > 0)
            {
                var   tokens  = _cashierService.GetAllTokens();// lấy tất cả device token
                int[] roleIds =
                {
                    //(int)RoleEnum.Receptionist,
                    (int)RoleEnum.Cashier,
                    (int)RoleEnum.Receptionist,
                    //(int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Xóa cuộc hẹn xét nghiệm nước tiểu"
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            return(Json(new
            {
                success = result
            }));
        }
コード例 #9
0
        public JsonResult UpdateLabTestingFail(int id)
        {
            var result  = _labTestingService.UpdateFail(id);
            var result1 = _labTestingService.GetLabTesting(id);
            //từ labtesting lấy ra samplegetting
            var s = result1.SampleGettingId; var sampleGetting = _sampleGettingService.GetSampleGetting(int.Parse(s.ToString()));
            //từ samplegetting lấy ra appointment
            var z = sampleGetting.AppointmentId; var appointment = _appointmentService.GetSingleById(int.Parse(z.ToString()));
            //từ samplegetting lấy ra sample
            var m = sampleGetting.SampleId; var sample = _sampleService.GetSampleById(int.Parse(m.ToString()));
            //từ appointment lấy ra patient
            var l = appointment.PatientId; var patient = _patientService.GetPatientById(int.Parse(l.ToString()));

            if (result == true)
            {
                var   tokens  = _tokenService.GetAll();
                int[] roleIds =
                {
                    (int)RoleEnum.Receptionist,
                    (int)RoleEnum.Cashier,
                    (int)RoleEnum.Manager
                };
                var data = new
                {
                    roleIds,
                    message = "Bệnh nhân: " + patient.FullName + " ĐT:" + patient.PhoneNumber + " Cần làm lại xét nghiệm: " + sample.SampleName,
                };
                SendNotificationUtils.SendNotification(data, tokens);

                /*
                 * var tokens = _appointmentService.GetAllTokens();
                 * foreach (var token in tokens)
                 * {
                 *  var data = new
                 *  {
                 *      to = token.TokenString,
                 *      data = new
                 *      {
                 *          message = "Bệnh nhân: " + patient.FullName + " ĐT:" + patient.PhoneNumber + " Cần làm lại xét nghiệm: " + sample.SampleName,
                 *      }
                 *  };
                 *  try
                 *  {
                 *      SendNotificationUtils.SendNotification(data);
                 *  }
                 *  catch (Exception ex)
                 *  {
                 *      //
                 *  }
                 * }/**/
            }
            return(Json(new
            {
                sucess = result
            }));
        }
コード例 #10
0
        public JsonResult UpdateResult(string code, string con, string cmt)
        {
            var result = _appointmentService.Update(code, con, cmt);

            if (result == true)
            {
                var   tokens  = _tokenService.GetAll();
                int[] roleIds =
                {
                    (int)RoleEnum.Patient
                };
                var data = new
                {
                    roleIds,
                    message = "Bạn đã có kết quả xét nghiệm."
                };
                SendNotificationUtils.SendNotification(data, tokens);
            }
            return(Json(new
            {
                success = result
            }));
        }