新增
This commit is contained in:
@@ -19,6 +19,8 @@ from doctor_workstation.ui.dialogs.prescription import (
|
||||
PrescriptionOrderDialog,
|
||||
PrescriptionTemplateDialog,
|
||||
RemoteMedicineComboBox,
|
||||
build_prescription_clinical_diagnosis,
|
||||
build_prescription_visit_no,
|
||||
parse_pasted_herbs,
|
||||
render_prescription_html,
|
||||
)
|
||||
@@ -109,6 +111,22 @@ def test_paste_parser_matches_common_admin_recipe_forms() -> None:
|
||||
]
|
||||
|
||||
|
||||
def test_prescription_seed_helpers_match_admin_visit_no_and_clinical() -> None:
|
||||
assert build_prescription_visit_no(diagnosis_id=15534) == "1K00015534"
|
||||
assert build_prescription_visit_no(appointment_id=401, diagnosis_id=15534) == "1K00000401"
|
||||
assert build_prescription_visit_no() == ""
|
||||
|
||||
assert build_prescription_clinical_diagnosis({"diagnosis_type": "follow_up"}) == "复诊"
|
||||
assert build_prescription_clinical_diagnosis({"clinical_diagnosis": "follow_up"}) == "复诊"
|
||||
assert (
|
||||
build_prescription_clinical_diagnosis(
|
||||
{"symptoms": "肝郁脾虚", "diagnosis_type": "follow_up"}
|
||||
)
|
||||
== "肝郁脾虚"
|
||||
)
|
||||
assert build_prescription_clinical_diagnosis({"clinical_diagnosis": "气阴两虚"}) == "气阴两虚"
|
||||
|
||||
|
||||
def test_remote_medicine_selector_rejects_new_free_text(
|
||||
application: QApplication,
|
||||
) -> None:
|
||||
@@ -374,6 +392,11 @@ def test_order_payload_and_a4_print_document(
|
||||
"dose_unit": "剂",
|
||||
"usage_days": 7,
|
||||
"times_per_day": 2,
|
||||
"dosage_amount": 5,
|
||||
"dosage_bag_count": 2,
|
||||
"dosage_unit": "g",
|
||||
"usage_way": "温水送服",
|
||||
"usage_time": "饭后",
|
||||
"herbs": [
|
||||
{"name": "黄芪", "dosage": 15, "formula_type": "主方"},
|
||||
{"name": "酸枣仁", "dosage": 12, "formula_type": "辅方"},
|
||||
@@ -399,13 +422,51 @@ def test_order_payload_and_a4_print_document(
|
||||
assert "林晓岚" in rendered
|
||||
assert "黄芪" in rendered
|
||||
assert "酸枣仁" in rendered
|
||||
assert "服药前请核对姓名、电话、医生等信息" in rendered
|
||||
assert "Rp." in rendered
|
||||
assert "药房联" in rendered
|
||||
assert "主方" in rendered
|
||||
assert "辅方" in rendered
|
||||
assert "105克" in rendered
|
||||
assert "84克" in rendered
|
||||
assert "单剂量:</span> 27克" in rendered
|
||||
assert "每天2次, 一次2袋, 每袋5g, 温水送服, 饭后" in rendered
|
||||
viewer = PrescriptionDetailDialog(prescription)
|
||||
assert "中医处方笺" in viewer.document.toHtml()
|
||||
document_html = viewer.document.toHtml()
|
||||
assert "药房联" in document_html
|
||||
assert "用药 (单剂)" in document_html
|
||||
viewer.close()
|
||||
order.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_prescription_detail_can_open_immutable_case_record_tab(
|
||||
application: QApplication,
|
||||
) -> None:
|
||||
prescription = {
|
||||
"id": 12,
|
||||
"diagnosis_id": 6,
|
||||
"patient_name": "林晓岚",
|
||||
"case_record": {
|
||||
"patient_name": "林晓岚",
|
||||
"phone": "13800138000",
|
||||
"local_hospital_name": "市中医院",
|
||||
"symptoms": "口渴乏力",
|
||||
"tongue_coating": "舌红少苔",
|
||||
},
|
||||
}
|
||||
viewer = PrescriptionDetailDialog(prescription, initial_tab="case")
|
||||
|
||||
assert viewer.tabs.count() == 2
|
||||
assert viewer.tabs.tabText(viewer.tabs.currentIndex()) == "详细病历"
|
||||
assert viewer.case_document is not None
|
||||
case_html = viewer.case_document.toHtml()
|
||||
assert "市中医院" in case_html
|
||||
assert "口渴乏力" in case_html
|
||||
viewer.close()
|
||||
application.processEvents()
|
||||
|
||||
|
||||
def test_demo_repository_pages_render_offscreen(
|
||||
application: QApplication,
|
||||
immediate_async: None,
|
||||
|
||||
Reference in New Issue
Block a user