Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data
bi-report
Commits
0377dbde
Commit
0377dbde
authored
Nov 16, 2020
by
yindanlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add yeji_day report codes
parent
d8cbef8d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
yeji_day.sql
pm/yeji_day/etl/yeji_day.sql
+37
-0
No files found.
pm/yeji_day/etl/yeji_day.sql
View file @
0377dbde
...
...
@@ -558,6 +558,43 @@ FULL JOIN
where
partition_day
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
8
),
'MM'
),
'-'
,
''
)
AND
partition_day
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
group
by
SUBSTR
(
partition_day
,
1
,
8
),
merchant_id
UNION
ALL
SELECT
SUBSTR
(
t1
.
dt
,
1
,
8
)
as
partition_date
,
merchant_id
,
sum
(
rechange
)
as
chongzhi_amount
,
''
all_amount
,
''
cpc_amount
,
''
cpc_chongzhi_amount
,
''
cpc_click_num
,
''
liulan_amount
,
''
sixin_amount
FROM
(
SELECT
b
.
doctor_id
,
dt
,
sum
(
rechange
)
as
rechange
--转诊充值消耗
FROM
(
SELECT
account_id
,
abs
(
rechange
)
as
rechange
,
REGEXP_REPLACE
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
)
as
dt
FROM
tl
.
tl_ap_account_accountflow
--流水表
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
REGEXP_REPLACE
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
)
>=
REGEXP_REPLACE
(
trunc
(
date_sub
(
current_date
(),
8
),
'MM'
),
'-'
,
''
)
and
REGEXP_REPLACE
(
SUBSTR
(
created_time
,
1
,
10
),
'-'
,
''
)
<=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
type
=
'16'
--转诊消耗
)
a
LEFT
JOIN
(
SELECT
id
,
doctor_id
FROM
tl
.
tl_ap_account_account
WHERE
partition_day
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
GROUP
BY
id
,
doctor_id
)
b
on
a
.
account_id
=
b
.
id
GROUP
BY
b
.
doctor_id
,
dt
)
t1
LEFT
JOIN
(
SELECT
doctor_id
,
merchant_id
FROM
online
.
ml_doctor_relation_dimen_day
WHERE
partition_date
=
regexp_replace
(
date_sub
(
current_date
(),
1
),
'-'
,
''
)
and
doctor_is_merchant
=
'true'
GROUP
BY
doctor_id
,
merchant_id
)
t2
on
t1
.
doctor_id
=
t2
.
doctor_id
GROUP
BY
SUBSTR
(
t1
.
dt
,
1
,
8
),
merchant_id
)
gg
LEFT
JOIN
(
...
...
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