 -- 当日体检人数统计SQL
SELECT
ROW_NUMBER() OVER (ORDER BY OrgName) AS Num,
	OrgName,
	ID,NAME,
	CASE SEX WHEN 2 THEN '女' ELSE '男' END AS sex,
	AGE,AgeClass,
	SignTime,CardNo
FROM
	Enrollment_Patient 
WHERE
	OrgName LIKE '2024年云南云澳达%'
	
	
	
	-- 团体统计
	
	SELECT * FROM Enrollment_OrgPatient where OID=799

	SELECT * FROM Enrollment_Org where OID=731


SELECT A.ID AS EID,A.Name,Age,AgeClass,B.DeptName,B.FeeItemName FROM Enrollment_Patient A
LEFT JOIN Enrollment_FeeItem B ON A.ID=B.EID
WHERE
A.SignTime BETWEEN '2024-06-16' AND '2024-06-18'
AND B.DeptName='健康管理中心/治未病'
AND B.IsSend=1
AND B.FeeItemName LIKE '%十二%'