代煎药网站增加与药企的每日校对功能 #21

Open
opened 2019-09-11 10:58:58 +08:00 by zhangyujun · 3 comments
Member

社区汇总数据查询:

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_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
Author
Member

社区数据明细查询

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_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
Author
Member

病人药品明细查询

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

病人药品明细查询 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
Owner

@zhangyujun 到点数据给我

@zhangyujun 到点数据给我
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cmdjy/wsd_djy#21
No description provided.