Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[update]获取职位/医生姓名 #99

Merged
merged 1 commit into from
Sep 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions bjguahao.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,30 +348,36 @@ def select_doctor_by_vec(self):
if self.config.assign == 'true':
for doctor_conf in self.config.doctorName:
for doctor in doctors:
if doctor["doctorName"] == doctor_conf and (doctor['totalCount']):
logging.info("选中:" + str(doctor["doctorName"]))
if self.get_doctor_name(doctor) == doctor_conf and (doctor['totalCount']):
logging.info("选中:" + self.get_doctor_name(doctor))
return doctor
return "NoDuty"
# 按照配置优先级选择医生
for doctor_conf in self.config.doctorName:
for doctor in doctors:
if doctor["doctorName"] == doctor_conf and doctor['totalCount']:
if self.get_doctor_name(doctor) == doctor_conf and doctor['totalCount']:
return doctor

# 若没有合适的医生,默认返回最好的医生
for doctor in doctors:
if doctor['totalCount']:
logging.info("选中:" + str(doctor["doctorName"]))
logging.info("选中:" + self.get_doctor_name(doctor))
return doctor
return "NoDuty"

def get_doctor_name(self,doctor):
if doctor['doctorName'] is not None:
return str(doctor['doctorName'])
else:
return str(doctor['doctorTitleName'])

def print_doctor(self):
logging.info("当前号余量:")
x = PrettyTable()
x.border = True
x.field_names = ["医生姓名", "擅长", "号余量"]
for doctor in self.dutys:
x.add_row([doctor["doctorName"], doctor['doctorSkill'], doctor['totalCount']])
x.add_row([self.get_doctor_name(doctor), doctor['doctorSkill'], doctor['totalCount']])
print(x.get_string())
pass

Expand Down