Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alter proc [dbo].[PaitentinfogetPaitentinfo]
- @PaitentID nvarchar(max)
- as
- begin
- select tp.ID,tp.PatientID,ltrim(rtrim((tp.srtfname))) srtfname, ltrim(rtrim(tp.strlname)) strlname,
- tp.strGender,tp.dtmDOB,isnull(tp.CountryId,1) as CountryId,tp.State,tp.strDistrict,tp.[VDC/Municipality] as intMID,tp.strAddress,
- isnull(tp.localaddress,'') as localaddress,isnull(tp.strGuardian,'') as strGuardian,tp.strRelation,isnull(tp.intmobile,'') as Contact,isnull(tp.strEmail,'') as strEmail,
- tp.intFileNumber,isnull(tp.strPanNo,'') as strPanNo,tp.dtmEntrydate,tp.dtmUpdatedate,tp.intUserID,tp.IsActive,tp.extra1,
- tp.extra2,tp.UHID,te.ID,te.strEncounterID,te.strPatientID,te.srtDepartment,te.strCurrentLocation,te.dtmDOR,te.dtmDOA,te.dtmDOD,TE.CreditLimit,
- te.dblCashbalance,te.strpatientType,te.dblDisountPercent,te.intConsultantID,te.intBillingModeID,te.intRefer_CorporateID,te.intRefer_doctorID,isnull(tp.BloodGroup,0) as BloodGroup ,
- te.dtmFollowupdate,te.strVisitType,te.IsActive,te.strIsFollowUp,te.ConsultDate,isnull(te.Policy_Num,'') as Policy_Num,isnull(te.Claim_ID,'') as Claim_ID,te.userid
- ,mu.Municipality, dis.DistrictName, st.StateName,
- case when DATEDIFF(year, dtmDOB, getdate()) > 0 then floor(DATEDIFF(Day, dtmDOB, getdate())/365.25)
- else case when DATEDIFF(month, dtmDOB, getdate()) > 0 then DATEDIFF(month, dtmDOB, getdate())
- else DATEDIFF(day, dtmDOB, getdate()) end
- end age,
- case when DATEDIFF(year, dtmDOB, getdate()) > 0 then 'Years'
- else case when DATEDIFF(month, dtmDOB, getdate()) > 0 then 'Months'
- else 'Days' end
- end strAge
- from tblpaitentinfo tp
- inner join tblEncounter te on tp.PatientID=te.strPatientID
- inner join tblDistrict dis on dis.ID = tp.strDistrict
- left join tblState st on st.Id = dis.State
- inner join tblMunicipality mu on mu.mID = tp.[VDC/Municipality]
- where tp.patientID=@paitentID order by te.ID desc
- end
- go
- Alter proc [dbo].[PrefixinsertPreFixID]
- @ID int,
- @fiscalyearid int,
- @type nvarchar(max),
- @prefix nvarchar(250),
- @suffix nvarchar(250),
- @startindex int,
- @startdate datetime,
- @enddate datetime,
- @userid int,
- @UpdatedIndex int
- as
- BEGIN
- IF @ID=0 or @ID=null
- BEGIN
- --IF NOT EXISTS(select * from tblprefixsetting where CONVERT(date, GETDATE()) between CONVERT(date, @startdate) and CONVERT(date, @enddate) and Type=@type)
- -- BEGIN
- insert into tblPrefixSetting(fiscalyearid,type,prefix,suffix,startindex,startdate,enddate,UpdatedIndex,userid,CreatedDate)
- values(@fiscalyearid,@type,@prefix,@suffix,@startindex,@startdate,@enddate,@UpdatedIndex,@userid,getdate())
- select 1
- -- END
- --ELSE
- -- BEGIN
- -- select 0
- -- END
- END
- ELSE
- BEGIN
- update tblPrefixSetting set fiscalyearid=@fiscalyearid,type=@type,prefix=@prefix,suffix=@suffix,startindex=@startindex,startdate=@startdate,enddate=@enddate where ID=@ID
- select 1
- END
- END
- go
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement