public ActionResult MedicineTake()
        {
            if (Session["CheckFeed"] == null || !(bool) Session["CheckMedicineTake"])
            {
                Response.Write("<script>history.go(0);</script>");
                return View("Error");
            }

            var listService = new ListService();
            ViewData["CureTaskEmployee"] = listService.GetCureTaskEmployee();
            ViewData["CureType"] = listService.GetCureTypeList();
            ViewData["Medicine"] = listService.GetMedicineList();
            ViewData["Unit"] = listService.GetUnitList();
            //定义实际领取的药品
            var medicineTakeModel = new MedicineTakeModel();
            var cureTypeModels = new List<CureTypeModel>();
            var medicineTakeDetails = new List<MedicineTakeDetail>();
            var cureTypeModel = new CureTypeModel();
            var medicineTakeDetail = new MedicineTakeDetail();
            cureTypeModels.Add(cureTypeModel);
            medicineTakeDetails.Add(medicineTakeDetail);
            medicineTakeModel.CureType = cureTypeModels;
            cureTypeModel.MedicineTakeDetails = medicineTakeDetails;
            //定义任务的药品
            var cureDetails = new List<CureDetail>();
            var cureDetail = new CureDetail();
            cureDetails.Add(cureDetail);
            var cureMedicineDetails = new List<CureMedicineDetail>();
            var cureMedicineDetail = new CureMedicineDetail();
            cureMedicineDetails.Add(cureMedicineDetail);
            cureDetail.CureMedicineDetail = cureMedicineDetails;
            medicineTakeModel.CureTaskType = cureDetails;

            return View(medicineTakeModel);
        }
Exemplo n.º 2
0
        public MedicineTakeModel GetCureTaskByEmployeeId(long employeeId)
        {
            var medicineTakeModel = new MedicineTakeModel();

            var tasktypeService = new TaskTypeService();
            var taskEmployeeService = new TaskEmployeeService();
            var taskService = new TaskService();
            var cureTaskMethodService = new CureTaskMethodService();
            var cureTaskCourseService = new CureTaskCourseService();
            var cureTaskMedicineService = new CureTaskMedicineService();
            int taskflag = 0;
            long employeeTaskId = 0;
            long cureCourseId = 0;
            List<task_employee> alltask = taskEmployeeService.FindByEmployeeId(employeeId);
            //根据任务id找到任务类型,若是当天的治疗任务,记录taskid
            foreach (task_employee task in alltask)
            {
                long tasktypeid = taskService.Find(task.TaskId).TaskTypeId;
                string tasktype = tasktypeService.Find(tasktypeid).Name;
                if (tasktype == "治疗")
                {
                    //判断当前记录的时间是否和任务中某一个疗程的开始时间相同,若是,则代表当天有治疗任务
                    List<cure_task_course> cureTaskCourses = cureTaskCourseService.FindByTaskId(task.TaskId);
                    foreach (cure_task_course cureTaskCourse in cureTaskCourses)
                    {
                        if (cureTaskCourse.Time.ToShortDateString() == DateTime.Now.ToShortDateString())
                        {
                            taskflag = 1;
                            employeeTaskId = task.TaskId;
                            cureCourseId = cureTaskCourse.Id;
                            medicineTakeModel.TaskCourseId = cureCourseId;
                        }
                    }
                }
            }
            if (taskflag == 1)
            {
                List<cure_task_method> cureTaskMethods = cureTaskMethodService.FindByCureTaskCourseId(cureCourseId);
                var cureDetails = new List<CureDetail>();
                CureDetail cureDetail = null;
                medicineTakeModel.CureTaskType = cureDetails;
                foreach (cure_task_method cureTaskMethod in cureTaskMethods)
                {
                    cureDetail = new CureDetail();
                    cureDetail.CureType = cureTaskMethod.cure_type.Name;
                    cureDetails.Add(cureDetail);
                    var cureMedicineDetails = new List<CureMedicineDetail>();
                    cureDetail.CureMedicineDetail = cureMedicineDetails;
                    CureMedicineDetail cureMedicineDetail = null;
                    List<cure_task_medicine> cureTaskMedicines =
                        cureTaskMedicineService.FindByCureTaskMethodId(cureTaskMethod.Id);
                    foreach (cure_task_medicine cureTaskMedicine in cureTaskMedicines)
                    {
                        cureMedicineDetail = new CureMedicineDetail();
                        cureMedicineDetail.Medicine = cureTaskMedicine.medicine.Name;
                        cureMedicineDetail.Quality = cureTaskMedicine.Quality;
                        cureMedicineDetail.Unit = cureTaskMedicine.unit.Name;
                        cureMedicineDetails.Add(cureMedicineDetail);
                    }
                }

                medicineTakeModel.TaskNumber = taskService.Find(employeeTaskId).TaskNumber;
                List<task_employee> allemployees = taskEmployeeService.FindByTaskId(employeeTaskId);
                int i;
                string reAllEmployeeName = "";
                for (i = 0; i < allemployees.Count - 1; i++)
                {
                    reAllEmployeeName = reAllEmployeeName + allemployees[i].employee.Name + ",";
                }
                reAllEmployeeName = reAllEmployeeName + allemployees[i].employee.Name;
                medicineTakeModel.EmloyeeName = reAllEmployeeName;
            }
            return medicineTakeModel;
        }