更新 问卷调查 可能会冲突的几个文件
parent
6642a61f39
commit
45ea04a7ec
@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\API\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class QuestionItemController extends Controller
|
||||||
|
{
|
||||||
|
public function item(Request $request)
|
||||||
|
{
|
||||||
|
$hospital_id = $request->post('hospital_id');
|
||||||
|
$items = DB::table('items')
|
||||||
|
->select(['item_id', 'name', 'pinyin', 'sex'])
|
||||||
|
->where(['hospital_id' => $hospital_id])
|
||||||
|
->get();
|
||||||
|
return \Yz::Return(true, '操作完成', [
|
||||||
|
'list' => $items
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
$name = $request->post('name');
|
||||||
|
$desc = $request->post('desc');
|
||||||
|
$jichu = $request->post('jichu');
|
||||||
|
$tuijian = $request->post('tuijian');
|
||||||
|
$gaoduan = $request->post('gaoduan');
|
||||||
|
if (!$name) {
|
||||||
|
return \Yz::echoError('请填写项目名称');
|
||||||
|
}
|
||||||
|
if (mb_strlen($name) > 20) {
|
||||||
|
return \Yz::echoError('项目名称过长');
|
||||||
|
}
|
||||||
|
if (mb_strlen($desc) > 200) {
|
||||||
|
return \Yz::echoError('项目说明过长');
|
||||||
|
}
|
||||||
|
DB::table('question_items')->insert([
|
||||||
|
'name' => $name,
|
||||||
|
'desc' => $desc ?? '',
|
||||||
|
'jichu' => $jichu ?? '[]',
|
||||||
|
'tuijian' => $tuijian ?? '[]',
|
||||||
|
'gaoduan' => $gaoduan ?? '[]',
|
||||||
|
'created_at' => date('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
return \Yz::Return(true, '操作完成');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$id = $request->post('id');
|
||||||
|
$name = $request->post('name');
|
||||||
|
$desc = $request->post('desc');
|
||||||
|
$jichu = $request->post('jichu');
|
||||||
|
$tuijian = $request->post('tuijian');
|
||||||
|
$gaoduan = $request->post('gaoduan');
|
||||||
|
if (!$name) {
|
||||||
|
return \Yz::echoError('请填写项目名称');
|
||||||
|
}
|
||||||
|
if (mb_strlen($name) > 20) {
|
||||||
|
return \Yz::echoError('项目名称过长');
|
||||||
|
}
|
||||||
|
if (mb_strlen($desc) > 200) {
|
||||||
|
return \Yz::echoError('项目说明过长');
|
||||||
|
}
|
||||||
|
DB::table('question_items')->where('id', $id)->update([
|
||||||
|
'name' => $name,
|
||||||
|
'desc' => $desc ?? '',
|
||||||
|
'jichu' => $jichu ?? '[]',
|
||||||
|
'tuijian' => $tuijian ?? '[]',
|
||||||
|
'gaoduan' => $gaoduan ?? '[]',
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
]);
|
||||||
|
return \Yz::Return(true, '操作完成');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete(Request $request)
|
||||||
|
{
|
||||||
|
$id = $request->post('id');
|
||||||
|
DB::table('question_items')->where('id', $id)->delete();
|
||||||
|
return \Yz::Return(true, '操作完成');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function list(Request $request)
|
||||||
|
{
|
||||||
|
$search = $request->post('search');
|
||||||
|
$list = DB::table('question_items')->where('name', $search)->get();
|
||||||
|
return \Yz::Return(true, '操作完成', [
|
||||||
|
'list' => $list
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\API\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
class
|
||||||
|
QuestionQuestionController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\API\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
|
||||||
|
class QuestionnaireController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class QuestionItem extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class QuestionQuestion extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Questionnaire extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateQuestionQuestionsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('question_questions', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('question', 200)->comment('问题名称');
|
||||||
|
$table->string('type', 20)->comment('类型 input select');
|
||||||
|
$table->longText('option')->comment('问题参数');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('question_questions');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateQuestionItemsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('question_items', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name', 50)->comment('风险名称');
|
||||||
|
$table->string('desc', 200)->comment('风险说明');
|
||||||
|
$table->longText('jichu')->comment('基础项目');
|
||||||
|
$table->longText('tuijian')->comment('优先推荐');
|
||||||
|
$table->longText('gaoduan')->comment('高端推荐');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('question_items');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateQuestionnairesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('questionnaires', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('type', 20)->comment('问卷类型 检前评估 问卷调查');
|
||||||
|
$table->string('name', 50)->comment('问卷名称');
|
||||||
|
$table->longText('items')->comment('一般检查项IDs');
|
||||||
|
$table->longText('questions')->comment('问题IDs');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('questionnaires');
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue