Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9a1b93b7
authored
Dec 02, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
药物类型
parent
307a873d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
20 deletions
+53
-20
app/Admin/Controllers/DrugController.php
+2
-0
app/Admin/Extensions/ToolBar/Forms/DrugImportForm.php
+6
-6
app/Api/Controllers/DosageController.php
+5
-14
app/Models/DrugModel.php
+11
-0
database/migrations/2024_12_02_203641_add_drug_type_to_drug_table.php
+28
-0
lang/zh_CN/drug.php
+1
-0
No files found.
app/Admin/Controllers/DrugController.php
View file @
9a1b93b7
...
@@ -46,6 +46,7 @@ protected function grid()
...
@@ -46,6 +46,7 @@ protected function grid()
$grid
->
column
(
'category_code'
);
$grid
->
column
(
'category_code'
);
$grid
->
column
(
'category_name'
);
$grid
->
column
(
'category_name'
);
$grid
->
column
(
'is_foreign'
)
->
using
(
DrugModel
::
FOREIGN_MAP
);
$grid
->
column
(
'is_foreign'
)
->
using
(
DrugModel
::
FOREIGN_MAP
);
$grid
->
column
(
'drug_type'
)
->
using
(
DrugModel
::
DRUG_TYPE_MAP
);
$grid
->
column
(
'is_rx'
)
->
using
(
DrugModel
::
RX_MAP
);
$grid
->
column
(
'is_rx'
)
->
using
(
DrugModel
::
RX_MAP
);
$grid
->
column
(
'is_si'
)
->
using
(
DrugModel
::
SI_MAP
);
$grid
->
column
(
'is_si'
)
->
using
(
DrugModel
::
SI_MAP
);
$grid
->
column
(
'limit_buy_7'
);
$grid
->
column
(
'limit_buy_7'
);
...
@@ -115,6 +116,7 @@ protected function form()
...
@@ -115,6 +116,7 @@ protected function form()
$form
->
text
(
'preparation_pec'
)
->
maxLength
(
128
);
$form
->
text
(
'preparation_pec'
)
->
maxLength
(
128
);
$form
->
text
(
'dosage_form'
)
->
required
()
->
maxLength
(
128
);
$form
->
text
(
'dosage_form'
)
->
required
()
->
maxLength
(
128
);
$form
->
select
(
'unit'
)
->
options
(
DrugUnitModel
::
all
()
->
pluck
(
'name'
,
'name'
));
$form
->
select
(
'unit'
)
->
options
(
DrugUnitModel
::
all
()
->
pluck
(
'name'
,
'name'
));
$form
->
radio
(
'drug_type'
)
->
options
(
DrugModel
::
DRUG_TYPE_MAP
)
->
default
(
DrugModel
::
DRUG_TYPE_WM
);
$form
->
text
(
'factory'
)
->
required
()
->
maxLength
(
128
);
$form
->
text
(
'factory'
)
->
required
()
->
maxLength
(
128
);
$form
->
text
(
'approval_no'
)
->
required
()
->
maxLength
(
64
);
$form
->
text
(
'approval_no'
)
->
required
()
->
maxLength
(
64
);
$form
->
text
(
'mnemonic'
)
->
maxLength
(
64
);
$form
->
text
(
'mnemonic'
)
->
maxLength
(
64
);
...
...
app/Admin/Extensions/ToolBar/Forms/DrugImportForm.php
View file @
9a1b93b7
...
@@ -52,12 +52,12 @@ public function handle(array $input): JsonResponse
...
@@ -52,12 +52,12 @@ public function handle(array $input): JsonResponse
$drugModel
->
factory
=
$item
[
'生产企业'
];
$drugModel
->
factory
=
$item
[
'生产企业'
];
$drugModel
->
approval_no
=
$item
[
'批准文号'
];
$drugModel
->
approval_no
=
$item
[
'批准文号'
];
$drugModel
->
mnemonic
=
$item
[
'助记码'
];
$drugModel
->
mnemonic
=
$item
[
'助记码'
];
$drugModel
->
standard_code
=
$item
[
'本位码'
];
$drugModel
->
standard_code
=
$item
[
'本位码'
]
??
''
;
$drugModel
->
category_code
=
$item
[
'分类码'
];
$drugModel
->
category_code
=
$item
[
'分类码'
]
??
''
;
$drugModel
->
category_name
=
$item
[
'分类名称'
];
$drugModel
->
category_name
=
$item
[
'分类名称'
]
??
''
;
$drugModel
->
is_foreign
=
self
::
toBool
(
$item
[
'是否进口药'
]);
$drugModel
->
is_foreign
=
self
::
toBool
(
$item
[
'是否进口药'
]
??
''
);
$drugModel
->
is_rx
=
self
::
toBool
(
$item
[
'是否处方药'
]);
$drugModel
->
is_rx
=
self
::
toBool
(
$item
[
'是否处方药'
]
??
''
);
$drugModel
->
is_si
=
self
::
toBool
(
$item
[
'是否医保药'
]);
$drugModel
->
is_si
=
self
::
toBool
(
$item
[
'是否医保药'
]
??
''
);
if
(
$drugModel
->
save
())
{
if
(
$drugModel
->
save
())
{
$successNum
++
;
$successNum
++
;
}
}
...
...
app/Api/Controllers/DosageController.php
View file @
9a1b93b7
...
@@ -3,18 +3,9 @@
...
@@ -3,18 +3,9 @@
namespace
App\Api\Controllers
;
namespace
App\Api\Controllers
;
use
App\Http\Controllers\BaseApiController
;
use
App\Http\Controllers\BaseApiController
;
use
App\Models\DoctorCorrectionModel
;
use
App\Models\DosageModel
;
use
App\Models\DoctorModel
;
use
App\Models\PatientModel
;
use
App\Models\PrescriptionLogModel
;
use
App\Models\PrescriptionModel
;
use
App\Models\PharmacyModel
;
use
App\Models\PharmacyModel
;
use
App\Models\User
;
use
App\Models\DosageModel
;
use
Datetime
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Validator
;
// 用法用量控制器
// 用法用量控制器
class
DosageController
extends
BaseApiController
class
DosageController
extends
BaseApiController
...
@@ -24,16 +15,17 @@ public function test()
...
@@ -24,16 +15,17 @@ public function test()
return
$this
->
success
(
'ok'
);
return
$this
->
success
(
'ok'
);
}
}
#
获取用法用量
//
获取用法用量
public
function
dosageList
(
Request
$request
)
public
function
dosageList
(
Request
$request
)
{
{
$authInfo
=
auth
(
'api'
)
->
user
();
$authInfo
=
auth
(
'api'
)
->
user
();
#
获取药店信息
//
获取药店信息
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$pharmacy
=
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
if
(
!
$pharmacy
)
{
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'您的账号可能在其他设备登录,请重新登录!'
);
return
$this
->
failed
(
'您的账号可能在其他设备登录,请重新登录!'
);
}
}
$dosages
=
DosageModel
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
get
()
->
toArray
();
$dosages
=
DosageModel
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
get
()
->
toArray
();
return
$this
->
success
(
$dosages
);
return
$this
->
success
(
$dosages
);
}
}
}
}
\ No newline at end of file
app/Models/DrugModel.php
View file @
9a1b93b7
...
@@ -72,6 +72,17 @@ class DrugModel extends Model
...
@@ -72,6 +72,17 @@ class DrugModel extends Model
self
::
FOREIGN_FALSE
=>
'否'
,
self
::
FOREIGN_FALSE
=>
'否'
,
];
];
// 药品类型[0=西药,1=中药]
const
DRUG_TYPE_WM
=
0
;
const
DRUG_TYPE_TCM
=
1
;
// 药品类型-文字映射
const
DRUG_TYPE_MAP
=
[
self
::
DRUG_TYPE_WM
=>
'西药'
,
self
::
DRUG_TYPE_TCM
=>
'中药'
,
];
public
function
setNameAttribute
(
$value
)
public
function
setNameAttribute
(
$value
)
{
{
$this
->
attributes
[
'name'
]
=
$value
;
$this
->
attributes
[
'name'
]
=
$value
;
...
...
database/migrations/2024_12_02_203641_add_drug_type_to_drug_table.php
0 → 100644
View file @
9a1b93b7
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
return
new
class
extends
Migration
{
/**
* Run the migrations.
*/
public
function
up
()
:
void
{
Schema
::
table
(
'drug'
,
function
(
Blueprint
$table
)
{
$table
->
tinyInteger
(
'drug_type'
)
->
default
(
0
)
->
comment
(
'药品类型[0=西药,1=中药]'
);
});
}
/**
* Reverse the migrations.
*/
public
function
down
()
:
void
{
Schema
::
table
(
'drug'
,
function
(
Blueprint
$table
)
{
//
});
}
};
lang/zh_CN/drug.php
View file @
9a1b93b7
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
'limit_buy_7'
=>
'7天限购'
,
'limit_buy_7'
=>
'7天限购'
,
'tag'
=>
'标签'
,
'tag'
=>
'标签'
,
'excluded_drug_ids'
=>
'互斥药品id组'
,
'excluded_drug_ids'
=>
'互斥药品id组'
,
'drug_type'
=>
'药品类型'
,
],
],
'options'
=>
[
'options'
=>
[
],
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment