public async Task <IActionResult> CreateMedicationDictionary([FromBody] CreateMedicationDictionaryRequestDto requestDto)
        {
            //校验名称是否存在
            var medicationDictionaryBiz = new MedicationDictionaryBiz();
            var medication = medicationDictionaryBiz.GetModelByNameAsync(requestDto.Name).Result;

            if (medication != null)
            {
                return(Failed(Common.ErrorCode.UserData, "名称已存在"));
            }
            var model = new MedicationDictionaryModel();

            model.MedicationGuid = Guid.NewGuid().ToString("N");
            model.MedicationType = requestDto.PrescriptionEnum.ToString();
            model.Name           = requestDto.Name;
            model.CreatedBy      = UserID;
            model.LastUpdatedBy  = UserID;
            var result = await medicationDictionaryBiz.InsertAsync(model);

            return(result ? Success() : Failed(ErrorCode.DataBaseError, "添加失败"));
        }
        public async Task <IActionResult> UpdateMedicationDictionaryAsync([FromBody] UpdateMedicationDictionaryRequestDto requestDto)
        {
            var medicationDictionaryBiz = new MedicationDictionaryBiz();
            var model = await medicationDictionaryBiz.GetAsync(requestDto.MedicationGuid);

            if (model == null)
            {
                return(Failed(Common.ErrorCode.UserData, "未找到数据"));
            }
            var medication = medicationDictionaryBiz.GetModelByNameAsync(requestDto.Name).Result;

            if (medication != null)
            {
                return(Failed(Common.ErrorCode.UserData, "名称已存在"));
            }
            model.LastUpdatedBy   = UserID;
            model.MedicationType  = requestDto.PrescriptionEnum.ToString();
            model.Name            = requestDto.Name;
            model.LastUpdatedDate = DateTime.Now;
            model.Name            = requestDto.Name;
            var result = await medicationDictionaryBiz.UpdateAsync(model);

            return(result ? Success() : Failed(Common.ErrorCode.DataBaseError, "编辑数据失败"));
        }