TemplateDao.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?php
  2. namespace app\api\dao\template;
  3. use app\api\controller\Template;
  4. use app\api\dao\ZskkDefaultDao;
  5. use app\api\model\constant\ConstantModel;
  6. use app\api\model\exam\ExamModel;
  7. use app\api\model\template\TemplateModel;
  8. use think\facade\Log;
  9. /**
  10. * 后台控制器基类
  11. * 接口方法权限 必传参数 接口返回 错误抛出 通用参数处理
  12. */
  13. class TemplateDao extends ZskkDefaultDao {
  14. protected $flag = true;
  15. protected $logName = "TemplateDao";
  16. protected $redis_name = 'db_config_public';
  17. protected $template = '';
  18. public function __construct(TemplateModel $templateModel)
  19. {
  20. parent::__construct();
  21. $this->template = $templateModel;
  22. }
  23. public function getExamClass($examId)
  24. {
  25. $examClass = ExamModel::where('id', $examId)->value('exam_class');
  26. return $examClass;
  27. }
  28. public function getPublicInfo($constantValue)
  29. {
  30. $data = $this->template->getPublicInfo($constantValue);
  31. return $data;
  32. }
  33. public function getConstant($examClass,$value)
  34. {
  35. $info = $this->template->getConstant($examClass,$value);
  36. return $info;
  37. }
  38. public function getUser($token)
  39. {
  40. $user = $this->getCache($token);
  41. if(!$user){
  42. $this->throwError('登陆信息失效,请重新进行登陆','0099');
  43. }
  44. return $user;
  45. }
  46. public function getPrivateInfo($constantValue,$uid)
  47. {
  48. $data = $this->template->getPrivateInfo($constantValue,$uid);
  49. return $data;
  50. }
  51. public function getPublic($key,$exam_class)
  52. {
  53. $info = $this->getCache($key);
  54. if($info){
  55. return $info;
  56. }else{
  57. $info = $this->template->getParentTemplate($exam_class,'public');
  58. $this->setCache($key,$info,43200);
  59. return $info;
  60. }
  61. }
  62. public function getPrivate($examClass,$userId)
  63. {
  64. $info = $this->template->getParentTemplate($examClass,'private',$userId);
  65. return $info;
  66. }
  67. public function getChildData($id)
  68. {
  69. $info = $this->template->getChildData($id);
  70. return $info;
  71. }
  72. public function getTemplate($id)
  73. {
  74. $info = $this->template->getTemplate($id);
  75. return $info;
  76. }
  77. public function getParentTitle($id)
  78. {
  79. $info = $this->template->getTemplateByPid($id);
  80. return $info;
  81. }
  82. public function checkParentTemplate($param,$doctor)
  83. {
  84. $info = $this->template->checkParentTemplate($param,$doctor);
  85. if($info){
  86. $this->throwError('已存在相同的模板标题,请重新填写',1000);
  87. }
  88. return $info;
  89. }
  90. public function checkChildTemplate($param,$doctor)
  91. {
  92. $info = $this->template->checkChildTemplate($param,$doctor);
  93. if($info){
  94. $this->throwError('已存在相同的模板标题,请重新填写',1000);
  95. }
  96. return $info;
  97. }
  98. public function insertTemplate($data)
  99. {
  100. $info = $this->template->insertTemplate($data);
  101. return $info;
  102. }
  103. public function getTemplateExam($id)
  104. {
  105. $info = $this->template->getTemplateExam($id);
  106. return $info;
  107. }
  108. public function updateTemplate($param)
  109. {
  110. $info = $this->template->updateTemplate($param);
  111. return $info;
  112. }
  113. public function getParentList($doctorId,$params)
  114. {
  115. $info = $this->template->getParentList($doctorId,$params);
  116. return $info;
  117. }
  118. public function checkTemplate($id)
  119. {
  120. $info = $this->template->checkTemplate($id);
  121. return $info;
  122. }
  123. public function delTemplate($doctor,$id)
  124. {
  125. $info = $this->template->delTemplate($doctor,$id);
  126. return $info;
  127. }
  128. public function getHospitalTemplate($institution,$class)
  129. {
  130. $info = $this->template->getHospitalTemplate($institution,$class);
  131. return $info;
  132. }
  133. }