Commit 3482042e by 赵增煜

Merge branch 'local-0409' into develop

parents c0062902 15ad825e
......@@ -106,7 +106,8 @@ protected function grid()
$grid->column('doctCaSign');
$grid->column('originalData');
$grid->column('certificate');
$grid->column('reviewUrl')->width(3);
# $grid->column('reviewUrl')->width(3);
$grid->column('textRecords')->width(3);
$grid->column('firstVisitRecord')->width(3);
$grid->column('created_at');
$grid->column('updated_at')->sortable();
......@@ -142,6 +143,7 @@ protected function grid()
'visitTimeStart' => '就诊开始时间',
'visitTimeEnd' => '诊断结束时间',
'reviewUrl' => '诊疗过程调阅地址',
'textRecords' => '诊疗过程数据',
'firstVisitRecord' => '线下初诊记录',
];
$grid->export($titles)->filename("问诊信息")->rows(function($rows){
......
......@@ -32,11 +32,17 @@ public function handle()
{
$this->info('处方信息(中药)同步开始...');
$timestamp_str = $this->argument('timestamp_str') ?? '';
// 如果 timestamp_str 为空,则获取当月的起始时间戳(精确到毫秒)
// 如果 timestamp_str 为空,则判断是否是当月第一天,决定取哪个月的第一天
if (empty($timestamp_str)) {
// 获取当前月份的第一天
$startOfMonth = Carbon::now()->startOfMonth();
// 转换为时间戳(秒级),然后乘以 1000 转换为毫秒
$now = Carbon::now();
if ($now->isSameDay($now->copy()->startOfMonth())) {
// 当前是当月第一天,获取上一个月的第一天
$startOfMonth = $now->subMonth()->startOfMonth();
} else {
// 当前不是当月第一天,获取当前月的第一天
$startOfMonth = $now->startOfMonth();
}
// 转换为毫秒时间戳
$timestamp_str = $startOfMonth->timestamp * 1000;
}
// 计算结束时间:基于 timestamp_str 加上 30 天
......
......@@ -32,11 +32,17 @@ public function handle()
{
$this->info('问诊同步开始...');
$timestamp_str = $this->argument('timestamp_str') ?? '';
// 如果 timestamp_str 为空,则获取当月的起始时间戳(精确到毫秒)
// 如果 timestamp_str 为空,则判断是否是当月第一天,决定取哪个月的第一天
if (empty($timestamp_str)) {
// 获取当前月份的第一天
$startOfMonth = Carbon::now()->startOfMonth();
// 转换为时间戳(秒级),然后乘以 1000 转换为毫秒
$now = Carbon::now();
if ($now->isSameDay($now->copy()->startOfMonth())) {
// 当前是当月第一天,获取上一个月的第一天
$startOfMonth = $now->subMonth()->startOfMonth();
} else {
// 当前不是当月第一天,获取当前月的第一天
$startOfMonth = $now->startOfMonth();
}
// 转换为毫秒时间戳
$timestamp_str = $startOfMonth->timestamp * 1000;
}
// 计算结束时间:基于 timestamp_str 加上 30 天
......@@ -75,6 +81,8 @@ public function handle()
}
# 处理数据存入到数据库,如果存在就更新否则就新增
foreach ($response_data as $item) {
// $this->info('问诊====>:'. json_encode($item));
// break;
$medical = MedicalModel::where('visitNo', $item['visitNo'])->first();
if($medical){
$this->info('更新问诊:'. $item['visitNo']);
......@@ -148,6 +156,11 @@ public function handle()
if (isset($item['firstVisitRecord'])) {
$medical->firstVisitRecord = json_encode($item['firstVisitRecord'], JSON_UNESCAPED_UNICODE); // 线上复诊的线下初诊记录信息
}
if (isset($item['textRecords'])) {
$medical->textRecords = json_encode($item['textRecords'], JSON_UNESCAPED_UNICODE);
}
$medical->updated_at = Carbon::now();
// 保存数据
$medical->save();
......@@ -225,6 +238,10 @@ public function handle()
if (isset($item['firstVisitRecord'])) {
$medical->firstVisitRecord = json_encode($item['firstVisitRecord'], JSON_UNESCAPED_UNICODE); // 线上复诊的线下初诊记录信息
}
if (isset($item['textRecords'])) {
$medical->textRecords = json_encode($item['textRecords'], JSON_UNESCAPED_UNICODE);
}
// 保存数据
$medical->save();
......
......@@ -31,11 +31,17 @@ public function handle()
{
$this->info('处方信息(西药)同步开始...');
$timestamp_str = $this->argument('timestamp_str') ?? '';
// 如果 timestamp_str 为空,则获取当月的起始时间戳(精确到毫秒)
// 如果 timestamp_str 为空,则判断是否是当月第一天,决定取哪个月的第一天
if (empty($timestamp_str)) {
// 获取当前月份的第一天
$startOfMonth = Carbon::now()->startOfMonth();
// 转换为时间戳(秒级),然后乘以 1000 转换为毫秒
$now = Carbon::now();
if ($now->isSameDay($now->copy()->startOfMonth())) {
// 当前是当月第一天,获取上一个月的第一天
$startOfMonth = $now->subMonth()->startOfMonth();
} else {
// 当前不是当月第一天,获取当前月的第一天
$startOfMonth = $now->startOfMonth();
}
// 转换为毫秒时间戳
$timestamp_str = $startOfMonth->timestamp * 1000;
}
// 计算结束时间:基于 timestamp_str 加上 30 天
......@@ -75,6 +81,9 @@ public function handle()
}
# 处理数据存入到数据库,如果存在就更新否则就新增
foreach ($response_data as $item) {
if ($item['hosRxCode'] == 'P17453092169362RG'){
}
$prescription = ExternalWmPrescriptionModel::where('hosRxCode', $item['hosRxCode'])->first();
if($prescription){
$this->info('更新处方(西药):'. $item['hosRxCode']);
......
......@@ -55,6 +55,7 @@ public function up()
$table->longText('originalData')->comment('数据原文');
$table->longText('certificate')->comment('数字证书');
$table->text('reviewUrl')->comment('诊疗过程调阅地址');
$table->longText('textRecords')->comment('诊疗过程数据');
$table->longText('firstVisitRecord')->comment('线下初诊记录');
$table->timestamps();
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment