1350 lines
63 KiB
PHP
1350 lines
63 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Facades\CommonService;
|
|
use App\Facades\HttpService;
|
|
use App\Facades\WechatService;
|
|
use BeyondCode\Comments\Contracts\Commentator;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
|
|
class User extends Authenticatable implements Commentator
|
|
{
|
|
use HasApiTokens, HasFactory, Notifiable;
|
|
|
|
const LANGUAGE_CH = 0;
|
|
const LANGUAGE_EN = 1;
|
|
const LANGUAGE_TW = 2;
|
|
//注册来源
|
|
const SOURCE_MP = 1; //小程序
|
|
const SOURCE_H5 = 2; //h5
|
|
const SOURCE_WORK = 3; //企业微信
|
|
const SOURCE_APP = 4; // app用户端
|
|
const SOURCE_APP_SERVER = 5; // app服务人员端
|
|
const FAT_DEVICE_TIANCHENG = 0;
|
|
const FAT_DEVICE_YUNKANGBAO = 1;
|
|
|
|
const IS_SERVER = 1;
|
|
const APP_USER_SOURCE = [self::SOURCE_MP, self::SOURCE_APP];
|
|
const SERVER_USER_SOURCE = [self::SOURCE_H5, self::SOURCE_WORK, self::SOURCE_APP_SERVER];
|
|
const SAAS_PREFIX = "health_";
|
|
// const STEP_TWO_CONFIG = [
|
|
// self::LANGUAGE_CH => self::STEP_TWO_INFO,
|
|
// self::LANGUAGE_EN => self::STEP_TWO_EN_INFO,
|
|
// self::LANGUAGE_TW => self::STEP_TWO_TW_INFO,
|
|
// ];
|
|
// const STEP_THREE_CONFIG = [
|
|
// self::LANGUAGE_CH => self::STEP_THREE_INFO,
|
|
// self::LANGUAGE_EN => self::STEP_THREE_EN_INFO,
|
|
// self::LANGUAGE_TW => self::STEP_THREE_TW_INFO,
|
|
// ];
|
|
const STEP_TWO_INFO = [
|
|
"step_two_info" => [
|
|
'stomach' => [
|
|
'title' => '肠胃不适反应有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '没有不适', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '恶心', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '胃部反酸', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '胃部疼痛', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '便秘', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '腹胀', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '大便带血', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '腹泻', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '沒有不適', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '惡心', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '胃部反酸', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '胃部疼痛', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '便秘', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '腹脹', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '大便帶血', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '腹瀉', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'No discomfort', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Nausea', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Gastric acid reflux', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Stomach pain', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Constipation', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Abdominal bloating', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Blood in stool', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Diarrhea', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'heart' => [
|
|
'title' => '心脏不适有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '没有不适', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '心慌,心悸', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '心率异常', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '胸闷', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '呼吸急促', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '头晕', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '打鼾', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '沒有不適', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '心慌,心悸', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '心率異常', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '胸悶', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '呼吸急促', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '頭暈', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '打鼾', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'No discomfort', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Palpitations', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Irregular heart rate', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Chest tightness', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Shortness of breath', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Dizziness', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Snoring', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'sleep' => [
|
|
'title' => '睡眠相关不适反应有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '没有不适', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '失眠', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '入睡困难', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '浅度睡眠', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '视觉疲劳', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '反应迟钝', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '记忆力衰退', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '焦虑', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '困倦疲惫', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '沒有不適', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '失眠', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '入睡困難', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '淺度睡眠', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '視覺疲勞', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '反應遲鈍', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '記憶力衰退', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '焦慮', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '困倦疲憊', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'No discomfort', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Insomnia', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Difficulty falling asleep', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Shallow sleep', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Visual fatigue', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Delayed reaction', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Memory decline', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Anxiety', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => 'Fatigue', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'man' => [
|
|
'title' => '目前男科问题有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '没有不适', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '不孕不育', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '尿频尿急', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '小腹胀痛', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '沒有不適', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '不孕不育', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '尿頻尿急', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '小腹脹痛', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'No discomfort', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Infertility', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Frequent urination', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Lower abdominal pain', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'other' => [
|
|
'title' => '其他不适有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '没有不适', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '呼吸系统不好', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '鼻炎', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '腰酸背痛', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '肌肉酸痛', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '容易感冒', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '虚弱无力', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '无食欲', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '容易感染', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '皮肤问题', 'isDesc' => 0],
|
|
['key' => 'key11', 'name' => '哮踹', 'isDesc' => 0],
|
|
['key' => 'key12', 'name' => '耳鸣', 'isDesc' => 0],
|
|
['key' => 'key13', 'name' => '咳嗽', 'isDesc' => 0],
|
|
['key' => 'key14', 'name' => '水肿', 'isDesc' => 0],
|
|
['key' => 'key15', 'name' => '反应迟钝', 'isDesc' => 0],
|
|
['key' => 'key16', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '沒有不適', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '呼吸系統不好', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '鼻炎', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '腰酸背痛', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '肌肉酸痛', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '容易感冒', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '虛弱無力', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '無食慾', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '容易感染', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '皮膚問題', 'isDesc' => 0],
|
|
['key' => 'key11', 'name' => '哮踹', 'isDesc' => 0],
|
|
['key' => 'key12', 'name' => '耳鳴', 'isDesc' => 0],
|
|
['key' => 'key13', 'name' => '咳嗽', 'isDesc' => 0],
|
|
['key' => 'key14', 'name' => '水腫', 'isDesc' => 0],
|
|
['key' => 'key15', 'name' => '反應遲鈍', 'isDesc' => 0],
|
|
['key' => 'key16', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'No discomfort', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Poor respiratory system', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Rhinitis', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Lower back pain', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Muscle soreness', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Frequent colds', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Weakness and fatigue', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Loss of appetite', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => 'Susceptibility to infections', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => 'Skin problems', 'isDesc' => 0],
|
|
['key' => 'key11', 'name' => 'Asthma', 'isDesc' => 0],
|
|
['key' => 'key12', 'name' => 'Tinnitus', 'isDesc' => 0],
|
|
['key' => 'key13', 'name' => 'Cough', 'isDesc' => 0],
|
|
['key' => 'key14', 'name' => 'Edema', 'isDesc' => 0],
|
|
['key' => 'key15', 'name' => 'Delayed reaction', 'isDesc' => 0],
|
|
['key' => 'key16', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'dietary' => [
|
|
'title' => '您的饮食习惯(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '一日三餐规律饮食', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '饿了就吃', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '偏好主食', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '偏好蔬菜水果', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '偏好肉类', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '偏好甜食', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '高盐高油', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '一日三餐規律飲食', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '餓了就吃', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '偏好主食', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '偏好蔬菜水果', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '偏好肉類', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '偏好甜食', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '高鹽高油', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'Regular three meals a day', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Eat when hungry', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Preference for staple foods', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Preference for vegetables and fruits', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Preference for meat', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Preference for sweets', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'High salt and oil intake', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'living' => [
|
|
'title' => '您的生活习惯(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '抽烟', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '喝酒', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '规律睡眠', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '经常熬夜', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '经常运动', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '偶尔运动', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '几乎不运动', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '抽煙', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '喝酒', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '規律睡眠', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '經常熬夜', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '經常運動', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '偶爾運動', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '幾乎不運動', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'Smoking', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Drinking', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Regular sleep', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Frequent staying up late', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Regular exercise', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Occasional exercise', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Rarely exercise', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'mental' => [
|
|
'title' => '您目前精神心理状态有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '经常感到职场压力', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '经常感到夫妻关系压力', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '经常感到父母关系压力', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '经常感到亲子关系压力', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '经常感到焦虑', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '经常无故冲动', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '经常处于心平气和的状态', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '面对问题,能够快速的找到解决的办法', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '开心愉悦', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '經常感到職場壓力', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '經常感到夫妻關係壓力', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '經常感到父母關係壓力', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '經常感到親子關係壓力', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '經常感到焦慮', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '經常無故衝動', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '經常處於心平氣和的狀態', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '面對問題,能夠快速的找到解決的辦法', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '開心愉悅', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'Frequent workplace stress', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Frequent marital stress', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Frequent parental stress', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Frequent parent-child relationship stress', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Frequent anxiety', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Frequent impulsive behavior', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Often in a calm state', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Able to quickly find solutions to problems', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => 'Happy and content', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'family' => [
|
|
'title' => '您目前家庭关系有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '夫妻关系和睦', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '亲子关系和睦', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '我与父母关系和睦', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '夫妻关系不和睦', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '亲子关系不和睦', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '我与父母关系不和睦', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '夫妻關係和睦', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '親子關係和睦', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '我與父母關係和睦', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '夫妻關係不和睦', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '親子關係不和睦', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '我與父母關係不和睦', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'Harmonious marital relationship', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Harmonious parent-child relationship', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Harmonious relationship with parents', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Unharmonious marital relationship', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Unharmonious parent-child relationship', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Unharmonious relationship with parents', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'family_member' => [
|
|
'title' => '您家庭成员有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '一个孩子', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '两个孩子', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '三个孩子及以上', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '父亲', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '母亲', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '丈夫', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '妻子', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '一個孩子', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '兩個孩子', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '三個孩子及以上', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '父親', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '母親', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '丈夫', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '妻子', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'One child', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Two children', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Three or more children', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Father', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Mother', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Husband', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Wife', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'personal' => [
|
|
'title' => '个人情况(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '已婚', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '未婚', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '离异', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '丧偶', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '财务方面压力较大', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '财务方面压力较小', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '财务方面毫无压力', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '已婚', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '未婚', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '離異', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '喪偶', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '財務方面壓力較大', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '財務方面壓力較小', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '財務方面毫無壓力', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'Married', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Unmarried', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Divorced', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Widowed', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'High financial pressure', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Low financial pressure', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'No financial pressure', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'woman' => [
|
|
'title' => '目前妇科问题有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '没有不适', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '月经不规律', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '月经紊乱', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '已绝经', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '白带增多异常', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '尿频尿急', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '不孕不育', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '小腹胀痛', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '子宫肌瘤', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'key1', 'name' => '沒有不適', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '月經不規律', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => '月經紊亂', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => '已絕經', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => '白帶增多異常', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => '尿頻尿急', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => '不孕不育', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => '小腹脹痛', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => '子宮肌瘤', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => '其他', 'isDesc' => 1],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'key1', 'name' => 'No discomfort', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => 'Irregular menstruation', 'isDesc' => 0],
|
|
['key' => 'key3', 'name' => 'Menstrual disorder', 'isDesc' => 0],
|
|
['key' => 'key4', 'name' => 'Menopause', 'isDesc' => 0],
|
|
['key' => 'key5', 'name' => 'Increased abnormal vaginal discharge', 'isDesc' => 0],
|
|
['key' => 'key6', 'name' => 'Frequent urination', 'isDesc' => 0],
|
|
['key' => 'key7', 'name' => 'Infertility', 'isDesc' => 0],
|
|
['key' => 'key8', 'name' => 'Lower abdominal pain', 'isDesc' => 0],
|
|
['key' => 'key9', 'name' => 'Uterine fibroids', 'isDesc' => 0],
|
|
['key' => 'key10', 'name' => 'Others', 'isDesc' => 1],
|
|
],
|
|
],
|
|
'know' => [
|
|
'title' => '目前妇科问题有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '完全知悉', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '不知悉、不理解', 'isDesc' => 0],
|
|
],
|
|
],
|
|
'understand' => [
|
|
'title' => '目前妇科问题有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '充分理解', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '不理解', 'isDesc' => 0],
|
|
],
|
|
],
|
|
'really' => [
|
|
'title' => '目前妇科问题有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '是', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '否', 'isDesc' => 0],
|
|
],
|
|
],
|
|
'duty' => [
|
|
'title' => '目前妇科问题有哪些(必选)',
|
|
'isMultiple' => 1,
|
|
'must' => 1,
|
|
'ch_config' => [
|
|
['key' => 'key1', 'name' => '是', 'isDesc' => 0],
|
|
['key' => 'key2', 'name' => '否', 'isDesc' => 0],
|
|
],
|
|
],
|
|
],
|
|
'step_three_info' => [
|
|
'blood_pressure' => [
|
|
'title' => '血压',
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'ch_config' => [
|
|
['key' => 'sbp', 'name' => '收缩压', 'isDesc' => 0],
|
|
['key' => 'dbp', 'name' => '舒张压', 'isDesc' => 0],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'sbp', 'name' => '收縮壓', 'isDesc' => 0],
|
|
['key' => 'dbp', 'name' => '舒張壓', 'isDesc' => 0],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'sbp', 'name' => 'Systolic blood pressure', 'isDesc' => 0],
|
|
['key' => 'dbp', 'name' => 'Diastolic pressure', 'isDesc' => 0],
|
|
],
|
|
],
|
|
'blood_sugar' => [
|
|
'title' => '糖检测',
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'ch_config' => [
|
|
['key' => 'fbg', 'name' => '空腹血糖', 'isDesc' => 0],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'fbg', 'name' => '空腹血糖', 'isDesc' => 0],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'fbg', 'name' => 'Fasting blood sugar', 'isDesc' => 0],
|
|
],
|
|
],
|
|
'urinalysis' => [
|
|
'title' => '肾功能检测',
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'ch_config' => [
|
|
['key' => 'urea', 'name' => '尿素', 'isDesc' => 0],
|
|
['key' => 'cre', 'name' => '肌酐', 'isDesc' => 0],
|
|
['key' => 'ua', 'name' => '尿酸', 'isDesc' => 0],
|
|
['key' => 'cvsc', 'name' => '胱抑素C', 'isDesc' => 0],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'urea', 'name' => '尿素', 'isDesc' => 0],
|
|
['key' => 'cre', 'name' => '肌酐', 'isDesc' => 0],
|
|
['key' => 'ua', 'name' => '尿酸', 'isDesc' => 0],
|
|
['key' => 'cvsc', 'name' => '胱抑素C', 'isDesc' => 0],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'urea', 'name' => 'Urea', 'isDesc' => 0],
|
|
['key' => 'cre', 'name' => 'Creatinine', 'isDesc' => 0],
|
|
['key' => 'ua', 'name' => 'Uric acid', 'isDesc' => 0],
|
|
['key' => 'cvsc', 'name' => 'Cystatin C', 'isDesc' => 0],
|
|
],
|
|
],
|
|
'blood_fat' => [
|
|
'title' => '血脂四项检查',
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'ch_config' => [
|
|
['key' => 'tc', 'name' => '总胆固醇', 'isDesc' => 0],
|
|
['key' => 'tg', 'name' => '甘油三酯', 'isDesc' => 0],
|
|
['key' => 'hdl', 'name' => '高密度脂蛋白', 'isDesc' => 0],
|
|
['key' => 'ldl', 'name' => '低密度脂蛋白', 'isDesc' => 0],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'tc', 'name' => '總膽固醇', 'isDesc' => 0],
|
|
['key' => 'tg', 'name' => '甘油三酯', 'isDesc' => 0],
|
|
['key' => 'hdl', 'name' => '高密度脂蛋白', 'isDesc' => 0],
|
|
['key' => 'ldl', 'name' => '低密度脂蛋白', 'isDesc' => 0],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'tc', 'name' => 'Total cholesterol', 'isDesc' => 0],
|
|
['key' => 'tg', 'name' => 'Triglycerides', 'isDesc' => 0],
|
|
['key' => 'hdl', 'name' => 'HDL', 'isDesc' => 0],
|
|
['key' => 'ldl', 'name' => 'LDL', 'isDesc' => 0],
|
|
],
|
|
],
|
|
'blood_routine' => [
|
|
'title' => '血常规/分类',
|
|
'isMultiple' => 1,
|
|
'must' => 0,
|
|
'ch_config' => [
|
|
['key' => 'wbc', 'name' => '白细胞计数', 'isDesc' => 0],
|
|
['key' => 'mch', 'name' => '平均RBC血红蛋白', 'isDesc' => 0],
|
|
['key' => 'rbc', 'name' => '红细胞计数', 'isDesc' => 0],
|
|
['key' => 'rdw', 'name' => 'RBC分布宽度标准差', 'isDesc' => 0],
|
|
['key' => 'hct', 'name' => '红细胞比积', 'isDesc' => 0],
|
|
['key' => 'mchc', 'name' => '平均RBC血红蛋白浓度', 'isDesc' => 0],
|
|
['key' => 'plt', 'name' => '血小板计数', 'isDesc' => 0],
|
|
['key' => 'rdwcv', 'name' => 'RBC分布宽度变异系数', 'isDesc' => 0],
|
|
['key' => 'pct', 'name' => '血小板比积', 'isDesc' => 0],
|
|
['key' => 'pdw', 'name' => '血小板体积分布宽带', 'isDesc' => 0],
|
|
['key' => 'ly', 'name' => '淋巴细胞计数', 'isDesc' => 0],
|
|
['key' => 'eos', 'name' => '嗜酸粒细胞计数', 'isDesc' => 0],
|
|
['key' => 'plcr', 'name' => '大血小板比率', 'isDesc' => 0],
|
|
['key' => 'eos_p', 'name' => '嗜酸睡粒细胞比值', 'isDesc' => 0],
|
|
['key' => 'mono', 'name' => '单核细胞计数', 'isDesc' => 0],
|
|
['key' => 'gr', 'name' => '中性粒细胞计数', 'isDesc' => 0],
|
|
['key' => 'mono_p', 'name' => '单核细胞比值', 'isDesc' => 0],
|
|
['key' => 'gr_p', 'name' => '中性粒细胞比值', 'isDesc' => 0],
|
|
['key' => 'ly_p', 'name' => '淋巴细胞比值', 'isDesc' => 0],
|
|
['key' => 'baso', 'name' => '嗜碱性粒细胞计数', 'isDesc' => 0],
|
|
['key' => 'mcv', 'name' => '平均RBC体积', 'isDesc' => 0],
|
|
['key' => 'baso_p', 'name' => '嗜碱性粒细胞比值', 'isDesc' => 0],
|
|
['key' => 'hgb', 'name' => '血红蛋白', 'isDesc' => 0],
|
|
['key' => 'mpv', 'name' => '平均血小板体积', 'isDesc' => 0],
|
|
],
|
|
'tw_config' => [
|
|
['key' => 'wbc', 'name' => '白細胞計數', 'isDesc' => 0],
|
|
['key' => 'mch', 'name' => '平均RBC血紅蛋白', 'isDesc' => 0],
|
|
['key' => 'rbc', 'name' => '紅細胞計數', 'isDesc' => 0],
|
|
['key' => 'rdw', 'name' => 'RBC分佈寬度標準差', 'isDesc' => 0],
|
|
['key' => 'hct', 'name' => '紅細胞比積', 'isDesc' => 0],
|
|
['key' => 'mchc', 'name' => '平均RBC血紅蛋白濃度', 'isDesc' => 0],
|
|
['key' => 'plt', 'name' => '血小板計數', 'isDesc' => 0],
|
|
['key' => 'rdwcv', 'name' => 'RBC分佈寬度變異係數', 'isDesc' => 0],
|
|
['key' => 'pct', 'name' => '血小板比積', 'isDesc' => 0],
|
|
['key' => 'pdw', 'name' => '血小板體積分佈寬帶', 'isDesc' => 0],
|
|
['key' => 'ly', 'name' => '淋巴細胞計數', 'isDesc' => 0],
|
|
['key' => 'eos', 'name' => '嗜酸粒細胞計數', 'isDesc' => 0],
|
|
['key' => 'plcr', 'name' => '大血小板比率', 'isDesc' => 0],
|
|
['key' => 'eos_p', 'name' => '嗜酸睡粒細胞比值', 'isDesc' => 0],
|
|
['key' => 'mono', 'name' => '單核細胞計數', 'isDesc' => 0],
|
|
['key' => 'gr', 'name' => '中性粒細胞計數', 'isDesc' => 0],
|
|
['key' => 'mono_p', 'name' => '單核細胞比值', 'isDesc' => 0],
|
|
['key' => 'gr_p', 'name' => '中性粒細胞比值', 'isDesc' => 0],
|
|
['key' => 'ly_p', 'name' => '淋巴細胞比值', 'isDesc' => 0],
|
|
['key' => 'baso', 'name' => '嗜鹼性粒細胞計數', 'isDesc' => 0],
|
|
['key' => 'mcv', 'name' => '平均RBC體積', 'isDesc' => 0],
|
|
['key' => 'baso_p', 'name' => '嗜鹼性粒細胞比值', 'isDesc' => 0],
|
|
['key' => 'hgb', 'name' => '血紅蛋白', 'isDesc' => 0],
|
|
['key' => 'mpv', 'name' => '平均血小板體積', 'isDesc' => 0],
|
|
],
|
|
'en_config' => [
|
|
['key' => 'wbc', 'name' => 'White blood cell count', 'isDesc' => 0],
|
|
['key' => 'mch', 'name' => 'Average RBC hemoglobin volume', 'isDesc' => 0],
|
|
['key' => 'rbc', 'name' => 'Red blood cell count', 'isDesc' => 0],
|
|
['key' => 'rdw', 'name' => 'RBC distribution width standard deviation', 'isDesc' => 0],
|
|
['key' => 'hct', 'name' => 'Hematocrit', 'isDesc' => 0],
|
|
['key' => 'mchc', 'name' => 'Average RBC hemoglobin concentration', 'isDesc' => 0],
|
|
['key' => 'plt', 'name' => 'Platelet count', 'isDesc' => 0],
|
|
['key' => 'rdwcv', 'name' => 'RBC distribution width coefficient of variation', 'isDesc' => 0],
|
|
['key' => 'pct', 'name' => 'Platelet specific product', 'isDesc' => 0],
|
|
['key' => 'pdw', 'name' => 'Broadband of platelet', 'isDesc' => 0],
|
|
['key' => 'ly', 'name' => 'Lymphocyte count', 'isDesc' => 0],
|
|
['key' => 'eos', 'name' => 'Eosinophil count', 'isDesc' => 0],
|
|
['key' => 'plcr', 'name' => 'Large platelet ratio', 'isDesc' => 0],
|
|
['key' => 'eos_p', 'name' => 'Eosinophilic sleeping granulocyte ratio', 'isDesc' => 0],
|
|
['key' => 'mono', 'name' => 'Monocyte count', 'isDesc' => 0],
|
|
['key' => 'gr', 'name' => 'Neutrophil count', 'isDesc' => 0],
|
|
['key' => 'mono_p', 'name' => 'Monocyte ratio', 'isDesc' => 0],
|
|
['key' => 'gr_p', 'name' => 'Neutrophil ratio', 'isDesc' => 0],
|
|
['key' => 'ly_p', 'name' => 'Lymphocyte ratio', 'isDesc' => 0],
|
|
['key' => 'baso', 'name' => 'Basophil count', 'isDesc' => 0],
|
|
['key' => 'mcv', 'name' => 'Average RBC volume', 'isDesc' => 0],
|
|
['key' => 'baso_p', 'name' => 'Basophil ratio', 'isDesc' => 0],
|
|
['key' => 'hgb', 'name' => 'Hemoglobin', 'isDesc' => 0],
|
|
['key' => 'mpv', 'name' => 'Mean platelet volume', 'isDesc' => 0],
|
|
],
|
|
],
|
|
],
|
|
];
|
|
|
|
const STEP_CONFIG_KEY = [
|
|
'stomach',
|
|
'heart',
|
|
'sleep',
|
|
'man',
|
|
'other',
|
|
'dietary',
|
|
'living',
|
|
'mental',
|
|
'family',
|
|
'family_member',
|
|
'personal',
|
|
'woman',
|
|
'know',
|
|
'understand',
|
|
'really',
|
|
'duty',
|
|
];
|
|
|
|
const AGENT_SHOP = ['ratio' => 6, 'sku_id' => 1, 'agent_sku_id' => 1, 'shop_id' => 8220];
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = ['name', 'mobile', 'email', 'password', 'avatar', 'sex', 'birthday', 'stature', 'body_images', "after_body_images", 'unit', 'is_subscribe', 'api_token', 'expire_at', 'fat_device', 'source', 'ip', 'area_code', 'open_id', "account_id"];
|
|
protected $guarded = [];
|
|
|
|
/**
|
|
* The attributes that should be hidden for serialization.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $hidden = [
|
|
// 'mobile',
|
|
'password',
|
|
'api_token',
|
|
];
|
|
|
|
protected $casts = [
|
|
'created_at' => 'datetime:Y-m-d H:i:s',
|
|
'updated_at' => 'datetime:Y-m-d H:i:s',
|
|
];
|
|
|
|
// Accessor for created_at attribute
|
|
public function getCreatedAtAttribute($value)
|
|
{
|
|
return (new \DateTime($value))->setTimezone(new \DateTimeZone('Asia/Shanghai'))->format('Y-m-d H:i:s');
|
|
}
|
|
|
|
// Accessor for updated_at attribute
|
|
public function getUpdatedAtAttribute($value)
|
|
{
|
|
return (new \DateTime($value))->setTimezone(new \DateTimeZone('Asia/Shanghai'))->format('Y-m-d H:i:s');
|
|
}
|
|
|
|
public function getMobileAttribute($value)
|
|
{
|
|
$res = aesDecryptCBC($value);
|
|
if (empty($res))
|
|
return $value;
|
|
return $res;
|
|
}
|
|
|
|
//
|
|
public function needsCommentApproval($model): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
protected function isSubscribe(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
get: fn($value) => ($value) ? 1 : 0,
|
|
);
|
|
}
|
|
|
|
public function damServiceUserRole()
|
|
{
|
|
return $this->hasMany(DmaServiceUserRole::class, "user_id", "id");
|
|
}
|
|
|
|
public function wechat()
|
|
{
|
|
return $this->hasOne(Wechat::class, 'user_id', 'id')->where('type', 'mp')->select("id", 'user_id', 'openid', 'unionid');
|
|
}
|
|
|
|
public function workWechat()
|
|
{
|
|
return $this->hasOne(Wechat::class, 'user_id', 'id')->where('type', 'work')->select("id", 'user_id', 'openid', 'unionid');
|
|
}
|
|
|
|
public function officialWechat()
|
|
{
|
|
return $this->hasOne(Wechat::class, 'user_id', 'id')->where('type', 'official')->select("id", 'user_id', 'openid', 'unionid');
|
|
}
|
|
|
|
public function payOrders()
|
|
{
|
|
return $this->hasMany(Order::class, 'user_id', 'id')->where('pay_status', 'PAID');
|
|
}
|
|
|
|
public function dmaOrder()
|
|
{
|
|
return $this->hasMany(Order::class, 'user_id', 'id')->where('pay_status', 'PAID')->whereNotIn("price", [0.01, 5800]);
|
|
|
|
}
|
|
|
|
public function baseUserInfo()
|
|
{
|
|
$array = ['name', 'sex', 'birthday', 'stature'];
|
|
foreach ($array as $arr) {
|
|
if (empty($this->$arr))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function userInfo()
|
|
{
|
|
return $this->hasOne(UserInfo::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function healthLogs()
|
|
{
|
|
return $this->hasMany(HealthLog::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function serviceUser()
|
|
{
|
|
return $this->hasOne(ServiceUser::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function medicalReports()
|
|
{
|
|
return $this->hasMany(MedicalReport::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function bp()
|
|
{
|
|
return $this->hasOne(S2Bp::class, 'user_id', "id");
|
|
}
|
|
|
|
public function otherHealthFile()
|
|
{
|
|
return $this->hasMany(OtherHealthFile::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function accounts()
|
|
{
|
|
return $this->hasMany(PartnerAccount::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function withdrawals()
|
|
{
|
|
return $this->hasMany(PartnerWithdrawal::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function commission()
|
|
{
|
|
return $this->hasMany(PartnerCommission::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function wallets()
|
|
{
|
|
return $this->hasOne(PartnerWallet::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function partner()
|
|
{
|
|
return $this->hasOne(Partner::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function coach()
|
|
{
|
|
return $this->hasOneThrough(Coach::class, Wechat::class, 'user_id', 'openid', 'id', 'openid');
|
|
}
|
|
|
|
public function coaches()
|
|
{
|
|
return $this->hasOneThrough(Coach::class, Wechat::class, 'user_id', 'openid', 'id', 'openid');
|
|
}
|
|
|
|
public function main_coaches()
|
|
{
|
|
return $this->hasOneThrough(MainCoach::class, Wechat::class, 'user_id', 'openid', 'id', 'openid');
|
|
}
|
|
|
|
public function customer_service_user()
|
|
{
|
|
return $this->hasOneThrough(CustomerServiceUser::class, Wechat::class, 'user_id', 'openid', 'id', 'openid');
|
|
}
|
|
|
|
public function chef_user()
|
|
{
|
|
return $this->hasOneThrough(ChefUser::class, Wechat::class, 'user_id', 'openid', 'id', 'openid');
|
|
}
|
|
|
|
public function service_roles()
|
|
{
|
|
return $this->belongsToMany(ServiceRole::class, 'service_role_users', 'user_id', 'role_id')->withTimestamps();
|
|
}
|
|
|
|
public function collaborator()
|
|
{
|
|
return $this->hasOne(Collaborator::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function moderator()
|
|
{
|
|
return $this->hasOne(Moderator::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function station()
|
|
{
|
|
return $this->hasOne(Station::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function office()
|
|
{
|
|
return $this->hasOneThrough(Office::class, Station::class, "user_id", "id", "id", "office_id");
|
|
}
|
|
|
|
public function isModerator()
|
|
{
|
|
$res = ($this->moderator && $this->moderator->status == 1) ? 1 : 0;
|
|
unset($this->moderator);
|
|
return $res;
|
|
}
|
|
|
|
public function isCompleteInfo()
|
|
{
|
|
|
|
}
|
|
|
|
public function imUser()
|
|
{
|
|
return $this->hasOne(WangYiYun::class);
|
|
}
|
|
|
|
//介绍人 用户购买活动票记录
|
|
public function recommendUserLog()
|
|
{
|
|
return $this->hasOne(RecommendUser::class, 'user_id', 'id');
|
|
}
|
|
|
|
//介绍人
|
|
public function recommendUser()
|
|
{
|
|
return $this->hasOneThrough(User::class, RecommendUser::class, 'user_id', 'id', 'id', 'recommend_user_id');
|
|
}
|
|
|
|
//分享人 第一次注册记录
|
|
public function shareUserLog()
|
|
{
|
|
return $this->hasOne(ShareUser::class, 'user_id', 'id');
|
|
}
|
|
|
|
//分享人 第一次注册记录
|
|
public function shareUser()
|
|
{
|
|
return $this->hasOneThrough(User::class, ShareUser::class, 'user_id', 'id', 'id', 'share_user_id');
|
|
}
|
|
|
|
|
|
public static function downloadQrcode($device = null)
|
|
{
|
|
$ios = "https://ufutx-health.oss-cn-hangzhou.aliyuncs.com/202312/13/health_ios.png";
|
|
$android = "https://image.fulllinkai.com/202303/15/f893b3511507c0616d2a6d855cb86279.png";
|
|
switch ($device) {
|
|
case "IOS":
|
|
$qrcode = $ios;
|
|
break;
|
|
case "ANDROID":
|
|
$qrcode = $ios;
|
|
break;
|
|
default:
|
|
$qrcode = [$ios, $android];
|
|
}
|
|
return $qrcode;
|
|
}
|
|
|
|
public static function sameDataToUser($old_user_id, $new_user_id)
|
|
{
|
|
DB::beginTransaction();
|
|
//更新partner表数据
|
|
$old_partner = Partner::where('user_id', $old_user_id)->first();
|
|
if ($old_partner) {
|
|
$old_partner->user_id = $new_user_id;
|
|
$old_partner->save();
|
|
}
|
|
//更新wechat表数据
|
|
$old_wechat_user = Wechat::where('user_id', $old_user_id)->where('type', 'official')->first();
|
|
if ($old_wechat_user) {
|
|
// $old_wechat_user->user_id = $new_user_id;
|
|
// $old_wechat_user->save();
|
|
Wechat::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
//更新合作伙伴表数据
|
|
$old_collaborator = Collaborator::where('user_id', $old_user_id)->first();
|
|
if ($old_collaborator) {
|
|
$old_collaborator->user_id = $new_user_id;
|
|
$old_collaborator->save();
|
|
}
|
|
//更新service 表数据
|
|
$old_service_user = ServiceUser::where('user_id', $old_user_id)->first();
|
|
if ($old_service_user) {
|
|
$old_service_user->user_id = $new_user_id;
|
|
$old_service_user->save();
|
|
}
|
|
|
|
$old_restaurant = Restaurant::where('user_id', $old_user_id)->first();
|
|
if ($old_restaurant) {
|
|
Restaurant::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
|
|
$old_restaurant_order = RestaurantOrder::where('user_id', $old_user_id)->first();
|
|
if ($old_restaurant_order) {
|
|
RestaurantOrder::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
|
|
$old_restaurant_order_refund = RestaurantOrderRefund::where('user_id', $old_user_id)->first();
|
|
if ($old_restaurant_order_refund) {
|
|
RestaurantOrderRefund::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
|
|
//更新绑定角色表
|
|
$old_role = ServiceRoleUser::where('user_id', $old_user_id)->first();
|
|
if ($old_role) {
|
|
ServiceRoleUser::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
//更新绑定角色表
|
|
$old_order_role = ServiceRoleOrder::where('user_id', $old_user_id)->first();
|
|
if ($old_order_role) {
|
|
ServiceRoleOrder::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
|
|
//更新绑定的群角色表数据
|
|
$old_bind_role = ServiceUserBindRole::where('user_id', $old_user_id)->first();
|
|
if ($old_bind_role) {
|
|
ServiceUserBindRole::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
//更新工位
|
|
$old_station = Station::where('user_id', $old_user_id)->first();
|
|
if ($old_station) {
|
|
Station::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
//更新批发商
|
|
$old_agent_user = AgentUser::where('user_id', $old_user_id)->first();
|
|
if ($old_agent_user) {
|
|
AgentUser::where('user_id', $old_user_id)->update(['user_id' => $new_user_id]);
|
|
}
|
|
UpdateUserLog::create(['old_user_id' => $old_user_id, 'new_user_id' => $new_user_id]);
|
|
DB::commit();
|
|
}
|
|
|
|
public function accid()
|
|
{
|
|
return self::SAAS_PREFIX . $this->id;
|
|
}
|
|
|
|
public static function userAccid($user_id)
|
|
{
|
|
return self::SAAS_PREFIX . $user_id;
|
|
}
|
|
|
|
public function shopAgentQrcodes()
|
|
{
|
|
return $this->hasMany(ShopAgentQrcode::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function getShopAgentQrcode($shop_id = null, $type = "MP")
|
|
{
|
|
$log = $this->shopAgentQrcodes()->where('shop_id', $shop_id)->where('type', $type)->first();
|
|
if (empty($log)) {
|
|
if ($type == "MP") {
|
|
if ($shop_id) {
|
|
$page = "pages/sub_mall/mallDetail";
|
|
$scene = "id=$shop_id&userId=" . $this->id . "&agent=1";
|
|
} else {
|
|
$page = "pages/tabBar/serve";
|
|
$scene = "userId=" . $this->id . "&agent=1";
|
|
}
|
|
$qrcode = WechatService::getMPQrcode($scene, $page);
|
|
} else {
|
|
$url = config('app.url') . "/h5/#/mallDetail?id={$shop_id}&agent_id={$this->id}&from_user_id={$this->id}&from_type=wine";
|
|
$qrcode = CommonService::makeQrcode($url);
|
|
}
|
|
$log = $this->shopAgentQrcodes()->create(['shop_id' => $shop_id, 'qrcode' => $qrcode, 'type' => $type]);
|
|
}
|
|
return $log->qrcode;
|
|
}
|
|
|
|
public function isAgent()
|
|
{
|
|
// $param = request()->all();
|
|
// $param['accid'] = $this->accid();
|
|
// $param = http_build_query($param);
|
|
// $url = config('app.shop_url')."is/agent?$param";
|
|
// $res = HttpService::getData($url);
|
|
// if ($res['code'] == 1) throw new \Exception("获取经销商信息失败");
|
|
// $data = $res['data'];
|
|
$agent_user = $this->agentUser;
|
|
if (empty($agent_user)) {
|
|
$data['agent_register'] = 0;
|
|
$data['is_agent'] = 0;
|
|
$data['can_restaurant'] = 0;
|
|
} else {
|
|
$data['agent_register'] = 1;
|
|
$data['is_agent'] = $agent_user->level;
|
|
$data['can_restaurant'] = $agent_user->can_restaurant;
|
|
}
|
|
return $data;
|
|
}
|
|
|
|
public function isVip()
|
|
{
|
|
$exists = Collaborator::where('user_id', $this->id)->where('type', 2)->where("status", 1)->exists();
|
|
return $exists ? 1 : 0;
|
|
}
|
|
|
|
public static function bodyImages($bodyImages)
|
|
{
|
|
if (!empty($bodyImages)) {
|
|
$bodyImages = json_decode($bodyImages);
|
|
}
|
|
return [
|
|
"bodyFront" => $bodyImages->bodyFront ?? '',
|
|
"bodyProfile" => $bodyImages->bodyProfile ?? '',
|
|
"bigHead" => $bodyImages->bigHead ?? '',
|
|
"leftPalm" => $bodyImages->leftPalm ?? '',
|
|
"rightPalm" => $bodyImages->rightPalm ?? '',
|
|
"tongue" => $bodyImages->tongue ?? '',
|
|
"other_img" => $bodyImages->other_img ?? [],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* 用户介绍人
|
|
*/
|
|
public function introduceUser()
|
|
{
|
|
return $this->hasOneThrough(User::class, UserIntroduceLog::class, 'user_id', 'id', 'id', 'introduce_user_id');
|
|
}
|
|
|
|
public function activityQrcodes()
|
|
{
|
|
return $this->hasMany(ActivityQrcode::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function activityOrders()
|
|
{
|
|
return $this->hasMany(ActivityOrder::class, 'user_id', 'id')->paid();
|
|
}
|
|
|
|
public function introduceActivityOrders()
|
|
{
|
|
return $this->hasMany(ActivityOrder::class, 'introduce_user_id', 'id')->paid();
|
|
}
|
|
|
|
public function introduceAgentOrders()
|
|
{
|
|
return $this->hasMany(AgentOrder::class, 'from_user_id', 'id')->paid();
|
|
}
|
|
|
|
/**
|
|
* 根据代理商级别,计算优惠价格
|
|
* @param $price
|
|
* @param bool $valid
|
|
* @return string
|
|
*/
|
|
public function calAgentPrice($price, $valid = true)
|
|
{
|
|
if (!$valid)
|
|
return $price;
|
|
if ($price == 0)
|
|
return number_format($price, 2, '.', '');
|
|
//是否批发商
|
|
$level = $this->agentUser ? $this->agentUser->level : 0;
|
|
if ($level == 1)
|
|
return number_format($price / 2, '.', '');
|
|
return number_format($price, 2, '.', '');
|
|
}
|
|
|
|
public function agentUser()
|
|
{
|
|
return $this->hasOne(AgentUser::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function agentOrders()
|
|
{
|
|
return $this->hasMany(AgentOrder::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function earning()
|
|
{
|
|
//收益金额
|
|
$total_amount = $this->agentEarnings()->sum('amount');
|
|
//已提现金额
|
|
$withdraw_amount = $this->agentWithdraws()->where('status', '<>', 'REFUSE')->sum('amount');
|
|
$amount = number_format($total_amount - $withdraw_amount, 2, '.', '');
|
|
return $amount;
|
|
}
|
|
|
|
public function agentEarnings()
|
|
{
|
|
return $this->hasMany(AgentEarning::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function agentWithdraws()
|
|
{
|
|
return $this->hasMany(AgentWithdraw::class, 'user_id', 'id');
|
|
}
|
|
|
|
public function updateInfo($data)
|
|
{
|
|
$user = $this;
|
|
if (isset($data['mobile'])) {
|
|
$mobile_user = self::with('officialWechat')->where("mobile", $data['mobile'])->first();
|
|
if ($mobile_user->id != $user->id && !$mobile_user->officialWechat) {//非公众号用户占用
|
|
$user = $mobile_user;
|
|
$this->officialWechat()->update(['user_id' => $mobile_user->id]);
|
|
}
|
|
}
|
|
if (isset($data['name'])) {
|
|
$user->name = $data['name'];
|
|
}
|
|
$user->save();
|
|
return $user;
|
|
}
|
|
|
|
/**
|
|
* 获取小程序或者app用户
|
|
* @param $mobile
|
|
* @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
|
|
*/
|
|
public static function getMpUser($mobile)
|
|
{
|
|
// $user = User::with('wechat')->whereHas('wechat', function ($sql) {
|
|
// $sql->where('type', 'mp');
|
|
// })->where('mobile', $mobile)->first();
|
|
// if (empty($user)) {
|
|
// $user = User::leftJoin('wechats', 'users.id', '=', 'wechats.user_id')
|
|
// ->whereNull('wechats.user_id') // 只选择wechat表中user_id为空的记录
|
|
// ->where('users.mobile', $mobile)
|
|
// ->select('users.*')->first();
|
|
// }
|
|
$user = User::where('mobile', $mobile)->whereIn('source', self::APP_USER_SOURCE)->first();
|
|
return $user;
|
|
}
|
|
|
|
public static function getOfficialUser($mobile)
|
|
{
|
|
$collaborator = Collaborator::where('mobile', $mobile)->where('status', 1)->first();
|
|
return $collaborator;
|
|
}
|
|
|
|
/**
|
|
* 审核服务人员,同步已存在的app服务人员信息
|
|
* @param $mobile
|
|
* @param $uid
|
|
*/
|
|
public static function updateServerUser($mobile, $uid)
|
|
{
|
|
//查看是否注册app服务人员端,如果存在,则同步审核信息
|
|
$app_server_user = User::where('mobile', $mobile)->where('source', self::SOURCE_APP_SERVER)->first();
|
|
if ($app_server_user) {
|
|
DB::beginTransaction();
|
|
//同步wechat表
|
|
$wechat = Wechat::where('user_id', $uid)->where('type', 'official')->first();
|
|
if ($wechat) {
|
|
$wechat->user_id = $app_server_user->id;
|
|
$wechat->save();
|
|
}
|
|
$collaborator = Collaborator::where('user_id', $uid)->first();
|
|
if ($collaborator) {
|
|
$collaborator->user_id = $app_server_user->id;
|
|
$collaborator->save();
|
|
}
|
|
UpdateUserLog::create(['old_user_id' => $uid, 'new_user_id' => $app_server_user->id]);
|
|
DB::commit();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 小程序更新手机号,如果先存在app用户,则把小程序用户同步给app用户
|
|
*/
|
|
public static function updateAppUser($mobile, $uid)
|
|
{
|
|
$app_user = User::where('mobile', $mobile)->where('source', User::SOURCE_APP)->first();
|
|
if ($app_user && $app_user->id != $uid) {
|
|
DB::beginTransaction();
|
|
//同步wechat表
|
|
$wechat = Wechat::where('user_id', $uid)->where('type', 'mp')->first();
|
|
if ($wechat) {
|
|
$wechat->user_id = $app_user->id;
|
|
$wechat->save();
|
|
}
|
|
|
|
UpdateUserLog::create(['old_user_id' => $uid, 'new_user_id' => $app_user->id]);
|
|
DB::commit();
|
|
}
|
|
return $app_user;
|
|
}
|
|
|
|
|
|
public function getGoodsSku($skus, $sku_id = null)
|
|
{
|
|
$agent_user = $this->agentUser;
|
|
foreach ($skus as &$sku) {
|
|
$sku['origin_price'] = $sku['price'];
|
|
if ($agent_user && $agent_user->level == AgentUser::AgentLevelBeing) {//批发商
|
|
$sku['price'] = $sku['agent_price'];
|
|
} elseif ($agent_user && $agent_user->level == AgentUser::AgentLevelReady) {//准批发商
|
|
$sku['price'] = $sku['ready_agent_price'];
|
|
} elseif ($agent_user && $agent_user->level == AgentUser::AgentStaff) {
|
|
$sku['price'] = $sku['staff_price'];
|
|
} elseif ($agent_user && $agent_user->level == AgentUser::AgentVIP) {
|
|
$sku['price'] = $sku['vip_price'];
|
|
}
|
|
if ($sku_id && $sku['sku_id'] == $sku_id)
|
|
return $sku;
|
|
}
|
|
return $skus;
|
|
}
|
|
|
|
public function isBan()
|
|
{
|
|
$ban = Banlist::where(function ($sql) {
|
|
$sql->where(["type" => "user", "value" => $this->id])->where(function ($query) {
|
|
$now = date("Y-m-d H:i:s");
|
|
$query->whereNull('expired_at')->orWhere("expired_at", ">", $now);
|
|
});
|
|
})->first();
|
|
if ($ban)
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
// protected function mobile(): Attribute
|
|
// {
|
|
// return Attribute::make(
|
|
// get: fn ($value) => aesDecryptCBC($value),
|
|
// );
|
|
// }
|
|
}
|