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
25d58436
authored
Nov 14, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
显示脱敏
parent
2036f568
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
112 deletions
+29
-112
app/Admin/Controllers/DoctorController.php
+6
-2
app/Admin/Controllers/DrugController.php
+1
-0
app/Admin/Controllers/PatientController.php
+7
-2
app/Admin/Controllers/PharmacistController.php
+7
-2
app/Admin/Controllers/PharmacyController.php
+1
-1
app/Admin/Controllers/PrescriptionController.php
+3
-2
app/helpers.php
+4
-103
No files found.
app/Admin/Controllers/DoctorController.php
View file @
25d58436
...
...
@@ -24,8 +24,12 @@ protected function grid()
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'name'
);
$grid
->
column
(
'id_card'
);
$grid
->
column
(
'mobile'
);
$grid
->
column
(
'id_card'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
,
'idcard'
);
});
$grid
->
column
(
'mobile'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
,
'mobile'
);
});
$grid
->
column
(
'license_no'
);
// $grid->column('license_no_pic')->image('', 50, 50);
// $grid->column('license_no_period');
...
...
app/Admin/Controllers/DrugController.php
View file @
25d58436
...
...
@@ -53,6 +53,7 @@ protected function grid()
$filter
->
like
(
'name'
)
->
width
(
3
);
$filter
->
like
(
'code'
)
->
width
(
3
);
$filter
->
like
(
'factory'
)
->
width
(
3
);
$filter
->
like
(
'standard_code'
)
->
width
(
3
);
});
// 行按钮控制
...
...
app/Admin/Controllers/PatientController.php
View file @
25d58436
...
...
@@ -26,12 +26,16 @@ protected function grid()
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'name'
);
$grid
->
column
(
'id_card'
);
$grid
->
column
(
'id_card'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
,
'idcard'
);
});
$grid
->
column
(
'gender'
,
'性别'
)
->
using
(
PatientModel
::
SEX_MAP
);
$grid
->
column
(
'age'
,
'年龄'
)
->
display
(
function
(
$value
)
{
return
getAgeByIdCard
(
$this
->
id_card
);
});
$grid
->
column
(
'mobile'
);
$grid
->
column
(
'mobile'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
,
'mobile'
);
});
$grid
->
column
(
'is_default'
)
->
using
([
0
=>
'否'
,
1
=>
'是'
]);
$grid
->
column
(
'user.id'
,
'关联用户'
);
$grid
->
column
(
'pharmacy.name'
,
'关联药店'
);
...
...
@@ -46,6 +50,7 @@ protected function grid()
$filter
->
like
(
'name'
)
->
width
(
3
);
$filter
->
like
(
'id_card'
)
->
width
(
3
);
$filter
->
like
(
'mobile'
)
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
)
->
select
(
PharmacyModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
3
);
});
// 行按钮控制
...
...
app/Admin/Controllers/PharmacistController.php
View file @
25d58436
...
...
@@ -64,10 +64,14 @@ protected function grid()
$grid
->
column
(
'id'
)
->
sortable
();
$grid
->
column
(
'status'
)
->
switch
();
$grid
->
column
(
'name'
);
$grid
->
column
(
'id_card'
);
$grid
->
column
(
'id_card'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
,
'idcard'
);
});
$grid
->
column
(
'license_number'
);
$grid
->
column
(
'signed_pic'
)
->
image
(
''
,
50
,
50
);
$grid
->
column
(
'mobile'
);
$grid
->
column
(
'mobile'
)
->
display
(
function
(
$content
)
{
return
data_masking
(
$content
,
'mobile'
);
});
$grid
->
column
(
'practicing_license_expired_time'
);
$grid
->
column
(
'pharmacy.name'
,
'关联药店'
);
// $grid->column('practicing_license')->image('', 50, 50);
...
...
@@ -85,6 +89,7 @@ protected function grid()
$filter
->
like
(
'name'
)
->
width
(
3
);
$filter
->
like
(
'id_card'
)
->
width
(
3
);
$filter
->
like
(
'mobile'
)
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
)
->
select
(
PharmacyModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
3
);
});
// 行按钮控制
...
...
app/Admin/Controllers/PharmacyController.php
View file @
25d58436
...
...
@@ -46,7 +46,7 @@ protected function grid()
$grid
->
column
(
'updated_at'
)
->
sortable
();
// 快捷搜索
$grid
->
quickSearch
([
'name'
,
'mobile'
])
->
placeholder
(
'请输入[
姓名|手机号|身份证号码
]'
)
->
width
(
25
);
$grid
->
quickSearch
([
'name'
,
'mobile'
])
->
placeholder
(
'请输入[
药店名称|管理员手机号
]'
)
->
width
(
25
);
$grid
->
filter
(
function
(
Grid\Filter
$filter
)
{
$filter
->
panel
();
// 更改为 panel 布局
...
...
app/Admin/Controllers/PrescriptionController.php
View file @
25d58436
...
...
@@ -29,7 +29,7 @@ protected function grid()
$grid
->
model
()
->
orderBy
(
'id'
,
'DESC'
);
$grid
->
column
(
'id'
,
'处方单编号'
)
->
sortable
();
$grid
->
column
(
'status'
);
$grid
->
column
(
'status'
)
->
using
(
PrescriptionModel
::
PRESCRIPTION_STATUS_MAP
)
;
$grid
->
column
(
'patient_name'
);
$grid
->
column
(
'patient_age'
);
$grid
->
column
(
'patient_gender'
);
...
...
@@ -57,7 +57,8 @@ protected function grid()
$filter
->
like
(
'patient_name'
)
->
width
(
3
);
$filter
->
like
(
'diagnosis_name'
)
->
width
(
3
);
$filter
->
like
(
'pharmacy_name'
)
->
width
(
3
);
$filter
->
equal
(
'pharmacy_id'
)
->
select
(
PharmacyModel
::
all
()
->
pluck
(
'name'
,
'id'
))
->
width
(
3
);
$filter
->
in
(
'status'
)
->
checkbox
(
PrescriptionModel
::
PRESCRIPTION_STATUS_MAP
)
->
width
(
3
);
});
// 行按钮控制
...
...
app/helpers.php
View file @
25d58436
<?php
if
(
!
function_exists
(
'fen_2_yuan'
))
{
/**
* 分转换成元
*
* @param string $fen
* @return string
*/
function
fen_2_yuan
(
$fen
)
{
return
$fen
?
bcdiv
(
$fen
,
'100'
,
2
)
:
'0'
;
}
}
if
(
!
function_exists
(
'yuan_2_fen'
))
{
/**
* 元转换成分
*
* @param string $yuan
* @return int
*/
function
yuan_2_fen
(
$yuan
)
{
$yuan
=
money_format
(
$yuan
);
// 首先移除可能存在的千分位逗号
return
intval
(
bcmul
(
$yuan
,
'100'
));
}
}
if
(
!
function_exists
(
'money_format'
))
{
/**
* 去除金额千分位逗号
*
* @param string $yuan
* @return string
*/
function
money_format
(
$yuan
)
{
return
$yuan
?
str_replace
(
','
,
''
,
$yuan
)
:
$yuan
;
}
}
if
(
!
function_exists
(
'object_2_array'
))
{
// 对象转换成数组
function
object_2_array
(
$object
)
...
...
@@ -48,28 +7,7 @@ function object_2_array($object)
return
array_map
(
'get_object_vars'
,
$object
);
}
}
if
(
!
function_exists
(
'byte_2_human'
))
{
// 换算成人可读文件大小
function
byte_2_human
(
$byte
)
//传入字节单位
{
$KB
=
1024
;
$MB
=
$KB
*
1024
;
$GB
=
$MB
*
1024
;
$TB
=
$GB
*
1024
;
if
(
$byte
<
$KB
)
{
return
$byte
.
'B'
;
}
elseif
(
$byte
<
$MB
)
{
//取两位小数四舍五入
return
round
(
$byte
/
$KB
,
2
)
.
'KB'
;
}
elseif
(
$byte
<
$GB
)
{
return
round
(
$byte
/
$MB
,
2
)
.
'MB'
;
}
elseif
(
$byte
<
$TB
)
{
return
round
(
$byte
/
$GB
,
2
)
.
'GB'
;
}
else
{
return
round
(
$byte
/
$TB
,
2
)
.
'TB'
;
}
}
}
if
(
!
function_exists
(
'clean_ids'
))
{
/**
* 清理输入字符串,提取数字ID,并返回一个整数数组或以逗号分隔的字符串。
...
...
@@ -100,25 +38,7 @@ function clean_ids($idsString, $returnArray = false)
return
$idArr
;
}
}
if
(
!
function_exists
(
'is_sequential'
))
{
function
is_sequential
(
$array
)
{
$minCount
=
min
(
$array
);
$maxCount
=
max
(
$array
);
if
(
$minCount
!=
1
||
$maxCount
!=
count
(
$array
))
{
return
false
;
}
$expectedCounts
=
range
(
1
,
count
(
$array
));
if
(
array_values
(
$array
)
!=
$expectedCounts
)
{
return
false
;
}
return
true
;
}
}
if
(
!
function_exists
(
'getAgeByIdCard'
))
{
function
getAgeByIdCard
(
$idCard
)
{
...
...
@@ -178,7 +98,7 @@ function getSexByIdCard($idCard)
* @param string $str 被脱敏文本
* @return string 脱敏后文本
*/
function
data_masking
(
string
$str
Type
,
$str
=
''
)
function
data_masking
(
string
$str
,
string
$strType
)
{
if
(
!
isset
(
$str
)
||
(
!
trim
(
$str
)
&&
trim
(
$str
)
==
''
))
{
return
$str
;
...
...
@@ -214,8 +134,8 @@ function data_masking(string $strType, $str = '')
case
'bankcard'
:
// 展示前4位和后3位
$maskStr
=
substr
(
$str
,
0
,
4
)
.
'************'
.
substr
(
$str
,
-
4
,
3
);
break
;
case
'idcard'
:
// 只展示
第一位和最后一
位
$maskStr
=
substr
(
$str
,
0
,
1
)
.
str_repeat
(
'*'
,
strlen
(
$str
)
-
2
)
.
substr
(
$str
,
-
1
,
1
);
case
'idcard'
:
// 只展示
前6位和后4
位
$maskStr
=
substr
(
$str
,
0
,
6
)
.
str_repeat
(
'*'
,
strlen
(
$str
)
-
10
)
.
substr
(
$str
,
-
4
);
break
;
case
'mobile'
:
// 展示前3位和后4位
$maskStr
=
substr_replace
(
$str
,
'****'
,
3
,
4
);
...
...
@@ -288,23 +208,4 @@ function validateBirthday($birthday)
return
$timestamp
!==
false
&&
$timestamp
<
strtotime
(
'midnight'
);
}
function
validateISO7064
(
$value
)
{
$bits
=
[
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
];
$arr_ch
=
[
'1'
,
'0'
,
'X'
,
'9'
,
'8'
,
'7'
,
'6'
,
'5'
,
'4'
,
'3'
,
'2'
];
$sign
=
0
;
for
(
$i
=
0
;
$i
<
17
;
$i
++
)
{
$b
=
(
int
)
$value
[
$i
];
$w
=
$bits
[
$i
];
$sign
+=
$b
*
$w
;
}
$n
=
$sign
%
11
;
$r
=
$arr_ch
[
$n
];
$last
=
substr
(
$value
,
-
1
);
return
(
$r
==
$last
)
||
$r
==
10
&&
(
$last
==
'x'
||
$last
==
'X'
);
}
}
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