海南医院帆软报表 最终版本SQL
1. 挂号微信收入明细
- -- WANTED-1283 门诊查询统计报表-挂号微信收入明细
- select
- p.name as patientName, -- 患者姓名
- p.birthday, -- 出生日期
- bl.outpatient_number as blNumber, -- 病历号
- case p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END as sex, -- 性别
- round((f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount,2) AS guaHaoMoney,
- h.type,
- h.pay_method,
- i.name as payMethod,
- h.flow_fee as weiXinMoney, -- 微信到账
- h.charge as weiXinCharge, -- 微信手续
- h.pay_time as payTime, -- 缴费时间
- a.create_time, -- 挂号时间
- a.dept_name, -- 挂号科室名称
- a.appointment_doctor_name as doctorName, -- 挂号医生
- (select t.docname from (
- SELECT u.id AS docid,u1.property_value AS docname
- FROM thc_warehouse.staff_record u
- LEFT JOIN thc_warehouse.staff_record_property u1 ON u1.property_code = 'SXX000083' AND u.id = u1.staff_record_id
- ) t where t.docid = a.creator) AS creater,
- CASE a.subsequent_visit
- WHEN 0 THEN '初诊'
- WHEN 1 THEN '复诊'
- WHEN 2 THEN '转诊'
- WHEN 3 THEN '急诊'
- WHEN 4 THEN '体检'
- WHEN 5 THEN '简易'
- WHEN 6 THEN '疫苗'
- WHEN 7 THEN '团队体检'
- END AS isReVisit -- 初复诊
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- INNER JOIN `thc_passport`.`patient` p on a.patient_id = p.id
- left join `thc_passport`.`patient_org` bl on a.patient_id = bl.patient_id
- left JOIN `thc_rcm`.`pay_payment` i on h.pay_method = i.value and g.clinicID = i.clinicid
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_method = 4 -- 微信支付
- ${if(len(creator) == 0,"","and a.creator = '" + creator + "'")}
- ${if(len(dept) == 0,"","and a.dept_id = '" + dept + "'")}
- ${if(len(startTime) == 0,"","and h.pay_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","and h.pay_time <= '" + endTime + "'")}
- ORDER BY g.createtime desc,a.create_time desc
2.挂号患者信息查询
- -- -----------------------
- -- 患者信息查询
- -- -----------------------
- select DISTINCT
- CASE a.appointment_state WHEN -1 THEN '是' ELSE '否' END AS returnFlag, -- 退号标志
- CASE a.is_appoint_resource WHEN 0 THEN '否' WHEN 1 THEN '是' END as isAppointResource, -- 指定标志
- a.create_time as guaHaoTime, -- 挂号时间
- p.create_time as createDocTime, -- 建档时间
- -- 挂号实收金额
- round((f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount,2) AS realFee,
- round(t1.realFee,2) as menZenRealMoney, -- 门诊实收金额
- j.outpatient_number as blNumber, -- 病历号
- p.name as patientName, -- 患者姓名
- a.dept_name, -- 科室名称
- a.appointment_doctor_name as doctorName, -- 医生
- CASE a.subsequent_visit -- 初复诊
- WHEN 0 THEN '初诊'
- WHEN 1 THEN '复诊'
- WHEN 2 THEN '转诊'
- WHEN 3 THEN '急诊'
- WHEN 4 THEN '体检'
- WHEN 5 THEN '简易'
- WHEN 6 THEN '疫苗'
- WHEN 7 THEN '团队体检'
- END AS isReVisit, -- 初复诊
- channel.name as sourceName, -- 信息(渠道)来源
- p.birthday, -- 出生日期
- if(i.id_no is null, if(i.other_type is null, null,
- (select e.name from `thc_warehouse`.`sys_type_info` e
- JOIN `thc_warehouse`.`sys_type` f ON e.sys_type_id = f.id
- WHERE f.`code` = 'THC_WH_PERSON_CARD' and e.value = i.other_type)
- ), '身份证') as cardType, -- 证件类型
- if(i.id_no is null,i.other_no,i.id_no) as cardNo, -- 证件号码
- CONCAT(t2.province,t2.city,t2.county,t2.addressDetail) as liveAddr, -- 住址
- CONCAT(t2.province2,t2.city2,t2.county2,t2.addressDetail2) as bornAddr, -- 户籍
- if(locate('区',t2.county2) > 0,t2.county2,'') as qu, -- 区
- a.patient_phone,
- (select t.docname from (
- SELECT u.id AS docid,u1.property_value AS docname
- FROM thc_warehouse.staff_record u
- LEFT JOIN thc_warehouse.staff_record_property u1 ON u1.property_code = 'SXX000083' AND u.id = u1.staff_record_id
- ) t where t.docid = a.creator) AS creater,
- -- a.appointment_starttime,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime, -- 预约时间
- -- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- a.referrer_dept_name, -- 爱院科室
- a.referrer_name, -- 爱院人
- a.description -- 备注
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_passport`.`patient` p on a.patient_id = p.id
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- LEFT JOIN `thc_c_union`.`member_channel` channel on a.channel_id = channel.id
- LEFT JOIN `thc_passport`.`contact` i on a.patient_id = i.patient_id
- LEFT JOIN `thc_passport`.`patient_org` j on a.patient_id = j.patient_id
- left join
- (
- select
- aa.id,
- round((ff.preFee - ff.discountFee - ff.promotionBenefitFee - ff.couponFee - ff.itemBenefitFee - ff.memberCardBenefitFee - ff.itemComInvBenefitFee) * ff.discount,2) AS realFee
- from `thc_arrange`.`bpm_appointment` aa
- inner join `thc_sob`.`bpm_service_order` bb on aa.orderId = bb.id
- inner join `thc_sob`.`bpm_service_order_item` cc on cc.service_order_id = bb.id and cc.id = aa.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` dd on dd.orderID = bb.id and dd.`isDelete` = 0 and dd.orderSource = 1 and dd.orderType = 3 and dd.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` ee on dd.id = ee.AccountBillId and ee.itemClass = 1 and ee.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` ff on ff.accountBillID = dd.id and ff.accountBillDetailID = ee.id
- inner join `thc_rcm`.`Cs_Settlement` gg on gg.id = ff.settlementID and gg.`isDelete` = 0 and gg.returnFlag = 0
- and gg.settlementType=1 -- 门诊收费
- where 1=1 and aa.del_flag = 0
- ) t1 on a.id = t1.id
- left join
- (
- select
- aa.id,
- -- 住址
- (select city.name from `thc_passport`.`city` where city.id =
- (if(p.address is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.address,'$.province'))))) as province,
- (select city.name from `thc_passport`.`city` where city.id =
- (if(p.address is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.address,'$.city'))))) as city,
- (select city.name from `thc_passport`.`city` where city.id =
- (if(p.address is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.address,'$.county'))))) as county,
- if(p.address is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.address,'$.addressDetail'))) as addressDetail,
- -- 户籍
- (select city.name from `thc_passport`.`city` where city.id =
- (if(p.household is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.household,'$.province'))))) as province2,
- (select city.name from `thc_passport`.`city` where city.id =
- (if(p.household is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.household,'$.city'))))) as city2,
- (select city.name from `thc_passport`.`city` where city.id =
- (if(p.household is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.household,'$.county'))))) as county2,
- if(p.household is null,null, TRIM(BOTH '"' FROM JSON_EXTRACT(p.household,'$.addressDetail'))) as addressDetail2,
- round((ff.preFee - ff.discountFee - ff.promotionBenefitFee - ff.couponFee - ff.itemBenefitFee - ff.memberCardBenefitFee - ff.itemComInvBenefitFee) * ff.discount,2) AS realFee
- from `thc_arrange`.`bpm_appointment` aa
- inner join `thc_sob`.`bpm_service_order` bb on aa.orderId = bb.id
- inner join `thc_sob`.`bpm_service_order_item` cc on cc.service_order_id = bb.id and cc.id = aa.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` dd on dd.orderID = bb.id and dd.`isDelete` = 0 and dd.orderSource = 1 and dd.orderType = 3 and dd.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` ee on dd.id = ee.AccountBillId and ee.itemClass = 1 and ee.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` ff on ff.accountBillID = dd.id and ff.accountBillDetailID = ee.id
- inner join `thc_rcm`.`Cs_Settlement` gg on gg.id = ff.settlementID and gg.`isDelete` = 0 and gg.returnFlag = 0 -- 门诊挂号
- and gg.settlementType=2 -- 非挂号消费类型
- inner join `thc_passport`.`patient` p on aa.patient_id = p.id
- where 1=1 and aa.del_flag = 0
- ) t2 on a.id = t2.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0
- AND d.orderSource = 1
- AND d.orderType = 3
- AND d.returnFlag = 0
- AND e.itemClass = 1
- AND e.returnFlag is NULL
- AND g.settlementType=2
- AND g.isDelete = 0
- AND g.returnFlag = 0 -- 门诊挂号
- ${if(len(startTime) == 0,"","AND a.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND a.create_time <= '" + endTime + "'")}
- -- 爱院标志
- ${if(loveYuan == 0,"and a.appointment_state is null","")}
- ${if(loveYuan == 1,"and a.appointment_state is not null","")}
- ${if(len(deptId) == 0,"","AND a.dept_id = '" + deptId + "'")} -- 部门
- ${if(len(doctor) == 0,"","AND a.appointment_doctor_id = '" + doctor + "'")} -- 医生
- ${if(len(channelId) == 0,"","AND a.channel_id = '" + channelId + "'")} -- 信息来源
- ${if(len(patientName) == 0,"","AND p.name like '%" + patientName + "%'")} -- 姓名
- ${if(len(blNumber) == 0,"","AND j.outpatient_number like '%" + blNumber + "%'")} -- 病历号
- ${if(len(phone) == 0,"","AND a.patient_phone like '%" + phone + "%'")} -- 电话号
- ${if(len(subVisit) == 0,"","AND a.subsequent_visit = '" + subVisit + "'")} -- 初复诊
- ${if(len(doctor) == 0,"","and a.appointment_doctor_id = '" + doctor + "'")} -- 接诊员
- ${if(isReturn == -1,"and a.appointment_state = -1","")} -- 退号标志
- ${if(isReturn == 0,"and a.appointment_state != -1","")} -- 退号标志
3.挂号按来源统计
- select
- channel.name as name,
- DATE_FORMAT(a.appointment_date,${if(dateType == 1,"'%Y-%m'","'%Y-%m-%d'")}) as date, -- 按日期还是月份展示
- IFNULL(count(1),0) as num
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- left join `thc_c_union`.`member_channel` channel on a.channel_id = channel.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- and DATE_FORMAT(a.appointment_date,'%Y-%m-%d') >= DATE_FORMAT(${if(len(startTime) == 0, "'0000-01-01'" , "'" + startTime + "'" )},'%Y-%m-%d')
- and DATE_FORMAT(a.appointment_date,'%Y-%m-%d') <= DATE_FORMAT(${if(len(endTime) == 0,"'9999-01-01'","'" + endTime + "'")},'%Y-%m-%d')
- ${if(len(subVisit) == 0,"","and a.subsequent_visit = '" + subVisit + "'")}
- -- and channel.name is not null
- group by date_format(a.appointment_date, ${if(dateType == 1,"'%Y-%m'","'%Y-%m-%d'")}), channel.name -- 按日期还是月份分组查询
- order by a.appointment_date DESC, data_source asc
3.1有交易流水的条件
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1
- )
4.挂号按医生统计
- select
- t0.deptName,
- t0.doctorName,
- t0.deptId,
- t0.doctorId,
- t0.startTime,
- t0.endTime,
- IFNULL(t0.num,0) as num0,
- IFNULL(t1.num,0) as num1,
- IFNULL(t2.num,0) as num2,
- IFNULL(t3.num,0) as num3,
- IFNULL(t4.num,0) as num4,
- IFNULL(t5.num,0) as num5,
- IFNULL(t6.num,0) as num6,
- IFNULL(t7.num,0) as num7,
- IFNULL(t8.num,0) as num8,
- IFNULL(t9.num,0) as num9,
- IFNULL(t10.num,0) as num10,
- IFNULL(t11.num,0) as num11,
- IFNULL(t12.num,0) as num12,
- IFNULL(t13.num,0) as num13,
- IFNULL(t14.num,0) as num14
- from
- -- ------------
- -- 总挂号数
- -- ------------
- (
- select t.startTime, t.endTime, count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.appointment_state,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t0
- -- ------------
- -- 退号
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- and a.appointment_state = -1
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t1
- on t0.deptId = t1.deptId and t0.doctorId = t1.doctorId
- -- ------------
- -- 实际挂号数 = 初诊数 + 复诊数 + 转诊数
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit in (0,1,2)
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t2
- on t0.deptId = t2.deptId and t0.doctorId = t2.doctorId
- -- ------------
- -- 指定
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.is_appoint_resource = 1
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t3
- on t0.deptId = t3.deptId and t0.doctorId = t3.doctorId
- -- ------------
- -- 初诊
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit = 0
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t4
- on t0.deptId = t4.deptId and t0.doctorId = t4.doctorId
- -- ------------
- -- 复诊
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit = 1
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t5
- on t0.deptId = t5.deptId and t0.doctorId = t5.doctorId
- -- ------------
- -- 体检
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit = 4
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t6
- on t0.deptId = t6.deptId and t0.doctorId = t6.doctorId
- -- ------------
- -- 团队
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit = 7
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t7
- on t0.deptId = t7.deptId and t0.doctorId = t7.doctorId
- -- ------------
- -- 简易
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit = 5
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t8
- on t0.deptId = t8.deptId and t0.doctorId = t8.doctorId
- -- ------------
- -- 转诊
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit = 2
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t9
- on t0.deptId = t9.deptId and t0.doctorId = t9.doctorId
- -- ------------
- -- 疫苗
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.subsequent_visit = 2
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t10
- on t0.deptId = t10.deptId and t0.doctorId = t10.doctorId
- -- ------------
- -- 微信数
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.data_source = 2
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t11
- on t0.deptId = t11.deptId and t0.doctorId = t11.doctorId
- -- ------------
- -- 微信金额
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0 and a.data_source = 2
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 AND h.pay_method = 4 -- 微信支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t12
- on t0.deptId = t12.deptId and t0.doctorId = t12.doctorId
- -- ------------
- -- 应收金额 t12
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t13
- on t0.deptId = t13.deptId and t0.doctorId = t13.doctorId
- -- ------------
- -- 实收金额 t13
- -- ------------
- left join
- (
- select round(sum(t.realFee),2) as num,t.deptId, doctorId,t.deptName,t.create_time,t.doctorName from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_doctor_id as doctorId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- a.appointment_doctor_name as doctorName,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee,
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where a.del_flag = 0
- AND g.id IN (
- SELECT DISTINCT g.id
- FROM `thc_arrange`.`bpm_appointment` a
- INNER JOIN `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- INNER JOIN `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id AND c.id = a.order_item_id
- INNER JOIN `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- INNER JOIN `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- INNER JOIN `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id AND f.accountBillDetailID = e.id
- INNER JOIN `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- INNER JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- WHERE 1=1
- AND a.del_flag = 0
- AND d.isDelete = 0 AND d.orderSource = 1 AND d.orderType = 3 AND d.returnFlag = 0
- AND e.itemClass = 1 AND e.returnFlag is NULL
- AND g.settlementType=2 AND g.`isDelete` = 0 AND g.returnFlag = 0 -- 门诊挂号
- AND h.type = 1 and h.pay_state = 1 -- 支付成功
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId,t.doctorId
- ) t14
- on t0.deptId = t14.deptId and t0.doctorId = t14.doctorId
- order by t0.startTime asc
5.挂号按科室统计
- select
- t0.deptName,
- t0.deptId,
- t0.startTime,
- t0.endTime,
- IFNULL(t0.num,0) as num0,
- IFNULL(t1.num,0) as num1,
- IFNULL(t2.num,0) as num2,
- IFNULL(t4.num,0) as num4,
- IFNULL(t5.num,0) as num5,
- IFNULL(t6.num,0) as num6,
- IFNULL(t7.num,0) as num7,
- IFNULL(t8.num,0) as num8,
- IFNULL(t9.num,0) as num9,
- IFNULL(t10.num,0) as num10,
- IFNULL(t11.num,0) as num11,
- IFNULL(t13.num,0) as num13,
- IFNULL(t14.num,0) as num14,
- IFNULL(t15.num,0) as num15,
- IFNULL(t16.num,0) as num16,
- IFNULL(t17.num,0) as num17,
- IFNULL(t18.num,0) as num18,
- IFNULL(t19.num,0) as num19,
- IFNULL(t20.num,0) as num20,
- IFNULL(t21.num,0) as num21,
- IFNULL(t22.num,0) as num22
- from
- -- ------------
- -- 总挂号数
- -- ------------
- (
- select t.startTime, t.endTime, count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.appointment_state,
- a.dept_id as deptId,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t0
- -- ------------
- -- 退号
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.appointment_state = -1
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t1
- on t0.deptId = t1.deptId
- -- ------------
- -- 实际挂号数 = 初诊数 + 复诊数 + 转诊数
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit in (0,1,2)
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t2
- on t0.deptId = t2.deptId
- -- ------------
- -- 初诊
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit = 0
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t4
- on t0.deptId = t4.deptId
- -- ------------
- -- 复诊
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit = 1
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t5
- on t0.deptId = t5.deptId
- -- ------------
- -- 体检
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit = 4
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t6
- on t0.deptId = t6.deptId
- -- ------------
- -- 团队
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit = 7
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t7
- on t0.deptId = t7.deptId
- -- ------------
- -- 简易
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit = 5
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t8
- on t0.deptId = t8.deptId
- -- ------------
- -- 转诊
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit = 2
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t9
- on t0.deptId = t9.deptId
- -- ------------
- -- 疫苗
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.subsequent_visit = 2
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t10
- on t0.deptId = t10.deptId
- -- ------------
- -- t11 微信数
- -- ------------
- left join
- (
- select count(1) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND a.data_source = 2
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t11
- on t0.deptId = t11.deptId
- -- ------------
- -- 挂号费 t13
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t13
- on t0.deptId = t13.deptId
- -- ------------
- -- 急诊费 t14
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id and b.del_flag = 0
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id` AND c.del_flag = 0
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.isDelete = 0
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id and e.isDelete = 0
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND e.itemCode = 'jiajifei' -- 加急费:急诊费
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t14
- on t0.deptId = t14.deptId
- -- ------------
- -- 工本费 t15
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND e.itemCode = 'bingliben' -- 病历本:工本费
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- ) t15
- on t0.deptId = t15.deptId
- -- ------------
- -- 卡费 t16
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 AND e.itemCode = 'jiuzhenka' -- 就诊卡:卡费
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t16
- on t0.deptId = t16.deptId
- -- ------------
- -- 现金 t17
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount,
- h.flow_fee,
- h.`charge`,
- h.`pay_method`
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- inner join `thc_rcm`.`pay_trade_log` h on h.`settlement_id` = g.id and h.type = 1
- where 1=1 and a.del_flag = 0 -- 门诊
- and h.type = 1 and h.pay_state = 1 and h.pay_method = 1 -- 银行卡
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t17
- on t0.deptId = t17.deptId
- -- ------------
- -- 银行卡 t18
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount,
- h.flow_fee,
- h.`charge`,
- h.`pay_method`
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- inner join `thc_rcm`.`pay_trade_log` h on h.`settlement_id` = g.id and h.type = 1
- where 1=1 and a.del_flag = 0
- and h.type = 1 and h.pay_state = 1 and h.pay_method = 2 -- 银行卡
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t18
- on t0.deptId = t18.deptId
- -- ------------
- -- 预检 t19
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0 and e.itemCode = 'yujian' -- 预检:预存款
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t19
- on t0.deptId = t19.deptId
- -- ------------
- -- 微信金额t20
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1 and a.del_flag = 0 and a.data_source = 2
- and h.type = 1 and h.pay_state = 1 and h.pay_method=4
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t20
- on t0.deptId = t20.deptId
- -- ------------
- -- 应收金额 t21
- -- ------------
- left join
- (
- select round(sum(t.preFee),2) as num,t.deptId, t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee, -- 原价
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t21
- on t0.deptId = t21.deptId
- -- ------------
- -- 实收金额 t22
- -- ------------
- left join
- (
- select round(sum(t.realFee),2) as num,t.deptId,t.deptName,t.create_time from
- (
- select
- a.data_source,
- a.is_appoint_resource,
- a.subsequent_visit,
- a.dept_id as deptId,
- a.appointment_state,
- a.dept_name as deptName,
- a.create_time,
- CONCAT(a.`appointment_date`," ",a.appointment_starttime) as startTime,
- CONCAT(a.`appointment_date`," ",a.appointment_endtime) as endTime,
- f.preFee,
- (f.preFee - f.discountFee - f.promotionBenefitFee - f.couponFee - f.itemBenefitFee - f.memberCardBenefitFee - f.itemComInvBenefitFee) * f.discount AS realFee,
- f.discount
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.`order_item_id`
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id and d.`isDelete` = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId and e.itemClass = 1 and e.returnFlag is NULL
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- where 1=1 and a.del_flag = 0
- and g.id in (
- SELECT DISTINCT g.id
- from `thc_arrange`.`bpm_appointment` a
- inner join `thc_sob`.`bpm_service_order` b on a.orderId = b.id
- inner join `thc_sob`.`bpm_service_order_item` c on c.service_order_id = b.id and c.id = a.order_item_id
- inner join `thc_rcm`.`Cs_AccountBill` d on d.orderID = b.id
- inner join `thc_rcm`.`Cs_AccountBillDetail` e on d.id = e.AccountBillId
- inner join `thc_rcm`.`Cs_SettlementDetail` f on f.accountBillID = d.id and f.accountBillDetailID = e.id
- inner join `thc_rcm`.`Cs_Settlement` g on g.id = f.settlementID
- inner JOIN `thc_rcm`.`pay_trade_log` h on h.settlement_id = g.id
- where 1=1
- and a.del_flag = 0
- and d.isDelete = 0 and d.orderSource = 1 and d.orderType = 3 and d.returnFlag = 0
- and e.itemClass = 1 and e.returnFlag is NULL
- and g.settlementType=2 and g.`isDelete` = 0 and g.returnFlag = 0 -- 门诊挂号
- and h.type = 1 and h.pay_state = 1
- )
- ${if(len(deptId) == 0,"","and a.dept_id = '" + deptId + "'")}
- ${if(len(doctorId) == 0,"","and a.appointment_doctor_id = '" + doctorId + "'")}
- ) t
- where 1=1
- ${if(len(startTime) == 0,"","AND t.create_time >= '" + startTime + "'")}
- ${if(len(endTime) == 0,"","AND t.create_time <= '" + endTime + "'")}
- group by t.deptId
- ) t22
- on t0.deptId = t22.deptId
- order by t0.startTime asc
海南医院帆软报表 最终版本SQL的更多相关文章
- 帆软报表FineReport SQLServer数据库连接失败常见解决方案
1. 问题描述 帆软报表FineReport客户端连接SQLServer(2000.2005等),常常会出现如下错误:com.microsoft.sqlserver.jdbc.SQLServerExc ...
- 帆软报表FineReport中数据连接之Websphere配置JNDI连接
以oracle9i数据源制作的模板jndi.cpt为例来说明如何在FineReport中的Websphere配置JNDI连接.由于常用服务器的JNDI驱动过大,帆软报表FineReport中没有自带, ...
- 帆软报表FineReport中数据连接之Tomcat配置JNDI连接
1. 问题描述 在帆软报表FineReport中,通过JNDI方式定义数据连接,首先在Tomcat服务器配置好JNDI,然后在设计器中直接调用JNDI的名字,即可成功使用JNDI连接,连接步骤如下: ...
- JEECG与帆软报表集成
将FineReport 集成到自己的web项目中,生成报表,可以方便快捷的和自己的项目融合在一起.简化了利用poi的导出遇到的问题. 1.首先在FR中建立好一个模板 例如:我的这张模板是连接 ...
- 帆软报表FineReport中数据连接之Weblogic配置JNDI连接
1. 制作报表的原理 在帆软报表FineReport设计器中先用JDBC连接到数据库,建立数据库连接,然后用SQL或者其他方法创建数据集,使用数据集制作报表,然后把建立的数据库连接从JDBC连接改成J ...
- 帆软报表FineReport中数据连接之Jboss配置JNDI连接
使用sqlsever 2000数据库数据源来做实例讲解,帆软报表FineReport数据连接中Jboss配置JNDI大概的过程和WEBSPHERE以及WEBLOGIC基本相同,用JDBC连接数据库制作 ...
- 帆软报表FineReport中数据连接的JDBC连接池属性问题
连接池原理 在帆软报表FineReport中,连接池主要由三部分组成:连接池的建立.连接池中连接使用的治理.连接池的关闭.下面就着重讨论这三部分及连接池的配置问题. 1. 连接池原理 连接池技术的核心 ...
- 帆软报表(finereport)单元格中各颜色标识的含义
帆软报表(finereport)单元格中,可根据单元格角标的颜色判断单元格进行的操作 过滤:单元格左下角黄色三角形 条件属性:单元格左上角红色三角形. 控件:单元格右侧中间的各种矩形. 左父格:单 ...
- 帆软报表(finereport)安装/配置
1.首先是安装帆软报表软件 下载地址:http://www.finereport.com/product/download 激活码注册格账号就有了 2.启动软件,新建连接数据库 点 ...
随机推荐
- IT项目管理——《人月神话》读后感
这也许是和候红老师的最后的几节课了吧,侯老师是一个很有思想深度,很关心同学的好老师. 一开学就布置了阅读<人月神话>的作业,说实话,我没有看,以我的速度可能2.3个小时就看完了,但是我觉得 ...
- BZOJ3566: [SHOI2014]概率充电器 树形+概率dp
3566: [SHOI2014]概率充电器 Time Limit: 40 Sec Memory Limit: 256 MBSubmit: 1888 Solved: 857[Submit][Stat ...
- 如何设置 ssh secure shell 支持中文
只需要设置下/etc/sysconfig/i18n 文件内容如清单 1 所示. 清单 1. 文件内容 1 2 3 LANG="zh_CN.GB18030" SUPPORTED=&q ...
- Linux:不同文件相同列字符合并文件(awk函数)
存在file1.txt,其内容如下: H aa 0 0 1 -9 H bb 0 0 2 -9 H cc 0 0 2 -9 存在file2.txt,其内容如下: H aa 0 0 0 -9 asd qw ...
- 第二十四节,TensorFlow下slim库函数的使用以及使用VGG网络进行预训练、迁移学习(附代码)
在介绍这一节之前,需要你对slim模型库有一些基本了解,具体可以参考第二十二节,TensorFlow中的图片分类模型库slim的使用.数据集处理,这一节我们会详细介绍slim模型库下面的一些函数的使用 ...
- ideaJ+maven+javaweb实践: sevlet实现upload&download,javaIO代码
因为工作的机器不让拷贝出来也不让发邮件出来也不让访问外网,所以文件两个PC挪来挪去很麻烦. 决定写一个网页,只有upload和download ideaJ,maven,java,tomcat 写一个j ...
- curl与wget
curl 和wget 区别 使用方法 可参考 curl vs Wget 1.curl是libcurl这个库支持的,wget是一个纯粹的命令行命令.2.curl支持更多的协议.curl supports ...
- 使用rdbtools工具来解析redis rdb文件
工欲善其事必先利其器,日常工作中,好的工具能够高效的协助我们工作:今天介绍一款用来解析redis rdb文件的工具,非常好用.会之,受用无穷! 一.rdbtools工具介绍 源码地址:https:// ...
- 这3周以来的面试总结(C#/.net 智能硬件/物联网)
2017.3找工作面试记录-第一周 2017.3找工作面试记录-第一周(2) 2017.3找工作面试记录-第二周 2017.4找工作面试记录-第三周 2017.4找工作面试记录-第三周(2)--金蝶 ...
- 关于web-root和web-inf的用处
web-inf下的页面不能直接反问,必须通过servlet页面进行跳转,安全性高. web-root下的页面能直接通过地址栏来访问,安全性低. 哪些页面放在web-root下,哪些放在web-inf下 ...