11、挂号需求整理(讲)
一、哪些是需要初始加载的,应该从哪个表里读
0、病历号
SELECT max(CaseNumber)
from register
如果能够查询到,就加1,如果查询不到,就直接返回1
1、性别
select *
from constantitem a,constanttype b
where a.constantTypeID=b.ID
and b.ConstantTypeName='性别类型'
2、结算类别
SELECT *
from constantitem a,constanttype b
where a.constantTypeID=b.id
and b.ConstantTypeName='结算类型'
3、收费方式
-- 查询常量为 性别类型 的所有常量信息
select *
from constantitem a,constanttype b
where a.constantTypeID=b.ID
and b.ConstantTypeName='收费方式'
二、级联加载
1、选择看诊日期-->查午别
主要是看排班表scheduling
排班日期
科室ID
医生ID
午别
select distinct noon
from scheduling
where scheddate='2019-04-01'
2、选择看诊日期和午别--->查科室
查科室需要获取科室id和名称
SELECT distinct a.DeptID,b.DeptName
from scheduling a,department b
where a.DeptID=b.ID
and a.SchedDate='2019-04-01'
and a.Noon='上午'
order by deptid
3、选择看诊日期和午别、科室-->查号别
select distinct c.*
from scheduling a,user b, RegistLevel c
where a.UserID=b.ID
and b.RegistLeID=c.id
and a.SchedDate='2019-04-01'
and a.Noon='上午'
and a.DeptID='1'
and b.IsScheduling='true'
4、选择看诊日期、午别、科室、号别-->查医生
select distinct b.*
from scheduling a,user b, RegistLevel c
where a.UserID=b.ID
and b.RegistLeID=c.id
and a.SchedDate='2019-04-01'
and a.Noon='上午'
and a.DeptID='1'
and b.IsScheduling='true'
and c.id='1'
5、选择完医生之后-->挂号限额 应收挂号费
挂号限额RegistQuota 应收挂号费RegistFee
select distinct c.*
from user b, RegistLevel c
where b.RegistLeID=c.id
and b.IsScheduling='true'
and c.id='1'
已用限额
select count(*)
from register
where VisitDate='2019-04-01'
and VisitState<>'4'
6、是否要病历本-->重新计算应收金额
规则是要病历本,在挂号费基本上加1元
挂号持久化
挂号信息最终持久化到
挂号表 Register
发票(收据)表Invoice
费用明细表 PatientCosts