Exemplo n.º 1
0
        private CTMS_GUIDELINE ModelToEntity(GuideLine model)
        {
            if (model == null)
            {
                return(null);
            }
            return(new CTMS_GUIDELINE()
            {
                ID = string.IsNullOrEmpty(model.ID) ? Guid.NewGuid().ToString() : model.ID,
                NAME = model.Name,
                CODE = model.Code,
                CLINICALBASIS = model.ClinicalBasis,
                ISINHERIT = model.IsInherit,
                PARENTID = model.ParentID,
                ENTERLOGICALOPERATOR = (int)model.EnterLogicalOperator,
                ENTERCONDITEMIDS = (model.EnterCondItemList == null || model.EnterCondItemList.Count <= 0) ? null : string.Join(",", model.EnterCondItemList.Where(o => o.ID > 0).Select(o => o.ID.ToString())),
                OUTLOGICALOPERATOR = (int)model.OutLogicalOperator,
                OUTCONDITEMIDS = (model.OutCondItemList == null || model.OutCondItemList.Count <= 0) ? null : string.Join(",", model.OutCondItemList.Where(o => o.ID > 0).Select(o => o.ID.ToString())),

                CREATEDATETIME = model.CreateDateTime,
                CREATEUSERID = model.CreateUserID,
                CREATEUSERNAME = model.CreateUserName,
                EDITDATETIME = model.EditTime,
                EDITUSERID = model.EditUserID,
                EDITUSERNAME = model.EditUserName,
                OWNERID = model.OwnerID,
                OWNERNAME = model.OwnerName,
                ISDELETED = model.IsDeleted,
                RECOMMENDPROCESS = model.RecommendProcess
            });
        }
Exemplo n.º 2
0
    private void UpdateGuideLine()
    {
        //We set a line between the object and a possible target
        if (_currentGuideLineTarget == null || !_currentGuideLineTarget.isActiveAndEnabled ||
            _currentGuideLineTarget.Completed)
        {
            TargetObject target = TargetObject.GetActiveTarget(ModelName);

            if (_guideLinePreview == null)
            {
                _guideLinePreview = Instantiate(_guideLinePrefab);
                _guideLinePreview.transform.SetLayerRecursive(OverlayLayer);
            }

            if (target != null)
            {
                _guideLinePreview.gameObject.SetActive(true);
                _guideLinePreview.Start = transform;
                _guideLinePreview.End   = target.transform;
            }
            else
            {
                _guideLinePreview.gameObject.SetActive(false);
            }
            _currentGuideLineTarget = target;
        }
    }
Exemplo n.º 3
0
        public static bool IsDuplicate(IList <GuideLine> existingLines, GuideLine newLine, out int index)
        {
            index = -1;
            return(false);

            var l = existingLines.Count;

            // Discard if an existing line has the same direction and origin
            for (var i = 0; i < l; i++)
            {
                var existingLine = existingLines[i];

                if (Vector3.Dot(existingLine.Direction.Flatten(), newLine.Direction.Flatten()) < 0.9f)
                {
                    continue;
                }

                if (Vector3Extensions.DistanceSquared(existingLine.Intersect, newLine.Intersect) < 0.5f)
                {
                    index = i;
                    return(true);
                }
            }

            index = -1;
            return(false);
        }
Exemplo n.º 4
0
 public void Initialize(GuideLine guideLinePrefab)
 {
     _guideLinePrefab = guideLinePrefab;
     foreach (var collider in GetComponentsInChildren <Collider>())
     {
         collider.enabled = true;
     }
 }
Exemplo n.º 5
0
    void DrawGuideLine()
    {
        float step = 1f / guideLines.Count;

        for (int i = 0; i < guideLines.Count; i++)
        {
            GuideLine line = guideLines[i];
            line.SetPositions(GetPoint(step * i), GetPoint(step * (i + 1)));
        }
    }
Exemplo n.º 6
0
    GuideLine CreateGuideLineSegment()
    {
        GameObject segment = new GameObject();

        segment.transform.SetParent(guideLine);

        GuideLine line = segment.AddComponent <GuideLine>();

        return(line);
    }
Exemplo n.º 7
0
 public void Initialize(PlaceableObject placeableObject, Transform tray, GuideLine guideLinePrefab, Action onClicked)
 {
     _guideLinePrefab     = guideLinePrefab;
     Prefab               = placeableObject;
     _tray                = tray;
     Text.text            = placeableObject.ModelName;
     PreviewImage.texture = placeableObject.Preview;
     Button.onClick.AddListener(() => onClicked());
     Messenger.AddListener(PlaceableObject.ObjectPlacedMessage, OnObjectPlaced);
 }
Exemplo n.º 8
0
        private void AddGuigeLine(WindowsPoint location, double width, double height, WindowsPoint mediaOffset)
        {
            var control = new GuideLine();

            Canvas.SetTop(control, location.Y);
            Canvas.SetLeft(control, location.X);

            control.Width  = width;
            control.Height = height;

            AddCanvasElement(control, mediaOffset);
        }
    public void Initialize(PlaceableObject[] placeableObjects, GuideLine guideLinePrefab)
    {
        //We create all the buttons to select the different parts
        foreach (var placeableObject in placeableObjects)
        {
            PlaceableObjectButton button = Instantiate(PartButton, PartButton.transform.parent);
            button.gameObject.SetActive(true);
            button.Initialize(placeableObject, Tray, guideLinePrefab, () => OnButtonClicked(button));

            _placeableObjectButtons[button] = placeableObject.ModelName;
        }
    }
        void AddGuigeLine(Point location, double width, double height)
        {
            var control = new GuideLine();

            Canvas.SetTop(control, location.Y);
            Canvas.SetLeft(control, location.X);

            control.Width  = width;
            control.Height = height;

            AddCanvasElement(control);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 是否满足进入条件
        /// </summary>
        /// <returns></returns>
        public bool EnterConditionIsMatch(string guideLineID, List <string> paramNames, List <string> paramValues)
        {
            if (string.IsNullOrEmpty(guideLineID))
            {
                throw new Exception("临床路径ID不能为空!");
            }
            GuideLine gl = Get(guideLineID);

            if (gl == null)
            {
                throw new Exception("临床路径ID有误!");
            }
            return(IsMatch(gl.EnterLogicalOperator, gl.EnterCondItemList, paramNames, paramValues));
        }
Exemplo n.º 12
0
        /// <summary>
        /// 删除元数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                LogService.WriteInfoLog(logTitle, "试图删除为空的GuideLine实体!");
                throw new KeyNotFoundException();
            }
            GuideLine model = GetSimpleModel(id);

            if (model != null)
            {
                model.IsDeleted = true;
                return(Edit(model));
            }
            return(false);
        }
Exemplo n.º 13
0
 /// <summary>
 /// 修改元数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Edit(GuideLine model)
 {
     if (string.IsNullOrEmpty(model.ID))
     {
         LogService.WriteInfoLog(logTitle, "试图修改为空的GuideLine实体!");
         throw new KeyNotFoundException();
     }
     using (DbContext db = new CRDatabase())
     {
         db.Entry(ModelToEntity(model)).State = EntityState.Modified;
         foreach (GuideLineData data in model.MetaDataList)
         {
             db.Entry(new GuideLineDataBLL().ModelToEntity(data)).State = EntityState.Modified;
         }
         return(db.SaveChanges() > 0);
     }
 }
Exemplo n.º 14
0
        public IHttpActionResult Post([FromBody] Request <GuideLine> request)
        {
            try
            {
                Response <GuideLine>    response = new Response <GuideLine>();
                GuideLine               model    = request.Data as GuideLine;
                List <GuidelineProduct> products = model.Products;
                if (model == null)
                {
                    return(NotFound());
                }
                if (string.IsNullOrEmpty(model.ID))
                {
                    string ID = bll.Add(model);
                    model.ID = ID;
                }
                else
                {
                    bool isEditSuccess = bll.Edit(model);
                }

                //todo:父类的guideline已经迁移到表CTMS_PARENTGUIDELINE
                bll.SaveParentGuideLine(model.ID, model.ParentList);

                GuidelineProductBLL gpBLL = new GuidelineProductBLL();
                foreach (GuidelineProduct item in products)
                {
                    if (string.IsNullOrEmpty(item.GuidelineProductId))
                    {
                        item.GuidelineId = model.ID;
                        gpBLL.Add(item);
                    }
                    else
                    {
                        gpBLL.Edit(item);
                    }
                }
                response.Data = model;
                return(Ok(response));
            }
            catch (DbEntityValidationException ex)
            {
                LogService.WriteErrorLog("GuideLineController[Post]", ex.ToString());
                return(BadRequest(ex.Message));
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 是否满足退出条件
        /// </summary>
        /// <returns></returns>
        public bool OuterConditionIsMatch(string guideLineID, List <string> paramNames, List <string> paramValues)
        {
            if (string.IsNullOrEmpty(guideLineID))
            {
                throw new Exception("临床路径ID不能为空!");
            }
            GuideLine gl = Get(guideLineID);

            if (gl == null)
            {
                throw new Exception("临床路径ID有误!");
            }
            if (gl.OutCondItemList == null || gl.OutCondItemList.Count == 0)
            {
                return(false);//todo 条件项为空时返回false?
            }
            return(IsMatch(gl.OutLogicalOperator, gl.OutCondItemList, paramNames, paramValues));
        }
Exemplo n.º 16
0
        public static void Render(RenderManager.CameraInfo cameraInfo, GuideLine guideLine)
        {
            var renderManager = RenderManager.instance;

            var minHeight = -1f;
            var maxHeight = 1280f;

            var direction = guideLine.Origin.Flatten().DirectionTo(guideLine.Intersect.Flatten());

            var line = new Segment3(guideLine.Origin, guideLine.Origin + direction * 100000f);

            renderManager.OverlayEffect.DrawSegment(cameraInfo, Settings.SecondaryColor,
                                                    line, guideLine.Width, 0,
                                                    minHeight,
                                                    maxHeight, true, true);

            renderManager.OverlayEffect.DrawSegment(cameraInfo, Settings.SecondaryColor,
                                                    line, 0.01f, 8f,
                                                    minHeight,
                                                    maxHeight, true, true);
        }
Exemplo n.º 17
0
    public void UpdateNumberSubDivisions(int num)
    {
        if (num != guideLines.Count)
        {
            while (num < guideLines.Count)
            {
                GuideLine line = guideLines[0];
                guideLines.Remove(line);
                GameObject.DestroyImmediate(line.gameObject);
            }

            while (num > guideLines.Count)
            {
                guideLines.Add(CreateGuideLineSegment());
            }

            DrawGuideLine();
        }

        UpdateCurveLength();
    }
Exemplo n.º 18
0
 /// <summary>
 /// 新增元数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public string Add(GuideLine model)
 {
     if (model == null)
     {
         return(string.Empty);
     }
     using (DbContext db = new CRDatabase())
     {
         model.ID = Guid.NewGuid().ToString();
         db.Set <CTMS_GUIDELINE>().Add(ModelToEntity(model));
         if (model.MetaDataList != null && model.MetaDataList.Count > 0)
         {
             foreach (GuideLineData data in model.MetaDataList)
             {
                 data.GuideLineID = model.ID;
                 db.Set <CTMS_GUIDELINEDATA>().Add(new GuideLineDataBLL().ModelToEntity(data));
             }
         }
         db.SaveChanges();
         return(model.ID);
     }
 }
Exemplo n.º 19
0
        private static void TestLine(NetInfo netInfo, Vector3 startPoint, Vector3 endPoint, Vector3 l1, Vector3 l2,
                                     IList <GuideLine> lines, ushort segmentId = 0, ushort nodeId = 0)
        {
            var p = Util.LineIntersectionPoint(startPoint.xz(), endPoint.xz(), l1.xz(), l2.xz());

            // Lines never meet, discard
            if (!p.HasValue)
            {
                return;
            }

            var intersect = new Vector3(p.Value.x, 0, p.Value.y);

            var intersectDistanceSqr = Vector3Extensions.DistanceSquared(intersect, endPoint.Flatten());

            // Discard if intersect is silly distance away
            if (intersectDistanceSqr > Settings.MaxGuideLineQueryDistanceSqr)
            {
                return;
            }

            var guideDirection     = l1.Flatten().DirectionTo(l2.Flatten());
            var intersectDirection = l1.Flatten().DirectionTo(intersect);

            // Ignore guides in the wrong direction
            if (Mathf.Abs(Vector3Extensions.GetSignedAngleBetween(guideDirection, intersectDirection, Vector3.up)) > 90f)
            {
                return;
            }

            intersect.y = TerrainManager.instance.SampleRawHeightSmooth(intersect);

            var intersectDistance = Mathf.Sqrt(intersectDistanceSqr);

            var line = new GuideLine(l1, intersect, netInfo.m_halfWidth * 2f, intersectDistance, segmentId);

            int index;

            if (IsDuplicate(lines, line, out index))
            {
                var d = lines[index];

                // If a duplicate, check if it is closer than the duplicate
                if (Vector3Extensions.DistanceSquared(d.Origin, endPoint) >
                    Vector3Extensions.DistanceSquared(l1, endPoint))
                {
                    lines[index] = line;
                }

                return;
            }

            // Check for intersection with existing nodes
            var ra   = Vector3.Cross(guideDirection, Vector3.up);
            var quad = new Quad3(l1 + ra, l1 - ra, intersect + ra, intersect - ra);

            if (NetManager.instance.OverlapQuad(Quad2.XZ(quad), 0, 1280f, ItemClass.CollisionType.Undefined, netInfo.m_class.m_layer, nodeId, 0, segmentId))
            {
                return;
            }

            lines.Add(line);
        }
Exemplo n.º 20
0
        public static bool IsDuplicate(IList<GuideLine> existingLines, GuideLine newLine, out int index)
        {
            index = -1;
            return false;
            var l = existingLines.Count;

            // Discard if an existing line has the same direction and origin
            for (var i = 0; i < l; i++) {

                var existingLine = existingLines[i];

                if (Vector3.Dot(existingLine.Direction.Flatten(), newLine.Direction.Flatten()) < 0.9f)
                    continue;

                if (Vector3Extensions.DistanceSquared(existingLine.Intersect, newLine.Intersect) < 0.5f) {
                    index = i;
                    return true;
                }

            }

            index = -1;
            return false;
        }
Exemplo n.º 21
0
        private static void TestLine(NetInfo netInfo, Vector3 startPoint, Vector3 endPoint, Vector3 l1, Vector3 l2,
			IList<GuideLine> lines, ushort segmentId = 0, ushort nodeId = 0)
        {
            var p = Util.LineIntersectionPoint(startPoint.xz(), endPoint.xz(), l1.xz(), l2.xz());

            // Lines never meet, discard
            if (!p.HasValue)
                return;

            var intersect = new Vector3(p.Value.x, 0, p.Value.y);

            var intersectDistanceSqr = Vector3Extensions.DistanceSquared(intersect, endPoint.Flatten());

            // Discard if intersect is silly distance away
            if (intersectDistanceSqr > Settings.MaxGuideLineQueryDistanceSqr)
                return;

            var guideDirection = l1.Flatten().DirectionTo(l2.Flatten());
            var intersectDirection = l1.Flatten().DirectionTo(intersect);

            // Ignore guides in the wrong direction
            if (Mathf.Abs(Vector3Extensions.GetSignedAngleBetween(guideDirection, intersectDirection, Vector3.up)) > 90f)
                return;

            intersect.y = TerrainManager.instance.SampleRawHeightSmooth(intersect);

            var intersectDistance = Mathf.Sqrt(intersectDistanceSqr);

            var line = new GuideLine(l1, intersect, netInfo.m_halfWidth*2f, intersectDistance, segmentId);

            int index;

            if (IsDuplicate(lines, line, out index)) {

                var d = lines[index];

                // If a duplicate, check if it is closer than the duplicate
                if (Vector3Extensions.DistanceSquared(d.Origin, endPoint) > Vector3Extensions.DistanceSquared(l1, endPoint)) {
                    lines[index] = line;
                }

                return;

            }

            // Check for intersection with existing nodes
            var ra = Vector3.Cross(guideDirection, Vector3.up);
            var quad = new Quad3(l1 + ra, l1 - ra, intersect + ra, intersect - ra);

            if (NetManager.instance.OverlapQuad(Quad2.XZ(quad), 0, 1280f, netInfo.m_class.m_layer, nodeId, 0, segmentId)) {
                return;
            }

            lines.Add(line);
        }
Exemplo n.º 22
0
        private ExtUserEvent GetExtData(UserEvent userEvent)
        {
            ExtUserEvent extUserEvent = new ExtUserEvent();

            extUserEvent.EventID      = userEvent.EventID;
            extUserEvent.ActionStatus = userEvent.ActionStatus;
            extUserEvent.Remarks      = userEvent.Remarks;
            List <UserEvent> tracks      = bll.GetList(p => p.USERAPPLYID.Equals(userEvent.UserApplyId)).OrderBy(p => p.CreateTime).ToList();
            UserInfoService  userService = new UserInfoService();
            UserRoleBLL      userRoleBLL = new UserRoleBLL();
            RoleBLL          roleBLL     = new RoleBLL();

            for (int i = 0; i < tracks.Count; i++)
            {
                string   _userID  = tracks[i].ToUser;
                UserInfo userInfo = userService.GetUserInfoByID(_userID);
                if (userInfo == null)
                {
                    tracks[i].ToUser = "";
                }
                else
                {
                    tracks[i].ToUser = userInfo.LoginName;
                }

                UserRole userrole = userRoleBLL.GetOne(p => p.USERID.Equals(_userID));
                if (userrole == null)
                {
                    tracks[i].Remarks = "";
                }
                else
                {
                    Role role = roleBLL.Get(userrole.RoleID);
                    tracks[i].Remarks = role == null ? "" : role.RoleName;
                }
            }


            //todo:20160119演示用,临时去了客服的代办信息
            extUserEvent.Tracks = tracks.Where(p => !p.Remarks.Contains("客服")).ToList();
            //extUserEvent.Tracks = tracks;

            DoctorControlBll dcBLL     = new DoctorControlBll();
            UserApply        userApply = dcBLL.GetModelUserApply(userEvent.UserApplyId);

            if (userApply != null)
            {
                extUserEvent.DoctorSuggest = userApply.DOCTORSUGGEST;

                GuideLineBLL gdBLL    = new GuideLineBLL();
                GuideLine    guidline = gdBLL.GetSimpleModel(userApply.CURRENTNODE);
                if (guidline != null)
                {
                    extUserEvent.CurrentNodeName  = guidline.Name;
                    extUserEvent.RecommendProcess = guidline.RecommendProcess;
                }
            }

            EventProductBLL epdBLL = new EventProductBLL();

            extUserEvent.Products = epdBLL.GetList(p => p.EVENTID.Equals(userEvent.EventID)).ToList();

            return(extUserEvent);
        }