首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >熟练的JSON结构用于患者和医生之间的评论部分?

熟练的JSON结构用于患者和医生之间的评论部分?
EN

Stack Overflow用户
提问于 2018-02-15 02:45:29
回答 1查看 99关注 0票数 0

我目前正在开发一个医疗应用程序,具有患者和医生之间的身份验证功能。

现在,针对患者和医生的当前JSON结构如下:

病人

代码语言:javascript
复制
"Patients": {
  "w14FKo72BieZwbxwUouTpN7UQm02": {
    "name": "Naseebullah Ahmadi",
    "profession": "Student",
    "gender": "Male",
    "type": "Patient",
    "doctors": ["Ernest"],
    "age": "20",
    "DOB": "02/06/1997",
    "address": "122 Atherstone Court",
    "contactNumber": "07473693312",
    "profilePicture": "../Images/profile.jpg",
    "history": {
      "age": "22",
      "weight": "53",
      "height": "172",
      "bmi": "20.4",
      "thermometer": "36.7",
      "calories": "537",
      "bpm": "87",
      "fat": "11",
      "allergies": ["Peanuts", "Penicilin"]
    },
    "appointments": [{
      "date": "25th Jul",
      "time": "13:00",
      "type": "Doctor",
      "name": "Ernest Kamavuako"
    }],
    "ecg": [""],
    "heartSound": [""]
  },

其中每个患者由他们的Id "example:w14FKo72BieZwbxwUouTpN7UQm02“标识

医生

代码语言:javascript
复制
"Doctors": {
  "VoxHFgUEIwRFWg7JTKNXSSoFoMV2": {
    "name": "Ernest Kamavuako",
    "gender": "Male",
    "type": "Doctor",
    "Patients": ["Naseebullah"],
    "age": "30",
    "dob": "20/12/1970",
    "address": "122 Harrow Street",
    "contactNumber": "07473033312",
    "profilePicture": "../Images/profile.jpg"
  }
}

现在的问题是:每个医生都能够阅读患者留给他们的评论,同样,每个患者也能够阅读每个医生留下的评论。

这两个原则都可以有50条评论的最大限制。

目前,我不确定如何表示"comment“对象,以及它应该如何布局。

这个问题纯粹是为了理解正在扮演的角色之间的关系。

EN

回答 1

Stack Overflow用户

发布于 2018-02-15 03:05:37

您可以为如下所示的注释创建一个json对象

代码语言:javascript
复制
"Comments": {
  "<doctorsId>:<patientsId>": {
    "doctorsComments" : '["comment1", "comment2"]',
    "patientsComments": '["comment1", "comment2"]'
  }
}

在这里,如果您有医生和患者的ids,就可以直接访问注释对象。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48794181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档