package com.yihu.jw.hospital.prescription.service;


import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.ca.OauthCaConfigDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Connection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * Created by yeshijie on 2020/05/07.
 */
@Service
@Transactional
public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {

    private static final Logger logger = LoggerFactory.getLogger(XzyyPrescriptionService.class);


    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;

    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private OauthCaConfigDao oauthCaConfigDao;
    @Autowired
    private PrescriptionInfoDao infoDao;
    @Autowired
    private PrescriptionDiagnosisDao diagnosisDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;


    /**
     * 挂号接口
     * @param outPatientId
     * @param doctor
     * @return
     */
    public JSONObject registerOutPatient(String outPatientId, String doctor){
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
        List<WlyyPrescriptionExpressageDO> expressageDOS =prescriptionExpressageDao.findByOutpatientId(outPatientId);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorMappingDO == null) {
            throw new RuntimeException("未找到医生映射信息");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
        if (patientMappingDO==null){
            throw new RuntimeException("未找到居民映射信息");
        }

        //查找居民当天挂号记录
        String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
        List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctorAndDel(outpatientDO.getPatient(), date, doctor,1);
        if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
            WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
            //判断是否已经挂号，如果已经挂号
            if (StringUtils.isNotBlank(registerDO.getRegisterNo())) {

                JSONObject res = new JSONObject();
                res.put("@RESULT", "0");
                logger.info("已经挂号 res: " + res.toString());

                //更新挂号流水号
                outpatientDO.setConNo(registerDO.getConNo());
                outpatientDO.setRegisterNo(registerDO.getRegisterNo());
                outpatientDO.setAdmDate(registerDO.getCreateTime());
                outpatientDO.setAdmNo(registerDO.getRegisterNo());
                outpatientDao.save(outpatientDO);
                return res;
            }
        }
        String doctorFlag =  doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode();
        String courierflag = "N";
        if (expressageDOS!=null&&expressageDOS.size()!=0){
            WlyyPrescriptionExpressageDO expressageDO = expressageDOS.get(0);
            if (expressageDO.getOneselfPickupFlg()!=null&&expressageDO.getOneselfPickupFlg()==1){
                courierflag="N";
            }else if (expressageDO.getOneselfPickupFlg()!=null&&expressageDO.getOneselfPickupFlg()==0){
                courierflag="Y";
            }
        }
        String chargeType = "";
        if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(outpatientDO.getType())){
            chargeType = doctorDO.getTwfzChargeType();
        }else if ("1".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(outpatientDO.getType())){
            chargeType = doctorDO.getSpfzChargeType();
        }else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(outpatientDO.getType())){
            chargeType = doctorDO.getTwzxChargeType();
        }else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(outpatientDO.getType())){
            chargeType = doctorDO.getSpzxChargeType();
        }else if ("3".equalsIgnoreCase(outpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(outpatientDO.getType())){
            chargeType = doctorDO.getJyzxChargeType();
        }else if ("2".equalsIgnoreCase(outpatientDO.getOutpatientType())){
            chargeType = doctorDO.getXtfzChargeType();
        }else {
            chargeType = doctorDO.getChargeType();
        }
        JSONObject res =  xzzxEntranceService.registeredOperate(doctorFlag,outpatientDO.getDept(),patientMappingDO.getMappingCode(),chargeType,courierflag);
        JSONObject result = new JSONObject();
        logger.info("挂号结果 res: " + res.toString());
        String rsCode = "";
        String serialNo = "";
        if (res!=null){
            JSONObject object = res.getJSONObject("returnContents");
            serialNo = object.getString("registerNo");
            if (object!=null){
                result.put("@RESULT", "0");
                result.put("@MSG","挂号成功！");
                rsCode = object.getString("registerNo");
            }
        }else {
            result.put("@RESULT", "-1");
            result.put("@MSG","挂号失败");
        }


        if (StringUtils.isNoneBlank(rsCode)) {
            //存储挂号号

            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            outpatientDO.setAdmNo(serialNo);
            logger.info("挂号流水 registerNo: ");
            outpatientDao.save(outpatientDO);

            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            // 存储挂号医生与挂号科室
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setDel(1);

            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            //挂号流水号与挂号次数
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);

        } else if ("-2".equals(rsCode)) {

            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            outpatientDO.setAdmNo(serialNo);
            logger.info("挂号流水 registerNo: " + serialNo );
            outpatientDao.save(outpatientDO);

            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();

            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setDel(1);

            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));

            patientRegisterDao.save(registerDO);

        }
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
        log.setName("挂号");
        log.setPatient(outpatientDO.getPatient());
        log.setDoctor(doctor);
        log.setResponse(res.toString());
        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
        log.setStatus("1");
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        return result;
    }


    public JSONObject refundRegisterNo(String outpatientId) throws Exception {
        JSONObject object = new JSONObject();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if(outpatientDO!=null){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
            if (StringUtils.isNoneBlank(outpatientDO.getRegisterNo())){
                object = xzzxEntranceService.refundConsultationToEntrance(outpatientDO.getRegisterNo(), outpatientDO.getCardNo());
                logger.info("退号结果 res: " + object.toString());
                if (object!=null&&object.getString("code").equalsIgnoreCase("0")){
                    WlyyPatientRegisterDO wlyyPatientRegisterDO = patientRegisterDao.findByRegisterNo(outpatientDO.getRegisterNo());
                    wlyyPatientRegisterDO.setDel(0);
                    patientRegisterDao.save(wlyyPatientRegisterDO);
                    outpatientDO.setHisStatus(-1);
                    outpatientDao.save(outpatientDO);
                }

                //保存日志
                WlyyHttpLogDO log = new WlyyHttpLogDO();
                log.setCode("refundregisterOutPatient");
                log.setName("退号");
                log.setPatient(outpatientDO.getPatient());
                log.setDoctor(outpatientDO.getDoctor());
                log.setResponse(object.toString());
                log.setRequest("outPatientId=" + outpatientId + "&doctor=" + outpatientDO.getDoctor());
                log.setStatus(object.getString("code"));
                log.setCreateTime(new Date());
                wlyyHttpLogDao.save(log);
            }
        }
        return  object;
    }

    /**
     * 处方签名
     * @param prescriptionDO
     * @throws Exception
     */
    public String SOF_SignDataWithExtraInfo(WlyyPrescriptionDO prescriptionDO) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
        List<WlyyPrescriptionInfoDO> infoDOS = infoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOS = diagnosisDao.findByPrescriptionId(prescriptionDO.getId(),1);
        JSONObject object = new JSONObject();
        String baseSign="";
        object.put("infos",infoDOS);
        object.put("registerSn",outpatientDO.getRegisterNo());
        object.put("diagnosiss",diagnosisDOS);
        JSONObject jsonObject = computeDigestForAlg(object.toJSONString());
        String hashValue = null;
        String hashType = null;
        if (jsonObject.getString("status").equalsIgnoreCase("0")){
            JSONObject data = jsonObject.getJSONObject("data");
            hashValue= data.getString("hashValue");
            hashType = data.getString("hashType");
        }

        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
        if (patientDO!=null&&doctorDO!=null){
            String patientName = patientDO.getName();
            Integer patientAge = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
            String patientSex = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            String recipeTime = DateUtil.dateToStrLong(prescriptionDO.getCreateTime());
            String openId = doctorDO.getOpenid();
            String idcard = patientDO.getIdcard();
            if (hashType!=null&&hashValue!=null){
                JSONObject object1 = synRecipeInfo("hash_004",getCode(),patientName,patientAge.toString(),patientSex,"SF",recipeTime,hashValue,hashType,openId,idcard);
                if (object1.getString("status").equalsIgnoreCase("0")){
                    logger.info("西药处方签名成功"+object1);
                    JSONObject jsonObject1 = JSONObject.parseObject(object1.getString("data"));
                    if (jsonObject1!=null){
                        baseSign=jsonObject1.getString("stamp");
                    }
                }
            }
        }
        return baseSign;
    }

    /**
     * 处方签名
     * @param prescriptionDO
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionDO prescriptionDO) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
        WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionDO.getId());
        JSONObject object = new JSONObject();
        object.put("emr",prescriptionEmrDO);
        object.put("registerSn",outpatientDO.getRegisterNo());
        object.put("doctorName",outpatientDO.getDoctorName());
        object.put("patientName",outpatientDO.getPatientName());
        JSONObject jsonObject = computeDigestForAlg(object.toJSONString());
        String hashValue = null;
        String hashType = null;
        if (jsonObject.getString("status").equalsIgnoreCase("0")){
            JSONObject data = jsonObject.getJSONObject("data");
            hashValue= data.getString("hashValue");
            hashType = data.getString("hashType");
        }

        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
        if (patientDO!=null&&doctorDO!=null){
            String patientName = patientDO.getName();
            Integer patientAge = IdCardUtil.getAgeForIdcard(patientDO.getIdcard());
            String patientSex = IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            String recipeTime = DateUtil.dateToStrLong(prescriptionDO.getCreateTime());
            String openId = doctorDO.getOpenid();
            String idcard = patientDO.getIdcard();
            if (hashType!=null&&hashValue!=null){
                JSONObject object1 = synRecipeInfo("hash_002",getCode(),patientName,patientAge.toString(),patientSex,"SF",recipeTime,hashValue,hashType,openId,idcard);
                if (object1.getString("status").equalsIgnoreCase("0")){
                    logger.info("门诊病历签名成功"+object1);

                }
            }
        }

    }


    /**
     * 数据哈希计算接口
     * @param content
     * @return
     */
    public JSONObject computeDigestForAlg(String content){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/common/computeDigestForAlg";
            }
            JSONObject object = new JSONObject();
            object.put("originData",content);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            logger.info("数据哈希计算接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    /***
     * 数据签名接口
     * @param templateId 模板ID签名数据摘要数据类型
     * @param urId 签名流水ID
     * @param patientName 患者姓名
     * @param patientAge 患者年龄
     * @param patientSex 患者性别
     * @param patientCardType  证件类型
     * @param recipeTime 开具时间
     * @param hashValue Hash原文(从签名指纹接口结果中得到的)
     * @param hashType Hash算法(从签名指纹接口结果中得到的)
     * @return
     */
    public JSONObject synRecipeInfo(String templateId,String urId,String patientName,String patientAge,String patientSex,String patientCardType,String recipeTime,String hashValue,String hashType,String openId,String patientCard){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/recipe/synRecipeInfo";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject object = new JSONObject();
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("templateId",templateId);
            head.put("clientSecret",clientSecret);
            head.put("selfSign",true);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            body.put("urId",urId);
            body.put("patientName",patientName);
            body.put("patientAge",patientAge);
            body.put("patientSex",patientSex);
            body.put("patientCardType",patientCardType);
            body.put("recipeTime",recipeTime);
            body.put("hashValue",hashValue);
            body.put("hashType",hashType);
            body.put("patientCard",patientCard);
            body.put("openId",openId);
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            logger.info("请求参数："+object);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            logger.info("数据签名接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }


    /***
     * 自动签名授权-请求自动签名授权接口
     * @param openId 患者姓名
     * @param sysTag 患者年
     * @return
     */
    public JSONObject selfSignRequest(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/request";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            if (StringUtils.isNoneBlank(sysTag)){
                body.put("sysTag",sysTag);
            }
            body.put("openId",openId);
            msg.put("body",body);
            logger.info("请求参数："+msg);
            String response = httpClientUtil.sendPost(url,msg.toJSONString());
            logger.info("请求自动签名授权接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /***
     * 自动签名授权-获取授权结果
     * @param baseDoctorDO
     * @param sysTag
     * @return
     */
    public JSONObject selfSignGetResult(BaseDoctorDO baseDoctorDO, String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/getResult";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            if (StringUtils.isNoneBlank(sysTag)){
                body.put("sysTag",sysTag);
            }
            body.put("openId",baseDoctorDO.getOpenid());
            msg.put("body",body);
            logger.info("请求参数："+msg);
            String response = httpClientUtil.sendPost(url,msg.toJSONString());
            JSONObject jsonRes=JSONObject.parseObject(response);
            JSONObject jsonObject = jsonRes.getJSONObject("data");
            Integer grantStep = jsonObject.getInteger("grantStep");
            if(1==grantStep){
                baseDoctorDO.setIsSign("1");
                baseDoctorDO.setLastSignTime(new Date());
                baseDoctorDao.save(baseDoctorDO);
            }
            logger.info("获取授权结果 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /***
     * 自动签名授权-退出授权接口
     * @param openId
     * @param sysTag
     * @return
     */
    public JSONObject selfSignQuit(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/quit";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            if (StringUtils.isNoneBlank(sysTag)){
                body.put("sysTag",sysTag);
            }
            body.put("openId",openId);
            msg.put("body",body);
            logger.info("请求参数："+msg);
            String response = httpClientUtil.sendPost(url,msg.toJSONString());
            logger.info("退出授权接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    public JSONObject checkDoctorNeedSign(String doctorId,String sysTag){
        BaseDoctorDO baseDoctorDO =baseDoctorDao.findById(doctorId);
        JSONObject jsonObject = new JSONObject();
        if (baseDoctorDO!=null){
            int defaultMinute=360;
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO=wlyyHospitalSysDictDao.findById("singTimeControl");
            if (wlyyHospitalSysDictDO!=null){
                defaultMinute=Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
            }
            long nowTime = new Date().getTime();
            long lastSignTime = baseDoctorDO.getLastSignTime()==null?new Date().getTime():baseDoctorDO.getLastSignTime().getTime();
            if ((nowTime-lastSignTime)>defaultMinute*60*1000){
                baseDoctorDO.setIsSign("0");
                jsonObject = this.selfSignRequest(baseDoctorDO.getOpenid(),sysTag);
                jsonObject.put("isNeedSign","true");
            }else {
                jsonObject.put("status",200);
                jsonObject.put("isNeedSign","false");
            }
            baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
        }
        return jsonObject;
    }
}
