三方报告 和 验证码

main
yanzai 7 months ago
parent ae911b6cff
commit 0ff7b4b890

@ -21,7 +21,7 @@
// env = 'dev'
// env = 'dev'
const api_url = {
main: 'https://zwrmyy.sixinyun.com'
main: 'https://shanghaikstj.sixinyun.com'
}
if (env === 'dev') {
api_url.main = 'http://sixintijian'

@ -21,7 +21,9 @@ class PEISApiController extends Controller
$api['团检预约取消'] = "{$url}/PEISCommon/CancelUnitAppointment/{$code}";
$api['个检预约取消'] = "{$url}/PEISCommon/CancelPersonAppointment/{$code}";
$api['报告文件下载'] = "{$url}/PEISCommon/DownloadReportFile/{$code}";
$api['三方报告文件下载'] = "{$url}/PEISCommon/DownloadExternalReportFile/{$code}";
$api['体检报告查询'] = "{$url}/PEISCommon/QueryExamReport/{$code}";
$api['三方体检报告查询'] = "{$url}/PEISCommon/QueryExternalReport/{$code}";
$api['分诊延后队列'] = "{$url}/PEISCommon/SkipQueue/{$code}";
$api['分诊加入队列'] = "{$url}/PEISCommon/JoinQueue/{$code}";
$api['分诊查询排队信息'] = "{$url}/PEISCommon/QueryTriage/{$code}";

@ -5,6 +5,8 @@ namespace App\Http\Controllers;
use App\Models\AnalysisType;
use App\Models\Hospital;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Yo;
@ -12,6 +14,9 @@ class ReportController extends Controller
{
public function down_pdf(Request $request)
{
$sf=$request->post('sf');
$type=$request->post('type');//文件类型
$data = [
"体检号" => $request->post('rid'),
"查询密码" => $request->post('password'),
@ -21,23 +26,37 @@ class ReportController extends Controller
if (!$hospital_info) Yo::error_echo(100000, ['机构/医院']);
$code = $hospital_info->code;
$peis = new PEISApiController();
$url = $peis::Api('报告文件下载', $code);
$data_string = json_encode($data, JSON_UNESCAPED_UNICODE);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($data_string)
]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$res_string = curl_exec($ch);
curl_close($ch);
if ($res_string == '无效URL') Yo::error_echo(200065);
if(isset($sf) and $sf==1){
$url = $peis::Api('三方报告文件下载', $code);
$url=$url.'?fileId='.$request->post('id').'&reportType='.$type;
$response = Http::get($url);
if ($response->successful()) {
$res = $response->body();
}else{
Yo::error_echo(200065);
}
$res_string=$res;
}else{
$url = $peis::Api('报告文件下载', $code);
$data_string = json_encode($data, JSON_UNESCAPED_UNICODE);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json; charset=utf-8',
'Content-Length: ' . strlen($data_string)
]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$res_string = curl_exec($ch);
curl_close($ch);
if ($res_string == '无效URL') Yo::error_echo(200065);
}
$disk = Storage::disk('public');
$name = $request->post('id');
$date = $request->post('rid');
$date = date('Ymd');
$path = "/assets/upload/pdf/$date/$name.pdf";
$put = $disk->put($path, $res_string);
if (!$put) Yo::error_echo(100028, ['put']);
@ -529,7 +548,20 @@ class ReportController extends Controller
public function info(Request $request)
{
$id = $request->post('id');
$res = self::get_report($id);
$sf = $request->post('sf');//三方0否1是
$peis = new PEISApiController();
if($sf===1){
//获取三方报告
$sanfang_res = $peis::Post('三方体检报告查询', request()->post('hospital'), [
"电话号码" => "",
"证件号码" => "",
"报告Id" => $id
])['data'];
}else{
$res = self::get_report($id);
}
$conclusion = [
'datetime' => '',
'doctor' => '',
@ -540,20 +572,15 @@ class ReportController extends Controller
$list = [
'info' => [
'id' => '',
'password' => ''
'password' => '',
'sf' => 0
],
'list' => []
];
if (count($res) != 0) {
if($res[0]['体检状态']!='报告已出') Yo::error_echo(200090);
$info=false;
if (isset($res) and count($res) != 0) {
if ($res[0]['体检状态'] != '报告已出') Yo::error_echo(200090);
$info = self::orderReport($res[0]);
// Yo::error_exit([
// 'message' => "res",
// 'code' => 2001,
// 'data' => $res
// ]);
$list['info']['id'] = $info['体检号'];
$list['info']['password'] = $info['查询密码'];
$list['list'] = $info['报告文件列表'];
@ -563,6 +590,14 @@ class ReportController extends Controller
'content' => $info['总检结论'],
'suggestion' => $info['总检建议'],
];
}
if(isset($sanfang_res) and count($sanfang_res)!=0){
$info= $sanfang_res[0];
$list['info']['sf']=1;
$list['list'] =[['文件Id'=>$info['文件Id'],'报告名称'=>$info['报告名称'],'报告类型'=>$info['报告类型']]];
}
if(!!$info){
foreach ($info['收费项目列表'] as $item) {
$content_list = [];
foreach ($item['基础项目列表'] as $i) {
@ -575,12 +610,14 @@ class ReportController extends Controller
}
$content[] = [
'title' => $item['收费项目名称'],
'datetime' => str_replace('T', ' ', $info['登记时间']),
'datetime' => str_replace('T', ' ', $sf===1?$item['检查时间']:$info['登记时间']),
'doctor' => $item['检查医生'],
'list' => $content_list
];
}
}
return Yo::echo([
'conclusion' => $conclusion,
'content' => $content,
@ -607,6 +644,20 @@ class ReportController extends Controller
'desc' => $hospital->name,
];
}
return Yo::echo(['list' => $list]);
//获取三方报告
$sanfang_res = $peis::Post('三方体检报告查询', $hospital->id, [
"电话号码" => "",
"证件号码" => $id_number,
"报告Id" => ''
])['data'];
$sanfang_list = [];
foreach ($sanfang_res as $item) {
$sanfang_list[] = [
'id' => $item['文件Id'],
'title' => explode('T', $item['收费项目列表'][0]['检查时间'])[0].$item['报告名称'] . '报告',
'desc' => $hospital->name,
];
}
return Yo::echo(['list' => $list,'sanfang_list'=>$sanfang_list]);
}
}

@ -0,0 +1,177 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Login;
use Yo;
class SmsController extends Controller
{
public $accessKeyId = 'LTAI5t7CPSKykQwQoAsq8yv3';
public $accessKeySecret = '3owutPRIKGzVTGbFvd5A5k9BPIglfS';
public $signName = '衡水市博爱健康医院';
public $TemplateCode = 'SMS_314661207';
public $Lifespan=1;//验证码有效期单位分钟
public function SendSms(Request $request)
{
Login::user();
// $lifespan=10;//验证码有效期单位分钟
$phone = $request->post('phone');
if(strlen($phone)!==11) Yo::error_echo(200093);
$code=$this->generateCode();
if(strlen($code)===4){
$cha=DB::table('sms')->where(['phone'=>$phone])->orderBy('id','desc')->first();
if(!!$cha){
$specificTimeTimestamp = strtotime($cha->created_at);
// 计算一分钟之后的时间戳
$oneMinuteLaterTimestamp = strtotime('+1 minute', $specificTimeTimestamp);
if($oneMinuteLaterTimestamp>time()){
Yo::error_echo(200094);
}
}
$end_time = strtotime('+'.$this->Lifespan.' minute', time());
$in=DB::table('sms')->insert([
'code'=>$code,
'phone'=>$phone,
'status'=>0,
'lifespan'=>$this->Lifespan,
'end_time'=>date('Y-m-d H:i:s', $end_time)
]);
if($in){
//调用发送短信接口
$templateParam = json_encode(['code' => $code], JSON_UNESCAPED_UNICODE);
$send= self::sendSms2($phone,$templateParam);
if($send->Code=="OK"){
return Yo::echo(['status' => true]);
}else{
Yo::error_echo(200096);
}
}
}
}
//校验短信验证码
public function CheckCode($phone,$code)
{
$nowtime=date('Y-m-d H:i:s');
$cha=DB::table('sms')->where(['phone'=>$phone,'code'=>$code,'status'=>0,['end_time','>',$nowtime]])->first();
if(!!$cha){
$u=DB::table('sms')->where(['id'=>$cha->id])->update([
'status'=>1
]);
if($u){
return true;
}
}else{
return false;
}
}
// 生成随机验证码
function generateCode($length = 4) {
$characters = '0123456789';
$code = '';
for ($i = 0; $i < $length; $i++) {
$code .= $characters[rand(0, strlen($characters) - 1)];
}
return $code;
}
public function testSms(){
$templateParam = json_encode(['code' => '0245'], JSON_UNESCAPED_UNICODE);
$send= self::sendSms2('19933509886',$templateParam);
return $send;
}
public function sendSms2($mobile,$paramString) {
//$mobile='19933509886';
// $paramString='';
$params = array ();
$accessKeyId = $this->accessKeyId;
$accessKeySecret = $this->accessKeySecret;
$params["PhoneNumbers"] = $mobile;
$params["SignName"] = $this->signName;
$params["TemplateCode"] = $this->TemplateCode;
$params['TemplateParam'] = $paramString;
$content = $this->request(
$accessKeyId,
$accessKeySecret,
"dysmsapi.aliyuncs.com",
array_merge($params, array(
"RegionId" => "cn-hangzhou",
"Action" => "SendSms",
"Version" => "2017-05-25",
))
);
return $content;
}
public function request($accessKeyId, $accessKeySecret, $domain, $params, $security=false) {
$apiParams = array_merge(array (
"SignatureMethod" => "HMAC-SHA1",
"SignatureNonce" => uniqid(mt_rand(0,0xffff), true),
"SignatureVersion" => "1.0",
"AccessKeyId" => $accessKeyId,
"Timestamp" => gmdate("Y-m-d\TH:i:s\Z"),
"Format" => "JSON",
), $params);
ksort($apiParams);
$sortedQueryStringTmp = "";
foreach ($apiParams as $key => $value) {
$sortedQueryStringTmp .= "&" . $this->encode($key) . "=" . $this->encode($value);
}
$stringToSign = "GET&%2F&" . $this->encode(substr($sortedQueryStringTmp, 1));
$sign = base64_encode(hash_hmac("sha1", $stringToSign, $accessKeySecret . "&",true));
$signature = $this->encode($sign);
$url = ($security ? 'https' : 'http')."://{$domain}/?Signature={$signature}{$sortedQueryStringTmp}";
try {
$content = $this->fetchContent($url);
return json_decode($content);
} catch( \Exception $e) {
return false;
}
}
private function encode($str)
{
$res = urlencode($str);
$res = preg_replace("/\+/", "%20", $res);
$res = preg_replace("/\*/", "%2A", $res);
$res = preg_replace("/%7E/", "~", $res);
return $res;
}
private function fetchContent($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"x-sdk-client" => "php/2.0.0"
));
if(substr($url, 0,5) == 'https') {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
$rtn = curl_exec($ch);
if($rtn === false) {
trigger_error("[CURL_" . curl_errno($ch) . "]: " . curl_error($ch), E_USER_ERROR);
}
curl_close($ch);
return $rtn;
}
}

@ -36,6 +36,7 @@ class UserPersonController extends Controller
$birthday = $request->post('birthday');
$sex = $request->post('sex');
$phone = $request->post('phone');
$code = $request->post('code');
$relationship = $request->post('relationship');
$marriage = $request->post('marriage');
$default = $request->post('default');
@ -46,6 +47,11 @@ class UserPersonController extends Controller
UserPerson::where('user', Login::$info->id)
->where('del', 2)->where('default', 1)->update(['default' => 2]);
}
if(!isset($birthday)) Yo::error_echo(200097);
//校验短信验证码
$Sms=new SmsController();
$checkCode= $Sms->CheckCode($phone,$code);
if(!$checkCode) Yo::error_echo(200095);
$default = $user_person_default_count > 0 ? 2 : 1;
$user_person = new UserPerson();
$user_person->user = Login::$info->id;

@ -138,4 +138,10 @@ return [
200088 => '分账名称长度在1-50位字符之间',
200089 => '分账类型不支持追回',
200090 => '该报告未出',
200093 => '手机号码格式不正确',
200094 => '请稍后再发送',
200095 => '验证码无效',
200096 => '短信发送失败',
200097 => '请选择生日',
];

@ -182,3 +182,5 @@ Route::post("api/$mp_api/Chat/UserChangeWorkOrder", [\App\Http\Controllers\ChatC
Route::post("api/$admin_api/Get/SiXinItems", [\App\Http\Controllers\ComboItemController::class, 'GetSiXinItems']);
Route::post("api/$admin_api/Get/SiXinItemsLinks", [\App\Http\Controllers\ComboItemController::class, 'GetSiXinItemsLinks']);
Route::post("api/$admin_api/Bind/SiXinItemsLinks", [\App\Http\Controllers\ComboItemController::class, 'BindSiXinItemsLinks']);
Route::any("api/$mp_api/sms/SendSms", [\App\Http\Controllers\SmsController::class, 'SendSms']);//发送验证码
Route::any("api/$mp_api/sms/testSendSms", [\App\Http\Controllers\SmsController::class, 'testSms']);//ceshi发送验证码

@ -41,6 +41,7 @@ url_array['User/status'] = `${url_}/api/Mp/User/status`;
url_array['Hospital/info'] = `${url_}/api/Mp/Hospital/info`;
url_array['Carousel/list'] = `${url_}/api/Mp/Carousel/list`;
url_array['Config/get'] = `${url_}/api/Mp/Config/get`;
url_array['Sms/SendSms'] = `${url_}/api/Mp/sms/SendSms`;
url_array['YO'] = `${url_}/api/yo`;
const api = (mark) => {
if (mark === '') return url_;

@ -133,6 +133,10 @@ export const HospitalInfoAction = async (data) => await $post({
url: 'Hospital/info',
data
})
export const SmsSendSmsAction = async (data) => await $post({
url: 'Sms/SendSms',
data
})
export const yo = async (data) => await $post({
url: 'YO',
data

@ -12,6 +12,7 @@
UserPersonUpdateAction,
UserPersonCountAction,
UserPersonInfoAction,
SmsSendSmsAction,
$image,
$response
} from '@/api'
@ -196,7 +197,35 @@
}
})
}
const sendSmsFunc = async () => {
if(user_person_info.value.birthday.length<1){
uni.showToast({
title: "请选择生日",
icon:"none"
});
return false
}
if(user_person_info.value.phone.length<1){
uni.showToast({
title: "请输入手机号",
icon:"none"
});
return false
}
uni.showLoading()
const response = await SmsSendSmsAction({
'phone': user_person_info.value.phone
})
uni.hideLoading();
$response(response, () => {
if(response.data.status===true){
uni.showToast({
title:"短信发送成功",
duration: 2000
});
}
})
}
const saveClick = async () => {
if(tongyi.value!='tongyi'){
uni.showToast({
@ -268,11 +297,26 @@
<image :src="$image('/storage/assets/mp/user/箭头@2x.png')"></image>
</view>
</view>
<view class="input_line_wrapper">
<!-- <view class="input_line_wrapper">
<view class="input_line_title_wrapper">手机号</view>
<view class="input_line_input_wrapper">
<input type="text" v-model="user_person_info.phone" placeholder="请输入">
</view>
</view> -->
<view class="input_line_wrapper2">
<view class="input_line_title_wrapper">手机号</view>
<view class="input_line_input_wrapper" style="width: 350rpx;">
<input type="text" v-model="user_person_info.phone" style="width: 350rpx;" placeholder="请输入">
</view>
<view v-if="Number($props.id) === 0" class="send_button" @click="sendSmsFunc()">
获取验证码
</view>
</view>
<view class="input_line_wrapper" v-if="Number($props.id) === 0">
<view class="input_line_title_wrapper">验证码</view>
<view class="input_line_input_wrapper">
<input type="text" v-model="user_person_info.code" placeholder="请输入">
</view>
</view>
<view class="input_line_wrapper">
<view class="input_line_title_wrapper">关系</view>
@ -426,4 +470,24 @@
border-bottom: 1rpx #EBEBEB solid;
position: relative;
}
.input_line_wrapper2 {
display: flex;
height: 110rpx;
align-items: center;
line-height: 110rpx;
width: 690rpx;
margin: 0 auto;
border-bottom: 1rpx #EBEBEB solid;
position: relative;
}
.send_button {
border: 1rpx solid #ccc;
font-size: 24rpx;
height: 60rpx;
line-height: 60rpx;
padding-left: 10rpx;
padding-right: 10rpx;
border-radius: 10rpx;
margin-left: 20rpx;
}
</style>

@ -1,7 +1,7 @@
let url_ = "https://hssbajkyy.sixinyun.com";
const dev = 0
const dev =0
if (dev === 1) {
url_ = "http://192.168.31.106:8000"
url_ = "http://hengshuiboai"
}
let url_array = {};
url_array['ReportDown'] = `${url_}/api/Mp/Down/pdf`;

@ -4,7 +4,7 @@ import {
let url_ = "https://hssbajkyy.sixinyun.com";
const dev = 0
if (dev === 1) {
url_ = "http://192.168.31.106:8000"
url_ = "http://hengshuiboai"
}
export const HospitalExtraReportStatusAction = async (data) => await $post({
url: 'HospitalExtraReportStatus',

@ -23,7 +23,8 @@
default: {
info: {
id: '',
password: ''
password: '',
sf:0,
},
list: []
}
@ -32,13 +33,15 @@
const popup=ref(null)
let url = ref('')
const ReportDown = async (id) => {
const ReportDown = async (id,type='') => {
uni.showLoading({
title: '正在查询报告...'
})
const response = await ReportDownAction({
rid: props.list.info.id,
password: props.list.info.password,
sf:props.list.info.sf?props.list.info.sf:0,
type:type,
id,
})
uni.hideLoading()
@ -137,7 +140,7 @@
</view>
<view class="report_list_wrapper">
<!-- <view @click="tiao()"></view> -->
<view @click="ReportDown(i['文件Id'])" class="report_item_wrapper" v-for="(i,k) in props.list.list" :key="k">
<view @click="ReportDown(i['文件Id'],i['报告类型']?i['报告类型']:'')" class="report_item_wrapper" v-for="(i,k) in props.list.list" :key="k">
<view class="report_item_icon_wrapper">
<image :src="$image('/storage/assets/report/home/报告@2x.png')"></image>
</view>

@ -37,9 +37,11 @@
$response(response, () => {
uni.hideLoading();
report_list.value = response.data.list
sanfang_report_list.value=response.data.sanfang_list
})
}
const report_list = ref([])
let sanfang_report_list=ref([])
const toPage = (page) => {
uni.navigateTo({
@ -48,7 +50,12 @@
}
const toReport = (id) => {
uni.navigateTo({
url: `/pages/main/report/report?hospital=${$props.hospital}&type=1&id=${id}`
url: `/pages/main/report/report?hospital=${$props.hospital}&type=1&sf=0&id=${id}`
})
}
const toSanFangReport=(id)=>{
uni.navigateTo({
url: `/pages/main/report/report?hospital=${$props.hospital}&type=2&sf=1&id=${id}`
})
}
@ -98,6 +105,18 @@
<image :src="$image('/storage/assets/report/home/右箭头@2x.png')"></image>
</view>
</view>
<view @click="toSanFangReport(i.id)" class="report_item_wrapper" v-for="(i,k) in sanfang_report_list" :key="k">
<view class="report_item_icon_wrapper">
<image :src="$image('/storage/assets/report/home/报告@2x.png')"></image>
</view>
<view class="report_item_content_wrapper">
<view class="report_item_content_title_wrapper">{{ i.title }}</view>
<view class="report_item_content_desc_wrapper">{{ i.desc }}</view>
</view>
<view class="report_item_right_wrapper">
<image :src="$image('/storage/assets/report/home/右箭头@2x.png')"></image>
</view>
</view>
</view>
</view>
</template>

@ -24,6 +24,10 @@
type: String,
default: '1'
},
sf: {//01
type: String,
default: '0'
},
id: {
type: String,
default: '0'
@ -36,7 +40,7 @@
const chooseTypeClick = (type) => {
if (Number($props.type) === type) return
uni.redirectTo({
url: `/pages/main/report/report?hospital=${$props.hospital}&type=${type}&id=${$props.id}`
url: `/pages/main/report/report?hospital=${$props.hospital}&type=${type}&sf=${$props.sf}&id=${$props.id}`
})
}
const ReportInfo = async () => {
@ -44,7 +48,8 @@
title: '加载中...'
});
const response = await ReportInfoAction({
id: $props.id
id: $props.id,
sf:Number($props.sf)
})
$response(response, () => {
uni.hideLoading();
@ -52,6 +57,7 @@
content: response.data.content,
conclusion: response.data.conclusion,
list: response.data.list,
}
})
}
@ -68,7 +74,7 @@
<view>
<view class="type_group_top_blank_wrapper"></view>
<view class="type_group_wrapper">
<view @click="chooseTypeClick(1)" class="type_item_wrapper" :class="[
<view v-if="Number($props.sf)==0" @click="chooseTypeClick(1)" class="type_item_wrapper" :class="[
Number($props.type) === 1 ? 'type_item_active_wrapper' : ''
]">
<view class="type_item_text_wrapper">总检结论</view>

Loading…
Cancel
Save