npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

wnjk

v0.0.7

Published

两只蜗牛通用微服务脚本

Downloads

13

Readme

wnjk是四川两只蜗牛公司提供的专门针对两只蜗牛平台的开发者工具包,类似于微信小程序的方式,第三方应用可以通过引用实现与两只蜗牛客户端容器(PC助手、移动端医护APP、居民端APP)的交互。两只蜗牛公司会为每一个微应用分配一个固定的appCode,以便交互时可以进行权限识别、设备调用等等。

1.安装:

npm install wnjk

示例
h5页面在初始化的时候需要创建wnjk库的实例,实例创建完成后即可调用js库提供的各种交互方法,具体的方法见节口一览。

appCode:两只蜗牛分配的微应用编码 nativeType:代表当前微应用是允许在哪个平台(PC:电脑端应用程序,android:安卓app,ios:苹果应用)

2交互数据格式

{ "data":null,  "msg":"HTTP 404",  "status":1004}

{ "status":99, "data":null,"msg":"应用密钥不能为空"}

status:状态码 ->沿用服务器返回错误码 data:返回数据 msg:出错信息

status状态码清单:

const val CODE_SUCCESS = 0//成功

const val CODE_UNAUTHORIZED = 1001 //权限不足

const val CODE_USER_REJECT = 1002 //用户拒绝授权

const val CODE_UNKNOWN_ERROR = 1003 //未知错误

const val CODE_ILLEGAL_PARAMETER = 1004 //参数验证错误

const val CODE_TIME_OUT = 1005 //TimeOut

3.接口明细

3.1从两只蜗牛app获取医护账号信息

功能说明:

微应用通过调用此方法可以获取两只蜗牛app当前登录医生的账户信息接口,首次调用或者是未授权的情况下都会弹出授权对话框。

方法名:WNJK.native.getDoctorInfo

接口参数:callback:(res)=>{}

接口返回:

{
	"status": 0, //用户拒绝授权的情况下会返回401  
	"data": {  
		"userId": "医生id",  
		"name": "医生真实姓名",  
		"nickname": "昵称",  
		"iconUrl": "头像地址",  
		"phoneNumber": "电话号码",  
		"idCard": "身份证号码",  
		"gender": "性别",  
		"age": "年龄",  
		"address": "现居地址",  
		"workAddress": "工作地址",  
		"jobTitle": "职位名称"  
	},  
	"errorMsg": ""  
}

调用示例:

WNJK.native.getDoctorInfo((res)=>{ ...... });

3.2.从两只蜗牛app获取居民档案详情

功能说明:

微应用通过调用此方法可以获取到两只蜗牛平台的居民档案详细数据

方法名:WNJK.native.getResidentInfo

接口参数:

"healthRecordId": "居民档案id(可以从选择的居民信息中获取到)"
"callback": (res)=>{ } 

接口返回:

{
	"status": 0,
	"data": {
		"residentHealthRecordId": "D6AB025E46C947B684D067A172CBCD8A",
		"profilePhoto": null,
		"name": "李小灵",
		"namePinyin": "LXL",
		"idCard": "500235199105103891",
		"phoneNumber": "18200433137",
		"gender": 1,
		"birthDay": "1991-05-09",
		"age": 30,
		"address": "四川省攀枝花市仁和区布德镇巴关河村22组",
		"residenceAddress": "四川省攀枝花市仁和区布德镇巴关河村22组",
		"tags": "一般",
		"listTags": [ "一般人群" ],
		"rhrStatus": 0,
		"areaCode": "51041110620422"
	},
	"errorMsg": ""
}

调用示例:

WNJK.native.getResidentInfo(“D6AB025E46C947B6”,(res)=>{ ........ });

3.3.退出当前微应用

功能说明:

调用此方法可在两只蜗牛app中,关闭当前微应用。

方法名:WNJK.native.exitApp

接口参数:无

接口返回:无

调用示例:

WNJK.native.exitApp();

3.4.调用两只蜗牛监测设备

功能说明:

调用此方法可以完成对两只蜗牛app集成硬件设备的调用,

方法名:WNJK.native.measure

接口参数:

"measureType": "检测指标代码(具体定义见下方表格)",
"presetParam":{
   "height": "体脂设备调用时需要出入",
   "bloodGlucoseType": "血糖测量时需要传入血糖类型,空腹血糖:0,非空腹血糖:1,随机:2"
}
callback:(res)=>{}

接口返回:

{
	"status": 0,
	"data": {
		"measureType": 1,//检测指标代码(具体定义见下方表格),整数
		"systolicPressure": "120",//收缩压,整数字符串
		"diastolicPressure": "75",//舒张压,整数字符串
		"mapBloodPressure": "120",//平均压,整数字符串
		"pulse": "75",//脉搏,整数字符串
		"heartRate": "75",//心率,整数字符串
		"ecgDiagnoseResult": "窦性心率",//心电诊断结果,字符串
		"ecgIsNormal": "1",//心电正常与否,整数字符串,正常心电图:1,异常心电图:2
		"ecgReportImgPath": "file:///sdcard/Android/0.jpg",//心电报告图片路径,字符串
		"bloodGlucoseType": "2",//血糖测量类型,空腹血糖:0,非空腹血糖:1,随机:2
		"bloodGlucose": "4.6",//血糖,小数字符串
		"bloodOxygen": "98.6",//血氧,小数字符串,0~100
		"bodyTemp": "37.2",//体温,小数字符串
		"bodyHeight": "181",//身高,整数字符串,cm
		"bodyWeight": "65",//体重,整数字符串,kg
		"bmi": "18.6",//体质指数,小数字符串
		"pro": "+-",//尿蛋白,取值:"-"、"+-"、"+"、"++"、"+++"、"++++"
		"glu": "+-",//尿糖,取值:"-"、"+-"、"+"、"++"、"+++"、"++++"
		"ket": "+-",//尿酮体,取值:"-"、"+-"、"+"、"++"、"+++"、"++++"
		"blo": "+-",//尿潜血,取值:"-"、"+-"、"+"、"++"、"+++"、"++++"
		"cholLevel": "<500",//总胆固醇,字符串,单位:mg/dL
		"trig": "47",//甘油三酯,字符串,单位:mg/dL
		"ldl": "<50",//血清低密度脂蛋白,字符串,单位:mg/dL
		"hdl": "44",//血清高密度脂蛋白,字符串,单位:mg/dL
		"alt": "26",//血清谷丙转氨,小数字符串,单位:U/L
		"ast": "25",//血清谷草转氨,小数字符串,单位:U/L
		"alb": "43.0",//白蛋白,小数字符串,单位:g/L
		"tbil": "13.6",//总胆红素,小数字符串,单位:umol/L
		"dbil": "3.5",//结合胆红素(即直接胆红素),小数字符串,单位:umol/L
		"cre": "54",//血清肌酐,小数字符串,单位:umol/L
		"urea": "4.98",//血尿素,小数字符串,单位:mmol/L
		"chol": "4.75",//总胆固醇,小数字符串,单位:mmol/L
		"tg": "1.73",//甘油三酯,小数字符串,单位:mmol/L
		"ldlc": "2.0",//血清低密度脂蛋白胆固醇,小数字符串,单位:mmol/L
		"hdlc": "1.93",//血清高密度脂蛋白胆固醇,小数字符串,单位:mmol/L
		"hemoglobinType": "2",//血红蛋白类型,成人(男):1,成人(女):2,新生儿:3
		"hemoglobin": "98.6",//血红蛋白,小数字符串,0~100
		"bodyFatRate": "",//体脂率,小数字符串
		"visceralFatGrade": "",//内脏脂肪等级,小数字符串
		"muscleMass": "",//肌肉量,小数字符串
		"basalMetabolicRate": "",//基础代谢率,小数字符串
		"bodyMoisture": "",//体水分,小数字符串
		"bodyAge": "",//体年龄,小数字符串
		"fatFreeBodyWeight": "",//去脂体重,小数字符串
		"subcutaneousFatRate": "",//皮下脂肪率,小数字符串
		"skeletalMuscleRate": "",//骨骼肌率,小数字符串
		"protein": "",//蛋白质,小数字符串
		"boneMass": "",//骨量,小数字符串
		"waistHipRatio": "",//腰臀比,小数字符串
		"BUltrasonicReportImgPath": "file:///sdcard/Android/0.jpg"//B超是否异常,整数字符串,正常:0,异常:1"BUltrasonicIsNormal": "1",
		"BUltrasonicDiagnoseResult": "",//B超诊断结果,字符串
	},
	"errorMsg": ""
}

调用示例:

WNJK.native.measure(1,{},(res)=>{ ...... });//测量血压

|指标|检测指标代码|单位| |---|---|---| |血压|1| mmHg| |心率|2|次/分| |血糖|4|mmol/L| |血氧|8|%| |体温|16|℃| |心电|32|无| |身高体重(即体质指数BMI)|64|无| |体脂|256|%| |血脂|512|mmol/L| |尿检|8192|无| |B超|131072|无| |肺功能|262144|无| |身高|3145728|cm|

3.5.扫描二维码

功能说明:

调用此方法,可激活两只蜗牛app的二维码扫描功能,并返回识别结果。

方法名:WNJK.native.scanQRCode

接口参数:callback:(res)=>{}

接口返回:

{
	"status": 0,//其他状态为失败
	"data": "识别结果文本",
	"errorMsg": ""
}

调用示例:

WNJK.native.scanQRCode((res)=>{ ....... });

3.6.选择本地图片

功能说明:调用此方法,可激活两只蜗牛app选择本地图片。

方法名:WNJK.native.pickPhoto

接口参数:callback:(res)=>{}

接口返回:

{
	"status": 0,//其他状态为失败
	"data": ["图片路径1","图片路径2".....],
	"errorMsg": ""
}

调用示例:

WNJK.native.pickPhoto((res)=>{ ....... });

3.7.从两只蜗牛app选择居民

功能说明:

调用此方法,可激活两只蜗牛app居民选择对话框,弹出框允许通过姓名或者身份证号搜索辖区内居民,找到居民后点击记录弹窗关闭,并返回该居民的简要信息。

方法名:WNJK.native.pickResident

接口参数:

condition:{"keywords":"xxxx","genders":"[...]性别(0:未知性别,1:男性,2:女性,9:未说明的性别)","minAge":"年龄起","maxAge":"年龄止"}
callback:(res)=>{}

接口返回:

{
	"status": 0,//其他状态为失败
	"data":{id:””,name:””.....},
	"errorMsg": ""
}

调用示例:

WNJK.native.pickResident({keywords:”王”},(res)=>{ ....... });

3.8.从两只蜗牛app选择医生

功能说明:

调用此方法,可激活两只蜗牛app医生选择对话框,弹出框允许通过姓名或者身份证号搜索辖区内医护人员列表,找到医生记录点击后弹窗关闭,并返回该医生的简要信息。

方法名:WNJK.native.pickDoctor

接口参数:

callback:(res)=>{}

接口返回:

{
	"status": 0,//其他状态为失败
	"data":{id:””,name:””.....},
	"errorMsg": ""
}

调用示例:

WNJK.native.pickDoctor({keywords:”张三”},(res)=>{ ....... });

3.9.运行环境验证

功能说明:

允许微应用向当前app发起验证请求,以便验证当前app容器是否为可信任。验证成功后,app会返回验证码。

方法名:WNJK.native.verificationApp

接口参数:

callback:(res)=>{}

接口返回:

{
	"status": 0,//其他状态为失败
	"data":{id:””,name:””.....},
	"errorMsg": ""
}

调用示例:

WNJK.native.verificationApp((res)=>{ ..... });

3.10.检查居民签约情况

功能说明:

微应用通过调用APP接口,验证指定居民是否已经签约了某个服务包。

方法名:WNJK.native.checkResidentSignStatus

接口参数:

spkgId:当前服务包id
healthRecordId:居民健康档案id
callback:(res)=>{}

接口返回:

{
	"status": 0,//其他状态为失败
	"data":true,
	"errorMsg": ""
}

调用示例:

WNJK.native.checkResidentSignStatus(spkgId:”xxx”,healthRecordId:”xxxx”,(res)=>{ ...... });

3.11.居民检查检验开单

功能说明:

微应用调用两只蜗牛app发起一个指定类型的检查检验开单流程,检查检验结果出来后,两只蜗牛服务端会主动推送到微应用方指定的接口。

方法名:WNJK.native.bindInspectionNum

接口参数:

业务id:微应用中定义的业务编号,用于返回检查检验结果的对应
measureType:检查类型(PACS影像:128、尿检:8192、生化:16384、B超:131072)
callback:(res)=>{}

接口返回:

{
	"status": 0,//其他状态为失败
	"data":{serialNumber:”检查检验开单流水号”},
	"errorMsg": ""
}

调用示例:

WNJK.native.bindInspectionNum(“businessId”,8192,(res)=>{ ...... });