Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
search_tips
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
rank
search_tips
Commits
eba6ca60
Commit
eba6ca60
authored
Apr 21, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改取值逻辑
parent
5b00ca71
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
words_utils.py
trans2es/commons/words_utils.py
+6
-4
doctor_transfer.py
trans2es/utils/doctor_transfer.py
+4
-4
hospital_transfer.py
trans2es/utils/hospital_transfer.py
+2
-3
No files found.
trans2es/commons/words_utils.py
View file @
eba6ca60
...
...
@@ -165,12 +165,13 @@ class QueryWordAttr(object):
return
0.0
@classmethod
def
get_doctor_query_word_weight
(
cls
,
name
):
def
get_doctor_query_word_weight
(
cls
,
name
=
None
,
doctor_id
=
None
):
try
:
if
not
cls
.
doctor_latest_date
:
cls
.
doctor_latest_date
=
DoctorConversion
.
objects
.
latest
(
'update_date'
)
.
update_date
doc_query_results
=
DoctorConversion
.
objects
.
filter
(
query
=
name
,
update_date
=
cls
.
doctor_latest_date
)
doc_query_results
=
DoctorConversion
.
objects
.
filter
(
business_id
=
doctor_id
,
update_date
=
cls
.
doctor_latest_date
)
total_score
=
0.0
for
query_item
in
doc_query_results
:
...
...
@@ -183,12 +184,13 @@ class QueryWordAttr(object):
return
0.0
@classmethod
def
get_hospital_query_word_weight
(
cls
,
name
):
def
get_hospital_query_word_weight
(
cls
,
name
=
None
,
hospital_id
=
None
):
try
:
if
not
cls
.
hospital_latest_date
:
cls
.
hospital_latest_date
=
HospitalConversion
.
objects
.
latest
(
'update_date'
)
.
update_date
hospital_query_results
=
HospitalConversion
.
objects
.
filter
(
query
=
name
,
update_date
=
cls
.
hospital_latest_date
)
hospital_query_results
=
HospitalConversion
.
objects
.
filter
(
business_id
=
hospital_id
,
update_date
=
cls
.
hospital_latest_date
)
total_score
=
0.0
for
query_item
in
hospital_query_results
:
...
...
trans2es/utils/doctor_transfer.py
View file @
eba6ca60
...
...
@@ -94,7 +94,8 @@ class DoctorTransfer(object):
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_doctor_query_word_weight
(
instance
.
name
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_doctor_query_word_weight
(
name
=
instance
.
name
,
doctor_id
=
instance
.
id
)
item_dict
[
"results_num"
]
=
QueryWordAttr
.
get_query_results_num
(
instance
.
name
)
item_dict
[
"type_flag"
]
=
get_tips_word_type
(
str
(
instance
.
name
)
.
lower
())
item_dict
[
"offline_score"
]
=
0.0
...
...
@@ -190,7 +191,8 @@ class DoctorTransferV1(object):
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_doctor_query_word_weight
(
instance
.
name
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_doctor_query_word_weight
(
name
=
instance
.
name
,
doctor_id
=
instance
.
id
)
item_dict
[
"results_num"
]
=
QueryWordAttr
.
get_query_results_num
(
instance
.
name
)
item_dict
[
"type_flag"
]
=
get_tips_word_type
(
instance
.
name
)
item_dict
[
"offline_score"
]
=
0.0
...
...
@@ -201,5 +203,3 @@ class DoctorTransferV1(object):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
(
dict
(),
list
())
trans2es/utils/hospital_transfer.py
View file @
eba6ca60
...
...
@@ -34,7 +34,7 @@ class HospitalTransfer(object):
item_dict
[
"ori_name"
]
=
name
item_dict
[
"is_online"
]
=
by_hospital_id_judge_office_online
(
is_online
=
instance
.
is_online
,
hospital_id
=
instance
.
id
,
name
=
name
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_hospital_query_word_weight
(
name
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_hospital_query_word_weight
(
name
,
hospital_id
=
instance
.
id
)
item_dict
[
"results_num"
]
=
QueryWordAttr
.
get_query_results_num
(
name
)
item_dict
[
"type_flag"
]
=
get_tips_word_type
(
name
)
item_dict
[
"offline_score"
]
=
0.0
...
...
@@ -69,7 +69,6 @@ class HospitalTransferV1(object):
def
get_hospital_suggest_data_list
(
cls
,
instance
):
try
:
ret_list
=
list
()
name
=
instance
.
name
.
strip
()
cut_bool
=
False
cut_word
=
[
"下线"
,
"停用"
,
"已经下线"
,
"账号停用"
]
...
...
@@ -86,7 +85,7 @@ class HospitalTransferV1(object):
item_dict
[
"is_online"
]
=
by_hospital_id_judge_office_online
(
is_online
=
instance
.
is_online
,
hospital_id
=
instance
.
id
,
name
=
name
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_hospital_query_word_weight
(
name
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_hospital_query_word_weight
(
name
,
hospital_id
=
instance
.
id
)
item_dict
[
"results_num"
]
=
QueryWordAttr
.
get_query_results_num
(
name
)
item_dict
[
"type_flag"
]
=
get_tips_word_type
(
name
)
item_dict
[
"offline_score"
]
=
0.0
...
...
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