请帮我为以上代码添加注释
时间: 2024-03-03 18:49:20 浏览: 122
以下是对该 SQL 查询语句的注释:
```
SELECT * FROM (
-- 查询所有列
SELECT
GY_YLSF.FYMC AS FYMC, -- 费用名称
GY_YLSF.FYDW AS FYDW, -- 费用单位
MS_YJ02.YLSL AS FYSL, -- 费用数量
MS_YJ02.YLDJ AS FYDJ, -- 费用单价
MS_YJ02.ZFBL AS ZFBL, -- 自负比例
(MS_YJ02.ZFBL * MS_YJ02.YLDJ * MS_YJ02.YLSL) as zje, -- 总金额
(MS_YJ02.YLDJ * MS_YJ02.YLSL) as zje1, -- 总金额
GY_YGDM.YGXM AS YGXM, -- 医生姓名
MS_YJ01.brxm as brxm, -- 病人姓名
ms_mzxx.jzrq as jzrq, -- 结算日期
MS_YJ02.fygb as fygb, -- 费用归并
YYGH_GHJL.fzbz as fzbz, -- 费别
GY_YLSF.srfl as srfl, -- 收入分类
ms_brda.mzhm, -- 门诊号码
MS_YJ01.ysdm, -- 医生代码
GY_YGDM.ygbh, -- 医工编号
ms_mzxx.sfrq, -- 收费日期
gy_ksdm.KSMC, -- 科室名称
MS_YJ01.BRXZ, -- 病人性质
MS_BRDA.BRID, -- 病人ID
(select dmmc from GY_YLSF a,GY_DMZD b where a.FYXH = GY_YLSF.FYXH and a.srfl = b.DMSB and b.DMLB = 1177 )sffl -- 收费分类
FROM
MS_YJ02, -- 医技申请单表
GY_YLSF, -- 医疗收费表
MS_YJ01, -- 医技执行单表
GY_YGDM, -- 医生表
gy_ksdm, -- 科室表
ms_mzxx, -- 门诊表
ms_brda, -- 病人档案表
YYGH_GHJL -- 挂号记录表
WHERE
(GY_YLSF.FYXH = MS_YJ02.YLXH) AND -- 医疗收费表和医技申请单表关联
(MS_YJ01.YJXH = MS_YJ02.YJXH) AND -- 医技执行单表和医技申请单表关联
(MS_YJ01.YSDM = GY_YGDM.YGDM) AND -- 医生表和医技执行单表关联
(gy_ksdm.ksdm = MS_YJ01.ksdm) AND -- 科室表和医技执行单表关联
(ms_yj01.brid = ms_brda.brid) AND -- 病人档案表和医技执行单表关联
(ms_mzxx.ZFPB = 0) AND -- 未作废的门诊记录
(ms_yj01.fphm = ms_mzxx.fphm) AND -- 医技执行单表和门诊表关联
(YYGH_GHJL.GHLSH = MS_YJ01.GHLSH) AND -- 挂号记录表和医技执行单表关联
(MS_YJ01.FJLB IS NULL OR MS_YJ01.FJLB = 0) AND -- 空或0的附加类别
(MS_YJ01.FPHM is not null) -- 非空的发票号码
)
```
阅读全文