MedicalOption.php 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\model;
  4. use think\Model;
  5. /**
  6. * 医学计算器选项模型
  7. * Class MedicalOption
  8. * @package app\model
  9. */
  10. class MedicalOption extends Model
  11. {
  12. /**
  13. * 数据表名称
  14. * @var string
  15. */
  16. protected $name = 'medical_options';
  17. /**
  18. * 自动写入时间戳
  19. * @var bool
  20. */
  21. protected $autoWriteTimestamp = false;
  22. /**
  23. * 设置字段信息
  24. * @var array
  25. */
  26. protected $schema = [
  27. 'id' => 'int',
  28. 'medical_question_id'=> 'int',
  29. 'content' => 'string',
  30. 'score' => 'float'
  31. ];
  32. /**
  33. * 允许批量赋值的字段
  34. * @var array
  35. */
  36. protected $allowField = [
  37. 'medical_question_id',
  38. 'content',
  39. 'score'
  40. ];
  41. /**
  42. * 获取所属问题
  43. */
  44. public function question()
  45. {
  46. return $this->belongsTo(MedicalQuestion::class, 'medical_question_id', 'id');
  47. }
  48. }