PublicPhone.php 987 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\library;
  3. use app\api\model\exam\ExamModel;
  4. use app\api\model\patientbind\PatientbindModel;
  5. use app\api\model\patientsearch\PatientsearchModel;
  6. /**
  7. * 存储手机号的同时
  8. * 同步公众号信息
  9. */
  10. class PublicPhone {
  11. public static function savePublicSearch($phone,$examId)
  12. {
  13. if(empty($phone) || empty($examId))
  14. {
  15. return '';
  16. }
  17. $userId = PatientbindModel::where('phone',$phone)->where('status',1)->value('user_id');
  18. $ins = ExamModel::where('id',$examId)->value('institution_id');
  19. if(empty($userId))
  20. {
  21. return '';
  22. }
  23. $data = [
  24. 'search_criteria'=>$phone,
  25. 'search_field'=>'phone',
  26. 'patient_uid'=>$userId,
  27. 'phone'=>$phone,
  28. 'institution_id'=>$ins,
  29. 'search_result'=>'1',
  30. 'exam_id'=>$examId,
  31. ];
  32. PatientsearchModel::insert($data);
  33. return '';
  34. }
  35. }