예제 #1
0
        public async Task <IHttpActionResult> Get(string patientId, string uid = null, string code = null)
        {
            DSSModel item = null;

            if (!string.IsNullOrEmpty(uid))
            {
                int key = int.Parse(uid);
                item = _context.Set <DSSModel>().Find(key);
                if (item == null)
                {
                    return(NotFound());
                }
            }
            else if (!string.IsNullOrEmpty(code))
            {
                item = _context.Set <DSSModel>().FirstOrDefault(e => e.Code == code);
                if (item == null)
                {
                    return(NotFound());
                }
            }
            else
            {
                return(NotFound());
            }

            //Run DSS
            var res = await _dssRunner.Run(patientId, item.Config);

            //_dssRunner.Run(id)
            return(Ok(res));
        }
예제 #2
0
        public async Task <IActionResult> Post(DSSModel model)
        {
            try
            {
                var newModel = await _context.AddAsync(model);

                var ret = await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Post DSS Model failed");
                return(BadRequest("Post DSS Model failed"));
            }


            return(Ok(model));
        }
예제 #3
0
        /// <summary>
        /// Get Config from deserializing model config in Json format
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static DSSConfig GetConfig(this DSSModel model)
        {
            var dssConfig = JsonConvert.DeserializeObject <DSSConfig>(model.Config);

            return(dssConfig);
        }