(example)
| 144 | |
| 145 | |
| 146 | def generate_clinical_diagnosis(example): |
| 147 | clinical_case_uid = example['clinical_case_uid'] |
| 148 | language = example['language'] |
| 149 | clinical_department = example['clinical_department'] |
| 150 | clinical_case_summary = example['clinical_case_summary'] |
| 151 | |
| 152 | logging.info('===> [clinical diagnosis inference]...') |
| 153 | logging.info('### [clinical case uid]: ' + str(clinical_case_uid)) |
| 154 | |
| 155 | if language == 'zh': |
| 156 | prompt = f'''您是一位经验丰富的{clinical_department}临床医生,根据给定的病例摘要,请分析并提供一个专业、详细、全面的临床诊断,包含以下6个部分: |
| 157 | 1. 初步诊断:分条列出患者可能存在的一种或多种疾病的名称。 |
| 158 | 2. 诊断依据:分条列出您做出初步诊断的依据。 |
| 159 | 3. 鉴别诊断:分条列出几种可能导致患者目前症状的疾病,并简要说明为何将它们排除。如果您认为不需要进行鉴别诊断,请直接回答“诊断明确,无需鉴别。”。 |
| 160 | 4. 主要诊断:一种对患者身体健康危害最大、最需要治疗的疾病的名称。 |
| 161 | 5. 治疗原则:概述治疗您给出的主要诊断的一般原则。 |
| 162 | 6. 治疗计划:分条列出初步的治疗计划。 |
| 163 | |
| 164 | 请确保您的回答符合以下格式: |
| 165 | “初步诊断:<您提供的初步诊断> |
| 166 | 诊断依据:<您提供的诊断依据> |
| 167 | 鉴别诊断:<您提供的鉴别诊断> |
| 168 | 主要诊断:<您提供的主要诊断> |
| 169 | 治疗原则:<您提供的治疗原则> |
| 170 | 治疗计划:<您提供的治疗计划>” |
| 171 | |
| 172 | 以下是给定的病例摘要: |
| 173 | |
| 174 | {clinical_case_summary} |
| 175 | |
| 176 | 您提供的临床诊断:''' |
| 177 | preliminary_diagnosis_pattern = r'初步诊断:([\s\S]*?)诊断依据:' |
| 178 | diagnostic_basis_pattern = r'诊断依据:([\s\S]*?)鉴别诊断:' |
| 179 | differential_diagnosis_pattern = r'鉴别诊断:([\s\S]*?)主要诊断:' |
| 180 | principal_diagnosis_pattern = r'主要诊断:([\s\S]*?)治疗原则:' |
| 181 | therapeutic_principle_pattern = r'治疗原则:([\s\S]*?)治疗计划:' |
| 182 | treatment_plan_pattern = r'治疗计划:([\s\S]*?)$' |
| 183 | else: |
| 184 | prompt = f'''You are an experienced {clinical_department} clinician. Based on the given clinical case summary, please analyze and provide a professional, detailed, and comprehensive clinical diagnosis, including the following 6 parts: |
| 185 | 1. Preliminary Diagnosis: List the names of one or multiple diseases that the patient might have. |
| 186 | 2. Diagnostic Basis: List the basis for your preliminary diagnosis. |
| 187 | 3. Differential Diagnosis: List several diseases that could cause the patient's current symptoms and briefly explain why you exclude them. If you believe differential diagnosis is unnecessary, please directly response "The diagnosis is clear and no differentiation is needed." |
| 188 | 4. Principal Diagnosis: The name of a disease that is most harmful to the patient's physical health and needs immediate treatment. |
| 189 | 5. Therapeutic Principle: Outline the general principles for treating your principal diagnosis. |
| 190 | 6. Treatment Plan: List the rough treatment plan. |
| 191 | |
| 192 | Please ensure that your response follows this format: |
| 193 | "Preliminary Diagnosis: <Your Preliminary Diagnosis> |
| 194 | Diagnostic Basis: <Your Diagnostic Basis> |
| 195 | Differential Diagnosis: <Your Differential Diagnosis> |
| 196 | Principal Diagnosis: <Your Principal Diagnosis> |
| 197 | Therapeutic Principle: <Your Therapeutic Principle> |
| 198 | Treatment Plan: <Your Treatment Plan>" |
| 199 | |
| 200 | The following is the given clinical case summary: |
| 201 | {clinical_case_summary} |
| 202 | |
| 203 | Your clinical diagnosis:''' |
no test coverage detected