本文整理汇总了Python中general.MedicalServiceTypePage.get_general_query方法的典型用法代码示例。如果您正苦于以下问题:Python MedicalServiceTypePage.get_general_query方法的具体用法?Python MedicalServiceTypePage.get_general_query怎么用?Python MedicalServiceTypePage.get_general_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类general.MedicalServiceTypePage
的用法示例。
在下文中一共展示了MedicalServiceTypePage.get_general_query方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
service_code AS group_field,
COUNT(DISTINCT patient_id) AS count_patients,
COUNT(DISTINCT service_id) AS count_services,
SUM(service_tariff) AS total_tariff,
SUM(CASE WHEN psc.id_pk is not NULL
THEN ROUND(service_tariff * 0.07, 2)
END) AS coeff1_07,
SUM(service_accepted) AS total_accepted
FROM registry_services
LEFT JOIN provided_service_coefficient psc
ON psc.service_fk = service_id
AND psc.coefficient_fk = 5
WHERE service_group = 15
AND service_code IN (
'119101',
'119119',
'119120'
)
GROUP BY mo_code, group_field
'''
return query
示例2: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
CASE WHEN service_code in ('098995', '198995') THEN '180'
WHEN service_code in ('098996', '198996') THEN '181'
WHEN service_code in ('098997', '198997') THEN '182'
WHEN service_code in ('098606') THEN '300'
WHEN service_code in ('098607') THEN '301'
WHEN service_code in ('098608', '198611') THEN '302'
WHEN service_code in ('198613') THEN '303'
WHEN service_code in ('098609', '198612') THEN '304'
WHEN service_code in ('198614') THEN '305'
WHEN service_code in ('198615') THEN '306'
WHEN service_code in ('198616') THEN '307'
WHEN service_code in ('198617') THEN '308'
END AS group_field,
COUNT(DISTINCT (patient_id, service_tariff_profile)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN (patient_id, service_tariff_profile)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN (patient_id, service_tariff_profile)
END) AS count_patients_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_quantity) AS count_days,
SUM(CASE WHEN is_adult
THEN service_quantity
END) AS count_days_adult,
SUM(CASE WHEN NOT is_adult
THEN service_quantity
END) AS count_days_child,
SUM(service_accepted) AS total_accepted,
SUM(CASE WHEN is_adult
THEN service_accepted
END) AS total_accepted_adult,
SUM(CASE WHEN NOT is_adult
THEN service_accepted
END) AS total_accepted_child
FROM registry_services
WHERE service_code in (
'098995', '098996', '098997',
'198995', '198996', '198997', '098606',
'098607', '098608', '098609', '198611',
'198612', '198613', '198614', '198615',
'198616', '198617'
)
GROUP BY mo_code, group_field
'''
return query
示例3: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
'0' AS group_field,
COUNT(DISTINCT patient_id) AS count_patients,
COUNT(DISTINCT CASE WHEN patient_gender = 2
THEN patient_id
END) AS count_patients_female,
COUNT(DISTINCT CASE WHEN patient_gender = 1
THEN patient_id
END) AS count_patients_male,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN patient_gender = 2
THEN service_id
END) AS count_services_female,
COUNT(DISTINCT CASE WHEN patient_gender = 1
THEN service_id
END) AS count_services_male
FROM registry_services
WHERE service_group = 12
AND service_subgroup = 9
GROUP BY mo_code, group_field
'''
return query
示例4: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
'0' AS group_field,
COUNT(DISTINCT (patient_id, is_adult)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN patient_id
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN patient_id
END) AS count_patients_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_tariff) AS total_tariff,
SUM(CASE WHEN is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_adult,
SUM(CASE WHEN NOT is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_child
FROM registry_services
WHERE service_code IN ('001841', '101841')
GROUP BY mo_code, group_field
'''
return query
示例5: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
'0' AS group_field,
COUNT(DISTINCT (patient_id, service_division, is_adult)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN (patient_id, service_division)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN (patient_id, service_division)
END) AS count_patients_child,
COUNT(DISTINCT event_id) AS count_treatments,
COUNT(DISTINCT CASE WHEN is_adult
THEN event_id
END) AS count_treatments_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN event_id
END) AS count_treatments_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_tariff) AS total_tariff,
SUM(CASE WHEN is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_adult,
SUM(CASE WHEN NOT is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_child
FROM registry_services
WHERE service_term = 3
AND service_reason = 1
AND (service_group = 24 OR service_group IS NULL)
AND NOT is_capitation
AND (SELECT
COUNT(DISTINCT inner_ps.id_pk)
FROM provided_service inner_ps
JOIN medical_service inner_ms
ON inner_ms.id_pk = inner_ps.code_fk
WHERE
inner_ps.event_fk = event_id
AND (inner_ms.group_fk is NULL
OR inner_ms.group_fk in (24))
AND inner_ms.reason_fk = 1
)>1
AND service_division NOT IN (399, 401, 403)
GROUP BY mo_code, group_field
'''
return query
示例6: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
'0' AS group_field,
COUNT(DISTINCT CASE WHEN service_group IN (4)
THEN (0, patient_id, service_code, is_adult)
WHEN service_group IN (9)
THEN (2, patient_id, service_group, is_adult)
ELSE (1, patient_id, service_division::varchar, is_adult)
END) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN (
CASE WHEN service_group IN (4)
THEN (0, patient_id, service_code, is_adult)
WHEN service_group IN (9)
THEN (2, patient_id, service_group, is_adult)
ELSE (1, patient_id, service_division::varchar, is_adult)
END
)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN (
CASE WHEN service_group IN (4)
THEN (0, patient_id, service_code, is_adult)
WHEN service_group IN (9)
THEN (2, patient_id, service_group, is_adult)
ELSE (1, patient_id, service_division::varchar, is_adult)
END)
END) AS count_patients_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_accepted) AS total_tariff,
SUM(CASE WHEN is_adult
THEN service_accepted
ELSE 0
END) AS total_tariff_adult,
SUM(CASE WHEN NOT is_adult
THEN service_accepted
ELSE 0
END) AS total_tariff_child
FROM registry_services
WHERE (service_term = 3
AND service_reason IN (2, 3)
AND (service_group = 24 OR service_group IS NULL)
AND NOT is_capitation)
OR (service_group = 9 AND service_code IN ('019214', '019215', '019216', '019217'))
OR service_group = 4
GROUP BY mo_code, group_field
'''
return query
示例7: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
service_code AS group_field,
COUNT(DISTINCT patient_id) AS count_patients,
COUNT(DISTINCT service_id) AS count_services,
SUM(service_tariff) AS total_tariff
FROM registry_services
WHERE service_group IN (25, 26)
GROUP BY mo_code, group_field
'''
return query
示例8: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
CASE WHEN service_code IN ('098716', '198716') THEN '0'
WHEN service_code IN ('098717', '198717') THEN '1'
END AS group_field,
COUNT(DISTINCT (patient_id, service_tariff_profile)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN (patient_id, service_tariff_profile)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN (patient_id, service_tariff_profile)
END) AS count_patients_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_quantity) AS count_days,
SUM(CASE WHEN is_adult
THEN service_quantity
END) AS count_days_adult,
SUM(CASE WHEN NOT is_adult
THEN service_quantity
END) AS count_days_child,
SUM(service_accepted) AS total_accepted,
SUM(CASE WHEN is_adult
THEN service_accepted
END) AS total_accepted_adult,
SUM(CASE WHEN NOT is_adult
THEN service_accepted
END) AS total_accepted_child
FROM registry_services
LEFT JOIN provided_service_coefficient psc
ON psc.service_fk = service_id
LEFT JOIN tariff_coefficient tc
ON tc.id_pk = psc.coefficient_fk
WHERE service_group = 30
GROUP BY mo_code, group_field
'''
return query
示例9: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
ksg.code :: varchar AS group_field,
COUNT(DISTINCT (patient_id, service_tariff_profile)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN (patient_id, service_tariff_profile)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN (patient_id, service_tariff_profile)
END) AS count_patients_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_quantity) AS count_days,
SUM(CASE WHEN is_adult
THEN service_quantity
END) AS count_days_adult,
SUM(CASE WHEN NOT is_adult
THEN service_quantity
END) AS count_days_child,
SUM(service_accepted) AS total_accepted,
SUM(CASE WHEN is_adult
THEN service_accepted
END) AS total_accepted_adult,
SUM(CASE WHEN NOT is_adult
THEN service_accepted
END) AS total_accepted_child
FROM registry_services
JOIN ksg ON ksg.code::VARCHAR = ksg_smo AND ksg.start_date = '2017-01-01'
AND ksg.term_fk = service_term
JOIN kpg ON kpg.id_pk = ksg.kpg_fk
WHERE service_term = 2
AND kpg.code = 37
GROUP BY mo_code, group_field
'''
return query
示例10: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
CASE WHEN service_code IN ('001038', '101038') THEN '0'
WHEN service_code IN ('001039', '101039') THEN '1'
END AS group_field,
COUNT(DISTINCT (patient_id, service_code, is_adult)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN (patient_id, service_code)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN (patient_id, service_code)
END) AS count_patients_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_tariff) AS total_tariff,
SUM(CASE WHEN is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_adult,
SUM(CASE WHEN NOT is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_child
FROM registry_services
WHERE service_term = 3
AND service_group = 4
AND NOT is_capitation
GROUP BY mo_code, group_field
'''
return query
示例11: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
'0' AS group_field,
COUNT(DISTINCT (patient_id, service_division, is_adult)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN (patient_id, service_division)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN (patient_id, service_division)
END) AS count_patients_child,
COUNT(DISTINCT service_id) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN service_id
END) AS count_services_child,
SUM(service_tariff) AS total_tariff,
SUM(CASE WHEN is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_adult,
SUM(CASE WHEN NOT is_adult
THEN service_tariff
ELSE 0
END) AS total_tariff_child
FROM registry_services
WHERE service_term = 3
AND service_reason IN (2)
AND (service_group = 24 OR service_group IS NULL)
AND is_capitation
AND service_division NOT IN (399, 401, 403)
GROUP BY mo_code, group_field
'''
return query
示例12: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
CASE WHEN service_tariff_profile IN (42, 40, 41) THEN '0'
ELSE '1'
END AS group_field,
COUNT(DISTINCT CASE WHEN service_group != 42 OR service_group IS NULL
THEN (patient_id, service_tariff_profile)
END) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult AND (service_group != 42 OR service_group IS NULL)
THEN (patient_id, service_tariff_profile)
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult AND (service_group != 42 OR service_group IS NULL)
THEN (patient_id, service_tariff_profile)
END) AS count_patients_child,
COUNT(DISTINCT CASE WHEN service_group != 42 OR service_group IS NULL
THEN service_id
END) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult AND (service_group != 42 OR service_group IS NULL)
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult AND (service_group != 42 OR service_group IS NULL)
THEN service_id
END) AS count_services_child,
SUM(CASE WHEN service_group != 42 OR service_group IS NULL
THEN service_quantity
END) AS count_days,
SUM(CASE WHEN is_adult AND (service_group != 42 OR service_group IS NULL)
THEN service_quantity
END) AS count_days_adult,
SUM(CASE WHEN NOT is_adult AND (service_group != 42 OR service_group IS NULL)
THEN service_quantity
END) AS count_days_child,
SUM(service_tariff) AS total_tariff,
SUM(CASE WHEN is_adult
THEN service_tariff
END) AS total_tariff_adult,
SUM(CASE WHEN NOT is_adult
THEN service_tariff
END) AS total_tariff_child,
SUM(CASE WHEN psc.coefficient_fk = 26
THEN ROUND(service_tariff * tc.value, 2)
ELSE 0
END) AS coeff_ku,
SUM(CASE WHEN is_adult AND psc.coefficient_fk = 26
THEN ROUND(service_tariff * tc.value, 2)
ELSE 0
END) AS coeff_ku_adult,
SUM(CASE WHEN NOT is_adult AND psc.coefficient_fk = 26
THEN ROUND(service_tariff * tc.value, 2)
ELSE 0
END) AS coeff_ku_child,
SUM(service_accepted) AS total_accepted,
SUM(CASE WHEN is_adult
THEN service_accepted
END) AS total_accepted_adult,
SUM(CASE WHEN NOT is_adult
THEN service_accepted
END) AS total_accepted_child
FROM registry_services
LEFT JOIN provided_service_coefficient psc
ON psc.service_fk = service_id
LEFT JOIN tariff_coefficient tc
ON tc.id_pk = psc.coefficient_fk
JOIN medical_division md
ON md.id_pk = event_division_id
WHERE (service_term = 2 AND service_group IS NULL
AND md.term_fk = 11) OR service_group IN (17, 42)
GROUP BY mo_code, group_field
'''
return query
示例13: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query()
return query
示例14: get_query
# 需要导入模块: from general import MedicalServiceTypePage [as 别名]
# 或者: from general.MedicalServiceTypePage import get_general_query [as 别名]
def get_query(self):
query = MedicalServiceTypePage.get_general_query() + '''
SELECT
mo_code AS mo_code,
(SELECT
DISTINCT ms1.subgroup_fk
FROM provided_service ps1
JOIN medical_service ms1
ON ms1.id_pk = ps1.code_fk
WHERE ps1.event_fk = event_id
AND ps1.start_date = service_start_date
AND ps1.end_date = service_end_date
AND ms1.subgroup_fk is NOT NULL) AS group_field,
COUNT(DISTINCT (patient_id, is_adult)) AS count_patients,
COUNT(DISTINCT CASE WHEN is_adult
THEN patient_id
END) AS count_patients_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
THEN patient_id
END) AS count_patients_child,
COUNT(DISTINCT CASE WHEN service_subgroup = 12
THEN event_id END) AS count_treatment,
COUNT(DISTINCT CASE WHEN is_adult AND service_subgroup = 12
THEN event_id
END) AS count_treatment_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult AND service_subgroup = 12
THEN event_id
END) AS count_treatment_child,
COUNT(DISTINCT CASE WHEN service_subgroup is NOT NULL
THEN service_id END) AS count_services,
COUNT(DISTINCT CASE WHEN is_adult
AND service_subgroup is NOT NULL
THEN service_id
END) AS count_services_adult,
COUNT(DISTINCT CASE WHEN NOT is_adult
AND service_subgroup is NOT NULL
THEN service_id
END) AS count_services_child,
SUM(service_quantity) AS total_quantity,
SUM(CASE WHEN is_adult
THEN service_quantity
END) AS total_quantity_adult,
SUM(CASE WHEN NOT is_adult
THEN service_quantity
END) AS total_quantity_child,
SUM(service_tariff) AS total_tariff,
SUM(CASE WHEN is_adult
THEN service_tariff
END) AS total_tariff_adult,
SUM(CASE WHEN NOT is_adult
THEN service_tariff
END) AS total_tariff_child,
SUM(CASE WHEN psc.id_pk is NOT NULL
THEN ROUND(service_tariff * 0.07, 2)
END) AS coef_mob_dental_office,
SUM(CASE WHEN is_adult AND psc.id_pk is NOT NULL
THEN ROUND(service_tariff * 0.07, 2)
END) AS coef_mob_dental_office_adult,
SUM(CASE WHEN NOT is_adult AND psc.id_pk is NOT NULL
THEN ROUND(service_tariff * 0.07, 2)
END) AS coef_mob_dental_office_child,
SUM(service_accepted) AS total_accepted,
SUM(CASE WHEN is_adult
THEN service_accepted
END) AS total_accepted_adult,
SUM(CASE WHEN NOT is_adult
THEN service_accepted
END) AS total_accepted_child
FROM registry_services
LEFT JOIN provided_service_coefficient psc
ON psc.service_fk = service_id
AND psc.coefficient_fk = 27
WHERE service_group = 19
GROUP BY mo_code, group_field
'''
return query