代煎药网站增加与药企的每日校对功能 #21
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
社区汇总数据查询:
create Proc [dbo].[djy_zscx](
@Kssj Datetime,
@Jssj Datetime
)
AS
BEGIN
Set Nocount On
select HosName jg ,
COUNT (*) sl
into t1
from dbo.HisPrescriptionInfo
where type='1'
and OpDatatime >=@Kssj
and OpDatatime <@Jssj
group by HosName
union all
select HosName jg ,-COUNT (*) sl
from dbo.HisPrescriptionInfo
where type='2'
and OpDatatime >=@Kssj
and OpDatatime <@Jssj
group by HosName
select jg '机构名称',sum(sl) '数量' from t1
group by t1.jg
end
drop table t1
社区数据明细查询
create Proc [dbo].[djy_rymxcx](
@HosName nvarchar(max),
@Kssj Datetime,
@Jssj Datetime
)
AS
BEGIN
Set Nocount On
select Id, PatientName,OpType,DrugCount from HisPrescriptionInfo
where HosName=@HosName
and OpDatatime>=@Kssj
and OpDatatime<@Jssj
and Type='1'
and ID not in(select RawRecordId from HisPrescriptionInfo where Type='2')
end
病人药品明细查询
create Proc [dbo].[djy_ypmxcx](
@Id int,
@Kssj Datetime,
@Jssj Datetime
)
AS
BEGIN
Set Nocount On
select a.Id, a.PatientName,b.DrugName,b.DrugType,
b.Count from HisPrescriptionInfo a , HisDrugInfo b
where a.HosKey=b.HosKey
and a.id=@Id
and OpDatatime>=@Kssj
and OpDatatime<@Jssj
and a.Type='1'
and a.Id not in(select RawRecordId from HisPrescriptionInfo where Type='2')
end
@zhangyujun 到点数据给我