douchiwan1503 2017-04-15 19:07
浏览 361
已采纳

如何使用MySQL和PHP进行问卷调查表结构?

i'm currently working on a nutricional evaluation project and, i've come to a point, where i'm failing to see how to do some tables relationship.

What i want to do: The nutricionist can create questionnaires to facilitate his nutricional evaluation about his pacients. Others nutricionists would be allowed to use questionnaires that were created by other nutricionists. (So these questionnaires would be public to use).

These questionnaires would have 5 to 10 questions tiped by the nutricionist, and the anwser for these questions would be a text tiped by the nutricionist as well.

Program Flow for New pacient: nutricionist register a new pacient(name, high, weight etc) --> Nutricionist chooses or creates one or many questionnaire to help on his evaluation --> nutricionist asks the questions for his pacient --> nutricionist saves the pacient anwsers --> Program continues...

Program Flow for old pacient: Nutricionist finds pacient --> Nutricionist see the questionnaires related to that pacient (at this point, there could be questionnaires that were make by another nutricionist) --> Nutricionist can create a New questionnaire or see the questionnaires already related to that pacient (cannot erase or alter any questionnaire) --> Program continues....

Main question: how could i do the tables relationship​ of nutricionist, questionnaire and pacient? Create tables for the questions and awnsers? I'm seriously Lost.

Obs: English is not my native language, but o tried my best.

  • 写回答

1条回答 默认 最新

  • douban5644 2017-04-15 20:10
    关注

    Well, you can create your tables in this format:

    1. Patient's Table
    Store details like the id (unique value to search for the patient in another table, doing an *AUTO_INCREMENT* would be perfect), name, weight, height, etc

    2. Nutritionist's Table
    Store details like id (unique value also), name, etc

    3. Questionnaire Table
    Store details like id (same as others above), patient_id, question, answer, etc

    For your program flow:

    Program Flow for New pacient: nutricionist register a new pacient(name, high, weight etc)

    These Details will be entered into the patient's table

    Nutricionist chooses or creates one or many questionnaire to help on his evaluation

    These details will be stored or selected from the questionnaire table

    nutricionist asks the questions for his pacient

    These details will be FETCHED from the questionnaire table

    nutricionist saves the pacient anwsers

    These details will be saved (stored) in the questionnaire table

    Nutricionist finds pacient

    Select from patients table

    Nutricionist see the questionnaires related to that pacient (at this point, there could be questionnaires that were make by another nutricionist)

    Select from questionnaire table where the current patient id is equal to the one already stored in the table

    Nutricionist can create a New questionnaire or see the questionnaires already related to that pacient (cannot erase or alter any questionnaire)

    Insert into questionnaire table OR query from the questionnaire table

    Hope this helps.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 MATLAB动图问题
  • ¥15 有段代码不知道怎么理解,const isToken = (config.headers || {}).isToken === false
  • ¥100 采用栈和深度优先算法对我的代码进行修改显示路径
  • ¥15 pointnet2包安装
  • ¥20 射频功率问题,解答者有酬谢!
  • ¥80 构建降雨和积水的预测模型
  • ¥15 #Qt Transform setTransform()在鼠标拖动移动视角是一致在原地不动,无法变换视角(细微观察似乎视图有在原地抖动),无法变换视角(细微观察似乎视图有在原地抖动)
  • ¥50 如何利用无人机拍摄的数码照片测量鸟卵的长短径
  • ¥100 github贡献者给与奖励
  • ¥15 使用DS18B20+ESP8266获取温度数据返回-127.00