|
|
|
@ -16,15 +16,16 @@ class QuestionnaireController extends Controller
|
|
|
|
foreach ($question as $key => $value) {
|
|
|
|
foreach ($question as $key => $value) {
|
|
|
|
$list[] = [
|
|
|
|
$list[] = [
|
|
|
|
'id' => $value->question,
|
|
|
|
'id' => $value->question,
|
|
|
|
'title' => $value->name,
|
|
|
|
'title' => $value->name,
|
|
|
|
'icon' => $value->icon,
|
|
|
|
'icon' => $value->icon,
|
|
|
|
'desc' => $value->desc,
|
|
|
|
'desc' => $value->desc,
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return \Yz::Return(true, '操作完成', [
|
|
|
|
return \Yz::Return(true, '操作完成', [
|
|
|
|
'list' => $list
|
|
|
|
'list' => $list
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function get(Request $request)
|
|
|
|
public function get(Request $request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$id = $request->post('id');
|
|
|
|
$id = $request->post('id');
|
|
|
|
@ -34,7 +35,7 @@ class QuestionnaireController extends Controller
|
|
|
|
return \Yz::echoError('问卷不存在');
|
|
|
|
return \Yz::echoError('问卷不存在');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$question_ids = json_decode($question->questions, true);
|
|
|
|
$question_ids = json_decode($question->questions, true);
|
|
|
|
$person_info = DB::table('web_user_person')->where('id', $person)->first();
|
|
|
|
$person_info = DB::table('web_user_person')->where('id', $person)->first();
|
|
|
|
$list = self::getList($person_info, $question_ids);
|
|
|
|
$list = self::getList($person_info, $question_ids);
|
|
|
|
return \Yz::Return(true, '操作完成', [
|
|
|
|
return \Yz::Return(true, '操作完成', [
|
|
|
|
'info' => $question,
|
|
|
|
'info' => $question,
|
|
|
|
@ -57,8 +58,9 @@ class QuestionnaireController extends Controller
|
|
|
|
'question' => $question->question,
|
|
|
|
'question' => $question->question,
|
|
|
|
'value' => '',
|
|
|
|
'value' => '',
|
|
|
|
];
|
|
|
|
];
|
|
|
|
if ($question->type == 'input') {
|
|
|
|
if (in_array($question->type, ['input', 'date', 'city'])) {
|
|
|
|
$item_data['value'] = $question->option['input']['value'];
|
|
|
|
$v = $question->option['input']['value'];
|
|
|
|
|
|
|
|
$item_data['value'] = $v;
|
|
|
|
$item_data['placeholder'] = $question->option['input']['placeholder'];
|
|
|
|
$item_data['placeholder'] = $question->option['input']['placeholder'];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$item_data['value'] = '';
|
|
|
|
$item_data['value'] = '';
|
|
|
|
@ -89,6 +91,19 @@ class QuestionnaireController extends Controller
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$v = str_replace('${体重}', '', $v);
|
|
|
|
$v = str_replace('${体重}', '', $v);
|
|
|
|
$v = str_replace('${身高}', '', $v);
|
|
|
|
$v = str_replace('${身高}', '', $v);
|
|
|
|
|
|
|
|
$v = str_replace('${今日日期}', date('Y-m-d'), $v);
|
|
|
|
|
|
|
|
if ($v == '${省市县}') {
|
|
|
|
|
|
|
|
$v = [[
|
|
|
|
|
|
|
|
'value' => '11',
|
|
|
|
|
|
|
|
'text' => '北京市'
|
|
|
|
|
|
|
|
], [
|
|
|
|
|
|
|
|
'value' => '1101',
|
|
|
|
|
|
|
|
'text' => '市辖区'
|
|
|
|
|
|
|
|
], [
|
|
|
|
|
|
|
|
'value' => '110101',
|
|
|
|
|
|
|
|
'text' => '东城区'
|
|
|
|
|
|
|
|
]];
|
|
|
|
|
|
|
|
}
|
|
|
|
$item_data['value'] = $v;
|
|
|
|
$item_data['value'] = $v;
|
|
|
|
$list[] = $item_data;
|
|
|
|
$list[] = $item_data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|