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.

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

报告相同问题?

悬赏问题

  • ¥88 实在没有想法,需要个思路
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)