Example #1
0
        /// <summary>
        /// 新建健康文档
        /// </summary>
        /// <param name="docmentNew"></param>
        /// <returns></returns>
        public ActionResult <bool> AddHealDocment(HealDocmentNew docmentNew)
        {
            try
            {
                if (docmentNew == null)
                {
                    throw new Exception("参数有误");
                }
                var check = _rpshd.Any(p => p.EmployeeID == docmentNew.EmployeeID);
                if (check)
                {
                    throw new Exception("该人员的健康档案已存在!");
                }
                var dbhd = docmentNew.MAPTO <Heal_Docment>();

                //自定义项
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbhd.ID,
                    Values     = docmentNew.UserDefineds
                };
                var defined = srvUserDefined.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }

                //电子文档
                var files = new AttachFileSave
                {
                    BusinessID = dbhd.ID,
                    files      = from f in docmentNew.AttachFiles
                                 select new AttachFileNew
                    {
                        FileTitle = f.FileTitle,
                        FileType  = f.FileType,
                        FileUrl   = f.FileUrl
                    }
                };

                var fre = srvFile.SaveFiles(files);
                if (fre.state != 200)
                {
                    throw new Exception(fre.msg);
                }
                _rpshd.Add(dbhd);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Example #2
0
 public ActionResult <bool> AddHealDocment(HealDocmentNew docmentNew)
 {
     LogContent = "新建了健康档案,参数源:" + JsonConvert.SerializeObject(docmentNew);
     return(bll.AddHealDocment(docmentNew));
 }