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
c0062902
authored
Apr 17, 2025
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'local-0409' into develop
parents
599320b4
8e695f84
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
25 deletions
+76
-25
app/Console/Commands/CmPrescription.php
+25
-8
app/Console/Commands/Medical.php
+25
-9
app/Console/Commands/WmPrescription.php
+26
-8
No files found.
app/Console/Commands/CmPrescription.php
View file @
c0062902
...
...
@@ -16,7 +16,7 @@ class CmPrescription extends Command
*
* @var string
*/
protected
$signature
=
'cm-prescription:init'
;
protected
$signature
=
'cm-prescription:init
{timestamp_str?}
'
;
/**
* The console command description.
...
...
@@ -31,13 +31,27 @@ class CmPrescription extends Command
public
function
handle
()
{
$this
->
info
(
'处方信息(中药)同步开始...'
);
$timestamp_str
=
$this
->
argument
(
'timestamp_str'
)
??
''
;
// 如果 timestamp_str 为空,则获取当月的起始时间戳(精确到毫秒)
if
(
empty
(
$timestamp_str
))
{
// 获取当前月份的第一天
$startOfMonth
=
Carbon
::
now
()
->
startOfMonth
();
// 转换为时间戳(秒级),然后乘以 1000 转换为毫秒
$timestamp_str
=
$startOfMonth
->
timestamp
*
1000
;
}
// 计算结束时间:基于 timestamp_str 加上 30 天
$beginTime
=
Carbon
::
createFromTimestampMs
(
$timestamp_str
);
// 将毫秒时间戳转换为 Carbon 实例
$endTime
=
$beginTime
->
copy
()
->
addDays
(
31
)
->
timestamp
*
1000
;
// 加上 30 天并转换为毫秒时间戳
// 输出时间戳以供调试
$this
->
info
(
"使用的开始时间戳:
{
$timestamp_str
}
"
);
$this
->
info
(
"使用的结束时间戳:
{
$endTime
}
"
);
try
{
$pageNum
=
1
;
// 初始页码
$maxPage
=
1
;
// 默认最大页数为 1
$baseParams
=
[
// 根据文档填写必要的参数
"beginTime"
=>
"1732982400000"
,
"endTime"
=>
"1859212800000"
,
"beginTime"
=>
$timestamp_str
,
"endTime"
=>
$endTime
,
"pageNum"
=>
1
,
"pageSize"
=>
20
,
];
...
...
@@ -191,15 +205,18 @@ public function handle()
$prescription
->
save
();
}
}
print_r
(
"maxPage:"
.
json_encode
(
$response
[
'data'
][
'maxPage'
])
.
"页
\n
"
);
// 更新分页信息
if
(
isset
(
$response
[
'data'
][
'maxPage'
]))
{
$maxPage
=
$response
[
'data'
][
'maxPage'
];
}
if
(
isset
(
$response
[
'data'
][
'pageNum'
]))
{
$pageNum
=
$response
[
'data'
][
'pageNum'
]
+
1
;
// 下一页
}
else
{
$pageNum
++
;
// 如果没有明确的 pageNum,手动递增
}
$pageNum
++
;
// if (isset($response['data']['pageNum'])) {
// $pageNum = $response['data']['pageNum'] + 1; // 下一页
// } else {
// $pageNum++; // 如果没有明确的 pageNum,手动递增
// }
print_r
(
"pageNum:"
.
$pageNum
.
"页
\n
"
);
}
else
{
Log
::
info
(
'CmPrescription-处方信息(中药)- 接口异常'
.
json_encode
(
$response
));
echo
"第
{
$pageNum
}
页查询失败。
\n
"
;
...
...
app/Console/Commands/Medical.php
View file @
c0062902
...
...
@@ -16,7 +16,7 @@ class Medical extends Command
*
* @var string
*/
protected
$signature
=
'medical:init'
;
protected
$signature
=
'medical:init
{timestamp_str?}
'
;
/**
* The console command description.
...
...
@@ -31,13 +31,27 @@ class Medical extends Command
public
function
handle
()
{
$this
->
info
(
'问诊同步开始...'
);
$timestamp_str
=
$this
->
argument
(
'timestamp_str'
)
??
''
;
// 如果 timestamp_str 为空,则获取当月的起始时间戳(精确到毫秒)
if
(
empty
(
$timestamp_str
))
{
// 获取当前月份的第一天
$startOfMonth
=
Carbon
::
now
()
->
startOfMonth
();
// 转换为时间戳(秒级),然后乘以 1000 转换为毫秒
$timestamp_str
=
$startOfMonth
->
timestamp
*
1000
;
}
// 计算结束时间:基于 timestamp_str 加上 30 天
$beginTime
=
Carbon
::
createFromTimestampMs
(
$timestamp_str
);
// 将毫秒时间戳转换为 Carbon 实例
$endTime
=
$beginTime
->
copy
()
->
addDays
(
31
)
->
timestamp
*
1000
;
// 加上 30 天并转换为毫秒时间戳
// 输出时间戳以供调试
$this
->
info
(
"使用的开始时间戳:
{
$timestamp_str
}
"
);
$this
->
info
(
"使用的结束时间戳:
{
$endTime
}
"
);
try
{
$pageNum
=
1
;
// 初始页码
$maxPage
=
1
;
// 默认最大页数为 1
$baseParams
=
[
// 根据文档填写必要的参数
"beginTime"
=>
"1732982400000"
,
"endTime"
=>
"1859212800000"
,
"beginTime"
=>
$timestamp_str
,
"endTime"
=>
$endTime
,
"pageNum"
=>
1
,
"pageSize"
=>
20
,
];
...
...
@@ -216,16 +230,18 @@ public function handle()
}
}
print_r
(
"maxPage:"
.
json_encode
(
$response
[
'data'
][
'maxPage'
])
.
"页
\n
"
);
// 更新分页信息
if
(
isset
(
$response
[
'data'
][
'maxPage'
]))
{
$maxPage
=
$response
[
'data'
][
'maxPage'
];
}
if
(
isset
(
$response
[
'data'
][
'pageNum'
]))
{
$pageNum
=
$response
[
'data'
][
'pageNum'
]
+
1
;
// 下一页
}
else
{
$pageNum
++
;
// 如果没有明确的 pageNum,手动递增
}
$pageNum
++
;
// if (isset($response['data']['pageNum'])) {
// $pageNum = $response['data']['pageNum'] + 1; // 下一页
// } else {
// $pageNum++; // 如果没有明确的 pageNum,手动递增
// }
print_r
(
"pageNum:"
.
$pageNum
.
"页
\n
"
);
}
else
{
Log
::
info
(
'Medical-问诊信息- 接口异常'
.
json_encode
(
$response
));
echo
"第
{
$pageNum
}
页查询失败。
\n
"
;
...
...
app/Console/Commands/WmPrescription.php
View file @
c0062902
...
...
@@ -15,7 +15,7 @@ class WmPrescription extends Command
*
* @var string
*/
protected
$signature
=
'wm-prescription:init'
;
protected
$signature
=
'wm-prescription:init
{timestamp_str?}
'
;
/**
* The console command description.
...
...
@@ -30,13 +30,28 @@ class WmPrescription extends Command
public
function
handle
()
{
$this
->
info
(
'处方信息(西药)同步开始...'
);
$timestamp_str
=
$this
->
argument
(
'timestamp_str'
)
??
''
;
// 如果 timestamp_str 为空,则获取当月的起始时间戳(精确到毫秒)
if
(
empty
(
$timestamp_str
))
{
// 获取当前月份的第一天
$startOfMonth
=
Carbon
::
now
()
->
startOfMonth
();
// 转换为时间戳(秒级),然后乘以 1000 转换为毫秒
$timestamp_str
=
$startOfMonth
->
timestamp
*
1000
;
}
// 计算结束时间:基于 timestamp_str 加上 30 天
$beginTime
=
Carbon
::
createFromTimestampMs
(
$timestamp_str
);
// 将毫秒时间戳转换为 Carbon 实例
$endTime
=
$beginTime
->
copy
()
->
addDays
(
31
)
->
timestamp
*
1000
;
// 加上 30 天并转换为毫秒时间戳
// 输出时间戳以供调试
$this
->
info
(
"使用的开始时间戳:
{
$timestamp_str
}
"
);
$this
->
info
(
"使用的结束时间戳:
{
$endTime
}
"
);
try
{
$pageNum
=
1
;
// 初始页码
$maxPage
=
1
;
// 默认最大页数为 1
$baseParams
=
[
// 根据文档填写必要的参数
"beginTime"
=>
"1732982400000"
,
"endTime"
=>
"1859212800000"
,
"beginTime"
=>
$timestamp_str
,
"endTime"
=>
$endTime
,
"pageNum"
=>
1
,
"pageSize"
=>
20
,
];
...
...
@@ -169,15 +184,18 @@ public function handle()
}
}
print_r
(
"maxPage:"
.
json_encode
(
$response
[
'data'
][
'maxPage'
])
.
"页
\n
"
);
// 更新分页信息
if
(
isset
(
$response
[
'data'
][
'maxPage'
]))
{
$maxPage
=
$response
[
'data'
][
'maxPage'
];
}
if
(
isset
(
$response
[
'data'
][
'pageNum'
]))
{
$pageNum
=
$response
[
'data'
][
'pageNum'
]
+
1
;
// 下一页
}
else
{
$pageNum
++
;
// 如果没有明确的 pageNum,手动递增
}
$pageNum
++
;
// if (isset($response['data']['pageNum'])) {
// $pageNum = $response['data']['pageNum'] + 1; // 下一页
// } else {
// $pageNum++; // 如果没有明确的 pageNum,手动递增
// }
print_r
(
"pageNum:"
.
$pageNum
.
"页
\n
"
);
}
else
{
Log
::
info
(
'WmPrescription-处方信息(西药)- 接口异常'
.
json_encode
(
$response
));
echo
"第
{
$pageNum
}
页查询失败。
\n
"
;
...
...
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