Index.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. namespace app\inter\controller;
  3. use think\Controller;
  4. use think\Db;
  5. use think\Session;
  6. use think\Log;
  7. use app\common\library\UUIDs;
  8. use think\Cache;
  9. class Index extends Controller
  10. {
  11. public function _initialize()
  12. {
  13. /*var_dump($_SERVER);die;
  14. parent::_initialize(); // TODO: Change the autogenerated stub
  15. $param = $_REQUEST;
  16. var_dump($param);
  17. $sessionid = $param['sessionid'];
  18. $doctor = Cache::get($sessionid);
  19. var_dump($doctor);
  20. $dname = DB::table('doctors')->where('id',$doctor['id'])->field('realname')->find();
  21. $info['id'] = UUIDs::uuid16();
  22. $info['param'] = serialize($param);
  23. $info['doctor_id'] = $doctor['id'];
  24. $info['doctor_name'] = $dname['realname'];
  25. $info['url'] = $_SERVER['REQUEST_URI'];
  26. var_dump($info);die;*/
  27. }
  28. public function index(){
  29. // DR->DX
  30. $a = DB::table('templates')->where('is_public','1')->where('exam_class_id','DR')->select();
  31. foreach ($a as $k => $v) {
  32. $b = array();
  33. $p = DB::table('templates')->where('parent_id',$v['id'])->select();
  34. unset($v['exam_class_id']);
  35. unset($v['id']);
  36. $b = $v;
  37. $b['exam_class_id'] = 'DX';
  38. $b['id'] = UUIDs::uuid16();
  39. $c = DB::table('templates')->insert($b);
  40. foreach ($p as $key => $value) {
  41. unset($value['exam_class_id']);
  42. unset($value['id']);
  43. unset($value['parent_id']);
  44. $y = array();
  45. $y = $value;
  46. $y['exam_class_id'] = 'DX';
  47. $y['parent_id'] = $b['id'];
  48. $y['id'] = UUIDs::uuid16();
  49. DB::table('templates')->insert($y);
  50. }
  51. }
  52. die;
  53. // 菜单权限
  54. /*$a = DB::table('doctors')->where('institution_id','74500001')->select();
  55. $i = 1;
  56. foreach($a as $k=>$v){
  57. $info = array();
  58. $info['id'] = UUIDs::uuid16();
  59. $info['doctor_id'] = $v['id'];
  60. $info['pass'] = '80ddb7d09ebc44b4';
  61. $info['type'] = 1;
  62. $c = DB::table('dr_cla_permission')->insert($info);
  63. if($c){
  64. echo $i;
  65. $i++;
  66. }
  67. }*/
  68. // 报告权限
  69. $qx = DB::table('doctors')->where('institution_id','74500001')->select();
  70. foreach($qx as $k=>$v){
  71. $qxinfo = array();
  72. if($v['department_id'] == 'd131507b77044283'){
  73. // 写报告权限
  74. $qxinfo['department_id'] = 'd131507b77044283';
  75. $qxinfo['doctor_class'] = '2,3,4';
  76. }else{
  77. $qxinfo['department_id'] = $v['department_id'];
  78. $qxinfo['doctor_class'] = '1';
  79. }
  80. $qxinfo['id'] = UUIDs::uuid16();
  81. $qxinfo['doctor_id'] = $v['id'];
  82. $qxx = DB::table('doctor_class')->insert($qxinfo);
  83. if(!$qxx){
  84. var_dump($qxinfo);
  85. }
  86. }
  87. die;
  88. $a = "select count(1) from templates where id='00'";
  89. $b = DB::query($a);
  90. var_dump($b);
  91. var_dump($b[0]['count(1)']);die;
  92. $c = DB::table('exam_class')->where('id',2)->find();
  93. var_dump($c);echo '<br>';
  94. $b = DB::table('templates')->where('exam_class_id',$c['name'])->where('create_user',1)->select();
  95. var_dump($b);die;
  96. var_dump(Cache::get('80f3d36662cddb97'));
  97. // Cache::clear();die;
  98. $a = model('app\inter\model\Exam')->select();
  99. // var_dump($a);die;
  100. // $this->uuids = new UUIDs();
  101. // $id = $this->uuids->uuid16();
  102. // var_dump($id);die;
  103. return json_encode(['status'=>'ok','code'=>'0000','info'=>$a]);
  104. }
  105. }