给第三方接口
parent
3faa049006
commit
07c6223869
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API\Internal;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class AppointmentController extends Controller
|
||||
{
|
||||
//给第三的接口,查询预约记录
|
||||
public function GetAppointmentRecord(){
|
||||
date_default_timezone_set('PRC');
|
||||
$sfz =request('id_card_num');
|
||||
$org_sn =request('org_sn');
|
||||
if(!isset($sfz)) return \Yz::echoError1('证件号不能为空');
|
||||
if(!isset($org_sn)) return \Yz::echoError1('机构code不能为空');
|
||||
|
||||
$currentYear = date('Y');
|
||||
$firstDay = date('Y-01-01', strtotime($currentYear));
|
||||
$lastDay = date('Y-12-31', strtotime($currentYear));
|
||||
|
||||
$HSM=\App\Lib\HSM::HsmEncrypt($sfz);
|
||||
if($HSM['status']!=true){
|
||||
return \Yz::echoError1('调用HSM加密失败');
|
||||
}
|
||||
$sfz=$HSM['data'];
|
||||
$infos=[];
|
||||
if(isset($sfz)){
|
||||
$info=DB::table('appointment_record as a')
|
||||
->select('a.id','a.name','a.sex','a.tel','a.id_card_num','a.date','a.time','a.type','a.fee_type as free_type','a.doc_type_id','a.org_code as org_sn','a.org_name','a.doc_type_name','a.created_at','b.org_name')
|
||||
->join('medical_institution as b','a.org_code','=','b.sn')
|
||||
->where(['a.id_card_num'=>$sfz,'a.is_del'=>0,'a.org_code'=>$org_sn])
|
||||
->whereBetween('a.created_at',[$firstDay,$lastDay])->orderBy('a.id','desc')->first();
|
||||
|
||||
if(!!$info){
|
||||
//查询相关图片
|
||||
$imgs=[];
|
||||
$imgs=DB::table('appointment_img')->where(['appointment_record_id'=>$info->id])->get();
|
||||
foreach ($imgs as $key=>$item){
|
||||
$imgs[$key]->imgurl=env('APP_URL').$item->imgurl;
|
||||
}
|
||||
$info->files=$imgs;
|
||||
$info->id_card_num=request('id_card_num');
|
||||
$infos[]=$info;
|
||||
}
|
||||
return \Yz::Return(true,'查完完成',$infos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class OrgService
|
||||
{
|
||||
//根据org_sn获取机构信息
|
||||
public function GetOrgInfo($org_sn){
|
||||
$orgInfo=DB::table('medical_institution')->where('sn',$org_sn)->get();
|
||||
if(count($orgInfo)==0){
|
||||
return ['status'=>false,'msg'=>'机构不存在'];
|
||||
}
|
||||
if(count($orgInfo)<>1){
|
||||
return ['status'=>false,'msg'=>'机构编码异常'];
|
||||
}
|
||||
return ['status'=>true,'msg'=>'','data'=>$orgInfo[0]];
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue