1、根据患者id取患者基本信息

	////获取生命体征
    s TW=##Class(Nur.CommonInterface.Temperature).getLastItemValue(PAADMRowID, "temperature")//体温
    s MB=##Class(Nur.CommonInterface.Temperature).getLastItemValue(PAADMRowID, "pulse")
    s HX=##Class(Nur.CommonInterface.Temperature).getLastItemValue(PAADMRowID, "breath")//呼吸
    s SZY=##Class(Nur.CommonInterface.Temperature).getLastItemValue(PAADMRowID, "sysPressure") //舒张压
    s SSY=##Class(Nur.CommonInterface.Temperature).getLastItemValue(PAADMRowID, "diaPressure") //收缩压
    s height=##class(Nur.CommonInterface.Temperature).getLastItemValue(adm,"height")  //身高
    s weight=##class(Nur.CommonInterface.Temperature).getLastItemValue(adm,"weight")//体重
/// 获取病人信息
/// 参考: web.DHCMGNurComm PatInfo
/// w ##class(web.NurMgHISComm).GetPatInfo("","0000000071")
/// input:就诊号,登记号,病区发烧指数
ClassMethod GetPatInfo(adm As %String = "", patno As %String = "", wardfire As %String = "") As %String
{
}
	s Medicare=$P($g(^PAPER(patientID,"PAT",1)),"^",22) ;住院号
	S PatAge=##class(web.DHCSTKUTIL).GetAge(patientID)  //年龄
	S PatW=##class(web.DHCSTCNTSCOMMON).GetPatWeight(AdmDr)       //体重
	S PatH=##class(web.DHCSTCNTSCOMMON).GetPatHeight(AdmDr)       //身高

2、通过M取病人所有基本信息

ClassMethod papino(){
	s a =-$$GetPapmiNo^DHCWLCommon(adm)
	/// 病人登记号 ^PAPMI_RowId得到病人姓名^PAPMI_RowId得到病人住院号(病案号)^.PAPMI_RowId获得病人的年龄
	/// ^.PAPMI_RowId获得病人的年龄^PAPMI_RowId获得病人的性别^PAPMI_RowId,获得病人的工作单位
	/// ^PAPMI_RowId,获得病人的区域地址^PAPMI_RowId,获得病人的详细地址^PAADM_RowID获得病人的人员类别
	/// ^取病人转归情况^PAADM_RowID获得病人的人员床位^.WARD_RowID取出病区的描述,不包含简写的
	/// ^.CTPCP_RowId获得医护人员的描述,
}

3、初始化页面直接加载到某一个输入框

$("#txt-cardno").focus();

4、在js中调用cls后台类方法

var patCarNo=tkMakeServerCall("web.UDHCJFIPReg","QRCodeIntoCardNo",patCarNo)

5、重新生成所有索引别名

do ##class(User.INCALIAS).%BuildIndices()

6、单独生成某一个索引别名

do ##class(User.DHCManfAddionInfo).%BuildIndices($ListBuild(IndexManf,indexType))

7、登记号回车事件

$('#txt-patno').on('keypress',function(event){
    if(window.event.keyCode == "13"){
        var patno=$.trim($("#txt-patno").val());
        if (patno!=""){
             var newpatno=NumZeroPadding(patno,DHCPHA_CONSTANT.DEFAULT.PATNOLEN);
             $(this).val(newpatno);
             Query();
                      }
       }
    });

8、屏蔽hisui按钮,和包含关系,在js初始化中编写

    var loginName="组长"
    var sess = session['LOGON.GROUPDESC']
    var loginGroup =sess.indexOf(loginName);
    if(loginGroup != -1){
  	  $("#btn-redir-dispquery").show();
     }else{
	  $("#btn-redir-dispquery").hide();
    }

9、代码去重迭代

    .s incibno="",expdate=""
    .s StkDate12 = $zt(StkDate,3)
    .s IL=$p(Incil,"||",2)
    .s LB=0 f  s LB=$o(^INCI(Inci,"IL",IL,"LB",LB))  q:LB=""  d
    ..s Inclb=Inci_"||"_IL_"||"_LB
    ..s Incib=$P(^INCI(Inci,"IL",IL,"LB",LB),"^",1)
    ..s ChlSub=$p(Incib,"||",2)
    ..s IncQty=##CLASS(web.DHCST.Common.DrugStkCommon).QtyINCLB(Inclb,StkDate)
    ..s BatNo=$p(^INCI(Inci,"IB",ChlSub),"^",1)
    ..s expdateno=$zd(+$p(^INCI(Inci,"IB",ChlSub),"^",2),3)
    ..i +IncQty>"0" d
    ...i (incibno'="")&&(("||"_incibno_"||")'[("||"_BatNo_"||")) d
    ....s incibno =incibno_"||"_BatNo
    ....s expdate=expdate_"||"_expdateno
    ...e  d
    ....s incibno=BatNo
    ....s expdate=expdateno

10、根据医嘱字表id获取病人基本信息、根据登记号获取病人基本信息

w ##class(web.DHCSTPharmacyCommon).GetPatientOrdInfo("1339||3")

11、获取处方类型、是否自费

w ##class(web.DHCOutPhDisp).GetPrescType("O17021500003")

12、通过处方号获取草药处方关联的诊断

w  ##class(web.DHCINPHA.MTCommon.PublicCallMethod).GetPrescDiagnos("I18071800003")

13、按照处方号获取该处方的处方类型

w ##class(PHA.OP.COM.Method).GetPrescTitle("MJ19081900001")

14、查询id初始化排列CheckBox选框并排列

$("[type='checkbox']").checkbox({})

15、下拉框调用数据方式:先初始化,在加上类名,方法名

///初始化调用的js方法
$(function(){
      InitCTLoc();
})
///初始化下拉列表数据的方法
function InitCTLoc(){
       $("#conPhaLoc").combobox({
              valueField:"value",
               textField:"text",
                     url:$URL+"?ResultSetType=array&ClassName=WshTest&QueryName=CTLoc"
})
}

<div contenteditable="false" spellcheck="true">valueField ,textField 对应后台query类里面的出参,名字必须和出参一致,否则不出数据。</div>

<div contenteditable="false" spellcheck="true">ResultSetType=array 让下拉框中的数据呈现数组列表的样式</div>

16、用json数据格式查询科室

/// 用json方式查询科室,调用方法
/// w ##class(web.DHCENS.Wsh.WshTest).JsonCTLoc()
ClassMethod JsonCTLoc(){
    s arr=[]
    s rowid="" 
    f  s rowid=$o(^CTLOC(rowid)) q:rowid=""  d 
    .q:+rowid=0
    .s json={}
   .s json.RowId=rowid
   .s json.text=$p(^CTLOC(rowid),"^",2)
   .d arr.%Push(json)
   q arr.%ToJSON()
}

17、用户去 seesion 设置 id 用户名

;s session=$G(%session.Data("LOGON.USERID"))
;i session'=4030 Set qHandle=$lb(0,repid,0) Quit $$$OK

18、$$ALPHAUP 索引补全

$$ALPHAUP^SSUTIL4

19、去除重复数据

.q:$d(list(adm))
.s list(adm)=""

20、计算循环出来数据

.s sum=$g(sum)+Dspqty

21、登记号,卡号自动补全代码

/// 前补零
/// Creator:zhuff
/// Input: Str->字符串  Len->补零后长度
/// w ##class(web.DHCENS.BLL.JKDAQuery.JKDABaseMethod).AddZero("005555",9)
ClassMethod AddZero(Str, Len) As %String{
    Quit:Str="" ""
    Quit:Len="" ""
    Quit:$Length(Str)>=Len Str
    s Str=$j(Str,Len)
    s Str=$tr(Str," ","0")
    Quit Str
}

22、protal 自动提示代码方法

23、根据 paadm 表 rowid,就诊号来获取诊断,入院诊断,出院诊断

/// Description: 根据就诊Id,取诊断-----用于Portal公共服务
/// Input: Adm : 就诊Id
/// Type: 诊断类型(DIS:出院诊断,M:主诊断,PRE:初步诊断,C008:入院诊断,空值:全部诊断)
/// Debug:w ##class(DtPortal.Common.PaadmService).GetAdmDiagnosis(578,"M")
ClassMethod GetAdmDiagnosis(Adm As %String, Type As %String = "") As %String
{
 Set $ZT="GetAdmDiagnosis"  
 if $g(Adm)="" q ""
 s MRAdm=$p($g(^PAADM(Adm)),"^",61)
 if $g(MRAdm)="" q ""
 Set DiagStr=""
 Set Diag=0
 For  Set Diag=$O(^MR(MRAdm,"DIA",Diag)) Quit:(Diag="") Do
 .Set DiagID=$P($g(^MR(MRAdm,"DIA",Diag)),"^",1)
 .s DiagTypeID=$o(^MR(MRAdm,"DIA",Diag,"TYP",0))
 .s TypeID="",TypeDesc=""
 .i DiagTypeID'="" s TypeID=$p($g(^MR(MRAdm,"DIA",Diag,"TYP",DiagTypeID)),"^",1)
 .i TypeID'="" s TypeDesc=$p($g(^MRC("DTYP",TypeID)),"^",2)
 .q:((Type="C008")&&(TypeDesc'="入院诊断"))
 .q:((Type="DIS")&&(TypeDesc'="出院诊断"))
 .q:((Type="M")&&(TypeDesc'="主诊断"))
 .q:((Type="PRE")&&(TypeDesc'="初步诊断"))
 .if DiagID'="" Set DiagDesc=$P($g(^MRC("ID",DiagID)),"^",2)
 .else  Set DiagDesc=$g(^MR(MRAdm,"DIA",Diag,"DES",1))
 .;If DiagDesc["-" Set DiagDesc=$P(DiagDesc,"-",2)
 .Ifg(^MR(MRAdm,"DIA",Diag,1)),"^",20)="Y" s DiagDesc=DiagDesc_"(主)"   //有主诊断标记加“主”--bmz20160310
 .If DiagStr="" Set DiagStr=DiagDesc
 .Else  Set DiagStr=DiagStr_","_DiagDesc
  quit DiagStr
GetAdmDiagnosis
  q -1
}

24、按照列计合

/// w ##class(web.DHCENS.Wsh.WshTest).getthod("2019-01-01","2019-03-10")
ClassMethod getthod(StartDate, EndDate)
{
    i StartDate["-" s StartDate=$zdh(StartDate,3)
    i EndDate["-" s EndDate = $zdh(EndDate,3)
    s count="0"
    f date =StartDate:1:EndDate  d
    .s adm = "" f  s adm=$O(^PAADMi("PAADM_AdmDate",date,adm)) q:(adm="")||(adm>120) d
    ..;q:adm=121
    ..s paadmid=""
    ..s:adm'="" paadmid =g(^PAADM(adm)),"^",1)
    ..s count = $g(paadmid)+count
    ..w adm_"+"_count_", "
    q count
}

25、根据时间就诊号查询改患者所有的医嘱,并返回医嘱串($s用法)

/// 根据时间就诊号查询改患者所有的医嘱,并返回医嘱串 OEORI_OEORD_ParRef = '8' and
/// w ##class(web.DHCENS.Wsh.WshTest).getorderDate("2020-07-07","2020-07-07","11")
ClassMethod getorderDate(stdate, enddate, adm)
{
    s stdate =$zdh(stdate,3)
    s enddate = $zdh(enddate,3)
    q:(stdate="")&&(enddate="")&&(adm="") $$$OK
    s str=""
   f date=stdate:1:enddate d
   .s order="0" f  s order=$O(^OEORDi(0,"StDt",date,order)) q:order=""  d
   ..s paadm = $p(^OEORD(order),"^",1)
   ..q:paadm'=adm
   ..s oeorditm="0"  f  s oeorditm = $O(^OEORDi(0,"StDt",date,order,oeorditm)) q:oeorditm=""  d
   ...s arcitm = $P(^OEORD(order,"I",oeorditm,1),"^",2)
   ...s ororditem =$P(^ARCIM($P(arcitm,"||",1),$P(arcitm,"||",2),1),"^",2)
   ...s str=$s(str="":ororditem,1:str_"^"_ororditem)
   q str
}

26、query 输出.44 变为正常 float

请问怎么写能让.44 变为0.44

$fn(.44,"N")