|
@@ -517,6 +517,13 @@ class Writereport extends Base
|
|
|
if($report_info['type'] == 1){
|
|
|
//本地报告确认
|
|
|
DB::table('exams')->where('id',$id)->update(['exam_status'=>'9']);
|
|
|
+ $sms = DB::table('institution')->where('id',$doctor['institution_id'])->value('patient_sms');
|
|
|
+ if($sms == 1){
|
|
|
+ $examData = DB::table('exams')->where('id',$id)->field('phone,study_id')->find();
|
|
|
+ $phone = $examData['phone'];
|
|
|
+ $study_id = $examData['study_id'];
|
|
|
+ $this->sendSms($phone,$report_id,$id,$study_id);
|
|
|
+ }
|
|
|
}else{
|
|
|
Message::read($doctor['id'],$report_info['remote_application_id'],4);
|
|
|
//远程
|
|
@@ -555,6 +562,38 @@ class Writereport extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function sendSms($phone,$reportId,$examId,$studyId)
|
|
|
+ {
|
|
|
+ $code = $this->getRandomString(4);
|
|
|
+ $id = UUIDs::uuid16();
|
|
|
+ if(empty($phone)){
|
|
|
+ $send_message = 0;
|
|
|
+ }else{
|
|
|
+ //发送短信
|
|
|
+ $send = send_message::sendSms2Patient($phone,$code,$id);
|
|
|
+ $data = json_decode(json_encode($send),true);
|
|
|
+ if($data['Code'] == 'OK'){
|
|
|
+ $send_message = 1;
|
|
|
+ }else{
|
|
|
+ $send_message = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $share = [
|
|
|
+ 'id'=>$id,
|
|
|
+ 'report_id'=>$reportId,
|
|
|
+ 'exam_id'=>$examId,
|
|
|
+ 'code'=>$code,
|
|
|
+ 'send_time'=>time(),
|
|
|
+ 'expires_time'=>time()+86400*7,
|
|
|
+ 'send_message'=>$send_message,
|
|
|
+ 'url'=>'',
|
|
|
+ 'phone'=>$phone,
|
|
|
+ 'study_id'=> $studyId
|
|
|
+ ];
|
|
|
+ DB::table('share')->insert($share);
|
|
|
+ }
|
|
|
+
|
|
|
private function confirmReport($application_id, $wechatService) {
|
|
|
Db::startTrans();
|
|
|
try{
|