123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- namespace app\api\dao\template;
- use app\api\controller\Template;
- use app\api\dao\ZskkDefaultDao;
- use app\api\model\constant\ConstantModel;
- use app\api\model\exam\ExamModel;
- use app\api\model\template\TemplateModel;
- use think\facade\Log;
- /**
- * 后台控制器基类
- * 接口方法权限 必传参数 接口返回 错误抛出 通用参数处理
- */
- class TemplateDao extends ZskkDefaultDao {
- protected $flag = true;
- protected $logName = "TemplateDao";
- protected $redis_name = 'db_config_public';
- protected $template = '';
- public function __construct(TemplateModel $templateModel)
- {
- parent::__construct();
- $this->template = $templateModel;
- }
- public function getExamClass($examId)
- {
- $examClass = ExamModel::where('id', $examId)->value('exam_class');
- return $examClass;
- }
- public function getPublicInfo($constantValue)
- {
- $data = $this->template->getPublicInfo($constantValue);
- return $data;
- }
- public function getConstant($examClass,$value)
- {
- $info = $this->template->getConstant($examClass,$value);
- return $info;
- }
- public function getUser($token)
- {
- $user = $this->getCache($token);
- if(!$user){
- $this->throwError('登陆信息失效,请重新进行登陆','0099');
- }
- return $user;
- }
- public function getPrivateInfo($constantValue,$uid)
- {
- $data = $this->template->getPrivateInfo($constantValue,$uid);
- return $data;
- }
- public function getPublic($key,$exam_class)
- {
- $info = $this->getCache($key);
- if($info){
- return $info;
- }else{
- $info = $this->template->getParentTemplate($exam_class,'public');
- $this->setCache($key,$info,43200);
- return $info;
- }
- }
- public function getPrivate($examClass,$userId)
- {
- $info = $this->template->getParentTemplate($examClass,'private',$userId);
- return $info;
- }
- public function getChildData($id)
- {
- $info = $this->template->getChildData($id);
- return $info;
- }
- public function getTemplate($id)
- {
- $info = $this->template->getTemplate($id);
- return $info;
- }
- public function getParentTitle($id)
- {
- $info = $this->template->getTemplateByPid($id);
- return $info;
- }
- public function checkParentTemplate($param,$doctor)
- {
- $info = $this->template->checkParentTemplate($param,$doctor);
- if($info){
- $this->throwError('已存在相同的模板标题,请重新填写',1000);
- }
- return $info;
- }
- public function checkChildTemplate($param,$doctor)
- {
- $info = $this->template->checkChildTemplate($param,$doctor);
- if($info){
- $this->throwError('已存在相同的模板标题,请重新填写',1000);
- }
- return $info;
- }
- public function insertTemplate($data)
- {
- $info = $this->template->insertTemplate($data);
- return $info;
- }
- public function getTemplateExam($id)
- {
- $info = $this->template->getTemplateExam($id);
- return $info;
- }
- public function updateTemplate($param)
- {
- $info = $this->template->updateTemplate($param);
- return $info;
- }
- public function getParentList($doctorId,$params)
- {
- $info = $this->template->getParentList($doctorId,$params);
- return $info;
- }
- public function checkTemplate($id)
- {
- $info = $this->template->checkTemplate($id);
- return $info;
- }
- public function delTemplate($doctor,$id)
- {
- $info = $this->template->delTemplate($doctor,$id);
- return $info;
- }
- public function getHospitalTemplate($institution,$class)
- {
- $info = $this->template->getHospitalTemplate($institution,$class);
- return $info;
- }
- }
|