Commit 6fe6a9fe by 赵增煜

Merge branch 'master' of http://git.imohe.com/zhaozengyu/tzt-admin

# Conflicts:
#	database/migrations/2024_11_04_135741_create_patient_table.php
解决冲突
parents 7d4e8d7c a9328bf7
......@@ -2,10 +2,11 @@
namespace App\Api\Controllers;
use App\Common\Util;
use App\Http\Controllers\BaseApiController;
use App\Models\PatientModel;
use Illuminate\Http\Request;
use App\Common\Util;
// 问诊人控制器
class PatientController extends BaseApiController
{
......@@ -17,12 +18,12 @@ public function test()
// 获取问诊人列表
public function patientList(Request $request)
{
$search_input = $request->input('search_input');
$query = PatientModel::query();
if ($search_input) {
$query->where('mobile', 'like', "%{$search_input}%");
# ->orWhere('mobile', 'like', "%{$search_input}%");
// ->orWhere('mobile', 'like', "%{$search_input}%");
}
$data = $query->paginate(10);
......@@ -33,9 +34,9 @@ public function patientList(Request $request)
public function add(Request $request)
{
$data = $request->all();
# TODO 表中缺少关联
# TODO 验证身份证号码是否正确
// TODO 表中缺少关联
// TODO 验证身份证号码是否正确
$idCardInfo = Util::getIdCardInfo($data['id_card']);
$data['gender'] = $idCardInfo['gender'];
......@@ -52,9 +53,9 @@ public function add(Request $request)
public function update(Request $request)
{
$id = $request->input('id');
# TODO 验证身份证号码是否正确
// TODO 验证身份证号码是否正确
# TODO 提取身份信息
// TODO 提取身份信息
$data = PatientModel::find($id);
if (! $data) {
return $this->error(401, '该问诊人不存在');
......@@ -82,9 +83,9 @@ public function delete(Request $request)
public function setDefault(Request $request)
{
// 通过id找到是否存在默认问诊人,如果存在比对id是否相同,如果不同则修改默认问诊人状态
# TODO 验证条件待调整
// TODO 验证条件待调整
$id = $request->input('id');
$data = PatientModel::where('is_default', 1)->where('id',$id)->first();
$data = PatientModel::where('is_default', 1)->where('id', $id)->first();
if ($data) {
if ($data['id'] == $id) {
return $this->success(['msg' => '该问诊人已经是默认问诊人']);
......@@ -105,9 +106,10 @@ public function setDefault(Request $request)
}
// 获取默认问诊人
public function getDefault(Request $request) {
public function getDefault(Request $request)
{
$id = $request->input('id');
$data = PatientModel::where('id',$id)->where('is_default', 1)->first();
$data = PatientModel::where('id', $id)->where('is_default', 1)->first();
if ($data) {
return $this->success($data);
} else {
......
......@@ -22,9 +22,9 @@ public function PharmacyList(Request $request)
$query->where('name', 'like', "%{$search_input}%");
// ->orWhere('address','like',"%{$search_input}%");
}
# TODO 是否闭店、是否在营业时间段、是否启用
# TODO 该药店下是否有药师在启用状态
// TODO 是否闭店、是否在营业时间段、是否启用
// TODO 该药店下是否有药师在启用状态
// $data = $query->where('is_close',0)
// ->where('is_open',1)
......
......@@ -14,11 +14,14 @@ public function up(): void
Schema::create('patient', function (Blueprint $table) {
$table->comment('问诊人');
$table->bigIncrements('id');
$table->string('name', 50)->nullable()->comment('姓名');
$table->string('name', 50)->comment('姓名');
$table->tinyInteger('gender')->default(0)->comment('性别。[1=男性,2=女性,0=未知]');
$table->string('id_card', 18)->nullable()->index('idx_idcard')->comment('身份证号');
$table->string('mobile', 11)->nullable()->index('idx_mobile')->comment('手机号');
$table->boolean('is_default')->default(false)->comment('是否默认问诊人');
$table->string('id_card', 18)->index('idx_idcard')->comment('身份证号');
$table->string('mobile', 11)->index('idx_mobile')->comment('手机号');
$table->bigInteger('user_id')->default(0)->index('idx_userid')->comment('用户表ID');
$table->bigInteger('pharmacy_id')->default(0)->index('idx_pharmacyid')->comment('药店表ID');
$table->boolean('is_default')->default(0)->comment('默认问诊人,用户添加的才需要设置[0=否,1=是]');
$table->timestamps();
$table->softDeletes();
});
......
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