------------ 英德中医院视图创建SQL ----------

SELECT a.patient_id, a.lab_num, b.name, a.hst_num, ISNULL(a.ExamApplyID, '') AS req_num, a.req_date, CONVERT(VARCHAR(19),a.audit_time, 120) AS audit_time,
       dbo.fnGetChkTypeNameByLabNum(a.HospitalID,a.lab_num) AS CheckName,
	   ISNULL(c.name, '') AS PatSource,ISNULL(b.id_card,'') AS IDCARD
	FROM lisdb..patient_register AS a WITH(NOLOCK)
		JOIN lisdb..patient_baseinfo AS b WITH(NOLOCK) ON a.HospitalID = b.HospitalID AND a.patient_id = b.patient_id
		JOIN lisdb..ill_type AS c WITH(NOLOCK) ON a.send_type = c.type_id
	WHERE a.HospitalID = 32 AND (a.crt_time >= CONVERT(VARCHAR(10),DATEADD(MONTH, - 3, GETDATE()),120)) AND (a.proc_flag in (80,85))

------------ 英德中医院视图创建SQL ----------