/// Description:: 取住院科室
/// Output: id:科室ID,locDesc:科室描述
/// Others: d ##class(%ResultSet).RunQuery("web.DHCENS.Wsh.WshTest","getDatetime","2019-01-31 14:56:21","2019-01-31 16:42:07")
/// / call web_DHCENS_Wsh.WshTest_getDatetime("2019-01-31 14:56:21","2019-01-31 16:42:07")
Query getDatetime(startDate As %String, EndDate As %String) As %Query(ROWSPEC = "rowid,date,time") [ SqlProc ]
{
}
ClassMethod getDatetimeExecute(ByRef qHandle As %Binary, startDate As %String, EndDate As %String) As %Status
{
Set repid=$I(^CacheTemp)
Set qHandle=$lb(0,repid,0)
Set ind=1
s (startTime,EndTime,startDate1,EndDate1)=""
i startDate[" " s startDate1 = $zdh($P(startDate," ",1),3)
i EndDate[" " s EndDate1 = $zdh($P(EndDate," ",1),3)
i startDate[" " s startTime = $zth($P(startDate," ",2),3)
i EndDate[" " s EndTime = $zth($P(EndDate," ",2),3)
s startsecond =startDate1*86400+startTime
s endsec = EndDate1*86400+EndTime
s id ="0"
f s id=$o(^PAADM(id)) q:id="" d
.s time = $P(^PAADM(id),"^",7)
.s date2 = $P(^PAADM(id),"^",6)
.s second = date2*86400+time
.q:(second<startsecond)||(second>endsec)
.s rowid = id
.s wang = $zd(date2,3)
.s lingt = $Zt(time,1)
.d outputRow8
Quit $$$OK
outputRow8
s row=$listbuild(rowid,wang,lingt)
s ^CacheTemp(repid,ind)=row
s ind=ind+1
q
}
ClassMethod getDatetimeClose(ByRef qHandle As %Binary) As %Status [ PlaceAfter = getDatetimeExecute ]
{
Set repid=$LIST(qHandle,2)
Kill ^CacheTemp(repid)
Quit $$$OK
}
ClassMethod getDatetimeFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ PlaceAfter = getDatetimeExecute ]
{
Set AtEnd=$LIST(qHandle,1)
Set repid=$LIST(qHandle,2)
Set ind=$LIST(qHandle,3)
Set ind=$o(^CacheTemp(repid,ind))
If ind="" {
Set AtEnd=1
Set Row=""
}
Else {
Set Row=^CacheTemp(repid,ind)
}
s qHandle=$lb(AtEnd,repid,ind)
Quit $$$OK
}
2、时间循环索引控制
.f date=startDate1:1:EndDate1 d
..s Adm="" f s Adm =$O(^PAADMi("PAADM_AdmDate",date,Adm)) q:Adm="" d
...s paadmdate =$P(^PAADM(Adm),"^",7)
...q:(date=startDate1)&&(paadmdate<startTime)
...q:(date=EndDate1)&&(paadmdate>EndTime)
...s paadmADMNO =$P(^PAADM(Adm),"^",81)
3、js获取当前系统时间
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
var date = new Date();
var year = date.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
var month = date.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
var day = date.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
var hours = date.getHours(); //小时 ,返回 Date 对象的小时 (0 ~ 23)
var minutes = date.getMinutes(); //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
var seconds = date.getSeconds(); //秒 ,返回 Date 对象的秒数 (0 ~ 59)
//获取当前系统时间
var currentDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
alert(currentDate);
//修改月份格式
if (month >= 1 && month <= 9) {
month = "0" + month;
}
//修改日期格式
if (day >= 0 && day <= 9) {
day = "0" + day;
}
//修改小时格式
if (hours >= 0 && hours <= 9) {
hours = "0" + hours;
}
//修改分钟格式
if (minutes >= 0 && minutes <= 9) {
minutes = "0" + minutes;
}
//修改秒格式
if (seconds >= 0 && seconds <= 9) {
seconds = "0" + seconds;
}
//获取当前系统时间 格式(yyyy-mm-dd hh:mm:ss)
var currentFormatDate = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
alert(currentFormatDate);
</script>
</body>
</html>
评论