Index.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. /*$a = DB::table('doctors')->where('institution_id','73090001')->select();
  30. foreach($a as $k=>$v){
  31. $c = DB::table('dr_cla_permission')->where('doctor_id',$v['id'])->where('pass','bdb52c21d1687709')->delete();
  32. $d = DB::table('dr_cla_permission')->where('doctor_id',$v['id'])->where('pass','0eac42ef01de23ff')->delete();
  33. }
  34. // bdb52c21d1687709 预约登记
  35. // 0eac42ef01de23ff 登记列表*/
  36. die;
  37. $doctor = '1';
  38. $dr = DB::table('dr_cla_permission')->where('doctor_id',1)->field('pass')->select();
  39. $a = array();
  40. $a['pass'] = '0eac42ef01de23ff';
  41. if(in_array($a,$dr)){
  42. echo 1;die;
  43. }
  44. foreach ($dr as $k => $v) {
  45. /*if($v['pass'] == 'bdb52c21d1687709'){
  46. //预约登记
  47. return json_encode(['status'=>'ok','code'=>'0000','info'=>'修改成功']);
  48. }*/
  49. /*switch($v['pass']){
  50. case 'bdb52c21d1687709':
  51. return '预约登记';
  52. break;
  53. case '0eac42ef01de23ff':
  54. //登记列表
  55. return '登记列表';
  56. break;
  57. case '80ddb7d09ebc44b4':
  58. //科室报告
  59. return '科室报告';
  60. break;
  61. }*/
  62. }
  63. die;
  64. // DR->DX
  65. $a = DB::table('templates')->where('is_public','1')->where('exam_class_id','DR')->select();
  66. foreach ($a as $k => $v) {
  67. $b = array();
  68. $p = DB::table('templates')->where('parent_id',$v['id'])->select();
  69. unset($v['exam_class_id']);
  70. unset($v['id']);
  71. $b = $v;
  72. $b['exam_class_id'] = 'DX';
  73. $b['id'] = UUIDs::uuid16();
  74. $c = DB::table('templates')->insert($b);
  75. foreach ($p as $key => $value) {
  76. unset($value['exam_class_id']);
  77. unset($value['id']);
  78. unset($value['parent_id']);
  79. $y = array();
  80. $y = $value;
  81. $y['exam_class_id'] = 'DX';
  82. $y['parent_id'] = $b['id'];
  83. $y['id'] = UUIDs::uuid16();
  84. DB::table('templates')->insert($y);
  85. }
  86. }
  87. die;
  88. // 菜单权限
  89. /*$a = DB::table('doctors')->where('institution_id','74500001')->select();
  90. $i = 1;
  91. foreach($a as $k=>$v){
  92. $info = array();
  93. $info['id'] = UUIDs::uuid16();
  94. $info['doctor_id'] = $v['id'];
  95. $info['pass'] = '80ddb7d09ebc44b4';
  96. $info['type'] = 1;
  97. $c = DB::table('dr_cla_permission')->insert($info);
  98. if($c){
  99. echo $i;
  100. $i++;
  101. }
  102. }*/
  103. // 报告权限
  104. $qx = DB::table('doctors')->where('institution_id','74500001')->select();
  105. foreach($qx as $k=>$v){
  106. $qxinfo = array();
  107. if($v['department_id'] == 'd131507b77044283'){
  108. // 写报告权限
  109. $qxinfo['department_id'] = 'd131507b77044283';
  110. $qxinfo['doctor_class'] = '2,3,4';
  111. }else{
  112. $qxinfo['department_id'] = $v['department_id'];
  113. $qxinfo['doctor_class'] = '1';
  114. }
  115. $qxinfo['id'] = UUIDs::uuid16();
  116. $qxinfo['doctor_id'] = $v['id'];
  117. $qxx = DB::table('doctor_class')->insert($qxinfo);
  118. if(!$qxx){
  119. var_dump($qxinfo);
  120. }
  121. }
  122. die;
  123. $a = "select count(1) from templates where id='00'";
  124. $b = DB::query($a);
  125. var_dump($b);
  126. var_dump($b[0]['count(1)']);die;
  127. $c = DB::table('exam_class')->where('id',2)->find();
  128. var_dump($c);echo '<br>';
  129. $b = DB::table('templates')->where('exam_class_id',$c['name'])->where('create_user',1)->select();
  130. var_dump($b);die;
  131. var_dump(Cache::get('80f3d36662cddb97'));
  132. // Cache::clear();die;
  133. $a = model('app\inter\model\Exam')->select();
  134. // var_dump($a);die;
  135. // $this->uuids = new UUIDs();
  136. // $id = $this->uuids->uuid16();
  137. // var_dump($id);die;
  138. return json_encode(['status'=>'ok','code'=>'0000','info'=>$a]);
  139. }
  140. }