Ejemplo n.º 1
0
        public DotDieuTri(JsonValue[] encounters)
        {
            foreach (var encounter in encounters)
            {
                var identifiers = encounter["identifier"].AsJsonArray;
                if (identifiers != null)
                {
                    foreach (var identifier in identifiers)
                    {
                        if (identifier["system"].AsString == Constants.CodeSystem.MA_YTE)
                        {
                            MaYte = identifier["value"].AsString;
                        }
                    }
                }

                var types = encounter["type"].AsJsonArray;
                if (types != null)
                {
                    foreach (var type in types)
                    {
                        if (type["system"].AsString == Constants.CodeSystem.KHOA_DIEU_TRI)
                        {
                            DmKhoaDieuTri = DanhMuc.FromCodeableConcept(type);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static DichVuKyThuat parseDVKTMessage(String json)
        {
            var dvkt = new DichVuKyThuat();

            var obj       = JsonValue.Parse(json);
            var entries   = obj["entry"].AsJsonArray;
            var resources = entries.Select(x => x["resource"]).ToArray();

            var encounters = resources.Where(x => x["resourceType"].AsString == "Encounter")
                             .ToArray();

            dvkt.DotDieuTri    = new DotDieuTri(encounters);
            dvkt.DmKhoaDieuTri = dvkt.DotDieuTri.DmKhoaDieuTri;

            var patient = resources.Where(x => x["resourceType"].AsString == "Patient")
                          .First();

            dvkt.BenhNhan = new BenhNhan(patient);

            var serviceRequest = resources.Where(x => x["resourceType"].AsString == "ServiceRequest")
                                 .First();

            dvkt.DmDichVu = DanhMuc.FromCodeableConcept(serviceRequest.AsJsonObject["code"]);
            var orderDetails = serviceRequest["orderDetail"].AsJsonArray;

            if (orderDetails != null && orderDetails.Count > 0)
            {
                dvkt.NoiDungYeuCau = orderDetails[0]["text"].AsString;
            }
            dvkt.BacSiYeuCau = new CanboYte(serviceRequest["requester"]);
            dvkt.NgayYeuCau  = DateTime.Parse(serviceRequest["authoredOn"]);

            return(dvkt);
        }