コード例 #1
0
ファイル: CodeItemCombService.cs プロジェクト: Stanleyjie/Kr
 /// <summary>
 /// 添加组合-医院码关系
 /// </summary>
 /// <param name="cceh"></param>
 /// <returns></returns>
 public bool CodeItemCombEntryHospAdd(CodeItemCombEntryHosp cceh)
 {
     try
     {
         _codeItemCombEntryHospRepository.Insert(cceh);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public async Task <IActionResult> CodeItemCombEntryHospAdd(CodeItemCombEntryHosp cceh)
        {
            try
            {
                //判断是否存在关系
                var CodeItemCombEntry = _codeItemCombEntryHospRepository.FindByClause(o => o.hospCombCode == cceh.hospCombCode);
                //如果不存在则新增,存在则修改
                if (CodeItemCombEntry == null)
                {
                    CodeItemCombEntryHosp ccehn = new CodeItemCombEntryHosp();
                    ccehn.hospCombCode = cceh.hospCombCode;
                    ccehn.combCode     = cceh.combCode;
                    ccehn.price        = cceh.price;
                    ccehn.hospitalCode = cceh.hospitalCode;
                    await Task.Factory.StartNew(() => _codeItemCombEntryHospRepository.Insert(ccehn));

                    result.returnMsg = "成功添加关系";
                }
                else
                {
                    CodeItemCombEntry.hospCombCode = cceh.hospCombCode;
                    CodeItemCombEntry.combCode     = cceh.combCode;
                    CodeItemCombEntry.price        = cceh.price;
                    CodeItemCombEntry.hospitalCode = cceh.hospitalCode;
                    await Task.Factory.StartNew(() => _codeItemCombEntryHospRepository.Update(cceh));

                    result.returnMsg = "成功修改关系";
                }
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                result.success   = false;
                result.returnMsg = "系统繁忙!请稍后在试";
            }
            return(Ok(result));
        }