522 lines
30 KiB
PHP
522 lines
30 KiB
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Facades\CommonService;
|
|
use App\Jobs\AddErrorLog;
|
|
use App\Models\FatKind;
|
|
use App\Models\FatMaxMin;
|
|
use App\Models\HealthKind;
|
|
use App\Models\HealthLevel;
|
|
use App\Models\NewFatLog;
|
|
use App\Models\User;
|
|
use App\Models\UserInfo;
|
|
use App\Models\Version;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Illuminate\Support\Facades\Redis;
|
|
|
|
class ConfigService
|
|
{
|
|
public function stepConfig($user,$sex=1)
|
|
{
|
|
$step_two_info = [
|
|
[
|
|
'index' => 'stomach',
|
|
'title' => trans('app.stomach.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.stomach.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 1],
|
|
['key' => 'key2', 'name' => trans('app.stomach.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.stomach.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.stomach.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.stomach.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.stomach.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.stomach.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.stomach.key8'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key9', 'name' => trans('app.stomach.key9'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
],
|
|
],
|
|
[
|
|
'index' => 'heart',
|
|
'title' => trans('app.heart.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.heart.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 1],
|
|
['key' => 'key2', 'name' => trans('app.heart.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.heart.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.heart.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.heart.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.heart.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.heart.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.heart.key8'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
],
|
|
],
|
|
[
|
|
'index' => 'sleep',
|
|
'title' => trans('app.sleep.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.sleep.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 1],
|
|
['key' => 'key2', 'name' => trans('app.sleep.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.sleep.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.sleep.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.sleep.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.sleep.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.sleep.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.sleep.key8'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key9', 'name' => trans('app.sleep.key9'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key10', 'name' => trans('app.sleep.key10'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
],
|
|
],
|
|
[
|
|
'index' => 'man',
|
|
'title' => trans('app.man.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.man.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 1],
|
|
['key' => 'key2', 'name' => trans('app.man.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.man.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.man.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.man.key5'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'woman',
|
|
'title' => trans('app.woman.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.woman.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.woman.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.woman.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.woman.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.woman.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.woman.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.woman.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.woman.key8'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key9', 'name' => trans('app.woman.key9'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key10', 'name' => trans('app.woman.key10'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'other',
|
|
'title' => trans('app.other.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.other.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 1],
|
|
['key' => 'key2', 'name' => trans('app.other.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.other.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.other.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.other.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.other.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.other.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.other.key8'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
// ['key' => 'key9', 'name' => trans('app.other.key9'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
['key' => 'key10', 'name' => trans('app.other.key10'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
// ['key' => 'key11', 'name' => trans('app.other.key11'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
['key' => 'key12', 'name' => trans('app.other.key12'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key13', 'name' => trans('app.other.key13'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key14', 'name' => trans('app.other.key14'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key15', 'name' => trans('app.other.key15'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key16', 'name' => trans('app.other.key16'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'dietary',
|
|
'title' => trans('app.dietary.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key9', 'name' => trans('app.dietary.key9'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key10', 'name' => trans('app.dietary.key10'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key1', 'name' => trans('app.dietary.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key11', 'name' => trans('app.dietary.key11'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.dietary.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.dietary.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.dietary.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.dietary.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.dietary.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.dietary.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.dietary.key8'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'living',
|
|
'title' => trans('app.living.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.living.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.living.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.living.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.living.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.living.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.living.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.living.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.living.key8'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'mental',
|
|
'title' => trans('app.mental.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.mental.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.mental.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.mental.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.mental.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.mental.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.mental.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.mental.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.mental.key8'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key9', 'name' => trans('app.mental.key9'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key10', 'name' => trans('app.mental.key10'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'surgery',
|
|
'title' => trans('app.surgery.title'),
|
|
'isMultiple' => 0,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.surgery.key1'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.surgery.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'medication',
|
|
'title' => trans('app.medication.title'),
|
|
'isMultiple' => 0,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.medication.key1'), 'isDesc' => 2, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.medication.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'allergies',
|
|
'title' => trans('app.allergies.title'),
|
|
'isMultiple' => 0,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.allergies.key1'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.allergies.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'family',
|
|
'title' => trans('app.family.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.family.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.family.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.family.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.family.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.family.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.family.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.family.key7'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'family_member',
|
|
'title' => trans('app.family_member.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.family_member.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.family_member.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.family_member.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.family_member.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.family_member.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.family_member.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.family_member.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.family_member.key8'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'personal',
|
|
'title' => trans('app.personal.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.personal.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.personal.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.personal.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.personal.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.personal.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.personal.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.personal.key7'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key8', 'name' => trans('app.personal.key8'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
// [
|
|
// 'index' => 'know',
|
|
// 'title' => trans('app.know.title'),
|
|
// 'isMultiple' => 0,
|
|
// 'must' => 1,
|
|
// 'isText' => 0,
|
|
// 'desc' => '',
|
|
// 'config' => [
|
|
// ['key' => 'key1', 'name' => trans('app.know.key1'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ['key' => 'key2', 'name' => trans('app.know.key2'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ]
|
|
// ],
|
|
// [
|
|
// 'index' => 'understand',
|
|
// 'title' => trans('app.understand.title'),
|
|
// 'isMultiple' => 0,
|
|
// 'must' => 1,
|
|
// 'isText' => 0,
|
|
// 'desc' => '',
|
|
// 'config' => [
|
|
// ['key' => 'key1', 'name' => trans('app.understand.key1'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ['key' => 'key2', 'name' => trans('app.understand.key2'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ]
|
|
// ],
|
|
// [
|
|
// 'index' => 'really',
|
|
// 'title' => trans('app.really.title'),
|
|
// 'isMultiple' => 0,
|
|
// 'must' => 1,
|
|
// 'isText' => 0,
|
|
// 'desc' => '',
|
|
// 'config' => [
|
|
// ['key' => 'key1', 'name' => trans('app.really.key1'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ['key' => 'key2', 'name' => trans('app.really.key2'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ]
|
|
// ],
|
|
// [
|
|
// 'index' => 'duty',
|
|
// 'title' => trans('app.duty.title'),
|
|
// 'isMultiple' => 0,
|
|
// 'must' => 1,
|
|
// 'isText' => 0,
|
|
// 'desc' => '',
|
|
// 'config' => [
|
|
// ['key' => 'key1', 'name' => trans('app.duty.key1'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ['key' => 'key2', 'name' => trans('app.duty.key2'), 'isDesc' => 0,'warn'=>false,'isNot'=>0],
|
|
// ]
|
|
// ],
|
|
[
|
|
'index' => 'desc',
|
|
'title' => trans('app.desc.title'),
|
|
'isMultiple' => 0,
|
|
'must' => 1,
|
|
'isText' => 1,
|
|
'desc' => '',
|
|
'config' => []
|
|
],
|
|
[
|
|
'index' => 'health_server',
|
|
'title' => trans('app.health_server.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'isText' => 0,
|
|
'desc' => '',
|
|
'config' => [
|
|
['key' => 'key1', 'name' => trans('app.health_server.key1'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key2', 'name' => trans('app.health_server.key2'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key3', 'name' => trans('app.health_server.key3'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key4', 'name' => trans('app.health_server.key4'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key5', 'name' => trans('app.health_server.key5'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key6', 'name' => trans('app.health_server.key6'), 'isDesc' => 0, 'warn' => false, 'isNot' => 0],
|
|
['key' => 'key7', 'name' => trans('app.health_server.key7'), 'isDesc' => 1, 'warn' => false, 'isNot' => 0],
|
|
]
|
|
],
|
|
];
|
|
//可能会用到,先写在这里
|
|
$step_three_info = [
|
|
[
|
|
'index' => 'blood_pressure',
|
|
'title' => trans('app.blood_pressure.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'config' => [
|
|
['key' => 'sbp', 'name' => trans('app.blood_pressure.sbp')],
|
|
['key' => 'dbp', 'name' => trans('app.blood_pressure.dbp')],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'blood_sugar',
|
|
'title' => trans('app.blood_sugar.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'config' => [
|
|
['key' => 'fbg', 'name' => trans('app.blood_sugar.fbg')],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'urinalysis',
|
|
'title' => trans('app.urinalysis.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'config' => [
|
|
['key' => 'urea', 'name' => trans('app.urinalysis.urea')],
|
|
['key' => 'cre', 'name' => trans('app.urinalysis.cre')],
|
|
['key' => 'ua', 'name' => trans('app.urinalysis.ua')],
|
|
['key' => 'cvsc', 'name' => trans('app.urinalysis.cvsc')],
|
|
]
|
|
],
|
|
[
|
|
'index' => 'blood_fat',
|
|
'title' => trans('app.blood_fat.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'config' => [
|
|
['key' => 'tc', 'name' => trans('app.blood_fat.tc')],
|
|
['key' => 'tg', 'name' => trans('app.blood_fat.tg')],
|
|
['key' => 'hdl', 'name' => trans('app.blood_fat.hdl')],
|
|
['key' => 'ldl', 'name' => trans('app.blood_fat.ldl')],
|
|
]
|
|
],
|
|
[
|
|
'blood_routine' => 'index',
|
|
'title' => trans('app.blood_routine.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'config' => [
|
|
['key' => 'wbc', 'name' => trans('app.blood_routine.wbc')],
|
|
['key' => 'mch', 'name' => trans('app.blood_routine.mch')],
|
|
['key' => 'rbc', 'name' => trans('app.blood_routine.rbc')],
|
|
['key' => 'rdw', 'name' => trans('app.blood_routine.rdw')],
|
|
['key' => 'hct', 'name' => trans('app.blood_routine.hct')],
|
|
['key' => 'mchc', 'name' => trans('app.blood_routine.mchc')],
|
|
['key' => 'plt', 'name' => trans('app.blood_routine.plt')],
|
|
['key' => 'rdwcv', 'name' => trans('app.blood_routine.rdwcv')],
|
|
['key' => 'pct', 'name' => trans('app.blood_routine.pct')],
|
|
['key' => 'pdw', 'name' => trans('app.blood_routine.pdw')],
|
|
['key' => 'ly', 'name' => trans('app.blood_routine.ly')],
|
|
['key' => 'eos', 'name' => trans('app.blood_routine.eos')],
|
|
['key' => 'plcr', 'name' => trans('app.blood_routine.plcr')],
|
|
['key' => 'eos_p', 'name' => trans('app.blood_routine.eos_p')],
|
|
['key' => 'mono', 'name' => trans('app.blood_routine.mono')],
|
|
['key' => 'gr', 'name' => trans('app.blood_routine.gr')],
|
|
['key' => 'mono_p', 'name' => trans('app.blood_routine.mono_p')],
|
|
['key' => 'gr_p', 'name' => trans('app.blood_routine.gr_p')],
|
|
['key' => 'ly_p', 'name' => trans('app.blood_routine.ly_p')],
|
|
['key' => 'baso', 'name' => trans('app.blood_routine.baso')],
|
|
['key' => 'mcv', 'name' => trans('app.blood_routine.mcv')],
|
|
['key' => 'baso_p', 'name' => trans('app.blood_routine.baso_p')],
|
|
['key' => 'hgb', 'name' => trans('app.blood_routine.hgb')],
|
|
['key' => 'mpv', 'name' => trans('app.blood_routine.mpv')],
|
|
],
|
|
[
|
|
'index' => 'liver',
|
|
'title' => trans('app.liver.title'),
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'config' => [
|
|
['key' => 'alt', 'name' => trans('app.liver.alt')],
|
|
['key' => 'ast', 'name' => trans('app.liver.ast')],
|
|
['key' => 'tbil', 'name' => trans('app.liver.tbil')],
|
|
['key' => 'dbil', 'name' => trans('app.liver.dbil')],
|
|
]
|
|
],
|
|
],
|
|
];
|
|
$user_info = UserInfo::where('user_id', $user->id)->first();
|
|
foreach ($step_two_info as $index => $item) {
|
|
$indexKey = $item['index'];
|
|
if (isset($user_info->$indexKey)) {
|
|
if ($indexKey == 'desc') {
|
|
$step_two_info[$index]['desc'] = $user_info->$indexKey;
|
|
}
|
|
$user_data = json_decode($user_info->$indexKey, true);
|
|
|
|
foreach ($item['config'] as $k => $value) {
|
|
$step_two_info[$index]['config'][$k]['state'] = 0;
|
|
$step_two_info[$index]['config'][$k]['describe'] = '';
|
|
$step_two_info[$index]['config'][$k]['images'] = [];
|
|
|
|
foreach ($user_data as $map) {
|
|
if ($map['key'] == $value['key']) {
|
|
$step_two_info[$index]['config'][$k]['state'] = $map['state'] ?? 0;
|
|
$step_two_info[$index]['config'][$k]['describe'] = $map['describe'] ?? '';
|
|
$step_two_info[$index]['config'][$k]['images'] = $map['images'] ?? [];
|
|
break; // 找到匹配的key后跳出循环
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
foreach ($item['config'] as $k => $val) {
|
|
$step_two_info[$index]['config'][$k]['state'] = 0;
|
|
$step_two_info[$index]['config'][$k]['describe'] = '';
|
|
$step_two_info[$index]['config'][$k]['images'] = [];
|
|
}
|
|
}
|
|
}
|
|
foreach ($step_two_info as $two_index => $two_info) {
|
|
if ($sex == 1 && $two_info['index'] == "woman") {
|
|
unset($step_two_info[$two_index]);
|
|
}
|
|
|
|
if ($sex == 2 && $two_info['index'] == "man") {
|
|
unset($step_two_info[$two_index]);
|
|
}
|
|
|
|
}
|
|
$step_two_info = array_values($step_two_info);
|
|
//获取体检报告异常
|
|
$anomaly_arr = DB::table('medical_reports')->where('user_id', $user->id)->orderByDesc('id')->value('anomaly');
|
|
$anomaly_arr = json_decode($anomaly_arr, true) ?: [];
|
|
$new_anomaly_arr = [];
|
|
foreach ($anomaly_arr as $subArray) {
|
|
$new_anomaly_arr = array_merge($new_anomaly_arr, $subArray);
|
|
}
|
|
|
|
// 移除重复元素
|
|
$new_anomaly_arr = array_values(array_unique($new_anomaly_arr));
|
|
foreach ($step_three_info as $tk => $three) {
|
|
foreach ($three['config'] as $k => $v) {
|
|
$step_three_info[$tk]['config'][$k]['state'] = 0;
|
|
if (!in_array($v['key'], $new_anomaly_arr)) {
|
|
continue;
|
|
}
|
|
$step_three_info[$tk]['config'][$k]['state'] = 1;
|
|
}
|
|
}
|
|
$data['step_two_info'] = $step_two_info;
|
|
$data['step_three_info'] = $step_three_info;
|
|
return service_success($data);
|
|
}
|
|
} |