DiAn.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\controller;
  3. use app\BaseController;
  4. use app\common\array2xml;
  5. use think\facade\Cache;
  6. use think\facade\Db;
  7. use think\facade\Log;
  8. class DiAn extends BaseController
  9. {
  10. public function index()
  11. {
  12. return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V' . \think\facade\App::version() . '<br/><span style="font-size:30px;">14载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=64890268" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ee9b1aa918103c4fc"></think>';
  13. }
  14. public function hello($name = 'ThinkPHP6')
  15. {
  16. return 'hello,' . $name;
  17. }
  18. public static function getDiAnData($data)
  19. {
  20. $xml = $data;
  21. $obj = simplexml_load_string($xml,"SimpleXMLElement", LIBXML_NOCDATA);
  22. return 1;
  23. $conn = mysqli_connect('127.0.0.1','root','123456');
  24. return 2;
  25. $a = mysqli_select_db($conn,'pacscenter');
  26. return 3;
  27. $sql = "select * from dianApiInfo where Barcode='$obj'";
  28. return $sql;
  29. $result = mysqli_query($conn, $sql);
  30. $info = mysqli_fetch_row($result);
  31. if(!empty($info))
  32. {
  33. $return = [
  34. 'Response'=>[
  35. 'resultCode'=>'1',
  36. 'result'=>'请求成功',
  37. 'xml'=>$info[1],
  38. 'patientId'=>$info[2],
  39. 'barCode'=>$info[3]
  40. ]
  41. ];
  42. $a2x = new array2xml();
  43. $r = $a2x->toXml($return);
  44. return $r;
  45. }else{
  46. $return = [
  47. 'Response'=>[
  48. 'resultCode'=>'0',
  49. 'result'=>'数据无法找到',
  50. 'xml'=>'',
  51. 'patientId'=>'',
  52. 'barCode'=>$obj
  53. ]
  54. ];
  55. $a2x = new array2xml();
  56. $r = $a2x->toXml($return);
  57. return $r;
  58. }
  59. // $a2x = new array2xml();
  60. // $data = $a2x->toXml($info);
  61. // return htmlspecialchars($data);
  62. return $data;
  63. }
  64. }