/// <summary> /// 手机预约信息,并返回给用户 /// <returns>成功则返回用户信息</returns> /// </summary> public async Task <IActionResult> Json_GetReservationInfo(int customerID, int departmentID, int doctorId, DateTime reservationDate, int reservationSlot, int?registOpId = null, string registOpMan = "", int?rxDoctorId = null) { try { if (!registOpId.HasValue) { try { registOpId = UserSelf.OpId; registOpMan = UserSelf.OpManFullMsg; } catch { } } //var u = UserLoginData; //姓名 var cust = _db.CHIS_Code_Customer.FirstOrDefault(m => m.CustomerID == customerID); //科室 var depart = _db.vwCHIS_Code_Department.FirstOrDefault(m => m.DepartmentID == departmentID); if (depart == null) { throw new Exception("科室没有找到"); } //医生 var employee = _db.vwCHIS_Code_Doctor.FirstOrDefault(m => m.DoctorId == doctorId); var workInfo = new DoctorCBL(this).GetEmployeeOnDutyInfo(doctorId, reservationDate, reservationSlot); if (workInfo == null) { workInfo = new DoctorCBL(this).InitalEmployeeOnDutyInfo(doctorId, depart.DepartmentID, reservationDate, reservationDate.AddDays(7)).FirstOrDefault(); } var timestr = $"{workInfo.FromTime?.ToString(@"hh\:mm")}—{workInfo.ToTime?.ToString(@"hh\:mm")}"; var add = await _resSvr.AddOneRegister(cust.CustomerID, depart.DepartmentID, doctorId, depart.StationID.Value, reservationDate, reservationSlot, RegistFrom.V20Web , opId : registOpId, opMan : registOpMan, rxDoctorId : rxDoctorId ); //给用户发送短信 StringBuilder b = new StringBuilder(); b.Append($"尊敬的{cust.CustomerName},请于{reservationDate.ToString("yyyy年MM月dd日")} {timestr} 至{depart.DepartmentName}({employee.DoctorName})医生处就诊,感谢您的预约。【天使健康】"); Codes.Utility.SMS sms = new Codes.Utility.SMS(); //await new SendVCodeCBL(this).SendVCode(cust.Telephone, b.ToString()); var rlt = await sms.PostSmsInfoAsync(cust.CustomerMobile, b.ToString()); return(Json(new { rlt = true, msg = "", rltCode = add.HaveRegisted ? "REPET_REGIST" : "", registStatus = add.HaveRegisted ? "请注意,您已经预约了,不能重复预约。先前预约信息如下。" : "", registerId = add.RegisterID, registerSeq = add.RegisterSeq, customer = cust, stationName = depart.StationName, departmentName = depart.DepartmentName, employee = employee, reservationDate = reservationDate.ToString("yyyy-MM-dd"), timeInfo = timestr })); } catch (Exception ex) { return(Json(new { rlt = false, msg = ex.Message })); } }
/// <summary> /// 获取医生出勤信息 /// </summary> public IActionResult Json_GetDoctorWorkInfos(int doctorId, int stationId, DateTime dateFrom, DateTime dateTo) { try { dateFrom = (dateFrom.Date <= DateTime.Now.Date ? DateTime.Now.AddDays(0).Date : dateFrom.Date); if (dateTo <= dateFrom || ((dateTo - DateTime.Now).TotalDays > 16)) { dateTo = DateTime.Now.AddDays(16).Date; } var finds = new DoctorCBL(this).InitalEmployeeOnDutyInfo(doctorId, stationId, dateFrom, dateTo).Select( m => new Models.ViewModels.EmployeeWorkInfo { DoctorId = doctorId, DoctorName = m.DoctorName, WorkDate = m.ScheduleDate, Work_Vacation = m.IsWorkSlot == false ? "VACATION" : "WORK", SlotIndex = m.Slot.Value, SlotTimeStart = m.FromTime.Value, SlotTimeEnd = m.ToTime.Value, AllowRegNum = m.MaxCount, ReservateLimitNum = m.ReservateLimitNum, ReservatedNum = m.ReservatedNum }).ToList().OrderBy(m => m.WorkDate).OrderBy(m => m.SlotIndex); //所有考察的时间 var tagDays = new List <DateTime>(); for (int i = 0; i <= (dateTo - dateFrom).Days; i++) { tagDays.Add(dateFrom.AddDays(i).Date); } //获取有上班日的时间表 var workDayList = (from item in finds where item.IsWork orderby item.WorkDate select item.WorkDate.Date).Distinct(); //不工作的时间 var notWorkDays = from item in tagDays where !workDayList.Contains(item) select item.ToString("yyyy-MM-dd"); return(Json(new { rlt = true, msg = "医生的上班情况", items = finds, workDays = workDayList, notWorkDays = notWorkDays })); } catch (Exception ex) { return(Json(new { rlt = false, msg = ex.Message })); } }
//工作站站医生 public async Task <IActionResult> DoctorIndex(string viewName = "DoctorIndex", object model = null) { //此处要做一个登录后的信息校验 var cbl = new DoctorCBL(this); var b0 = await cbl.IsNeedCompleteDoctorInfo(this.UserSelf.DoctorId); if (b0) { return(RedirectToAction("DoctorInfos", "MyPanel")); } else if (cbl.IsCheckingOccupationInfo(this.UserSelf.DoctorId)) { return(RedirectToAction("CheckingOccupationInfo", "MyPanel")); } else { await Logger.WriteInfoAsync("Home", "Login", $"用户({UserSelf.DoctorId},{UserSelf.DoctorName})登入系统,工作站({UserSelf.StationId},{UserSelf.StationName})。"); return(View(viewName, model)); } }
public IActionResult DoctorOccupationInfosSave(CHIS.Models.DataModel.vwDoctor model, List <int> departsId, List <CHIS_Code_DoctorCertbook> certbooks) { return(TryCatchFunc(() => { var docId = this.UserSelf.DoctorId; var doc = _db.CHIS_Code_Doctor.FirstOrDefault(m => m.DoctorId == docId); if (doc.PostTitle != model.DoctorBase.PostTitle) { doc.PostTitle = model.DoctorBase.PostTitle; doc.IsChecking = true; } doc.DoctorSkillRmk = model.DoctorBase.DoctorSkillRmk; _db.SaveChanges(); var cbl = new DoctorCBL(this); //更新部门信息 bool rlt = cbl.ChangeDoctorDeparts(departsId, docId); //更新证书 bool rlt2 = cbl.ChangeDoctorCertbooks(certbooks, docId); return null; })); }
//获取医生当日班次剩余预约数量等信息 public IActionResult Json_GetDoctorReservationInfo(int doctorId, DateTime date, int slotNum) { try { var findDutys = new DoctorCBL(this).GetEmployeeOnDutyInfo(doctorId, date, slotNum); int restReservatedNum = findDutys.ReservateLimitNum - findDutys.ReservatedNum; //剩余预约数量 if (date.Date == DateTime.Today) //如果是当日 { restReservatedNum = findDutys.MaxCount + findDutys.AddCount - findDutys.TodayRegistedNum; } bool isFull = (restReservatedNum <= 0); return(Json(new { rlt = true, msg = "", isWorkSlot = findDutys.IsWorkSlot.Value, isFull = isFull, restReservatedNum = restReservatedNum })); } catch (Exception ex) { return(Json(new { rlt = false, msg = ex.Message })); } }
public async Task <IActionResult> LoadDoctorsOfMyStation(string searchText, int?stationId, string timeRange = "All", bool?isVed = null, int pageIndex = 1, int pageSize = 20) { initialData_Page(ref pageIndex, ref pageSize); DateTime?dt0 = null, dt1 = null; initialData_TimeRange(ref dt0, ref dt1, timeRange); if (!stationId.HasValue) { stationId = UserSelf.StationId; } //bool btimeRange = timeRange != "All"; //var ds = await new CHIS.DAL.Doctor().LoadDoctorListAsync(searchText, stationId, dt0.Value, dt1.Value, isVed,btimeRange, pageIndex, pageSize); //return PartialView("_pvDoctorsOfMyStationList2", new Ass.Mvc.PageListInfoDs(ds)); var find = new DoctorCBL(this).queryDoctorsOfMyStation(stationId.Value); if (timeRange != "All") { find = find.Where(m => m.DoctorCreateTime >= dt0 && m.DoctorCreateTime < dt1); } if (isVed.HasValue) { find = find.Where(m => m.DoctorIsAuthenticated == isVed.Value); } if (searchText.IsNotEmpty()) { var t = searchText.GetStringType(); if (t.IsMobile) { find = find.Where(m => m.CustomerMobile == t.String); } else if (t.IsEmail) { find = find.Where(m => m.Email == t.String); } else if (t.IsIdCardNumber) { find = find.Where(m => m.IDcard == t.String); } else if (t.IsLoginNameLegal) { find = find.Where(m => m.LoginName == t.String); } else { find = find.Where(m => m.DoctorName == t.String); } } var total = find.Count(); find = find.OrderBy(m => m.DoctorId).Skip((pageIndex - 1) * pageSize).Take(pageSize); var list = await find.ToListAsync(); var model = new Ass.Mvc.PageListInfo <Models.vwCHIS_Code_Doctor> { DataList = list, RecordTotal = total, PageIndex = pageIndex, PageSize = pageSize }; return(PartialView("_pvDoctorsOfMyStationList", model)); }