|
@@ -504,8 +504,9 @@ class Writereport extends Base
|
|
|
DB::table('exams')->where('id',$id)->update(['exam_status'=>'9']);
|
|
|
}else{
|
|
|
Message::read($doctor['id'],$report_info['remote_application_id'],4);
|
|
|
- //远程确认
|
|
|
- DB::table('remote_application')->where('id',$report_info['remote_application_id'])->update(['report_status'=>'9']);
|
|
|
+ //远程
|
|
|
+ $this->confirmReport($report_info['remote_application_id']);
|
|
|
+ // DB::table('remote_application')->where('id',$report_info['remote_application_id'])->update(['report_status'=>'9']);
|
|
|
// 添加messages消息
|
|
|
$t = '您的报告已确认';
|
|
|
$institution = DB::table('institution')->where('id',$doctor['institution_id'])->field('name')->find();
|
|
@@ -536,6 +537,43 @@ class Writereport extends Base
|
|
|
|
|
|
}
|
|
|
|
|
|
+ private function confirmReport($application_id) {
|
|
|
+ DB::startTrans();
|
|
|
+ try{
|
|
|
+ DB::table('remote_application')->where('id', $application_id)->update(['report_status'=>'9']);
|
|
|
+ $remote_order = DB::table('remote_order')
|
|
|
+ ->where('status', Application::ORDER_STATUS['PAYCOMPLTET'])
|
|
|
+ ->where('application_id', $application_id)
|
|
|
+ ->field('order_money, id, super_hospital_id')
|
|
|
+ ->find();
|
|
|
+ if(!$remote_order) {
|
|
|
+ DB::commit();
|
|
|
+ // todo 微信消息推送
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ $hospital = DB::table('institution')->where('id', $remote_order['super_hospital_id'])->field('current_money')->find();
|
|
|
+ DB::table('institution')->where('id', $remote_order['super_hospital_id'])->update(['current_money' => $current_money + $remote_order['order_money']]);
|
|
|
+ DB::table('remote_order')->where('id', $remote_order['id'])->update(['status' => Application::ORDER_STATUS['CONFIRM']]);
|
|
|
+ DB::table('remote_water')->insert([
|
|
|
+ 'id' => UUIDs::uuid16(),
|
|
|
+ 'hospital_id' => $remote_order['super_hospital_id'],
|
|
|
+ 'order_id' => $remote_order['id'],
|
|
|
+ 'money' =>$remote_order['order_money'],
|
|
|
+ 'type' => Application::WATER_TYPE['ADD'],
|
|
|
+ 'why' => Application::WATER_WHY['REMOTEINCOME'],
|
|
|
+ 'timestamp' => time(),
|
|
|
+ ]);
|
|
|
+ // 提交事务
|
|
|
+ DB::commit();
|
|
|
+ // todo 消息推送
|
|
|
+ return true;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ // 回滚事务
|
|
|
+ DB::rollback();
|
|
|
+ }
|
|
|
+ return json_encode(['status'=>'fail','code'=>'2110','确认报告失败']);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 审核报告
|
|
|
*
|