Code Monkey home page Code Monkey logo

bjguahao's Introduction

bjguahao

北京市预约挂号统一平台

bjguahao

Installation

$ npm install bjguahao

Example

const bjguahao = require('bjguahao');

const input = prompt => new Promise((resolve, reject) => {
  process.stdout.write(prompt + ' ');
  process.stdin
    .once('error', reject)
    .once('data', line => resolve(`${line}`.trim()));
});

const datetime = (date, pattern) =>
  pattern.replace(/{(\w+)}/g, (_, name) => ({
    yyyy: date.getFullYear(),
    yy: date.getYear(),
    MM: date.getMonth() + 1,
    dd: date.getDate(),
    hh: date.getHours(),
    mm: date.getMinutes(),
    ss: date.getSeconds(),
  })[name] || `{${name}}`);

(async () => {


  var session = '';

  if(!session) {
    const mobile = await input('username:');;
    const password = await input('password:');
    session = await bjguahao.login(mobile, password);
  }
  
  const payload = {
    hospitalId: 1,
    departmentId: 200004023,
    dutyCode: 1,
    dutyDate: datetime(new Date, '{yyyy}-{MM}-{dd}')
  };
  
  const doctors = await bjguahao.doctors(session, payload);
  console.log(' doctors');
  doctors.forEach(doctor => {
    console.log(` - ${doctor.doctorName}(${doctor.doctorTitleName}) ${doctor.skill}`);
  });
  console.log();

  const doctor = doctors[0];
  payload.doctorId = doctor.doctorId;
  payload.dutySourceId = doctor.dutySourceId;
  const patients = await bjguahao.patients(session, payload);
  console.log(' patients');
  patients.forEach(patient => {
    console.log(` - ${patient.name}(${patient.tail})`);
  });
  console.log();

  payload.patientId = patients[0].id;
  payload.phone = patients[0].phone;

  const result = await bjguahao.code(session, payload.phone);
  console.log(result);
  console.log();

  payload.smsVerifyCode = await input('verify code:');

  const output = await bjguahao(session, payload);
  console.log(output);

})();

Documentation

  • bjguahao.code
  • bjguahao.login
  • bjguahao.request
  • bjguahao.doctors
  • bjguahao.patients
  • bjguahao.calendar

Contributing

  • Fork this Repo first
  • Clone your Repo
  • Install dependencies by $ npm install
  • Checkout a feature branch
  • Feel free to add your features
  • Make sure your features are fully tested
  • Publish your local branch, Open a pull request
  • Enjoy hacking <3

MIT

This work is licensed under the MIT license.


bjguahao's People

Contributors

lsongdev avatar

Stargazers

 avatar  avatar Xiaoming Liu avatar Jay Su avatar Lu Bingkun avatar  avatar final avatar snailx avatar  avatar __qms avatar Anno avatar SU_ZE__ avatar Ahmed avatar 金木 avatar 席铭 avatar Snowly avatar nyz avatar Victor avatar  avatar xcatliu avatar Fangzhou Li avatar vivaxy avatar

Watchers

 avatar  avatar  avatar

bjguahao's Issues

20190823

跟进 114yygh 平台的修改

  1. login 使用的 quicklogin 接口已失效,平台使用了新接口并使用 AES 加密了手机号和密码
  2. getPatients 使用的预约挂号页面结构发生了改变,模糊了患者姓名字段添加了手机号
  3. 订单确认时短信发送接口发生了改变,现在要求传递患者手机号字段

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.