HIS 9.0以下的版本参考使用。HIS9.0+的只要做第一步的对应ip等数据的修改即可。
使用管理员demo登录侧菜单 – HTTP接口配置界面
(如果没有这个菜单,请看第二步添加,然后回来执行)
新增加服务,配置信息如下:
MWHOSAuth2GetToken
东华HOS统一认证Auth2获得Token
111.205.6.218?(换成你们项目hos访问的ip)
8002?(换成你们项目hos访问的端口,可以问下hos的开发)
/api/oauth2/token
[{"key":"client_id","value":"1Jab5H75k7za","desc":""},{"key":"client_secret","value":"j402E2578d3H1IB8","desc":""},{"key":"grant_type","value":"authorization_code","desc":""}]
是否https:看hos服务器部署的是否https,否则这里不勾!!
SSLECP
[{"key":"code","value":"lK8p7g26hU","desc":"111"}]
第二个配置信息如下:
MWHOSAuth2GetUserInfo
东华HOS统一认证Auth2获得用户信息
111.205.6.218?
8002?(换成你们项目hos访问的端口,可以问下hos的开发)
/api/security/oauth2/user/info
[{"key":"client_id","value":"1Jab5H75k7za","desc":""},{"key":"client_secret","value":"j402E2578d3H1IB8","desc":""}]
是否https:看hos服务器部署的是否https,否则这里不勾!!
SSLECP
[{"key":"code","value":"lK8p7g26hU","desc":"111"}]
上面两个依次点击修改
修改固定参数,点击下拉,修改值为hos给你们项目的值。例如:(his单点登录的appid和秘钥:AppId:7C26dfsdH4、s1sdfs5870)
client_id :填appid
client_secret :填秘钥
填完之后点每行记录最后的测试按钮,要有正常返回数据即可,返回的提示错误不用管。例如:
如果你的返回,有提示这个错误:
请访问执行这个:https://hisui.cn/?p=946 然后再点测试。
最后这里还是有问题,截图你的配置给hos开发人员检查。
第一步没有菜单的才执行,第一步成功执行了的,不要执行!
告诉我们没有,我发一个xml给你,导入studio。
然后挂菜单,看下面配置:
bsp.sys.request
HTTP接口配置
bsp.sys.request.csp
系统配置
完成后回到第一步继续配置。
1、正式库的登录页面文件修改:
打开:csp/dhc.logon.csp
搜索:##Class(websys.SessionLogon).Logon()
复制代码,放到搜索到的代码的上面:
If $g(%request.Data("CASTypeCode",1))="MWHOSAuth2"{
s caslogin = 0
Set RedirectUrl = ##Class(websys.cas.MWHOSAuth2Logon).getConfigUrl()
Set OauthClientId = ##Class(websys.cas.MWHOSAuth2Logon).getConfigClientId()
Set appURL= ##Class(ext.util.String).GetCacheURL() //"http://"_%request.CgiEnvs("HTTP_HOST")_%request.CgiEnvs("HTTP_URL")
Set appURL = $replace(appURL,"csp/dhc.logon.csp?","form.htm?") ;2016 增加form.htm来传数据库密码与用户名
Set ViewCode = $G(%request.Data("ViewCode",1))
Set SelfUrl = appURL
Set SelfUrl = $p(SelfUrl,"?")_"?CASTypeCode=MWHOSAuth2"
if SelfUrl'["MACAddr" Set SelfUrl = SelfUrl_"&MACAddr=E8:D0:FC:E2:54:95&token="_(##class(web.Util.Encryption).MD5HexStr($h_OauthClientId))
s:ViewCode'="" SelfUrl = SelfUrl _"&ViewCode="_ ViewCode
s:$G(%request.Data("postDictCode",1))'="" SelfUrl = SelfUrl _"&groupId="_ $G(%request.Data("postDictCode",1))
s:$G(%request.Data("buCode",1))'="" SelfUrl = SelfUrl _"&locId="_ $G(%request.Data("buCode",1))
s:$G(%request.Data("groupId",1))'="" SelfUrl = SelfUrl _"&groupId="_ $G(%request.Data("groupId",1))
s:$G(%request.Data("locId",1))'="" SelfUrl = SelfUrl _"&locId="_ $G(%request.Data("locId",1))
;Set ^Wanghc("HOSToken",$I(^Wanghc),"TOKEN","CSP")=SelfUrl
Set code = $G(%request.Data("code",1)) //授权码
if code=""{
Set Redirect = RedirectUrl_"?scope=openid&response_type=code&client_id="_OauthClientId_"&redirect_uri="_$zcvt(SelfUrl,"O","URL")
Set %response.Redirect = Redirect
Quit 1
}
Set %request.Data("token",1)=code
If $g(%request.Data("groupId",1)) '= "" {
Set GrpID = $g(%request.Data("groupId",1))
Set %request.Data("SSUSERGROUPDESC",1) = $p($g(^SSU("SSGRP",GrpID)),"^",1)
}
If $g(%request.Data("locId",1)) '= "" {
Set DepId = $g(%request.Data("locId",1))
Set %request.Data("DEPARTMENT",1) = $p(^CTLOC(DepId),"^",2)
Set hospid=$p($g(^CTLOC(+DepId)),"^",22)
Set defaultHosp=$p($g(^CT("HOSP",+hospid)),"^",2)
Set %request.Data("Hospital",1) = defaultHosp
}
}
2、studio导入类文件:发消息我,“HOS类文件”。
3、HOS配置好跳转登录HIS的地址:
例如:
https://112.35.54.57:1443/imedical/web/form.htm?CASTypeCode=MWHOSAuth2
测试,从HOS跳转登录HIS。成功反馈下。
3、失败,发我远程,联系。
1、his8.4以下的要检查:
##Class(web.SSUser).IsValidUserMd5Password
修改后的方法:
ClassMethod IsValidUserMd5Password(username As %String, password As %String, overrideauthentication As %Library.Boolean = 0) As %String
{
n encrypt
if ($G(TOKEN)_!_!_039;=""){
Set casTypeCode = $g(%request.Data("CASTypeCode",1))
Set LogonCls = casTypeCode_"Logon"
set userCode = $classmethod("websys.cas."_LogonCls,"IsValidUserMd5Password",username,password,overrideauthentication)
Quit:(userCode["^") userCode
Quit:userCode="" "-3^CASAuthUserCodeNull"
Set userid = $o(^SSU("SSUSR",0,"SSUSR_Initials",$$ALPHAUP^SSUTIL4(userCode),""))
if (userid_!_!_039;>0) set userid="-100^tokenUsernameError" Quit userid
do ##class(websys.cas.Logon).FillRequest(userCode,1)
set department = $G(%request.Data("DEPARTMENT",1)) //not delete this line code
set hosp = $G(%request.Data("Hospital",1))
Set username = userCode
s password = "7DDEB10883804C0C04911262A37E420a"
} else {
;Set ^Temp("wanghc",1)=username_","_password_","_overrideauthentication
s encrypt=password
s userid=$o(^SSU("SSUSR",0,"SSUSR_Initials",$$ALPHAUP^SSUTIL4(username),""))
Q:userid="" 0_"^UserNotFindErr"
s persistPWD=$p($g(^SSU("SSUSR",userid)),"^",3)
s persistPWD=##class(web.Util.Encryption).MD5HexStr(persistPWD)
q:persistPWD_!_!_039;=encrypt -userid_"^PasswordErr"
}
Set persistUserName = $p($g(^SSU("SSUSR",userid)),"^",1)
Q:$zcvt(persistUserName,"U")_!_!_039;=$zcvt(username,"U") "0^UserNotFindErr"
s SSUSRActive=$p($g(^SSU("SSUSR",userid)),"^",19)
Q:SSUSRActive_!_!_039;="Y" -userid_"^UnActiveErr"
s datefrom=$p($g(^SSU("SSUSR",userid)),"^",96)
s dateto=$p($g(^SSU("SSUSR",userid)),"^",97)
Q:(datefrom_!_!_039;="")&&(datefrom>+$H) -userid_"^DateFromScopeErr"
Q:(dateto_!_!_039;="")&&(dateto<+$H) -userid_"^DateToScopeErr"
quit +userid
}
2、问题:弹出的his,需要输入密码,没有直接登录his。
更新类方法: ##class(websys.cas.Logon).FillRequest(userCode,1)
ClassMethod FillRequest(UserName, FillLoc = 1)
{
Set MyTempUserId = $o(^SSU("SSUSR",0,"SSUSR_Initials",$$ALPHAUP^SSUTIL4(UserName),""))
Set MyTempUserObject = ##class(User.SSUser).%OpenId(MyTempUserId,0)
Set %request.Data("USERNAME",1)=UserName
Set %request.Data("PASSWORD",1)="******" ;##class(web.Util.Encryption).MD5HexStr(MyTempUserObject.SSUSRPassword) //"7DDEB10883804C0C04911262A37E420C"
If $g(FillLoc){
If MyTempUserObject.SSUSRGroup,""=$G(%request.Data("SSUSERGROUPDESC",1)) {
Set %request.Data("SSUSERGROUPDESC",1)=MyTempUserObject.SSUSRGroup.SSGRPDesc
}
If (MyTempUserObject.SSUSRDefaultDeptDR),""=$G(%request.Data("DEPARTMENT",1)) {
Set %request.Data("DEPARTMENT",1)=MyTempUserObject.SSUSRDefaultDeptDR.CTLOCDesc
if ( MyTempUserObject.SSUSRDefaultDeptDR.CTLOCHospitalDR){
Set %request.Data("Hospital",1)=MyTempUserObject.SSUSRDefaultDeptDR.CTLOCHospitalDR.HOSPDesc
}
}
}
Set MyTempUserObject=""
Quit MyTempUserId
}
3、检查跳转his的方式:
7.0-8.3的iMedical, HOS找到桌面IE浏览器打开his
8.4-8.5的iMedical,HOS找到桌面医为浏览器打开his
9.0的iMedical才可以嵌入弹出his
4、SQL检查:
INSERT INTO websys.standardtypeitem(Parref,StoredValue,Code,Description) VALUES(_!_!_039;websys_!_!_039;,_!_!_039;1_!_!_039;,_!_!_039;CASLogonDirectMenu_!_!_039;,_!_!_039;统一登录成功直接进入头菜单_!_!_039;);
5、登录页面显示报错:
studio打开文件 csp/dhc.logon.csp
搜索:
"oauthLogonURL"
将第三步【三】执行的SQL的值,直接写在代码里面。例如:
修改前:
Set RedirectUrl = ##class(websys.StandardTypeItem).GetIdFromCodeOrDescription("WebsysHOS","oauthLogonURL") ;"https://111.205.6.218:1443/oauth/authorize" //"http://114.251.235.4:8229/oauth/authorize"
Set OauthClientId = ##class(websys.StandardTypeItem).GetIdFromCodeOrDescription("WebsysHOS","oauthClientId") ;"https://111.205.6.218:1443/oauth/authorize" //"http://114.251.235.4:8229/oauth/authorize"
修改后:
Set RedirectUrl = "https://111.205.6.218:1443/oauth/authorize"
Set OauthClientId = "1Jab5H75k7za"
访问量: 511764