From 6ab4b1e0b68e4c347110e37018fa005603f53904 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期二, 29 九月 2026 23:49:04 +0800
Subject: [PATCH] ai优化

---
 src/utils/stringUtil.ts |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/utils/stringUtil.ts b/src/utils/stringUtil.ts
index ab955b6..1093bf7 100644
--- a/src/utils/stringUtil.ts
+++ b/src/utils/stringUtil.ts
@@ -3,10 +3,23 @@
   return value == null || value.trim() === '';
 }
 
-export function genderFormat(value: number): string {
-  if ( 1===value ) {
-    return "鐢�";
-  } else {
-    return "濂�";
-  }
+/**
+ * 鎬у埆鏍煎紡鍖栵紙1 鐢� / 2 濂筹級銆�
+ *
+ * 銆愪慨姝c�戝師瀹炵幇鏄� `if (1===value) "鐢�" else "濂�"` 鈥斺�� 浼氭妸**浠讳綍闈� 1 鐨勫��**閮藉綋鎴�"濂�"锛�
+ * 鍖呮嫭 0锛堟湭鐭ワ級涓� null/undefined銆傚疄娴嬪簱涓� `pat_gender = 0` 鏈� 2,123 琛�
+ * 锛堣 AppointmentServiceImpl 鐨� UNKNOWN_GENDER 甯搁噺璇箟锛夛紝杩欎簺鎮h�呬細琚�**閿欐樉涓哄コ鎬�**銆�
+ *
+ * 鍙﹀娉ㄦ剰锛歁ySQL 鐨� `tinyint(1)` 浼氳 JDBC 椹卞姩鏄犲皠涓� Boolean锛�
+ * 鏁呰繖閲屽悓鏃跺吋瀹� boolean / 瀛楃涓叉暟瀛楋紙"1"銆�"2"锛夌瓑褰㈡�併��
+ */
+export function genderFormat(value: number | string | boolean | null | undefined): string {
+  if (value === null || value === undefined || value === '') return '鏈煡'
+  if (value === true) return '鐢�'
+  if (value === false) return '鏈煡'
+  const n = Number(value)
+  if (n === 1) return '鐢�'
+  if (n === 2) return '濂�'
+  // 0 = 鏈煡锛圚IS 鏈彁渚涳級锛屼笉瑕侀粯璁ゆ垚"濂�"
+  return '鏈煡'
 }

--
Gitblit v1.9.3