# WeChat Senior Medical Development Document

# 1 Revised Records

March 20, 2024

消息推送接口与就医助手合并,原长辈就医消息接口即将下线;



April 23, 2024

The new hospital homepage calls instructions are provided for older hospital pages. See 3.5 for details; New methods of design and development according to visual specifications are added, as detailed in 3.3.2;

# 2 Functional introduction

WeChat Medical treatment for elderly patients is an age-appropriate version construction program for medical industry provided by WeChat, and hospitals Service Account or Weixin Mini Program can access to achieve age-adequate version development to provide friendly online medical treatment services for elder patients.



微信长辈就医主要包括三个功能:

1)页面适老化改造标准方案,提供两种方式,接入微信长辈就医SDK或按微信长辈就医设计规范设计全流程;

2)快捷建档接口,医院调用后可获得老年患者实名信息(姓名、身份证、手机号),免去建档填写的繁琐流程;

3)门诊主流程消息推送接口,底层对接就医助手消息方案,为医院提供一整套消息能力,可按需调用生成可视化门诊就诊流程。

微信长辈就医体验路径:扫描下方二维码,按服务号引导开通后,点击“我的医院”菜单,查找含关怀版标志的医院进行挂号体验即可。



图1 微信长辈就医体验路径示意图

# 3 Product Development

# 3.1 How to call

All interface requests are HTTPS-POST requests, UTF-8 encoding, request and corresponding parameters only support JSON data format, all interface calls need to obtain access_token authorization, the service provider obtains access_token , go WeChat open platform -Third Party Platform model, whereby the hospital authorizes the third-party service provider's "WeChat elders to see a doctor" rights set, operational guidelines for the authorization process click here to see .

# 3.2 Pre-development preparation

The development preparation list is as follows, which, when gathered, is provided to our staff to assist in configuring the test environment:

  • [x] Service Account AppID;
  • [x] Developer WeChat account;
  • [x] Test path to get wxmed_authcode, either H5 link or Weixin Mini Program path;
  • [x] Hospital information, fields as follows:
field Example
Hospital Name Second People's Hospital of Guangdong Province
Service Account Nickname Second People's Hospital of Guangdong Province
Service Account AppID Service Account AppID Information
Hospital address

Provide provincial and urban areas + detailed address + coordinates, multiple hospitals provided separately
466 New Hong Zhong Road, Haizhu District, Guangzhou, Guangdong (23.0940539);113.333887)

No.290Jichang Road, Baiyun District, Guangzhou, Guangdong Province (23.179604;113.260129)
Hospital Grade Level 3 A
Is it public? yes
Hospital attributes General Hospital

# 3.3 Page Standard Aging Modification Scheme

In the construction of the aging hospital, the elderly provide two standard programs for aging transformation, respectively WeChat elders medical treatment SDK Or follow the WeChat elders medical care design specification to design the full process. The two options are detailed below, and the hospital can choose on-demand.

# 3.3.1 WeChat SDK for Elderly Medical Treatment

# 1) SDK documentation

参见 微信长辈就医SDK方案



# 2) Program Presentation

This solution is provided by WeChat with a standardized front-end SDK that includes outpatient enrollment, contributions, queries, and personal center (enrollment, payroll records) functions. Hospitals only need to provide a div selector similar to accessing VUE for initialization.When the corresponding protocol fields are entered in different page steps, the SDK renders the age-appropriate page in the corresponding div, easily enabling online font augmentation, button augmentation, contrast deepening, and page interaction simplification, making it convenient for elderly patients to operate.

The page style and interaction are all handled by the SDK, and the access side only needs to handle the logical part of the page (data interface pull, event hook callback logic, etc.).



图2-1 微信长辈就医SDK挂号流程descript

图2-2 微信长辈就医SDK挂号流程descript

图3 微信长辈就医SDK缴费流程descript

图4 微信长辈就医SDK报告查询流程descript

# 3) Program explaination

This SDK currently supports the H5 format, and if a hospital plans to use H5 to provide age-appropriate services, it can refer directly to the [WeChat Early Care SDK]]](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/cityservice/elderMedical-sdk.html) documentation development.

若医院计划采用小程序形式开发,也可接入本方案,通过小程序内嵌webview实现。因小程序内嵌webview不支持拉起支付,故此处支付流程需切换为小程序支付实现。



# 4) Medical Bulletin Interface (optional)

Some hospitals may be required to show patients the precautions before coming to see a doctor. We call this information a medical notice, as shown below.



图5 医院就医须知demo descript

SDK支持医院按既定样式展示就医公告,可通过本接口进行内容设置。设置步骤为:添加草稿->编辑人员线上预览草稿->确认发布,医院也可以直接跳过预览步骤,将公告直接发布。



步骤1 添加公告草稿____接口说明__添加一条草稿状态的公告,草稿状态下的公告指定用户可以查看效果__接口地址__https://api.weixin.qq.com/intp/eldermedical/sethopsnotice/?access_token=ACCESS_TOKEN__请求参数名| 字段 | 字段名 | 类型 | 是否必填 | 说明 | | -------------- | ------------ | ------ | -------- | ------------------------------------------------------------ | | app_id | business side app_id | string | is the AppID of | Service Account | | notice_type | notice type | uint32 | Yes | 1: Medical Information Before Registration 2: Hospital Information | | note_content | announcement | string | yes | length limit 3000 characters, supports rich text , images embedded in rich text in tag form, for example: ' ` | | notice_id | notice ID | uint32 | No | If you do not pass notice_id, you will add a draft. If you pass notice_id, you will overwrite the contents of the specified draft. |

Return parameter name

field Field Name type Is it compulsory? Introductions
errcode Return code int32 yes Error code
errmsg Return information string yes Error message
Return the following parameters if the request is successful
notice_id uint32 yes

Add an example of a notification request:

{"app_id":"wx5f6e43071809a9dd""notice_content":"Hello World!!!</br>Hello World!!!</br>Hello World!!!</br><img src=\"https://res.wx.qq.com/op_res/uuuyIn2NDBPzbSu0VnQ13lEQNv6A2uPJNtLnvr3NuuoKU2v-hg5YJ4CDklPQc5yVAWSVGbkA-sMkQQnmkvR8Sg\" style=\"width:100px;height:100px;\" />","notice_type":1
}

Return Example:

{"notice_id":1,"errcode":0,"errmsg":"ok"}



图6 医院就医公告富文本demo descript

步骤2 公告草稿预览设置____接口说明__设置草稿的预览人员名单,设置成功后,指定的用户可以查看草稿公告的效果__接口地址__https://api.weixin.qq.com//intp/eldermedical/previewhopsnotice?access_token=ACCESS_TOKEN__请求参数名| 字段 | 字段名 | 类型 | 是否必填 | 说明 | | ---------------- | -------------------- | ------ | -------- | ----------------------------- | | app_id | business side app_id | string | is the AppID of | Service Account | | notice_type | notice type | uint32 | Yes | 1: Medical Information Before Registration 2: Hospital Information | | notice_id | Notice ID | uint32 | Yes | | | preview_username | The WeChat number that can preview the announcement | string | is | | | operation | Operation Type | uint32 | Yes | 1: Remove Preview Permission 2: Add Preview Permission |

Return parameter name

field Field Name type Is it compulsory? Introductions
errcode Return code int32 yes Error code
errmsg Return information string yes Error message
Return the following parameters if the request is successful
notice_id uint32 yes

Example request parameters:

{
"app_id": "wx5f6e43071809a9dd",
"notice_type": 1,
"preview_username": "WX_TEST_ACCT",
"notice_id": 2,
"operation": 1
}

Example of return parameters:

{"notice_id":2,"errcode":0,"errmsg":"ok"}



Step 3 Official announcement____Interface explaination__After confirming the effect of a notification in draft state, set the notification in the draft state to publish status. When the setting is completed, the notification is visible to all people__Interface address__https://api.weixin.qq.com/intp/eldermedical/publichopsnotice?access_token=ACCESS_TOKEN__Request parameter name| Field | Field Name | Type | Required or Not | Dxplaination | | ----------- | ------------ | ------ | -------- | ---------------------------- | | app_id | business side app_id | string | is the AppID of | Service Account | | notice_type | notice type | uint32 | Yes | 1: Medical information before registration 2: Hospital information | | notice_id | Notice ID | uint32 | Yes | |

Return parameter name

field Field Name type Is it compulsory? Introductions
errcode Return code int32 yes Error code
errmsg Return information string yes Error message
Return the following parameters if the request is successful
notice_id uint32 yes

Example request parameters:

{"app_id":"wx5f6e43071809a9dd","notice_type":1,"notice_id":1}

Example of return parameters:

{"notice_id":1,"errcode":0,"errmsg":"ok"}



__Step 4 Check all announcements____Interface explaination__Check all the current hospital announcements, including the announcement in draft status, WeChat side to retain the last five announcements.__Interface address__https://api.weixin.qq.com/intp/eldermedical/gethospnoticelist?access_token=ACCESS_TOKEN Request parameter name | Field | Field Name | Type | Required or Not | Dxplaination | | ----------- | ------------ | ------ | -------- | ---------------------------- | | app_id | business side app_id | string | is the AppID of | Service Account | | notice_type | notice type | uint32 | Yes | 1: Medical information before registration 2: Hospital information |

Return parameter name

field Field Name type Is it compulsory? Introductions
errcode Return code int32 yes Error code
errmsg Return information string yes Error message
Return the following parameters if the request is successful
notice_list array object array yes The element fields in the array are as follows
-notice_id Announcement ID uint32 yes
-content Contents of the announcement string yes
-status Announcement Status string yes DRAFT: Draft, PUBLIC: Published
preview_openid User openid who can preview the draft string array no

Example of request parameters

{"app_id":"wx5f6e43071809a9dd","notice_type":1}
{
"notice_list": [{
"notice_id": 1,
"content": "Hello World!",
"status": "PUBLIC",
"preview_openid": []
}, {
"notice_id": 2,
"content": "Hello World",
"status": "DRAFT",
"preview_openid": ["ont-9vhrWCkLFRNKw_8SkWFdmUnc"]
}],
"errcode": 0,
"errmsg": "ok"
}

# 3.3.2 WeChat Design specification for elderly medical treatment

# 1) Regulatory documentation

参见 微信长辈就医设计规范



# 2) Regulation introduction

微信长辈就医设计规范 由微信提供一套页面适老化设计规范,医院可参考规范,遵循可感知性、可可操作性、理解性、兼容性和安全性设计老年用户访问的界面功能,功能开发完毕后经微信团队验收通过即可发布上线。本方案设计、前后端均由医院实现。



# 3) Open the component

The hospital may call this component at an age-appropriate entry point. After the call, the user enters the WeChat standardized opening process for elderly care. After the opening process, the hospital may call the real name component mentioned below in 3.3.2 to obtain the real name information of the user.



图7 微信长辈就医开通组件descript

__H5开通组件__H5的跳转链接为:

https://mp.weixin.qq.com/insurance/template/eldermedical/open.html?appid={appid}#wechat_redirect

链接上的{appid}需要替换成服务号的appid。



小程序开通组件

wx.navigateToMiniProgram({
    appId: 'wx308bd2aeb83d3345',
    path: '/subPages/medical-mvp/auth/main?from=hospital&appid={appid}',
    complete: (res) => {
      console.log('onTapToEldmOpen res', res)
    }
});
# 4) Real-name components

The hospital can call the real name component on demand when signing up, and after calling it, the WeChat name authorization pop-up will be called with the user's consent, and WeChat will generate the wisdom of the patient's medical authorization code, wxmed_authcode, and pass it to the hospital page.Hospitals can call 3.4.1 to query the user's real name API to decrypt and help older patients complete back-office documentation, freeing them from the tedious work of filling in personal information.



图8 微信长辈就医实名组件 descript

H5实名组件 H5的跳转链接为:

https://mp.weixin.qq.com/insurance/template/eldermedical/auth-realname.html?appid={appid}&returnUrl={returnUrl}#wechat_redirect

说明:链接上的参数{returnUrl} -> 授权后会返回此{returnUrl},注意链接必须经过encodeURIComponent,授权获得的wxamedAuthcode会携带在此参数上返回。 参数{appid}需要替换成服务号的appid。



小程序实名组件

wx.openBusinessView({
    businessType: 'eldermedicalAuthRealname',
    queryString: 'appid={appid}',
    complete: (res) => {
      console.log('onTapToEldmAuth res code', res.extraData.wxamedAuthcode)
    }
});

# 3.4 List of API interfaces

# 3.4.1 Query user real name API

# 1) Interface Dxplaination

In order to reduce the threshold of archiving of elderly patients, WeChat provides this interface free of charge to public hospitals.When elderly patients register, the hospital can consult the user's real-name information (name, identity card, mobile phone number) through this interface, and obtain the above information to create a diagnostic and treatment card for the user in the background. After the elderly patient registers, there is no need to re-file, and can register directly.



上述流程示例

用户访问医院适老版主页时,实名开通微信长辈就医服务。使用医院关怀版服务时,院方可请求查询用户实名API获取实名信息,完成后台建档 (说明:下图全部流程由微信提供,医院无需开发前端界面)。

图9 微信长辈就医获取用户实名授权流程(若用户已在别处开通长辈就医,则点击图一服务直接拉起第五张图的实名弹窗)descript用户点击医院服务后,医院获取实名的时序图如下:

图10 微信长辈就医获取用户实名时序图

时序图说明:

  1. Users enter the hospital's updated home page and click on the hospital registration service.

  2. The user agrees to authorize the transmission of real name information to the hospital;

  3. WeChat Generate elder medical information authorization code wxmed_authcode;

  4. To jump to the hospital's registration page, wxmed_authcode is passed to the hospital via urlquery, as follows:

小程序path: /pages/registerpage?wxmed_authcode=xxx
h5链接:https://registerpage.hospital.com?wxmed_authcode=xxx
  1. The filing process for entering the hospital;

  2. The hospital background inquires the user's identity information and mobile phone number through the "query user's real name API" and wxmed_authcode provided in this document;

  3. WeChat returns the encrypted user identity information and mobile phone number;

  4. WeChat assigned to each hospital their own real name information decryption KEY, after decryption can get user real name information;The decryption key is provided by a WeChat staff member after the developer provides the information requested in this document 3.2;

  5. The hospital completes the follow-up filing and registration process.

# 2) Interface Details

Request address:

https://api.weixin.qq.com/cityservice/getmedrealname?access_token=ACCESS_TOKEN

List of request parameters:

field Field Name type Is it compulsory? Introductions
app_id Business side AppID string yes Requires access_token to match AppID
open_id WeChat User openid string yes User ID under the current AppID
wxmed_authcode Real name information code string yes Corresponds to wxmed_authcode in the url, valid for 10 minutes

Example of request parameters

{
  "app_id": "wx23dde3xd34569cba",
  "open_id": "ont-9vr_is4GBmeuh_xy1YHidhgY",
  "wxmed_authcode": "BMUewIb9qr2GMDeInZKOBg.."
}

Return a list of parameters

field Field Name type Is it compulsory? Introductions
errcode int32 yes Error code
errmsg string yes Error message
Return the following parameters if the request is successful
cipher_real_name Encrypted real name information string no Encrypted message after base64
cipher_algorithm Cryptographic Algorithms string no Default: AES_256_ECB_PKCS7Padding
key_version Real-name information encryption key version number int no The initial version number is 0 to identify subsequent key replacement upgrades
app_id Business side AppID string no
open_id WeChat User openid string no

The real-name data belongs to sensitive information and cannot be transmitted in clear text. Therefore, the real-name information returned by the platform is base64 character string which has been symmetrically encrypted. The platform will assign a 32-bit (256-bit) key to each hospital, which can be obtained after decryption. The default encryption and decryption algorithm is: AES_256_ECB_PKCS7Padding;Decryption sample code Download

Decrypted text of real name

{"real_name":"张三","id_card_no":"45088100000000","id_card_type":1,"phone":"13800000138","timestamp":1661420431,"phone_country_code":"86"}

Dxplaination of the real name information field

field Field Name type Is it compulsory? Introductions
real_name Full name string yes
id_card_no Document Number string yes
id_card_type Type of document int32 yes 1 居民身份证;

4 澳门居民往来内地通行证;

5 台湾居民往来内地通行证;

6香港居民往来内地通行证。
phone Telephone Number string yes
timestamp timestamp int64 yes

# 3.4.2 Outpatient main process message pushing interface

# 1) Interface Dxplaination

The hospital calls this interface to push 4 outpatient main process messages (success notification, pending order notification, test inspection report, medicine retrieval reminder) to the user, who clicks on the age-appropriate page of the hospital's relevant services.

In addition, to facilitate patients, we also recommend that hospitals issue stop notices through elderly medical visits, reminders for queues, reminder of waiting lists for examinations, notices for cancellation of appointments and notices of successful payment.



注意事项:

1)接口中status 值1501001、1501018、1501030、1501031、1501034分别对应预约挂号成功通知、门诊待缴费提醒、检查结果通知、检验结果通知、取药提醒这5条消息,是门诊就医主流程消息,必须下发;

2)status 值1501010、1501014、1501026、1501027、1501004、1501019分别对应停诊通知、排队候诊提醒、检查排号提醒、检验排号提醒、取消预约挂号通知、门诊缴费成功通知,是门诊就医体验优化类消息,建议下发;

3)为给医院提供丰富的模板消息,同时减少医院对接的工作,本接口和就医助手共用同一套消息接口和模板库。曾经对接过就医助手的医院只需在原就医助手的基础上,提供适老化的网页链接或小程序页面路径,即可完成改造。



demo示例:

医院调用本接口后,老年患者 可在【微信长辈就医】服务号中收到院方下发的就医主流程消息,消息跳转到院方服务。

图11 微信长辈就医消息下发流程descript



# 2) Interface Details

See WeChat Medical Assistant Interface Documentation

# 3.4.3 Ask the user whether they have access to the elderly medical care function

# 1) Interface Dxplaination

WeChat Elderly medical function requires users to simply open, users have a variety of opening methods, including:

Path 1 access to the hospital Service Account, Weixin Mini Program of the old version of the home page opened, the old version of the home page generation method see 3.5;

Fig.12 Hospital Service Account / Weixin Mini Program entrance access to elderly medical services

descript



路径2 访问「微信」-「我」-「服务」-「城市服务」-「医疗」-「长辈就医」进行开通;



图13 微信城市服务入口访问长辈就医服务descript

路径3 关注“微信长辈就医”服务号,按指引开通。



图14 微信长辈就医服务号访问长辈就医服务 descript

医院调用本接口可查询用户开通状态。 请注意:1)该开通流程无需医院开发,为微信统一流程;2)用户开通状态为“已开通”时,才可以获取用户实名信息和推送门诊主流程消息。

# 2) Interface Details

Request address:

https://api.weixin.qq.com/cityservice/getmsgrelation?access_token=ACCESS_TOKEN

Request parameter name

field Field Name type Is it compulsory? Introductions
business_id Business id uint32 yes Older people's medical practice fills 130
open_id WeChat User openid string yes

Example of request parameters

{

"business_id": 130,

"open_id": "ont-9vr_is4GBmeuh_xy1YHidhgY",

}

Return parameter name

field Field Name type Is there necessarily anything? Introductions
errcode Return code uint32_t yes 0 - Success Not 0 - Failure
errmsg Return instructions string yes
is_subscribed Do you subscribe? uint32_t yes 1- Open 0 - Not Open

Example of Return Parameters

{
  "err_code": 0,
  "err_msg": "ok",
  "is_subscribed": 1
}

# 3.5 Hospital Maintenance Home Page

After the hospital completes the development of the aforementioned process with reference to the document, the aging version can be placed on Service Account, Weixin Mini Program for elderly users to access, as follows:

# 3.5.1 Place the entrance

In order to reduce the cost of finding elderly patients, it is recommended to put the appropriate version of the entrance on the hospital WeChat Service Account menu or Weixin Mini Program home page.The entry copy is customized by the hospital and can be referenced by name: elderly mode, elderly service, care version.



Figure 15 Hospital WeChat Service Account / Weixin Mini Programdescript

# 3.5.2 Hospital suitable homepage generation

WeChat provides the ability to quickly generate a hospital's old-fashioned home page without additional development. The hospital provides developed links / paths for registered registration, contributions, query reports, and personal center (registration, contribution records) functions to quickly create an old-fashionable home page for user access.

Suitable for the old version of the main color of the home page can be adaptive hospital Service Account main color value.



图16 医院适老版主页示例图descript

服务号适老版主页生成方式 H5的跳转链接为:

https://mp.weixin.qq.com/insurance/template/eldermedical/hospital-homepage.html?appid={appid}#wechat_redirect

链接上的{appid}需要替换成服务号的appid。



小程序适老版主页生成方式

wx.navigateToMiniProgram({
    appId: 'wx308bd2aeb83d3345',
    path: '/subPages/medical-mvp/hospital-homepage/main?appid={appid}',
    complete: (res) => {
      console.log('onTapToEldmHomePage res', res)
    }
});

# 4 Acceptance materials and promotional materials

# 4.1 Acceptance requirements

In order to ensure the medical experience of elderly users, the WeChat team will conduct acceptance of this function, and we can get acceptance guidelines through the fifth link.

# 4.2 Promotional materials

In order to facilitate the offline promotion of this feature, we have prepared the source files of E-Labour, Table Sticker and Poster. You can download and make it again. Click to see [WeChat.

# 5 Contact Us

If you have any questions regarding the above products, you are welcome to contact us.

descript