Quellcode durchsuchen

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
hxm vor 3 Jahren
Ursprung
Commit
b4efa9d32f
27 geänderte Dateien mit 2017 neuen und 1372 gelöschten Zeilen
  1. 38 17
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/SFUtils.java
  3. 19 5
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  4. 6 4
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  5. 23 0
      common/common-entity/sql记录
  6. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  7. 36 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/consult/BaseYunxingChannelDO.java
  8. 128 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/prescription/BaseCarePrescriptionDO.java
  9. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java
  10. 0 7
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/device/DeviceManageEndpoint.java
  11. 17 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/consult/BaseYunxingChannelDao.java
  12. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/prescription/BaseCarePrescriptionDao.java
  13. 19 11
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java
  14. 113 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/prescription/PrescriptionEndpoint.java
  15. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java
  16. 18 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/patient/PatientNoLoginEndPoint.java
  17. 36 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java
  18. 8 12
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java
  19. 78 41
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java
  20. 6 6
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  21. 190 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/prescription/BaseCarePrescriptionService.java
  22. 52 17
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java
  23. 8 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/SecurityOrderUtil.java
  24. 2 2
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java
  25. 23 12
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java
  26. 25 19
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  27. 1141 1215
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 38 - 17
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -2789,7 +2789,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                outpatientDao.save(outpatientDO);
                //先下单
                businessOrderService.savePrescriptionOrder(prescription.getId());
                if(!demoFlag) {
                /*if(!demoFlag) {
                    //同步his
                    ykyyEntranceService.findByRealOrder(prescription.getId(), demoFlag);
                    List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
@ -2808,7 +2808,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
                        }
                    }
                }
                }*/
                /*if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)) {
                    if (StringUtils.isNotBlank(inspectionJson)) {
                        if (StringUtils.isNotBlank(infoJsons)) {
@ -9376,6 +9376,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }*/
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                wlyyPrescriptionDO.setStatus(10);
                if(!demoFlag) {
                    //同步his
                    try {
                        WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                        ykyyEntranceService.findByRealOrder(prescriptionId, demoFlag);
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                        logger.info("cfsb", wlyyPrescriptionDO.getRealOrder());
                        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("YKTCONTROL");
                        if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
                        } else {
                            ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(), wlyyPrescriptionDO.getOrderId(), wlyyPrescriptionDO.getRealOrder());
                        }
                        List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                        if (list!=null&&list.size()>0){
                            ykyySMSService.sendSmsByTempcode("prescription_remind", outpatientDO, wlyyPrescriptionDO, "");
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                if (list!=null&&list.size()>0){
@ -11545,7 +11566,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map saveNatAppointment(String chargeAmount,String inspectionName,String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
                                   String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName,String pm,String pushFlag,String cardNoType,String consumer,
                                  String checkPart,String chargeFlag,String chargeCode,String icdCode) throws Exception {
                                  String checkPart,String chargeFlag,String chargeCode,String icdCode,String preNo) throws Exception {
        Map returnMap = new HashMap();
        Integer winNo = 6;
        if (checkPart==null||checkPart==""){
@ -11890,7 +11911,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            format2 = new SimpleDateFormat("yyyy-MM-dd").parse(natTime);
            String shortDate = new SimpleDateFormat("yyyyMMdd").format(format2);
            System.out.println("yyyy-MM-dd转yyyyMMdd:"+shortDate);
           /* String regRes=tasyNatService.saveRegOrder(regDept,shortDate,pm,preNo,cardNo,mobile,name,"3");
            String regRes=tasyNatService.saveRegOrder(regDept,shortDate,pm,preNo,cardNo,mobile,name,"3");
            com.alibaba.fastjson.JSONObject regObj = com.alibaba.fastjson.JSONObject.parseObject(regRes);
            String HisSeqNo="";
            String orderNum="";
@ -11904,11 +11925,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    returnMap.put("status","-1");
                    return  returnMap;
                }
            }*/
            }
            //先进行核算检测预约
            String realOrder="";
            String addressNow=provinceName+cityName+townName+streetName+address;
            String result = tasyNatService.initNatParams("",name.trim(),mediaCard.trim(),addressNow,firstJobCode,secondJobCode);
            String result = tasyNatService.initNatParams(HisSeqNo,name.trim(),mediaCard.trim(),addressNow,firstJobCode,secondJobCode);
            Boolean flag = false;
            if (StringUtils.isNoneBlank(result)){
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
@ -11919,7 +11940,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    if ("0".equalsIgnoreCase(returnCode)){
                        returnMap.put("msg",object.getString("data"));
                        returnMap.put("status","-1");
                        //tasyNatService.cancleOrder(cardNo,HisSeqNo,orderNum);
                        tasyNatService.cancleOrder(cardNo,HisSeqNo,orderNum);
                        return  returnMap;
                    }else {
                        flag = true;
@ -11935,13 +11956,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                baseNatAppointmentDO.setChargeAmount(itemPrice);
                baseNatAppointmentDO.setMedicare(mediaCard.trim());
                //baseNatAppointmentDO.setRegisterNo(HisSeqNo);
                baseNatAppointmentDO.setRegisterNo(HisSeqNo);
                baseNatAppointmentDO.setName(name);
                baseNatAppointmentDO.setCardNo(cardNo.trim());
                baseNatAppointmentDO.setCardType(cardType);
                baseNatAppointmentDO.setAddress(address);
                //baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                //baseNatAppointmentDO.setOderNum(orderNum);
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                baseNatAppointmentDO.setOderNum(orderNum);
                baseNatAppointmentDO.setCityName(cityName);
                baseNatAppointmentDO.setFirstJobCode(firstJobCode);
                baseNatAppointmentDO.setFirstJobName(firstJobName);
@ -12438,9 +12459,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
                            //取消号源
                            //String registerCancel =tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                            /*com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(registerCancel);
                            String isSuccess=jsonObject.getString("success");*/
                            String registerCancel =tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                            com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(registerCancel);
                            String isSuccess=jsonObject.getString("success");
                            String natCancel=tasyNatService.cancelNat(baseNatAppointmentDO.getRealOrder(),baseNatAppointmentDO.getMedicare().trim(),baseNatAppointmentDO.getName());
                            com.alibaba.fastjson.JSONObject jsonObject1 = JSON.parseObject(natCancel);
                            String returnCode=jsonObject1.getString("ReturnCode");
@ -13187,18 +13208,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        logger.info("获取患者待结算信息结束!");
        logger.info("医保挂号开始!");
        String register = healthCareService.register(registerNo);
        String register = healthCareService.registerToEntrance(registerNo);
        logger.info("医保挂号结束!");
        logger.info("医保费用明细上传开始!");
        String feeDetailUpload= healthCareService.feeDetailUpload(registerNo);
        String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(registerNo);
        logger.info("医保费用明细上传结束!");
        logger.info("医保预结算信息开始!");
        YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlement(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(registerNo);
        logger.info("医保预结算信息结束!");
        logger.info("获取医保结算页面地址开始!");
        String getSettlementResultUrl = healthCareService.getSettlementResultUrl(registerNo);
        String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo);
        logger.info("获取医保结算页面地址结束!");
        JSONObject object = new JSONObject();
        object.put("register",register);

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/SFUtils.java

@ -335,7 +335,7 @@ public class SFUtils {
        order.put("destProvince",sfexpress_obj.getProvinceName());
        order.put("destCity",sfexpress_obj.getCityName());
        order.put("destDistrict",sfexpress_obj.getTownName());
        order.put("destAddress",sfexpress_obj.getAddress());
        order.put("destAddress",sfexpress_obj.getStreetName()+sfexpress_obj.getAddress());
        
        order.put("packagesNo",1);
        order.put("depositumInfo","药品");

+ 19 - 5
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -976,7 +976,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                        if (StringUtils.isNoneBlank(wlyyPrescriptionDO.getAdmNo())){
                                            condition = " t.JZXH = '"+wlyyPrescriptionDO.getAdmNo()+"' and ";
                                        }
                                        String address =wlyyPrescriptionExpressageDO.getProvinceName()+ wlyyPrescriptionExpressageDO.getCityName()+wlyyPrescriptionExpressageDO.getTownName()+wlyyPrescriptionExpressageDO.getAddress();
                                        String address =wlyyPrescriptionExpressageDO.getProvinceName()+ wlyyPrescriptionExpressageDO.getCityName()+wlyyPrescriptionExpressageDO.getTownName()+wlyyPrescriptionExpressageDO.getStreetName()+wlyyPrescriptionExpressageDO.getAddress();
                                        //同步his写入自取信息
                                        String updatesql = "update v_ms_dd01 t set t.PSFS = 0 ,t.FKZT=1 ,t.SJR= '"+wlyyPrescriptionExpressageDO.getName()+"' ," +
@ -1008,7 +1008,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                            JSONObject json = JSONObject.parseObject(sfResult.toString());
                                            String sfOrder =  json.getString("mailNo");
                                            logger.info("---获取订单号为:"+sfOrder);
                                            String address = wlyyPrescriptionExpressageDO.getProvinceName()+wlyyPrescriptionExpressageDO.getCityName()+wlyyPrescriptionExpressageDO.getTownName()+wlyyPrescriptionExpressageDO.getAddress();
                                            String address = wlyyPrescriptionExpressageDO.getProvinceName()+wlyyPrescriptionExpressageDO.getCityName()+wlyyPrescriptionExpressageDO.getTownName()+wlyyPrescriptionExpressageDO.getStreetName()+wlyyPrescriptionExpressageDO.getAddress();
                                            String updatesql = "update v_ms_dd01 t set t.PSFS = 1 ,t.FKZT=1 ,t.YFSB = 6 ,t.KDDH ='"+sfOrder+"',t.SJR = '"+wlyyPrescriptionExpressageDO.getName()+"' ," +
                                                    " t.SJRDH = '"+wlyyPrescriptionExpressageDO.getMobile()+"' ,"+
                                                    " t.SJRDZ = '"+address+"'"+
@ -1946,7 +1946,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
    }
    public MixEnvelop findYktCardCharge(String startTime, String endTime, String orderNo, String yktOrderNo, String patientName
                                                    , String idCard, String medicard , Integer status, Integer page, Integer pageSize){
                                                    , String idCard, String medicard,Integer status, Integer page, Integer pageSize,String orderType,String orderCategory){
        String sql = " select t.id as \"id\"," +
                " t.patient as \"patient\","+
                " t.patient_name as \"patientName\","+
@ -1965,9 +1965,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                " t.yk_order_no as \"ykOrderNo\","+
                " t.yk_order_id as \"ykOrderId\","+
                " b.idcard as \"idcard\", "+
                " b.mobile as \"mobile\" "+
                " b.mobile as \"mobile\", "+
                " t.order_type as \"orderType\", "+
                " case t.order_category when '2' then '2' when '3' then '2' else t.order_category end  as \"orderCategory\" "+
                " from base_business_order_pay t" +
                " left join base_patient b on t.patient = b.id  where 1=1 and t.relation_name = '就诊卡充值' ";
                " left join base_patient b on t.patient = b.id  where 1=1  ";
        if (StringUtils.isNoneBlank(startTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
@ -2008,6 +2010,18 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (status!=null){
            sql+=" and t.status ="+status+"";
        }
        if (StringUtils.isNoneBlank(orderType)){
            sql+=" and t.order_type ="+orderType+"";
        }
        if (StringUtils.isNoneBlank(orderCategory)){
            if (orderCategory.equalsIgnoreCase("2")){
                sql+=" and t.order_category IN ('2','3') ";
            }
            sql+=" and t.order_category = '"+orderCategory+"'  ";
        }
        sql+=" order by t.create_time desc ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        /*for (Map<String,Object> map:list){

+ 6 - 4
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -443,10 +443,12 @@ public class ElasticsearchUtil {
        //时间格式转换  yyyy-MM-dd转成 2017-07-17T00:00:00+0800
        areaLevel="6";
        String sqlArea = " select area_level from wlyy_job_config_new where id='"+index+"' ";
        List<String> areaLevels = jdbcTemplate.queryForList(sqlArea,String.class);
        if (areaLevels.size()>0){
            areaLevel = areaLevels.get(0);
        if (!index.contains(",")){
            String sqlArea = " select area_level from wlyy_job_config_new where id="+index;
            List<String> areaLevels = jdbcTemplate.queryForList(sqlArea,String.class);
            if (areaLevels.size()>0){
                areaLevel = areaLevels.get(0);
            }
        }
        if (StringUtils.isNotEmpty(startDate)) {
            if (startDate.length() > 10) {

+ 23 - 0
common/common-entity/sql记录

@ -1527,3 +1527,26 @@ CREATE TABLE `base_capacity_label` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力状况记录表';
-- 2021-10-11 ysj
CREATE TABLE `base_care_prescription` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(50) DEFAULT NULL,
  `patient_name` varchar(50) DEFAULT NULL,
  `status` tinyint(4) DEFAULT NULL COMMENT '状态1待处理 2已处理',
  `doctor` varchar(50) DEFAULT NULL COMMENT '处理医生',
  `doctor_name` varchar(50) DEFAULT NULL,
  `apply_imgs` varchar(500) DEFAULT NULL COMMENT '申请附件',
  `apply_content` varchar(500) DEFAULT NULL COMMENT '申请内容',
  `deal_imgs` varchar(500) DEFAULT NULL COMMENT '处理附件',
  `deal_content` varchar(500) DEFAULT NULL COMMENT '处理内容',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='医养处方表';
CREATE TABLE `base_yunxing_channel` (
  `id` varchar(50) NOT NULL,
  `session_id` varchar(200) DEFAULT NULL COMMENT '会话id',
  `channel_id` varchar(50) DEFAULT NULL COMMENT '云信视频id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='云信会话关联表';

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -26,6 +26,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
	// 13、互联网医院专家咨询, 20紧急救助咨询, 21上门辅导咨询, 22安防警报咨询
	// 23 新生儿在线咨询
	// 24 老人在线咨询
	// 25
	private String patient;         // 提问者标识
	private String name;            // 患者姓名
	private Integer sex;            // 患者性别

+ 36 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/consult/BaseYunxingChannelDO.java

@ -0,0 +1,36 @@
package com.yihu.jw.entity.care.consult;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * Created by yeshijie on 2021/10/11.
 */
@Entity
@Table(name = "base_yunxing_channel")
public class BaseYunxingChannelDO extends UuidIdentityEntity {
    private String sessionId;
    private String channelId;
    @Column(name = "session_id")
    public String getSessionId() {
        return sessionId;
    }
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }
    @Column(name = "channel_id")
    public String getChannelId() {
        return channelId;
    }
    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }
}

+ 128 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/prescription/BaseCarePrescriptionDO.java

@ -0,0 +1,128 @@
package com.yihu.jw.entity.care.prescription;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * Created by yeshijie on 2021/10/11.
 */
@Entity
@Table(name="base_care_prescription")
public class BaseCarePrescriptionDO extends UuidIdentityEntityWithCreateTime {
    private String patient;//
    private String patientName;//
    private Integer status;//状态1待处理 2已处理
    private String doctor;//处理医生
    private String doctorName;//
    private String applyImgs;//申请附件
    private String applyContent;//申请内容
    private String dealImgs;//处理附件
    private String dealContent;//处理内容
    private String sex;
    private String age;
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "apply_imgs")
    public String getApplyImgs() {
        return applyImgs;
    }
    public void setApplyImgs(String applyImgs) {
        this.applyImgs = applyImgs;
    }
    @Column(name = "apply_content")
    public String getApplyContent() {
        return applyContent;
    }
    public void setApplyContent(String applyContent) {
        this.applyContent = applyContent;
    }
    @Column(name = "deal_imgs")
    public String getDealImgs() {
        return dealImgs;
    }
    public void setDealImgs(String dealImgs) {
        this.dealImgs = dealImgs;
    }
    @Column(name = "deal_content")
    public String getDealContent() {
        return dealContent;
    }
    public void setDealContent(String dealContent) {
        this.dealContent = dealContent;
    }
    @Transient
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    @Transient
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/message/SystemMessageDO.java

@ -25,6 +25,7 @@ public class SystemMessageDO extends UuidIdentityEntity {
     * 家属紧急预警系统消息 50
     * 新生儿在线咨询 850
     * 老人在线咨询 851
     * 老人健康咨询 852
     */
    private String type;
    /**

+ 0 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/device/DeviceManageEndpoint.java

@ -335,13 +335,6 @@ public class DeviceManageEndpoint extends EnvelopRestEndpoint {
            map.put("failedNum", rows-1 - correctLs.size() );
            map.put("errorData", JSON.toJSONString(errorMsgMapTotal, SerializerFeature.WriteMapNullValue));
            map.put("errorData", errorLs);
            //失败数据下载
            if (errorLs.size()>0){
                response.setContentType("octets/stream");
                response.setHeader("Content-Disposition", "attachment; filename=" + new String("deviceImport.xls"));
                OutputStream os = response.getOutputStream();
                deviceManageService.write(os, errorLs);
            }
            return ObjEnvelop.getSuccess("success",JSON.toJSONString(map,SerializerFeature.WriteMapNullValue));
        } catch (Exception e) {

+ 17 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/consult/BaseYunxingChannelDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.care.dao.consult;
import com.yihu.jw.entity.care.booking.BaseBookingServiceDo;
import com.yihu.jw.entity.care.consult.BaseYunxingChannelDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/10/11.
 */
public interface BaseYunxingChannelDao extends PagingAndSortingRepository<BaseYunxingChannelDO,String>,
        JpaSpecificationExecutor<BaseYunxingChannelDO> {
    @Query("select a from BaseYunxingChannelDO a where a.sessionId = ?1 ")
    BaseYunxingChannelDO findBySessionId(String sessionId);
}

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/prescription/BaseCarePrescriptionDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.care.dao.prescription;
import com.yihu.jw.entity.care.message.OrgNoticeDO;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/10/11.
 */
public interface BaseCarePrescriptionDao  extends PagingAndSortingRepository<BaseCarePrescriptionDO,String>, JpaSpecificationExecutor<BaseCarePrescriptionDO> {
}

+ 19 - 11
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/consult/PatientConsultEndpoint.java

@ -117,7 +117,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "sessionId",required = false) String sessionId,
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
		try {
			if (StringUtils.isBlank(orgCode)&&StringUtils.isBlank(sessionId)){
@ -136,7 +136,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type){
		try {
			String consultCode = consultService.getUnfinishedConsult(patient, doctor, type);
@ -160,7 +160,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "images",required = false) String images,
			@ApiParam(name = "voice", value = "语音")
			@RequestParam(value = "voice",required = false) String voice,
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询")
			@ApiParam(name = "type", value = "咨询类型:23在线咨询,24老人在线咨询,25老人健康咨询")
			@RequestParam(value = "type",required = false) Integer type,
			@ApiParam(name = "source", value = "咨询类型来源")
			@RequestParam(value = "source",required = false) String source){
@ -173,7 +173,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			String agent = getAgentUID();
			ConsultTeamDo consult = new ConsultTeamDo();
			// 设置咨询类型:23 在线咨询 24老人在线咨询
			// 设置咨询类型:23 在线咨询 24老人在线咨询 25老人健康咨询
			consult.setType(type);
			// 设置主要症状
			consult.setSymptoms(symptoms);
@ -189,10 +189,19 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				re = consultService.addTeamConsult(consult, patient,doctor,source,agent);
				//发送系统消息
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				systemMessageDO.setTitle("新增在线咨询");
				systemMessageDO.setType("850");
				if (type==24){
					systemMessageDO.setType("851");
				switch (type){
					case 23:
						systemMessageDO.setTitle("新增在线咨询");
						systemMessageDO.setType("850");
						break;
					case 24:
						systemMessageDO.setTitle("新增在线咨询");
						systemMessageDO.setType("851");
						break;
					case 25:
						systemMessageDO.setTitle("新增健康咨询");
						systemMessageDO.setType("852");
						break;
				}
				systemMessageDO.setReceiver(re.getString("doctor"));
				systemMessageDO.setReceiverName(re.getString("doctorName"));
@ -226,7 +235,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "patient",required = true) String patient,
			@ApiParam(name = "orgCode", value = "机构code")
			@RequestParam(value = "orgCode",required = true) String orgCode,
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name="type",value = "咨询类型 23新生儿在线咨询 24老人在线咨询 25老人健康咨询")
			@RequestParam(value = "type",required = false,defaultValue = "23") Integer type,
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
@ -251,7 +260,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "symptoms",required = false) String symptoms,
			@ApiParam(name = "id", value = "咨询ID")
			@RequestParam(value = "id",required = false) String id,
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询")
			@ApiParam(name = "type", value = "咨询类型 23新生儿在线咨询 24老人在线咨询 25老人健康咨询")
			@RequestParam(value = "type",required = true) String type,
			@ApiParam(name = "status", value = "咨询状态:0进行中,1已完成,-1患者取消,-2超时未响应自动关闭")
			@RequestParam(value = "status",required = false) Integer status,
@ -528,7 +537,6 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				object.put("relation_code",session_id);
				imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
			}
			return success(result);
		} catch (Exception e) {
			return failedException2(e);

+ 113 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/prescription/PrescriptionEndpoint.java

@ -0,0 +1,113 @@
package com.yihu.jw.care.endpoint.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.prescription.BaseCarePrescriptionService;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.common.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/10/11.
 */
@RestController
@RequestMapping("prescription" )
@Api(tags = "续方信息", description = "续方信息")
public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseCarePrescriptionService prescriptionService;
    @GetMapping(value = "queryPatientList")
    @ApiOperation(value = "居民查询工单列表")
    public PageEnvelop queryPatientList(
            @ApiParam(name = "patientId", value = "居民id") @RequestParam(value = "patientId", required = true) String patientId,
            @ApiParam(name = "status", value = "工单状态") @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try{
            JSONObject result = prescriptionService.queryPatientList(patientId, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            Long count = result.getLongValue(ResponseContant.count);
            return PageEnvelop.getSuccessListWithPage("查询成功",(List<BaseCarePrescriptionDO>)result.get(ResponseContant.resultMsg),page,size,count);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @GetMapping(value = "queryDoctorList")
    @ApiOperation(value = "医生端列表查询")
    public PageEnvelop queryDoctorList(
            @ApiParam(name = "doctorCode", value = "医生id") @RequestParam(value = "doctorCode", required = true) String doctorCode,
            @ApiParam(name = "status", value = "工单状态") @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try{
            JSONObject result = prescriptionService.queryDoctorList(doctorCode, status, page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return PageEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            Long count = result.getLongValue(ResponseContant.count);
            return PageEnvelop.getSuccessListWithPage("查询成功",(List<BaseCarePrescriptionDO>)result.get(ResponseContant.resultMsg),page,size,count);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @PostMapping(value = "applyPrescription")
    @ApiOperation(value = "申请续方")
    public ObjEnvelop applyPrescription(@ApiParam(name = "applyImgs", value = "申请图片")
                             @RequestParam(value = "applyImgs", required = false)String applyImgs,
                                        @ApiParam(name = "applyContent", value = "附加说明")
                             @RequestParam(value = "applyContent", required = false)String applyContent,
                                        @ApiParam(name = "patientId", value = "居民id")
                                            @RequestParam(value = "patientId", required = true)String patientId){
        try{
            return success(prescriptionService.applyPrescription(patientId,applyImgs,applyContent));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "dealPrescription")
    @ApiOperation(value = "处理续方")
    @ObserverRequired
    public Envelop dealPrescription(@ApiParam(name = "dealImgs", value = "处理图片")
                                    @RequestParam(value = "dealImgs", required = false)String dealImgs,
                                    @ApiParam(name = "dealContent", value = "续方说明")
                                    @RequestParam(value = "dealContent", required = false)String dealContent,
                                    @ApiParam(name = "id", value = "居民id")
                                    @RequestParam(value = "id", required = true)String id,
                                    @ApiParam(name = "doctorId", value = "医生id")
                                    @RequestParam(value = "doctorId", required = true)String doctorId){
        try{
            String result = prescriptionService.dealPrescription(id,dealImgs,dealContent,doctorId);
            if(StringUtils.isBlank(result)){
                return success("处理成功");
            }else {
                return failed(result,-1);
            }
        }catch (Exception e){
            return failedException2(e);
        }
    }
}

+ 16 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java

@ -76,6 +76,22 @@ public class SignEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findOrgWithoutSigned")
    @ApiOperation(value = "查找签约机构")
    public ListEnvelop findOrgWithoutSigned (
            @ApiParam(name = "patient", value = "患者code", required = true)
            @RequestParam(value = "patient",required = true) String patient,
            @ApiParam(name = "name", value = "机构名称", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "type", value = "类型 3 养老 4 教育,1 医疗", required = false)
            @RequestParam(value = "type",required = false) String type) throws Exception {
        try{
            return ListEnvelop.getSuccess("查询成功",servicePackageService.findOrgWithoutSigned(patient,name,type));
        }catch (Exception e){
            return failedListEnvelopException2(e);
        }
    }
    @GetMapping(value = "findSignDoctor")
    @ApiOperation(value = "查找签约医生")
    public ListEnvelop findSignDoctor (

+ 18 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/third/patient/PatientNoLoginEndPoint.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.endpoint.third.patient;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.service.consult.ConsultService;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.care.service.org.BaseOrgService;
import com.yihu.jw.care.service.sign.ServicePackageService;
@ -50,6 +51,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private ServicePackageService servicePackageService;
    @Autowired
    private PatientNoLoginService patientNoLoginService;
    @Autowired
    private ConsultService consultService;
    /**
     * 获取微信openid
@ -171,4 +174,19 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = "updateChannelId")
    @ApiOperation(value = "保存云信channelId", notes = "保存云信channelId")
    public Envelop updateChannelId(@ApiParam(name = "sessionId", value = "sessionId")
                                   @RequestParam(value = "sessionId", required = true)String sessionId,
                                   @ApiParam(name = "channelId", value = "渠道id")
                                   @RequestParam(value = "channelId", required = true)String channelId) {
        try {
            consultService.updateChannelId(sessionId,channelId);
            return success("保存成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 36 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultService.java

@ -2,6 +2,7 @@ package com.yihu.jw.care.service.consult;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.consult.BaseYunxingChannelDao;
import com.yihu.jw.care.util.EntranceUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -11,6 +12,7 @@ import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDoctorDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.consult.BaseYunxingChannelDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
@ -72,6 +74,23 @@ public class ConsultService {
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private EntranceUtil entranceUtil;
    @Autowired
    private BaseYunxingChannelDao yunxingChannelDao;
    /**
     * 保存云信channelId
     * @param sessionId
     * @param channelId
     */
    public void updateChannelId(String sessionId,String channelId){
        BaseYunxingChannelDO channelDO = yunxingChannelDao.findBySessionId(sessionId);
        if(channelDO == null){
            channelDO = new BaseYunxingChannelDO();
            channelDO.setSessionId(sessionId);
        }
        channelDO.setChannelId(channelId);
        yunxingChannelDao.save(channelDO);
    }
    /**
     * 获取居民该机构的最近一次在线咨询
@ -498,6 +517,20 @@ public class ConsultService {
     */
    public JSONObject addTeamConsult(ConsultTeamDo ct, String patient, String doctor, String source,String agent) throws Exception {
        JSONObject re = new JSONObject();
        String title = "";
        switch (ct.getType()){
            case 23:
                title="在线咨询";
                break;
            case 24:
                title="在线咨询";
                break;
            case 25:
                title="健康咨询";
                break;
            default:
                throw new RuntimeException("暂不支持发起此类型的咨询!");
        }
        boolean boo = StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()));
        logger.info("boo"+boo);
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("consultClose");
@ -509,7 +542,7 @@ public class ConsultService {
        }
        if (!flag){
            if (!StringUtils.isEmpty(getUnfinishedConsult(patient, doctor,ct.getType()))) {
                throw new RuntimeException("居民还有未结束的在线咨询!");
                throw new RuntimeException("居民还有未结束的"+title+"!");
            }
        }
@ -538,7 +571,7 @@ public class ConsultService {
        // 医生未读数量为1
        ct.setDoctorRead(1);
        // 添加咨询记录
        ConsultDo consult = imService.addConsult(ct.getPatient(), "在线咨询", ct.getSymptoms(), ct.getImages(), ct.getType(),source);
        ConsultDo consult = imService.addConsult(ct.getPatient(), title, ct.getSymptoms(), ct.getImages(), ct.getType(),source);
//		// 设置关联指导
//		consult.setGuidance(ct.getGuidance());
        // 设置咨询标识
@ -549,7 +582,7 @@ public class ConsultService {
        ct.setDoctorName(baseDoctorDO.getName());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("title", tempPatient.getName() + "申请在线咨询");
        jsonObject.put("title", tempPatient.getName() + "申请"+title);
        jsonObject.put("content",ct.getSymptoms());
        jsonObject.put("age", DateUtil.getAgeForIdcard(tempPatient.getIdcard()));
        jsonObject.put("sex",tempPatient.getSex());

+ 8 - 12
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doctor/CareDoctorService.java

@ -193,8 +193,7 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        if (doctorDO==null){
            return new ArrayList<>();
        }
        //教师角色登录时为本机构科室列表,点击展开人员列表
        //助老员角色登录时为本机构科室列表,点击展开人员列表
        //医生通讯录只展示医生所在医院下所有科室列表 其他角色同理
        Integer doctorLevel = doctorDO.getLevel();
        Integer doctorOrgType =0 ;
        boolean isSearchDoctorOrgType=false;
@ -210,18 +209,13 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                isSearchDoctorOrgType=true;
            }
        }
        if (1==doctorLevel) {//专科医生
            doctorOrgType=1;
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        if (2==doctorLevel) {//社区医生
        if (1==doctorLevel) {//社区医生
            doctorOrgType=2;
            if ("1,2".equals(orgType)){
                isSearchDoctorOrgType=true;
            }
        }
        //医生机构
        String sql ="select org.code from base_doctor_hospital dh inner join base_org org on dh.org_code = org.code " +
                "and dh.doctor_code='"+doctorId+"' and org.type='"+doctorOrgType+"' ORDER BY dh.create_time desc limit 1";
@ -235,11 +229,13 @@ public class CareDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
            }
            sql += " GROUP BY org.`code` ";
        }
        else if (orgType.equals("1,2")){//医疗机构
        } else if (orgType.equals("1,2")){//医疗机构
           sql+=" and org.type in(1,2) ";
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' ";
            }
        }
        else {//养老
        else {//教师
            if (isSearchDoctorOrgType&&doctorOrg.size()>0){
                sql += " and org.code = '"+doctorOrg.get(0)+"' and org.type='"+orgType+"'  ";
            }else {

+ 78 - 41
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/lifeCare/LifeCareOrderService.java

@ -97,6 +97,8 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    //是否开启支付 false 不需要支付
    public static final boolean  isNeedPay = false;
    /**
     * 记录完成情况
@ -450,16 +452,19 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
            logger.error(failMsg);
            return result;
        }
        if(orderDO.getStatus() != LifeCareOrderDO.Status.waitForPay.getType()){
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            String failMsg = "无法取消工单,已支付的工单需要到我的订单中进行申请退款," + orderId;
            result.put(ResponseContant.resultMsg, failMsg);
            logger.error(failMsg);
            return result;
        if(isNeedPay){
            if(orderDO.getStatus() != LifeCareOrderDO.Status.waitForPay.getType()){
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                String failMsg = "无法取消工单,已支付的工单需要到我的订单中进行申请退款," + orderId;
                result.put(ResponseContant.resultMsg, failMsg);
                logger.error(failMsg);
                return result;
            }
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderDO.getId());
            businessOrderDO.setStatus(2);
            businessOrderDao.save(businessOrderDO);
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(orderDO.getId());
        businessOrderDO.setStatus(2);
        businessOrderDao.save(businessOrderDO);
//        if(orderDO.getStatus().equals(LifeCareOrderDO.Status.complete.getType())){
//            result.put(ResponseContant.resultFlag, ResponseContant.fail);
//            String failMsg = "只有医生服务前的工单才可取消";
@ -489,16 +494,19 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        lifeCareCancelLogDao.save(cancelLogDO);
        // 发送微信模板消息,通知居民工单已取消(smyyyqx-上门预约已取消)
//        String first = "key1,您好,您的上门预约服务已退回,点击查看原因";
//        BasePatientDO patient = patientDao.findById(orderDO.getPatient());
//        first  = first.replace("key1", null != patient.getName() ? patient.getName() : "");
//        JSONObject json = new JSONObject();
//        json.put("id", orderDO.getId());
//        List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
//        if(basePatientWechatDos.size()>0){
//            String openId = basePatientWechatDos.get(0).getOpenid();
//            messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,null,null,30,json, DateUtil.dateToChineseDate(new Date()),"生活照料已取消");
//        }
        if(!isNeedPay){
            String first = "key1,您好,您的上门预约服务已退回,点击查看原因";
            BasePatientDO patient = patientDao.findById(orderDO.getPatient());
            first  = first.replace("key1", null != patient.getName() ? patient.getName() : "");
            JSONObject json = new JSONObject();
            json.put("id", orderDO.getId());
            List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient.getId());
            if(basePatientWechatDos.size()>0){
                String openId = basePatientWechatDos.get(0).getOpenid();
                messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","smyyyqx",openId,first,null,null,30,json, DateUtil.dateToChineseDate(new Date()),"生活照料已取消");
            }
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, "工单服务已取消!");
        return result;
@ -520,19 +528,37 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        try {
            jsonObjectParam = JSONObject.parseObject(jsonData);
            orderDO = EntityUtils.jsonToEntity(jsonObjectParam.get("order").toString(), LifeCareOrderDO.class);
            //存在未支付的订单不能发起
            boolean bool = lifeCareOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                    new Integer[]{
                            BaseDoorCoachOrderDO.Status.waitForPay.getType()
                    });
            if(isNeedPay){
                //存在未支付的订单不能发起
                boolean bool = lifeCareOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                        new Integer[]{
                                LifeCareOrderDO.Status.waitForPay.getType(),
                                LifeCareOrderDO.Status.waitForAccept.getType(),
                                LifeCareOrderDO.Status.signIn.getType()
                        });
                if(bool){
                    String failMsg = "当前服务对象存在未支付或未完成,无法再次申请!";
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
                    result.put(ResponseContant.resultMsg, failMsg);
                    logger.error(failMsg);
                    return result;
                }
            }else{
                boolean bool = lifeCareOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
                        new Integer[]{
                                LifeCareOrderDO.Status.waitForAccept.getType(),
                                LifeCareOrderDO.Status.signIn.getType()
                        });
                if(bool){
                    String failMsg = "当前服务对象存在未完成,无法再次申请!";
                    result.put(ResponseContant.resultFlag, ResponseContant.fail);
                    result.put(ResponseContant.resultMsg, failMsg);
                    logger.error(failMsg);
                    return result;
                }
            if(bool){
                String failMsg = "当前服务对象存在未支付或未完成,无法再次申请!";
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg, failMsg);
                logger.error(failMsg);
                return result;
            }
            Integer type = orderDO.getType();
            if (type==1||type==2){
@ -547,12 +573,14 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
                orderDO.setProxyPatient(proxyPatient);
                orderDO.setProxyPatientName(doctorDO.getName());
                orderDO.setProxyPatientPhone(doctorDO.getMobile());
                List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,orderDO.getPatient());
                if (basePatientWechatDos.size()>0){
                    JSONObject json = new JSONObject();
                    String openId = basePatientWechatDos.get(0).getOpenid();
                    messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","shzldzf",openId,null,null,"请在30分钟内完成支付",3,json,
                            DateUtil.dateToChineseDate(new Date()),"助老员已为您代预约生活照料","待支付");
                if(isNeedPay){
                    List<BasePatientWechatDo> basePatientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,orderDO.getPatient());
                    if (basePatientWechatDos.size()>0){
                        JSONObject json = new JSONObject();
                        String openId = basePatientWechatDos.get(0).getOpenid();
                        messageUtil.putTemplateWxMessage(wxId,"template_process_feedback","shzldzf",openId,null,null,"请在30分钟内完成支付",3,json,
                                DateUtil.dateToChineseDate(new Date()),"助老员已为您代预约生活照料","待支付");
                    }
                }
            }
            if(StringUtils.isNotBlank(agent)){
@ -597,7 +625,12 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        }
        orderDO.setNumber(orderNoService.getOrderNo(1));
        orderDO.setCreateTime(new Date());
        orderDO.setStatus(0);//待付款状态
        if(isNeedPay){
            orderDO.setStatus(0);//待付款状态
        }else {
            orderDO.setStatus(1);//待(医生)接单
        }
        try {
            BaseAdminServiceDynamic baseAdminServiceDynamic = new BaseAdminServiceDynamic();
@ -628,7 +661,9 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        result.put(ResponseContant.resultMsg, orderDO);
        //发起支付订单
        payService.submitOrder(orderDO.getPatient(),"4",orderDO.getId(),orderDO.getTotalFee().doubleValue());
        if (isNeedPay){
            payService.submitOrder(orderDO.getPatient(),"4",orderDO.getId(),orderDO.getTotalFee().doubleValue());
        }
        //给签约医生发送预约短信
        String sql ="SELECT i.code,r.team_code,pack.org_code,pack.org_name from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i,base_service_package pack  \n" +
@ -640,9 +675,11 @@ public class LifeCareOrderService extends BaseJpaService<LifeCareOrderDO, LifeCa
        for (BaseDoctorDO doctorDO:doctorDOS){
            try {
                if (StringUtils.isNotBlank(doctorDO.getMobile())){
                    messageUtil.sendTXYSJson("1099805",doctorDO.getMobile(),orderDO.getPatientName());
                    messageUtil.sendTXYSJson("1099807",doctorDO.getMobile(),orderDO.getPatientName(),"生活照料");
                }
            }catch (Exception e){}
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return result;

+ 6 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -622,12 +622,12 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        }
        sql += filter1;
        sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex,online,signStatus ";
        sql += " ORDER BY online desc,signStatus desc";
        sql += " ORDER BY online desc,a.ykt_id desc,signStatus desc";
        sql += limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);
        String sqlLife= "SELECT COUNT(*) from base_life_care_order where `status` = 2";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order where `status` = 0";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order where `status` = 7 ";
        String sqlLife= "SELECT COUNT(*) from base_life_care_order ";
        String sqlEmergency= "SELECT COUNT(*) from base_emergency_assistance_order ";
        String sqlSecurity= "SELECT COUNT(*) from base_security_monitoring_order  ";
        String sqlDevice = "SELECT pd.category_code deviceFlag, IFNULL(d.contact_status,0) status from wlyy_patient_device pd,wlyy_devices d";
        for (Map<String,Object> map:list){
            String paientId = map.get("id").toString();
@ -636,7 +636,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            Date birthday = DateUtil.strToDate(map.get("birthday").toString());
            Integer age = IdCardUtil.getAgeByIdcardOrBirthday(idcardNo,birthday);
            map.put("age",age);
            String filter = " and patient = '"+paientId+"'";
            String filter = " where patient = '"+paientId+"'";
            Integer lifeCare = jdbcTemplate.queryForObject(sqlLife+filter,Integer.class);
            Integer emergency = jdbcTemplate.queryForObject(sqlEmergency+filter,Integer.class);
            Integer security = jdbcTemplate.queryForObject(sqlSecurity+filter,Integer.class);
@ -681,7 +681,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
        String sql = "SELECT a.id,a.name,a.photo,a.sex,IFNULL(a.on_line,0) online from base_doctor a,base_doctor_hospital h" +
                "  WHERE a.id=h.doctor_code and a.doctor_level = 2 and a.del = '1' and h.del = '1' ";
        if(!StringUtil.isBlank(name)){
            sql+= " a.and name like '%"+name+"%' ";
            sql+= " and a.name like '%"+name+"%' ";
        }
        sql += fileter;
        sql += " ORDER BY online desc";

+ 190 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/prescription/BaseCarePrescriptionService.java

@ -0,0 +1,190 @@
package com.yihu.jw.care.service.prescription;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.prescription.BaseCarePrescriptionDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2021/10/11.
 */
@Service
public class BaseCarePrescriptionService {
    @Autowired
    private BaseCarePrescriptionDao carePrescriptionDao;
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 医生端列表查询
     * @param doctorCode
     * @param status
     * @param page
     * @param size
     * @return
     */
    public JSONObject queryDoctorList(String doctorCode, Integer status, int page, int size) {
        JSONObject result = new JSONObject();
        List<BaseCarePrescriptionDO> sqlResultlist;
        String sql = "select distinct a.*," +
                "     case p.sex " +
                "     when 1 then '男'  " +
                "     when 2 then '女' " +
                "     end AS sex, " +
                "     TIMESTAMPDIFF(year,p.birthday,NOW()) AS age  ";
        String filters = "from base_care_prescription a" +
                " LEFT JOIN base_patient p ON a.patient = p.id," +
                "         base_service_package_sign_record sr,base_service_package_record r,base_service_package pack," +
                "         base_team_member m " +
                "         WHERE  sr.id = r.sign_id and sr.patient = a.patient and r.service_package_id = pack.id " +
                "         and m.team_code = r.team_code  and m.doctor_code = '"+doctorCode+"' ";
        if(status != null){
            filters += " and a.status = "+status;
        }
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        String limit = " order by a.create_time desc limit "+start+","+end;
        String countSql = "SELECT count(distinct a.id) ";
        try {
            sqlResultlist = jdbcTemplate.query(sql+filters+limit,new BeanPropertyRowMapper(BaseCarePrescriptionDO.class));
        } catch (Exception e) {
            e.printStackTrace();
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询列表信息失败");
            return result;
        }
        Long count;
        try {
            count = jdbcTemplate.queryForObject(countSql+filters, Long.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库统计数量失败" );
            return result;
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, sqlResultlist);
        JSONObject countItem = new JSONObject();
        countItem.put("count", count);
        result.putAll(countItem);
        return result;
    }
    /**
     * 居民端列表查询
     * @param patientId
     * @param status
     * @param page
     * @param size
     * @return
     */
    public JSONObject queryPatientList(String patientId, Integer status, int page, int size) {
        JSONObject result = new JSONObject();
        List<BaseCarePrescriptionDO> sqlResultlist;
        String sql = "select * from base_care_prescription  ";
        String filters = " where patient = '"+patientId+"' ";
        if(status != null){
            filters += " and status = "+status;
        }
        int start = 0 == page ? page++ : (page - 1) * size;
        int end = 0 == size ? 15 : size;
        String limit = " order by create_time desc limit "+start+","+end;
        String countSql = "SELECT count(id) from base_care_prescription ";
        try {
            sqlResultlist = jdbcTemplate.query(sql+filters+limit,new BeanPropertyRowMapper(BaseCarePrescriptionDO.class));
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询列表信息失败");
            return result;
        }
        Long count;
        try {
            count = jdbcTemplate.queryForObject(countSql+filters, Long.class);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库统计数量失败" );
            return result;
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg, sqlResultlist);
        JSONObject countItem = new JSONObject();
        countItem.put("count", count);
        result.putAll(countItem);
        return result;
    }
    /**
     * 申请续方
     * @param patient
     * @param applyImgs
     * @param applyContent
     */
    public BaseCarePrescriptionDO applyPrescription(String patient,String applyImgs,String applyContent){
        BaseCarePrescriptionDO prescriptionDO = new BaseCarePrescriptionDO();
        prescriptionDO.setApplyImgs(applyImgs);
        prescriptionDO.setApplyContent(applyContent);
        BasePatientDO patientDO = patientDao.findById(patient);
        prescriptionDO.setPatient(patient);
        prescriptionDO.setPatientName(patientDO.getName());
        prescriptionDO.setStatus(1);
        carePrescriptionDao.save(prescriptionDO);
        return prescriptionDO;
    }
    /**
     * 医生处理续方
     * @param id
     * @param dealImgs
     * @param dealContent
     */
    public String dealPrescription(String id,String dealImgs,String dealContent,String doctor){
        String result = "";
        BaseCarePrescriptionDO prescriptionDO = carePrescriptionDao.findOne(id);
        if(2 == prescriptionDO.getStatus()){
            return "请勿重复处理";
        }
        prescriptionDO.setDealContent(dealContent);
        prescriptionDO.setDealImgs(dealImgs);
        prescriptionDO.setStatus(2);
        prescriptionDO.setDoctor(doctor);
        BaseDoctorDO doctorDO = doctorDao.findById(doctor);
        prescriptionDO.setDoctorName(doctorDO.getName());
        carePrescriptionDao.save(prescriptionDO);
        return result;
    }
}

+ 52 - 17
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/ServicePackageService.java

@ -203,6 +203,27 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        return list;
    }
    public List<BaseOrgDO> findOrgWithoutSigned(String patient,String name,String type){
        String sql = " select DISTINCT o.* from base_org o where o.`code` not in ( " +
                "SELECT  DISTINCT i.org_code FROM  base_service_package_sign_record sr, " +
                " base_service_package_record r,  base_service_package i WHERE  sr.id = r.sign_id " +
                " and sr.status=1 and sr.patient = '"+patient+"' " +
                " AND r.service_package_id = i.id AND i.del = 1  AND sr.`status` = 1 " +
                ") ";
        if("1".equals(type)){
            sql += " and (o.type =1 or o.type = 2) ";
        }else if("3".equals(type)){
            sql += " and o.type =3 ";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " and o.name like '%"+name+"%' ";
        }
        //type =4 新生儿
        List<BaseOrgDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(BaseOrgDO.class));
        return list;
    }
    /**
     * 查找签约医生
     * @param patient
@ -370,11 +391,25 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
        signRecordDO.setPatient(patientId);
        signRecordDO.setName(patientDO.getName());
        List<ServicePackageRecordDO> recordDOList = signRecordDO.getRecordDOList();
        List<String> packages = recordDOList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
        if (packages.size()>0){
            String packagesId = packages.stream().map(String::valueOf).collect(Collectors.joining("','"));
            String sql  = " SELECT  DISTINCT i.org_code FROM  base_service_package_sign_record sr, " +
                    " base_service_package_record r,  base_service_package i WHERE  sr.id = r.sign_id  " +
                    " and sr.status=1 and sr.patient = '"+patientId+"'  " +
                    " AND r.service_package_id = i.id AND i.del = 1  AND sr.`status` = 1 and i.id in ('"+packagesId+"') ";
            if (jdbcTemplate.queryForList(sql).size()>0){
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"您已签约该机构,无法重复签约");
                return result;
            }
        }
        String signId = signRecordDO.getId();
        List<String> idList = new ArrayList<>();
        if(StringUtil.isEmpty(signId)){
            List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
            if(signRecordDOs.size()==0){
//            List<ServicePackageSignRecordDO> signRecordDOs = servicePackageSignRecordDao.findByStatusAndPatient(1,signRecordDO.getPatient());
//            if(signRecordDOs.size()==0){
                BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
                //需要新增签约记录
                signRecordDO.setStatus(1);
@ -399,24 +434,24 @@ public class ServicePackageService extends BaseJpaService<ServicePackageDO, Serv
                    archiveDO.setSignStatus(1);
                    archiveDao.save(archiveDO);
                }
            }else{
                //不能重复签约
                result.put(ResponseContant.resultFlag, ResponseContant.fail);
                result.put(ResponseContant.resultMsg,"请勿重复签约");
                return result;
//                ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
//                if(archiveDO!=null){
//                    archiveDO.setSignStatus(1);
//                    archiveDao.save(archiveDO);
//                }
//                signId = signRecordDOs.get(0).getId();
//                List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
//                idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
            }
//            }else{
//                //不能重复签约
//                result.put(ResponseContant.resultFlag, ResponseContant.fail);
//                result.put(ResponseContant.resultMsg,"请勿重复签约");
//                return result;
////                ArchiveDO archiveDO = archiveDao.findByPatientAndDoctorCode(patientId,doctorId);
////                if(archiveDO!=null){
////                    archiveDO.setSignStatus(1);
////                    archiveDao.save(archiveDO);
////                }
////                signId = signRecordDOs.get(0).getId();
////                List<ServicePackageRecordDO> existList = servicePackageRecordDao.findBySignId(signId);
////                idList = existList.stream().map(ServicePackageRecordDO::getServicePackageId).collect(Collectors.toList());
//            }
        }else{
            //不能重复签约
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"请勿重复签约");
            result.put(ResponseContant.resultMsg,"不允许修改原有签约信息");
            return result;
        }
        //生成居民标签

+ 8 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/SecurityOrderUtil.java

@ -152,6 +152,14 @@ public class SecurityOrderUtil {
            params.add(new BasicNameValuePair("patientId", logDO.getPatient()));
            params.add(new BasicNameValuePair("orderSource", orderSource));//工单来源工单发起来源状态 1APP 2手环 3居家报警 4拐杖
            String response = httpClientUtil.post(url, params,"UTF-8");
            JSONObject result = com.alibaba.fastjson.JSONObject.parseObject(response);
            logDO.setSosSendStatus(result.getInteger("status").toString());
            if (result.containsKey("message")){
                logDO.setSosSendMessage(result.getString("message"));
            }
            if (result.containsKey("msg")){
                logDO.setSosSendMessage(result.getString("msg"));
            }
            System.out.println(response);
        }
        sosLogDao.save(logDO);

+ 2 - 2
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/consult/FinishConsultJob.java

@ -59,7 +59,7 @@ public class FinishConsultJob implements Job {
            sql.append("SELECT s.id session_id, s.name session_name, s.create_date session_create_time, s.last_message_time, ")
            .append("t.id topic_id, t.name topic_name, t.create_time topic_create_time, t.start_message_id ")
            .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("WHERE s.id = t.session_id AND s.type in(23,24,25)  AND t.end_message_id IS NULL AND s.last_content_type in(1,2,3,4,15,16,17) and s.last_sender_id IN ( ")
            .append("SELECT id FROM ").append(imDb).append(".doctors d where d.id<>t.patient) ")
            .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600 ")
            .append("ORDER BY t.create_time");
@ -82,7 +82,7 @@ public class FinishConsultJob implements Job {
            sql = new StringBuffer();
            sql.append("SELECT s.id session_id,t.id topic_id, t.name topic_name ")
             .append("FROM ").append(imDb).append(".sessions s,").append(imDb).append(".wlyy_consults t ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("WHERE s.id = t.session_id AND s.type in (23,24,25) AND t.end_message_id IS NULL AND t.reply=1 AND s.last_content_type =14 ")
             .append("AND UNIX_TIMESTAMP(now()) - UNIX_TIMESTAMP(s.last_message_time) > 24*3600  ");
            StringBuffer sql2 = new StringBuffer();

+ 23 - 12
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java

@ -12,6 +12,7 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
/**
@ -30,6 +31,8 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    private HealthCareService healthCareService;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Value("${wechat.id}")
    private String wechatId;
    public static String entranceHealthCareUrl = "http://172.16.100.240:10023/healthCare/";
    @GetMapping(value = "doctorAuthentication")
@ -37,13 +40,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop doctorAuthentication(@ApiParam(name = "doctorId", value = "医生id", required = true)
                                           @RequestParam(value = "doctorId",required = true) String doctorId){
        try {
            String url = entranceHealthCareUrl + "doctorAuthentication?doctorId="+doctorId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                String url = entranceHealthCareUrl + "doctorAuthentication?doctorId="+doctorId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.doctorAuthentication(doctorId));
            }
        }catch (Exception e){
@ -57,13 +64,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop doctorFaceCheckInAddress(@ApiParam(name = "doctorId", value = "医生id", required = true)
                                           @RequestParam(value = "doctorId",required = true) String doctorId){
        try {
            String url = entranceHealthCareUrl + "doctorFaceCheckInAddress?doctorId="+doctorId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                String url = entranceHealthCareUrl + "doctorFaceCheckInAddress?doctorId="+doctorId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
            }else {
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                return ObjEnvelop.getSuccess("ok",healthCareService.doctorFaceCheckInAddress(doctorId));
            }
        }catch (Exception e){
            e.printStackTrace();

+ 25 - 19
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -2053,29 +2053,33 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findYkCardCharge)
    @ApiOperation(value = "查询眼科通充值记录", notes = "")
    public MixEnvelop findYkCardCharge(@ApiParam(name = "startTime", value = "")
    public MixEnvelop findYkCardCharge(@ApiParam(name = "startTime", value = "开始时间")
                             @RequestParam(value = "startTime", required = false)String startTime,
                             @ApiParam(name = "endTime", value = "")
                             @ApiParam(name = "endTime", value = "结束时间")
                             @RequestParam(value = "endTime", required = false)String endTime,
                             @ApiParam(name = "orderNo", value = "")
                             @ApiParam(name = "orderNo", value = "订单号")
                             @RequestParam(value = "orderNo", required = false)String orderNo,
                             @ApiParam(name = "yktOrderNo", value = "")
                             @ApiParam(name = "yktOrderNo", value = "眼科订单号")
                             @RequestParam(value = "yktOrderNo", required = false)String yktOrderNo,
                             @ApiParam(name = "patientName", value = "")
                             @ApiParam(name = "patientName", value = "患者姓名")
                             @RequestParam(value = "patientName", required = false)String patientName,
                             @ApiParam(name = "idCard", value = "")
                             @ApiParam(name = "idCard", value = "身份证")
                             @RequestParam(value = "idCard", required = false)String idCard,
                                       @ApiParam(name = "medicard", value = "")
                                           @RequestParam(value = "medicard", required = false)String medicard,
                                       @ApiParam(name = "status", value = "")
                                           @RequestParam(value = "status", required = false)Integer status,
                                       @ApiParam(name = "page", value = "")
                                           @RequestParam(value = "page", required = false)Integer page,
                                       @ApiParam(name = "pageSize", value = "")
                                           @RequestParam(value = "pageSize", required = false)Integer pageSize) {
        try {
            return businessOrderService.findYktCardCharge(startTime,endTime,orderNo,yktOrderNo,patientName,idCard,medicard,status,page,pageSize);
                             @ApiParam(name = "medicard", value = "就诊卡")
                             @RequestParam(value = "medicard", required = false)String medicard,
                             @ApiParam(name = "status", value = "状态(0:未支付|1:已支付| 9退款完成)")
                             @RequestParam(value = "status", required = false)Integer status,
                             @ApiParam(name = "page", value = "页数")
                             @RequestParam(value = "page", required = false)Integer page,
                             @ApiParam(name = "pageSize", value = "页吗")
                             @RequestParam(value = "pageSize", required = false)Integer pageSize,
                             @ApiParam(name = "orderType", value = "咨询方式(1、图文、3、视频)")
                             @RequestParam(value = "orderType", required = false)String orderType,
                             @ApiParam(name = "orderCategory", value = "业务列表(1,专家咨询,2、复诊,4处方、5、就诊卡充值)")
                             @RequestParam(value = "orderCategory", required = false)String orderCategory) {
        try {
            return businessOrderService.findYktCardCharge(startTime,endTime,orderNo,yktOrderNo,patientName,idCard,medicard,status,page,pageSize, orderType, orderCategory);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
@ -2465,11 +2469,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "chargeCode", value = "chargeCode")
                                          @RequestParam(value = "chargeCode",required = false)String chargeCode,
                                      @ApiParam(name = "icdCode", value = "icdCode")
                                          @RequestParam(value = "icdCode",required = false)String icdCode){
                                          @RequestParam(value = "icdCode",required = false)String icdCode,
                                      @ApiParam(name = "preNo", value = "preNo")
                                          @RequestParam(value = "preNo",required = false)String preNo){
        try {
            return success(prescriptionService.saveNatAppointment(chargeAmount,inspectionName,mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,
                    cityName,townName,streetName,pm,pushFlag,cardNoType,getUID(),checkPart,chargeFlag,chargeCode,icdCode));
                    cityName,townName,streetName,pm,pushFlag,cardNoType,getUID(),checkPart,chargeFlag,chargeCode,icdCode,preNo));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }

+ 1141 - 1215
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -8,7 +8,6 @@ import com.yihu.jw.area.service.BaseCommitteeService;
import com.yihu.jw.area.service.BaseProvinceService;
import com.yihu.jw.area.service.BaseTownService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
@ -17,7 +16,6 @@ import com.yihu.jw.entity.base.area.BaseCommitteeDO;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
import com.yihu.jw.entity.base.area.BaseTownDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
@ -79,30 +77,30 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(PrescriptionEndpoint.class);
    @Autowired
    private PrescriptionService prescriptionService;
    
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    
    @Autowired
    private InspectionService inspectionService;
    
    @Autowired
    private DoctorPreSignService doctorPreSignService;
    
    @Autowired
    private WorkTimeService workTimeService;
    
    @Autowired
    private ImService imService;
    
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
@ -145,7 +143,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Value("${demo.flag}")
    private boolean demoFlag;
    
    @Value("${wechat.id}")
    private String wxId;
@ -161,328 +159,325 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @PostMapping(value = "updPrescriptionExpressage")
    @ApiOperation(value = "修改续方收货信息")
    public ObjEnvelop updPrescriptionExpressage(@ApiParam(name = "id", value = "收获信息id")
                                                @RequestParam(value = "id", required = true) String id,
                                                @ApiParam(name = "oneselfPickupFlg", value = "是否自取 1是 0否")
                                                @RequestParam(value = "oneselfPickupFlg", required = true) Integer oneselfPickupFlg,
                                                @ApiParam(name = "name", value = "收货人姓名")
                                                @RequestParam(value = "name", required = false) String name,
                                                @ApiParam(name = "mobile", value = "收货人电话")
                                                @RequestParam(value = "mobile", required = false) String mobile,
                                                @ApiParam(name = "address", value = "详细地址")
                                                @RequestParam(value = "address", required = false) String address,
                                                @ApiParam(name = "provinceCode", value = "省code")
                                                @RequestParam(value = "provinceCode", required = false) String provinceCode,
                                                @ApiParam(name = "provinceName", value = "省名称")
                                                @RequestParam(value = "provinceName", required = false) String provinceName,
                                                @ApiParam(name = "cityCode", value = "市code")
                                                @RequestParam(value = "cityCode", required = false) String cityCode,
                                                @ApiParam(name = "cityName", value = "市名称")
                                                @RequestParam(value = "cityName", required = false) String cityName,
                                                @ApiParam(name = "townCode", value = "区code")
                                                @RequestParam(value = "townCode", required = false) String townCode,
                                                @ApiParam(name = "townName", value = "区名称")
                                                @RequestParam(value = "townName", required = false) String townName,
                                                @ApiParam(name = "streetCode", value = "街道code")
                                                @RequestParam(value = "streetCode", required = false) String streetCode,
                                                @ApiParam(name = "streetName", value = "街道名称")
                                                @RequestParam(value = "streetName", required = false) String streetName) {
                                         @RequestParam(value = "id",required = true) String id,
                                         @ApiParam(name = "oneselfPickupFlg", value = "是否自取 1是 0否")
                                         @RequestParam(value = "oneselfPickupFlg",required = true) Integer oneselfPickupFlg,
                                         @ApiParam(name = "name", value = "收货人姓名")
                                         @RequestParam(value = "name",required = false) String name,
                                         @ApiParam(name = "mobile", value = "收货人电话")
                                             @RequestParam(value = "mobile",required = false) String mobile,
                                         @ApiParam(name = "address", value = "详细地址")
                                             @RequestParam(value = "address",required = false) String address,
                                         @ApiParam(name = "provinceCode", value = "省code")
                                             @RequestParam(value = "provinceCode",required = false) String provinceCode,
                                         @ApiParam(name = "provinceName", value = "省名称")
                                             @RequestParam(value = "provinceName",required = false) String provinceName,
                                         @ApiParam(name = "cityCode", value = "市code")
                                             @RequestParam(value = "cityCode",required = false) String cityCode,
                                         @ApiParam(name = "cityName", value = "市名称")
                                             @RequestParam(value = "cityName",required = false) String cityName,
                                         @ApiParam(name = "townCode", value = "区code")
                                             @RequestParam(value = "townCode",required = false) String townCode,
                                         @ApiParam(name = "townName", value = "区名称")
                                             @RequestParam(value = "townName",required = false) String townName,
                                         @ApiParam(name = "streetCode", value = "街道code")
                                             @RequestParam(value = "streetCode",required = false) String streetCode,
                                         @ApiParam(name = "streetName", value = "街道名称")
                                             @RequestParam(value = "streetName",required = false) String streetName){
        try {
            WlyyPrescriptionExpressageDO obj = prescriptionService.updPrescriptionExpressage(id, oneselfPickupFlg, name, mobile, address, provinceCode
                    , provinceName, cityCode, cityName, townCode, townName, streetCode, streetName);
            return success(obj);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
                                          @RequestParam(value = "patient", required = false) String patient,
                                          @RequestParam(value = "patient",required = false) String patient,
                                          @ApiParam(name = "startTime", value = "开始时间")
                                          @RequestParam(value = "startTime", required = false) String startTime,
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime", required = false) String endTime,
                                          @RequestParam(value = "endTime",required = false) String endTime,
                                          @ApiParam(name = "ksdm", value = "科室代码")
                                          @RequestParam(value = "ksdm", required = false) String ksdm,
                                              @RequestParam(value = "ksdm",required = false) String ksdm,
                                          @ApiParam(name = "cardNo", value = "就诊卡", required = false)
                                          @RequestParam(value = "cardNo", required = false) String cardNo,
                                              @RequestParam(value = "cardNo",required = false)String cardNo,
                                          @ApiParam(name = "flag", value = "标识", required = false)
                                          @RequestParam(value = "flag", required = false) String flag) throws Exception {
                                              @RequestParam(value = "flag",required = false)String flag) throws Exception {
        try {
            if (StringUtils.isNoneBlank(startTime)) {
                startTime = startTime + " 00:00:00";
            if(StringUtils.isNoneBlank(startTime)){
                startTime = startTime+" 00:00:00";
            }
            if (StringUtils.isNoneBlank(endTime)) {
                endTime = endTime + " 23:59:59";
            if(StringUtils.isNoneBlank(endTime)){
                endTime =endTime+" 23:59:59";
            }
            List<WlyyOutpatientVO> vos = new ArrayList<>();
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag, ksdm, cardNo);
            } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
                vos = tnPrescriptionService.findOutpatientList(patient, cardNo, startTime, endTime, demoFlag, ksdm, flag);
            } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
            }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
                vos = tnPrescriptionService.findOutpatientList(patient, cardNo,startTime, endTime, demoFlag,ksdm,flag);
            }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            } else {
            }else {
                return ListEnvelop.getError("尚未开发!");
            }
            return success(vos);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientInfo)
    @ApiOperation(value = " 查询单条门诊就诊记录")
    public ObjEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民id")
                                         @RequestParam(value = "patient", required = false) String patient,
                                         @RequestParam(value = "patient",required = false) String patient,
                                         @ApiParam(name = "conNo", value = "就诊次数")
                                         @RequestParam(value = "conNo", required = false) String conNo) throws Exception {
                                         @RequestParam(value = "conNo",required = false) String conNo)throws Exception{
        try {
            WlyyOutpatientVO obj = new WlyyOutpatientVO();
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                obj = prescriptionService.findOutpatientInfo(patient, conNo);
            } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
                obj = tnPrescriptionService.findOutpatientInfo(patient, conNo, demoFlag, null);
            } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                obj = prescriptionService.findOutpatientInfo(patient,conNo);
            }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
                obj = tnPrescriptionService.findOutpatientInfo(patient,conNo,demoFlag,null);
            }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            } else {
            }else {
                return ObjEnvelop.getError("尚未开发!");
            }
            return success(obj);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescriptionList)
    @ApiOperation(value = "门诊下所有处方信息")
    public ListEnvelop findOriginPrescriptionList(
            @ApiParam(name = "registerSn", value = "流水号")
            @RequestParam(value = "registerSn", required = false) String registerSn,
            @RequestParam(value = "registerSn",required = false) String registerSn,
            @ApiParam(name = "patNo", value = "病人id")
            @RequestParam(value = "patNo", required = false) String patNo,
            @RequestParam(value = "patNo",required = false) String patNo,
            @ApiParam(name = "admNo", value = "住院唯一号")
            @RequestParam(value = "admNo", required = false) String admNo,
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号")
            @RequestParam(value = "realOrder", required = false) String realOrder) throws Exception {
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        try {
            List<WlyyPrescriptionVO> obj = new ArrayList<>();
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo, demoFlag);
            } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
                obj = tnPrescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo, demoFlag);
            } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                obj= prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
            }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
                obj= tnPrescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
            }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            } else {
            }else {
                return ListEnvelop.getError("尚未开发!");
            }
            return success(obj);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescription)
    @ApiOperation(value = "历史处方信息(单条)")
    public ObjEnvelop findOriginPrescription(
            @ApiParam(name = "registerSn", value = "流水号", required = false)
            @RequestParam(value = "registerSn", required = false) String registerSn,
            @RequestParam(value = "registerSn",required = false) String registerSn,
            @ApiParam(name = "patNo", value = "病人id", required = false)
            @RequestParam(value = "patNo", required = false) String patNo,
            @RequestParam(value = "patNo",required = false) String patNo,
            @ApiParam(name = "admNo", value = "住院唯一号", required = false)
            @RequestParam(value = "admNo", required = false) String admNo,
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号", required = false)
            @RequestParam(value = "realOrder", required = false) String realOrder) throws Exception {
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        try {
            WlyyPrescriptionVO obj = prescriptionService.findOriginPrescription(registerSn, patNo, admNo, realOrder, demoFlag);
        try{
            WlyyPrescriptionVO obj = prescriptionService.findOriginPrescription(registerSn, patNo, admNo,realOrder, demoFlag);
            return success(obj);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionList)
    @ApiOperation(value = "获取续方记录列表", notes = "获取续方记录列表")
    public MixEnvelop<WlyyPrescriptionVO, WlyyPrescriptionVO> findPrescriptionList(@ApiParam(name = "patient", value = "居民code")
                                                                                   @RequestParam(value = "patient", required = false) String patient,
                                                                                   @ApiParam(name = "status", value = "状态,多状态‘,’分割,例如‘1,2’,‘1,2,3’")
                                                                                   @RequestParam(value = "status", required = false) String status,
                                                                                   @ApiParam(name = "startTime", value = "开始时间,‘yyyy-MM-dd’")
                                                                                   @RequestParam(value = "startTime", required = false) String startTime,
                                                                                   @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd’")
                                                                                   @RequestParam(value = "endTime", required = false) String endTime,
                                                                                   @ApiParam(name = "page", value = "第几页,1开始’")
                                                                                   @RequestParam(value = "page", required = false) Integer page,
                                                                                   @ApiParam(name = "size", value = "每页大小")
                                                                                   @RequestParam(value = "size", required = true) Integer size) {
        try {
            return prescriptionService.findPrescriptionList(patient, status, startTime, endTime, page, size, wxId);
    public MixEnvelop<WlyyPrescriptionVO,WlyyPrescriptionVO> findPrescriptionList(@ApiParam(name = "patient", value = "居民code")
                                                                                  @RequestParam(value = "patient", required = false) String patient,
                                                                                  @ApiParam(name = "status", value = "状态,多状态‘,’分割,例如‘1,2’,‘1,2,3’")
                                                                                  @RequestParam(value = "status", required = false)String status,
                                                                                  @ApiParam(name = "startTime", value = "开始时间,‘yyyy-MM-dd’")
                                                                                  @RequestParam(value = "startTime", required = false)String startTime,
                                                                                  @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd’")
                                                                                  @RequestParam(value = "endTime", required = false)String endTime,
                                                                                  @ApiParam(name = "page", value = "第几页,1开始’")
                                                                                  @RequestParam(value = "page", required = false)Integer page,
                                                                                  @ApiParam(name = "size", value = "每页大小")
                                                                                  @RequestParam(value = "size", required = true) Integer size) {
        try {
            return prescriptionService.findPrescriptionList(patient,status,startTime,endTime,page,size,wxId);
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientList)
    @ApiOperation(value = "查询复诊记录列表", notes = "查询复诊记录列表")
    public MixEnvelop<WlyyOutpatientVO, WlyyOutpatientVO> findReOutpatientList(@ApiParam(name = "patient", value = "居民code")
                                                                               @RequestParam(value = "patient", required = true) String patient,
                                                                               @ApiParam(name = "status", value = "状态:-1取消,0候诊中,1就诊中,2已完成")
                                                                               @RequestParam(value = "status", required = false) Integer status,
                                                                               @ApiParam(name = "startTime", value = "开始时间,‘yyyy-MM-dd’")
                                                                               @RequestParam(value = "startTime", required = false) String startTime,
                                                                               @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd’")
                                                                               @RequestParam(value = "endTime", required = false) String endTime,
                                                                               @ApiParam(name = "outpatientType", value = "1复诊2协同3咨询")
                                                                               @RequestParam(value = "outpatientType", required = false) String outpatientType,
                                                                               @ApiParam(name = "page", value = "第几页,1开始’")
                                                                               @RequestParam(value = "page", required = false) Integer page,
                                                                               @ApiParam(name = "size", value = "每页大小")
                                                                               @RequestParam(value = "size", required = true) Integer size) {
        try {
            return prescriptionService.findReOutpatientList(patient, status, startTime, endTime, outpatientType, page, size);
        } catch (Exception e) {
    public MixEnvelop<WlyyOutpatientVO,WlyyOutpatientVO> findReOutpatientList(@ApiParam(name = "patient", value = "居民code")
                                                                              @RequestParam(value = "patient", required = true) String patient,
                                                                              @ApiParam(name = "status", value = "状态:-1取消,0候诊中,1就诊中,2已完成")
                                                                              @RequestParam(value = "status", required = false) Integer status,
                                                                              @ApiParam(name = "startTime", value = "开始时间,‘yyyy-MM-dd’")
                                                                              @RequestParam(value = "startTime", required = false)String startTime,
                                                                              @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd’")
                                                                              @RequestParam(value = "endTime", required = false)String endTime,
                                                                              @ApiParam(name = "outpatientType", value = "1复诊2协同3咨询")
                                                                                  @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                                                              @ApiParam(name = "page", value = "第几页,1开始’")
                                                                              @RequestParam(value = "page", required = false)Integer page,
                                                                              @ApiParam(name = "size", value = "每页大小")
                                                                              @RequestParam(value = "size", required = true) Integer size) {
        try {
            return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,outpatientType,page,size);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientInfo)
    @ApiOperation(value = "查询复诊记录,处方,居民信息,物流(单条)", notes = "查询复诊记录,处方,居民信息,物流(单条)")
    public ObjEnvelop findReOutpatientInfo(@ApiParam(name = "outpatientId", value = "复诊ID")
                                           @RequestParam(value = "outpatientId", required = true) String outpatientId,
                                           @ApiParam(name = "prescriptionId", value = "处方ID")
                                           @RequestParam(value = "prescriptionId", required = false) String prescriptionId) throws Exception {
                                           @RequestParam(value = "prescriptionId", required = false) String prescriptionId)throws Exception{
        try {
            com.alibaba.fastjson.JSONObject obj = prescriptionService.findReOutpatientInfo(outpatientId, prescriptionId, wxId);
            com.alibaba.fastjson.JSONObject obj =  prescriptionService.findReOutpatientInfo(outpatientId,prescriptionId,wxId);
            return success(obj);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionInfo)
    @ApiOperation(value = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)", notes = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)")
    public ObjEnvelop<Map<String, Object>> findPrescriptionInfo(@ApiParam(name = "prescriptionId", value = "续方明细")
                                                                @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
    public ObjEnvelop<Map<String,Object>> findPrescriptionInfo(@ApiParam(name = "prescriptionId", value = "续方明细")
                                                               @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
        try {
            return success(BaseHospitalRequestMapping.Prescription.api_success, prescriptionService.findPrescriptionInfo(prescriptionId));
        } catch (Exception e) {
            return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.findPrescriptionInfo(prescriptionId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkPrescription)
    @ApiOperation(value = "判断是否可续方,true 可以,false不可以", notes = "判断是否可续方,true 可以,false不可以")
    public ObjEnvelop<Boolean> checkPrescription(@ApiParam(name = "patient", value = "续方明细")
                                                 @RequestParam(value = "patient", required = false) String patient) {
        
        try {
            return success(BaseHospitalRequestMapping.Prescription.api_success, prescriptionService.checkPrescription(patient));
        } catch (Exception e) {
            return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.checkPrescription(patient));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.cancelPrescription)
    @ApiOperation(value = "居民取消续方", notes = "居民取消续方")
    public ObjEnvelop<Boolean> cancelPrescription(@ApiParam(name = "prescriptionId", value = "续方ID")
                                                  @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
        
        try {
            return success(BaseHospitalRequestMapping.Prescription.api_success, prescriptionService.cancelPrescription(prescriptionId));
        } catch (Exception e) {
            return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.cancelPrescription(prescriptionId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientCard)
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民Code")
                                       @RequestParam(value = "patient", required = true) String patient) throws Exception {
                                       @RequestParam(value = "patient", required = true)String patient)throws Exception {
        try {
            if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                return success(prescriptionService.findPatientCard(patient));
            } else if ("xm_hcyy_wx".equalsIgnoreCase(wxId)) {
            }else if ("xm_hcyy_wx".equalsIgnoreCase(wxId)){
                String result = hcyyEntranceService.findPatientCard(patient);
                JSONArray jsonArray = new JSONArray();
                if (result != null && result != "") {
                if (result!=null&&result!=""){
                    JSONArray array = JSONArray.parseArray(result);
                    if (array != null && array.size() != 0) {
                    if (array!=null&&array.size()!=0){
                        jsonArray = array.getJSONArray(0);
                    }
                }
                return success(jsonArray);
            } else if ("xm_tasy_wx".equalsIgnoreCase(wxId)) {
            }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
                return success(tasyNatService.findPatientCard(patient));
            } else {
            }else {
                return ListEnvelop.getError("暂未开放");
            }
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOutpatient)
    @ApiOperation(value = "判断是否可用发起门诊", notes = "判断是否可用发起门诊")
    public ObjEnvelop checkOutpatient(@ApiParam(name = "patient", value = "续方明细")
                                      @RequestParam(value = "patient", required = true) String patient,
                                      @RequestParam(value = "patient", required = true)String patient,
                                      @ApiParam(name = "flag", value = "标识是否开启结算")
                                      @RequestParam(value = "flag", required = false) boolean flag,
                                      @RequestParam(value = "flag", required = false)boolean flag,
                                      @ApiParam(name = "outpatientType", value = "1在线复诊 2 协同 3 专家咨询")
                                      @RequestParam(value = "outpatientType", required = false) String outpatientType) throws Exception {
                                          @RequestParam(value = "outpatientType", required = false)String outpatientType)throws Exception{
        try {
            return success(prescriptionService.checkOutpatient(patient, wxId, flag, outpatientType));
        } catch (Exception e) {
            return success(prescriptionService.checkOutpatient(patient,wxId,flag,outpatientType));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllHospital)
    @ApiOperation(value = "查询所有机构", notes = "查询所有机构")
    public ListEnvelop findAllHospital(@ApiParam(name = "level", value = "医院等级")
                                       @RequestParam(value = "level", required = false) Integer level,
                                       @RequestParam(value = "level", required = false)Integer level,
                                       @ApiParam(name = "keyWord", value = "名字关键字")
                                       @RequestParam(value = "keyWord", required = false) String keyWord) {
                                       @RequestParam(value = "keyWord", required = false)String keyWord) {
        try {
            return success(prescriptionService.findAllHospital(level, keyWord));
        } catch (Exception e) {
            return success(prescriptionService.findAllHospital(level,keyWord));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByHospital)
    @ApiOperation(value = "查询机构底下部门", notes = "查询机构底下部门")
    public ListEnvelop findDeptByHospital(@ApiParam(name = "orgCode", value = "机构code")
                                          @RequestParam(value = "orgCode", required = true) String orgCode,
                                          @RequestParam(value = "orgCode", required = true)String orgCode,
                                          @ApiParam(name = "dept", value = "需要置顶部门")
                                          @RequestParam(value = "dept", required = false) String dept,
                                          @RequestParam(value = "dept", required = false)String dept,
                                          @ApiParam(name = "consultDeptFlag", value = "1为查询开通服务部门")
                                          @RequestParam(value = "consultDeptFlag", required = false) String consultDeptFlag) {
                                          @RequestParam(value = "consultDeptFlag", required = false)String consultDeptFlag) {
        try {
            return success(prescriptionService.findDeptByHospital(orgCode, dept, consultDeptFlag));
        } catch (Exception e) {
            return success(prescriptionService.findDeptByHospital(orgCode,dept,consultDeptFlag));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -491,13 +486,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptDescByDeptCodeAndOrgCode)
    @ApiOperation(value = "查询科室介绍", notes = "查询科室介绍")
    public MixEnvelop findDeptDesc(@ApiParam(name = "orgCode", value = "机构code")
                                   @RequestParam(value = "orgCode", required = true) String orgCode,
                                   @ApiParam(name = "deptCode", value = "部门code")
                                   @RequestParam(value = "deptCode", required = true) String deptCode) {
                                          @RequestParam(value = "orgCode", required = true)String orgCode,
                                          @ApiParam(name = "deptCode", value = "部门code")
                                          @RequestParam(value = "deptCode", required = true)String deptCode) {
        try {
            return prescriptionService.findDeptDesc(orgCode, deptCode);
        } catch (Exception e) {
            return prescriptionService.findDeptDesc(orgCode,deptCode);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
@ -506,200 +501,200 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByOrgCode)
    @ApiOperation(value = "查询机构下所有科室", notes = "查询机构下所有科室")
    public MixEnvelop findDeptByOrgCode(@ApiParam(name = "orgCode", value = "机构code")
                                        @RequestParam(value = "orgCode", required = true) String orgCode,
                                   @RequestParam(value = "orgCode", required = true)String orgCode,
                                        @ApiParam(name = "keyName", value = "关键字")
                                        @RequestParam(value = "keyName", required = false) String keyName) {
                                        @RequestParam(value = "keyName", required = false)String keyName) {
        try {
            return prescriptionService.findDeptByOrgCode(orgCode, keyName);
        } catch (Exception e) {
            return prescriptionService.findDeptByOrgCode(orgCode,keyName);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByKeyWord)
    @ApiOperation(value = "查询有所有已开放的科室", notes = "查询有所有已开放的科室")
    public ListEnvelop findDeptByKeyWord(@ApiParam(name = "keyWord", value = "关键字")
                                         @RequestParam(value = "keyWord", required = false) String keyWord,
                                         @RequestParam(value = "keyWord", required = false)String keyWord,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = true) Integer page,
                                         @RequestParam(value = "page",required = true) Integer page,
                                         @ApiParam(name = "pagesize", value = "分页大小")
                                         @RequestParam(value = "pagesize", required = true) Integer pagesize) {
                                         @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        try {
            return success(prescriptionService.findDeptByKeyWord(keyWord, page, pagesize));
        } catch (Exception e) {
            return success(prescriptionService.findDeptByKeyWord(keyWord,page,pagesize));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDept)
    @ApiOperation(value = "查询部门下医生", notes = "查询部门下医生")
    public ListEnvelop findDoctorByHospitalAndDept(@ApiParam(name = "orgCode", value = "机构code")
                                                   @RequestParam(value = "orgCode", required = false) String orgCode,
                                                   @RequestParam(value = "orgCode", required = false)String orgCode,
                                                   @ApiParam(name = "dept", value = "部门code")
                                                   @RequestParam(value = "dept", required = false) String dept,
                                                   @RequestParam(value = "dept", required = false)String dept,
                                                   @ApiParam(name = "chargeType", value = "号别")
                                                   @RequestParam(value = "chargeType", required = false) String chargeType,
                                                   @RequestParam(value = "chargeType", required = false)String chargeType,
                                                   @ApiParam(name = "doctorCode", value = "需要置顶医生")
                                                   @RequestParam(value = "doctorCode", required = false) String doctorCode,
                                                   @RequestParam(value = "doctorCode", required = false)String doctorCode,
                                                   @ApiParam(name = "outpatientType", value = "1图文,2视频")
                                                   @RequestParam(value = "outpatientType", required = false) String outpatientType,
                                                   @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                                   @ApiParam(name = "startDate", value = "开始时间,yyyy-MM-dd HH:mm:ss")
                                                   @RequestParam(value = "startDate", required = false) String startDate,
                                                   @RequestParam(value = "startDate", required = false)String startDate,
                                                   @ApiParam(name = "endDate", value = "结束时间,yyyy-MM-dd HH:mm:ss")
                                                   @RequestParam(value = "endDate", required = false) String endDate,
                                                   @RequestParam(value = "endDate", required = false)String endDate,
                                                   @ApiParam(name = "key", value = "关键字搜索,医生名字/科室名称/专长")
                                                   @RequestParam(value = "key", required = false) String key,
                                                   @RequestParam(value = "key", required = false)String key,
                                                   @ApiParam(name = "consultStatus", value = "是否在线")
                                                   @RequestParam(value = "consultStatus", required = false) String consultStatus) {
                                                   @RequestParam(value = "consultStatus", required = false)String consultStatus) {
        try {
            return success(prescriptionService.findDoctorByHospitalAndDept(orgCode, dept, chargeType, doctorCode, outpatientType, startDate, endDate, key, consultStatus));
        } catch (Exception e) {
            return success(prescriptionService.findDoctorByHospitalAndDept(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
    public ObjEnvelop appointmentRevisit(@ApiParam(name = "outpatientJson", value = "居民门诊json")
                                         @RequestParam(value = "outpatientJson", required = false) String outpatientJson,
                                         @RequestParam(value = "outpatientJson", required = false)String outpatientJson,
                                         @ApiParam(name = "expressageJson", value = "居民物流json")
                                         @RequestParam(value = "expressageJson", required = false) String expressageJson,
                                         @RequestParam(value = "expressageJson", required = false)String expressageJson,
                                         @ApiParam(name = "registerJson", value = "预约时间")
                                         @RequestParam(value = "registerJson", required = false) String registerJson,
                                         @RequestParam(value = "registerJson", required = false)String registerJson,
                                         @ApiParam(name = "chargeType", value = "预约实体json")
                                         @RequestParam(value = "chargeType", required = false) String chargeType) throws Exception {
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        
        try {
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson, expressageJson, registerJson, chargeType);
            if (wlyyOutpatientDO != null && null == wlyyOutpatientDO.getId() && !wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")) {
                ObjEnvelop objEnvelop = new ObjEnvelop();
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
            if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()&&!wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")){
                ObjEnvelop objEnvelop =new ObjEnvelop();
                String msg = "";
                if (1 == wlyyOutpatientDO.getRemindCount()) {
                if (1==wlyyOutpatientDO.getRemindCount()){
                    msg = "自取";
                } else {
                }else {
                    msg = "快递配送";
                }
                objEnvelop.setMessage("您已经选择过" + msg + "方式,请勿修改");
                objEnvelop.setMessage("您已经选择过"+msg+"方式,请勿修改");
                objEnvelop.setStatus(300);
                return objEnvelop;
            } else {
            }else {
                BaseDoctorDO doctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
                if (wlyyOutpatientDO.getPayStatus() != null && wlyyOutpatientDO.getPayStatus() == 1) {
                if (wlyyOutpatientDO.getPayStatus()!=null&&wlyyOutpatientDO.getPayStatus()==1){
                    //发送系统消息
                    SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO, payFlag);
                    SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
                    //发送IM消息
                    hospitalSystemMessageService.sendImMessage(systemMessageDO);
                }
                //发送医生抢单消息
                if (StringUtils.isBlank(wlyyOutpatientDO.getDoctor())) {
                if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
                    hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
                }
                if (!"zsyy".equals(qywxId) && !"xm_xzzx_wx".equals(qywxId)) {
                if(!"zsyy".equals(qywxId) && !"xm_xzzx_wx".equals(qywxId)){
                    //发送厦门i健康智能推送
                    try {
                        if (doctorDO != null && "3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())) {
                            String wxurl = wlyyUrl + "/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId=1_1&sessionType=1&from=1&content=1&businessType=new&doctor_idcard=" + doctorDO.getIdcard() + "&patientName=" + URLEncoder.encode(wlyyOutpatientDO.getPatientName()) + "&url=1";
                            logger.info("发送厦门i健康智能推送url:" + wxurl);
                    try{
                        if (doctorDO!=null&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                            String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId=1_1&sessionType=1&from=1&content=1&businessType=new&doctor_idcard="+doctorDO.getIdcard()+"&patientName="+URLEncoder.encode(wlyyOutpatientDO.getPatientName())+"&url=1";
                            logger.info("发送厦门i健康智能推送url:"+wxurl);
                            wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
                        }
                    } catch (Exception e) {
                        logger.info("发送厦门i健康智能失败" + e.toString());
                    }catch (Exception e){
                        logger.info("发送厦门i健康智能失败"+e.toString());
                    }
                }
                return success(BaseHospitalRequestMapping.Prescription.api_success, wlyyOutpatientDO);
                return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
            }
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
    @ApiOperation(value = "获取ICD10诊断编码", notes = "获取ICD10诊断编码")
    public ListEnvelop getICD10(@ApiParam(name = "pyKey", value = "拼音关键字")
                                @RequestParam(value = "pyKey", required = false) String pyKey) throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
                                @RequestParam(value = "pyKey", required = false)String pyKey)throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            return success(prescriptionService.getICD10(pyKey));
        } else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectIcd10Dict(pyKey));
        } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
            return success(tnPrescriptionService.getICD10(pyKey, false));
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getICD10(pyKey,false));
        }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            ListEnvelop listEnvelop = new ListEnvelop();
            return listEnvelop;
        } else {
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugDictionary)
    @ApiOperation(value = "获取药品字典", notes = "获取药品字典")
    public ListEnvelop getDrugDictionary(@ApiParam(name = "drugNo", value = "药品编码")
                                         @RequestParam(value = "drugNo", required = false) String drugNo,
                                         @RequestParam(value = "drugNo", required = false)String drugNo,
                                         @ApiParam(name = "pyKey", value = "拼音关键字")
                                         @RequestParam(value = "pyKey", required = false) String pyKey,
                                         @RequestParam(value = "pyKey", required = false)String pyKey,
                                         @ApiParam(name = "winNo", value = "分部编码")
                                         @RequestParam(value = "winNo", required = false) String winNo,
                                         @RequestParam(value = "winNo", required = false)String winNo,
                                         @ApiParam(name = "groupNo", value = "药房编码")
                                         @RequestParam(value = "groupNo", required = false) String groupNo) throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
            return success(prescriptionService.getDrugDictionary(drugNo, pyKey, winNo, groupNo));
        } else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
            return success(xzzxEntranceService.selectDrugDict(pyKey, drugNo));
        } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
            return success(tnPrescriptionService.getDrugDictionary(drugNo, pyKey, null, groupNo, null));
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
                                         @RequestParam(value = "groupNo", required = false)String groupNo)throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectDrugDict(pyKey,drugNo));
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getDrugDictionary(drugNo,pyKey,null,groupNo,null));
        }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            ListEnvelop listEnvelop = new ListEnvelop();
            return listEnvelop;
        } else {
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugUse)
    @ApiOperation(value = "获取用法", notes = "获取用法")
    public ListEnvelop getDrugUse(@ApiParam(name = "pyKey", value = "拼音关键字")
                                  @RequestParam(value = "pyKey", required = false) String pyKey,
                                  @RequestParam(value = "pyKey", required = false)String pyKey,
                                  @ApiParam(name = "drugNo", value = "药品编码")
                                  @RequestParam(value = "drugNo", required = false) String drugNo) throws Exception {
                                  @RequestParam(value = "drugNo", required = false)String drugNo)throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
            return success(prescriptionService.getDrugUse(drugNo, pyKey));
        } else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            return success(prescriptionService.getDrugUse(drugNo,pyKey));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectMedicineUsed(pyKey));
        } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
            return success(tnPrescriptionService.getDrugUse(pyKey, demoFlag));
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getDrugUse(pyKey,demoFlag));
        }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            ListEnvelop listEnvelop = new ListEnvelop();
            return listEnvelop;
        } else {
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugFrequency)
    @ApiOperation(value = "获取用药频次", notes = "获取用药频次")
    public ListEnvelop getDrugFrequency() throws Exception {
    public ListEnvelop getDrugFrequency()throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")) {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            return success(prescriptionService.getDrugFrequency());
        } else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectFrequencyDict());
        } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnPrescriptionService.getDrugFrequency(demoFlag));
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
        }else if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
            ListEnvelop listEnvelop = new ListEnvelop();
            return listEnvelop;
        } else {
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
    }
@ -707,39 +702,39 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.deletePrescriptionByid)
    @ApiOperation(value = "删除处方草稿", notes = "删除处方草稿")
    public Envelop deletePrescription(@ApiParam(name = "id", value = "处方id")
                                      @RequestParam(value = "id", required = true) String id) throws Exception {
                                              @RequestParam(value = "id", required = true)String id)throws Exception {
        try {
        try{
            return success(prescriptionService.deletePrescription(id));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.makeDiagnosis)
    @ApiOperation(value = "下诊断", notes = "下诊断接口")
    public ObjEnvelop makeDiagnosis(@ApiParam(name = "outPatientId", value = "门诊编号")
                                    @RequestParam(value = "outPatientId", required = true) String outPatientId,
                                    @RequestParam(value = "outPatientId", required = true)String outPatientId,
                                    @ApiParam(name = "advice", value = "医嘱")
                                    @RequestParam(value = "advice", required = false) String advice,
                                    @RequestParam(value = "advice", required = false)String advice,
                                    @ApiParam(name = "type", value = "1需要提交his,2不提交只下诊断")
                                    @RequestParam(value = "type", required = true) String type,
                                    @RequestParam(value = "type", required = true)String type,
                                    @ApiParam(name = "infoJsons", value = "药品json")
                                    @RequestParam(value = "infoJsons", required = false) String infoJsons,
                                    @RequestParam(value = "infoJsons", required = false)String infoJsons,
                                    @ApiParam(name = "diagnosisJson", value = "诊断json")
                                    @RequestParam(value = "diagnosisJson", required = true) String diagnosisJson,
                                    @RequestParam(value = "diagnosisJson", required = true)String diagnosisJson,
                                    @ApiParam(name = "inspectionJson", value = "检查检验")
                                    @RequestParam(value = "inspectionJson", required = false) String inspectionJson,
                                    @RequestParam(value = "inspectionJson", required = false)String inspectionJson,
                                    @ApiParam(name = "emrJson", value = "电子病历")
                                    @RequestParam(value = "emrJson", required = false) String emrJson,
                                        @RequestParam(value = "emrJson", required = false)String emrJson,
                                    @ApiParam(name = "prescriptionId", value = "处方id")
                                    @RequestParam(value = "prescriptionId", required = false) String prescriptionId,
                                        @RequestParam(value = "prescriptionId", required = false)String prescriptionId,
                                    @ApiParam(name = "hisId", value = "审方唯一标识")
                                    @RequestParam(value = "hisId", required = false) String hisId,
                                        @RequestParam(value = "hisId", required = false)String hisId,
                                    @ApiParam(name = "orderId", value = "上门服务订单号")
                                    @RequestParam(value = "orderId", required = false) String orderId) throws Exception {
        Map<String, Object> result = prescriptionService.makeDiagnosis(outPatientId, prescriptionId, advice, type, infoJsons, diagnosisJson, inspectionJson, emrJson, hisId);
                                        @RequestParam(value = "orderId", required = false)String orderId)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,prescriptionId,advice,type,infoJsons,diagnosisJson,inspectionJson,emrJson,hisId);
        try {
            com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
@ -747,232 +742,198 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = (List<WlyyPrescriptionDiagnosisDO>) com.alibaba.fastjson.JSONArray.parseArray(diagnosisJson, WlyyPrescriptionDiagnosisDO.class);
            String zd_str = "";
            String jl_str = advice;
            for (WlyyPrescriptionDiagnosisDO diagnosisDO : diagnosisDOs) {
                if ("1".equals(diagnosisDO.getType())) {
                    zd_str += diagnosisDO.getName() + "," + zd_str;
                } else {
                    zd_str += diagnosisDO.getName() + ",";
            for(WlyyPrescriptionDiagnosisDO diagnosisDO:diagnosisDOs){
                if("1".equals(diagnosisDO.getType())){
                    zd_str+=diagnosisDO.getName()+","+zd_str;
                }else {
                    zd_str+=diagnosisDO.getName()+",";
                }
            }
            zd_str = zd_str.substring(0, zd_str.length() - 1);
            msgObj.put("zd", zd_str);
            msgObj.put("jl", jl_str);
            msgObj.put("outpatientid", outPatientId);
            zd_str = zd_str.substring(0,zd_str.length()-1);
            msgObj.put("zd",zd_str);
            msgObj.put("jl",jl_str);
            msgObj.put("outpatientid",outPatientId);
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
            String immsg = imService.pushHuiZhenMsg(msgObj, wlyyOutpatientDO.getDoctor(), wlyyOutpatientDO.getDoctorName(), outPatientId, wlyyOutpatientDO.getPatient(), wlyyOutpatientDO.getOutpatientType());
            System.out.println("发送诊断消息成功:" + immsg);
            if (result.get("prescriptionId") != null && StringUtils.isNoneBlank(orderId)) {
                prescriptionService.savePrescriptionToDoorService(orderId, result.get("prescriptionId").toString());
            String immsg = imService.pushHuiZhenMsg(msgObj,wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getDoctorName(),outPatientId,wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getOutpatientType());
            System.out.println("发送诊断消息成功:"+immsg);
            if (result.get("prescriptionId")!=null&&StringUtils.isNoneBlank(orderId)){
              prescriptionService.savePrescriptionToDoorService(orderId,result.get("prescriptionId").toString());
            }
        } catch (Exception e) {
            System.out.println("发送诊断消息失败:" + e.getMessage());
        }catch (Exception e){
            System.out.println("发送诊断消息失败:"+e.getMessage());
//            e.printStackTrace();
        }
        return success(result);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findExpressageList)
    @ApiOperation(value = "获取订单列表", notes = "获取订单列表")
    public MixEnvelop findExpressageList(@ApiParam(name = "status", value = "流程状态,多状态用‘,’分割")
                                         @RequestParam(value = "status", required = false) String status,
                                         @RequestParam(value = "status", required = false)String status,
                                         @ApiParam(name = "oneselfPickupFlg", value = "是否自取 1是 0否")
                                         @RequestParam(value = "oneselfPickupFlg", required = false) String oneselfPickupFlg,
                                         @RequestParam(value = "oneselfPickupFlg", required = false)String oneselfPickupFlg,
                                         @ApiParam(name = "nameKey", value = "配送员名称")
                                         @RequestParam(value = "nameKey", required = false) String nameKey,
                                         @RequestParam(value = "nameKey", required = false)String nameKey,
                                         @ApiParam(name = "patientName", value = "就诊人")
                                         @RequestParam(value = "patientName", required = false) String patientName,
                                             @RequestParam(value = "patientName", required = false)String patientName,
                                         @ApiParam(name = "startTime", value = "开始时间,yyyy-MM-dd")
                                         @RequestParam(value = "startTime", required = false) String startTime,
                                         @RequestParam(value = "startTime", required = false)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd")
                                         @RequestParam(value = "endTime", required = false) String endTime,
                                         @RequestParam(value = "endTime", required = false)String endTime,
                                         @ApiParam(name = "page", value = "第几页,1开始")
                                         @RequestParam(value = "page", required = false) Integer page,
                                         @RequestParam(value = "page", required = false)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = false) Integer size) {
                                         @RequestParam(value = "size", required = false)Integer size) {
        try {
            return prescriptionService.findExpressageList(status, oneselfPickupFlg, nameKey, startTime, endTime, page, size, wxId, patientName);
        } catch (Exception e) {
            return prescriptionService.findExpressageList(status,oneselfPickupFlg,nameKey,startTime,endTime,page,size,wxId,patientName);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.setMailno)
    @ApiOperation(value = "设置订单编号", notes = "设置订单编号")
    public ObjEnvelop setMailno(@ApiParam(name = "mailno", value = "订单号")
                                @RequestParam(value = "mailno", required = false) String mailno,
                                @RequestParam(value = "mailno", required = false)String mailno,
                                @ApiParam(name = "expressageId", value = "订单id")
                                @RequestParam(value = "expressageId", required = false) String expressageId) {
                                @RequestParam(value = "expressageId", required = false)String expressageId) {
        try {
            return success(prescriptionService.setMailno(mailno, expressageId));
        } catch (Exception e) {
        try{
            return success(prescriptionService.setMailno(mailno,expressageId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.pushListWrite)
    @ApiOperation(value = "订单导出", notes = "订单导出")
    public void pushListWrite(@ApiParam(name = "status", value = "流程状态,多状态用‘,’分割")
                              @RequestParam(value = "status", required = false) String status,
                              @RequestParam(value = "status", required = false)String status,
                              @ApiParam(name = "oneselfPickupFlg", value = "是否自取 1是 0否")
                              @RequestParam(value = "oneselfPickupFlg", required = false) String oneselfPickupFlg,
                              @RequestParam(value = "oneselfPickupFlg", required = false)String oneselfPickupFlg,
                              @ApiParam(name = "nameKey", value = "配送员名称")
                              @RequestParam(value = "nameKey", required = false) String nameKey,
                              @RequestParam(value = "nameKey", required = false)String nameKey,
                              @ApiParam(name = "patientName", value = "就诊人姓名")
                              @RequestParam(value = "patientName", required = false) String patientName,
                              @RequestParam(value = "patientName", required = false)String patientName,
                              @ApiParam(name = "startTime", value = "开始时间,yyyy-MM-dd")
                              @RequestParam(value = "startTime", required = false) String startTime,
                              @RequestParam(value = "startTime", required = false)String startTime,
                              @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd")
                              @RequestParam(value = "endTime", required = false) String endTime,
                              HttpServletResponse response) throws Exception {
        MixEnvelop expressages = prescriptionService.findExpressageList(status, oneselfPickupFlg, nameKey, startTime, endTime, 1, 10000, wxId, patientName);
        List<Map<String, Object>> list = expressages.getDetailModelList();
                              @RequestParam(value = "endTime", required = false)String endTime,
                              HttpServletResponse response) throws Exception{
        MixEnvelop expressages = prescriptionService.findExpressageList(status,oneselfPickupFlg,nameKey,startTime,endTime,1,10000,wxId,patientName);
        List<Map<String,Object>> list = expressages.getDetailModelList();
        response.setContentType("octets/stream");
        response.setHeader("Content-Disposition", "attachment; filename=" + new String("pushDataList.xls"));
        response.setHeader("Content-Disposition", "attachment; filename="+ new String( "pushDataList.xls"));
        OutputStream os = response.getOutputStream();
        prescriptionService.pushListWrite(os, list);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.searchRecordWrite)
    @ApiOperation(value = "咨询记录导出", notes = "咨询记录导出")
    public Envelop searchRecordWrite(/*@ApiParam(name = "doctor", value = "医生id")
                                         @RequestParam(value = "doctor",required = false) String doctor,
                                     @ApiParam(name = "title", value = "咨询标题关键字")
                                         @RequestParam(value = "title",required = false) String title,
                                     @ApiParam(name = "patient", value = "患者id")
                                         @RequestParam(value = "patient",required = false) String patient,
                                     @ApiParam(name = "id", value = "咨询ID")
                                         @RequestParam(value = "id",required = false) String id,
                                     @ApiParam(name = "type", value = "咨询类型")
                                         @RequestParam(value = "type",required = true) String type,
                                     @ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
                                         @RequestParam(value = "status",required = true) Integer status,
                                     @ApiParam(name = "start_time", value = "开始时间 YYYY-MM-DD HH:MM:SS")
                                         @RequestParam(value = "start_time",required = false) String start_time,
                                     @ApiParam(name = "end_time", value = "结束时间 YYYY-MM-DD HH:MM:SS")
                                         @RequestParam(value = "end_time",required = false) String end_time,*/
                                     HttpServletResponse response) throws Exception {
        try {
            MixEnvelop expressages = imService.recordByDoctor();//doctor, id, type, status, title, start_time, end_time, patient
            List<Map<String, Object>> list = expressages.getDetailModelList();
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("searchRecordWrite.xls"));
            OutputStream os = response.getOutputStream();
            prescriptionService.searchRecordWrite(os, list);
            return success(expressages);
        } catch (Exception e) {
            return failedException(e);
        }
        prescriptionService.pushListWrite(os,list);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByDeptTypeCode)
    @ApiOperation(value = "就诊费用查询", notes = "就诊费用查询")
    public ListEnvelop findByDeptTypeCode(@ApiParam(name = "deptTypeCode", value = "6总部7金榜8夏禾")
                                          @RequestParam(value = "deptTypeCode", required = false) String deptTypeCode) throws Exception {
                                          @RequestParam(value = "deptTypeCode", required = false)String deptTypeCode) throws Exception{
        try {
            return success(prescriptionService.findByDeptTypeCode(deptTypeCode));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getCardInfo)
    @ApiOperation(value = "获取卡信息", notes = "获取卡信息")
    public ObjEnvelop getCardInfo(@ApiParam(name = "cardNo", value = "卡号")
                                  @RequestParam(value = "cardNo", required = false) String cardNo) throws Exception {
        return success(prescriptionService.getCardInfo(cardNo, demoFlag));
                                  @RequestParam(value = "cardNo", required = false)String cardNo) throws Exception {
        return success(prescriptionService.getCardInfo(cardNo,demoFlag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWithWork)
    @ApiOperation(value = "查询医生带排班", notes = "查询医生带排班")
    public ObjEnvelop findDoctorWithWork(@ApiParam(name = "orgCode", value = "机构code")
                                         @RequestParam(value = "orgCode", required = false) String orgCode,
                                         @RequestParam(value = "orgCode", required = false)String orgCode,
                                         @ApiParam(name = "dept", value = "部门code")
                                         @RequestParam(value = "dept", required = false) String dept,
                                         @RequestParam(value = "dept", required = false)String dept,
                                         @ApiParam(name = "doctorCode", value = "需要置顶医生code")
                                         @RequestParam(value = "doctorCode", required = false) String doctorCode,
                                         @RequestParam(value = "doctorCode", required = false)String doctorCode,
                                         @ApiParam(name = "chargeType", value = "号别")
                                         @RequestParam(value = "chargeType", required = false) String chargeType,
                                         @RequestParam(value = "chargeType", required = false)String chargeType,
                                         @ApiParam(name = "outpatientType", value = "1图文,2视频")
                                         @RequestParam(value = "outpatientType", required = false) String outpatientType,
                                         @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                         @ApiParam(name = "startDate", value = "开始时间,yyyy-MM-dd HH:mm:ss")
                                         @RequestParam(value = "startDate", required = false) String startDate,
                                         @RequestParam(value = "startDate", required = false)String startDate,
                                         @ApiParam(name = "endDate", value = "结束时间,yyyy-MM-dd HH:mm:ss")
                                         @RequestParam(value = "endDate", required = false) String endDate,
                                         @RequestParam(value = "endDate", required = false)String endDate,
                                         @ApiParam(name = "key", value = "关键字搜索,医生名字/科室名称/专长")
                                         @RequestParam(value = "key", required = false) String key,
                                         @RequestParam(value = "key", required = false)String key,
                                         @ApiParam(name = "consultStatus", value = "是否在线")
                                         @RequestParam(value = "consultStatus", required = false) String consultStatus,
                                         @RequestParam(value = "consultStatus", required = false)String consultStatus,
                                         @ApiParam(name = "ywCode", value = "业务Code")
                                         @RequestParam(value = "ywCode", required = false) String ywCode,
                                             @RequestParam(value = "ywCode", required = false)String ywCode,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = true) Integer page,
                                         @RequestParam(value = "page", required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true) Integer size) {
                                         @RequestParam(value = "size", required = true)Integer size) {
        
        try {
            return success(prescriptionService.findDoctorWithWork(orgCode, dept, chargeType, doctorCode, outpatientType, startDate, endDate, key, consultStatus, page, size, ywCode));
            return success(prescriptionService.findDoctorWithWork(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus,page,size,ywCode));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWithMouthWork)
    @ApiOperation(value = "查询医生列表带月份排班状态", notes = "查询医生列表带月份排班状态")
    public ObjEnvelop findDoctorWithMouthWork(@ApiParam(name = "orgCode", value = "机构code")
                                              @RequestParam(value = "orgCode", required = true) String orgCode,
                                              @RequestParam(value = "orgCode", required = true)String orgCode,
                                              @ApiParam(name = "dept", value = "部门code")
                                              @RequestParam(value = "dept", required = false) String dept,
                                              @RequestParam(value = "dept", required = false)String dept,
                                              @ApiParam(name = "date", value = "yyyy-MM")
                                              @RequestParam(value = "date", required = true) String date,
                                              @RequestParam(value = "date", required = true)String date,
                                              @ApiParam(name = "chargeType", value = "号别")
                                              @RequestParam(value = "chargeType", required = false) String chargeType,
                                              @RequestParam(value = "chargeType", required = false)String chargeType,
                                              @ApiParam(name = "nameKey", value = "名字关键字")
                                              @RequestParam(value = "nameKey", required = false) String nameKey,
                                              @RequestParam(value = "nameKey", required = false)String nameKey,
                                              @ApiParam(name = "iswork", value = "不传全部,1.当月已经排班,2.当月未排班")
                                              @RequestParam(value = "iswork", required = false) String iswork,
                                              @RequestParam(value = "iswork", required = false)String iswork,
                                              @ApiParam(name = "page", value = "第几页")
                                              @RequestParam(value = "page", required = true) Integer page,
                                              @RequestParam(value = "page", required = true)Integer page,
                                              @ApiParam(name = "size", value = "每页大小")
                                              @RequestParam(value = "size", required = true) Integer size) {
                                              @RequestParam(value = "size", required = true)Integer size) {
        
        try {
            return success(prescriptionService.findDoctorWithMouthWork(orgCode, dept, chargeType, date, nameKey, iswork, page, size));
        } catch (Exception e) {
            return success(prescriptionService.findDoctorWithMouthWork(orgCode,dept,chargeType,date,nameKey,iswork,page,size));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWorkTimeInfo)
    @ApiOperation(value = "获取具体号源", notes = "获取具体号源")
    public ListEnvelop findWorkTimeInfo(@ApiParam(name = "id", value = "排班id")
                                        @RequestParam(value = "id", required = false) String id) {
                                        @RequestParam(value = "id", required = false)String id) {
        try {
            return success(prescriptionService.findWorkTimeInfo(id));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorInfo)
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop findDoctorInfo(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true) String doctor,
                                     @RequestParam(value = "doctor", required = true)String doctor,
                                     @ApiParam(name = "withWork", value = "传1带排班,其他不带")
                                     @RequestParam(value = "withWork", required = false) String withWork,
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                     @RequestParam(value = "patient", required = false) String patient) {
                                         @RequestParam(value = "patient", required = false)String patient){
        try {
            return success(prescriptionService.findDoctorInfo(doctor, withWork, patient));
        } catch (Exception e) {
            return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
@ -980,64 +941,64 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateDoctorInfo)
    @ApiOperation(value = "更新医生信息", notes = "更新医生信息")
    public ObjEnvelop updateDoctorInfo(@ApiParam(name = "id", value = "医生id")
                                       @RequestParam(value = "id", required = true) String id,
                                     @RequestParam(value = "id", required = true)String id,
                                       @ApiParam(name = "img", value = "风采图")
                                       @RequestParam(value = "img", required = false) String img,
                                       @RequestParam(value = "img", required = false)String img,
                                       @ApiParam(name = "photo", value = "头像")
                                       @RequestParam(value = "photo", required = false) String photo,
                                           @RequestParam(value = "photo", required = false)String photo,
                                       @ApiParam(name = "background", value = "医生id")
                                       @RequestParam(value = "background", required = false) String background,
                                           @RequestParam(value = "background", required = false)String background,
                                       @ApiParam(name = "expertise", value = "医生特长")
                                       @RequestParam(value = "expertise", required = false) String expertise,
                                           @RequestParam(value = "expertise", required = false)String expertise,
                                       @ApiParam(name = "visitHospital", value = "出诊医院code")
                                       @RequestParam(value = "visitHospital", required = false) String visitHospital,
                                           @RequestParam(value = "visitHospital", required = false)String visitHospital,
                                       @ApiParam(name = "visitHospitalName", value = "出诊医院名称")
                                       @RequestParam(value = "visitHospitalName", required = false) String visitHospitalName,
                                           @RequestParam(value = "visitHospitalName", required = false)String visitHospitalName,
                                       @ApiParam(name = "visitDept", value = "出诊科室code")
                                       @RequestParam(value = "visitDept", required = false) String visitDept,
                                           @RequestParam(value = "visitDept", required = false)String visitDept,
                                       @ApiParam(name = "visitDeptName", value = "出诊科室名称")
                                       @RequestParam(value = "visitDeptName", required = false) String visitDeptName,
                                           @RequestParam(value = "visitDeptName", required = false)String visitDeptName,
                                       @ApiParam(name = "backgroundId", value = "背景id")
                                       @RequestParam(value = "backgroundId", required = false) String backgroundId,
                                           @RequestParam(value = "backgroundId", required = false)String backgroundId,
                                       @ApiParam(name = "name", value = "姓名")
                                       @RequestParam(value = "name", required = false) String name,
                                           @RequestParam(value = "name", required = false)String name,
                                       @ApiParam(name = "sex", value = "性别")
                                       @RequestParam(value = "sex", required = false) Integer sex,
                                           @RequestParam(value = "sex", required = false)Integer sex,
                                       @ApiParam(name = "learning", value = "学术背景")
                                       @RequestParam(value = "learning", required = false) String learning,
                                           @RequestParam(value = "learning", required = false)String learning,
                                       @ApiParam(name = "introduce", value = "简介")
                                       @RequestParam(value = "introduce", required = false) String introduce) {
                                           @RequestParam(value = "introduce", required = false)String introduce){
        try {
            return success(prescriptionService.updateDoctorInfo(id, img, background, expertise, visitHospital, visitHospitalName, visitDept, visitDeptName, backgroundId, name, sex, learning, introduce, photo));
            return success(prescriptionService.updateDoctorInfo(id, img,background,expertise, visitHospital, visitHospitalName, visitDept, visitDeptName, backgroundId,name,sex,learning,introduce,photo));
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorBaseInfo)
    @ApiOperation(value = "获取医生基本信息信息", notes = "获取医生基本信息信息")
    public ObjEnvelop findDoctorBaseInfo(@ApiParam(name = "doctor", value = "医生code")
                                         @RequestParam(value = "doctor", required = true) String doctor) {
                                         @RequestParam(value = "doctor", required = true)String doctor){
        try {
            return success(prescriptionService.findDoctorBaseInfo(doctor));
        } catch (Exception e) {
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.cancelOutPatient)
    @ApiOperation(value = "取消复诊", notes = "取消复诊")
    public ObjEnvelop cancelOutPatient(@ApiParam(name = "outPatientId", value = "门诊记录")
                                       @RequestParam(value = "outPatientId", required = false) String outPatientId,
                                       @RequestParam(value = "outPatientId", required = false)String outPatientId,
                                       @ApiParam(name = "cancelType", value = "取消原因类型")
                                       @RequestParam(value = "cancelType", required = false) String cancelType,
                                       @RequestParam(value = "cancelType", required = false)String cancelType,
                                       @ApiParam(name = "cancelValue", value = "取消原因名称")
                                       @RequestParam(value = "cancelValue", required = false) String cancelValue,
                                       @RequestParam(value = "cancelValue", required = false)String cancelValue,
                                       @ApiParam(name = "cancelRemark", value = "取消原因详细说明")
                                       @RequestParam(value = "cancelRemark", required = false) String cancelRemark) {
                                       @RequestParam(value = "cancelRemark", required = false)String cancelRemark) {
        //修改consult门诊状态
        //修改consult门诊状态
@ -1050,129 +1011,129 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            }
        }*/
        try {
        try{
            try {
                String consultCode = imService.getConsultCodeByOutpatientId(outPatientId);
                System.out.println("consultCode" + consultCode);
                if (StringUtils.isNoneBlank(consultCode)) {
                System.out.println("consultCode"+consultCode);
                if(StringUtils.isNoneBlank(consultCode)) {
                    ConsultDo consultDo = consultDao.findByRelationCode(outPatientId);
                    if (null != consultDo) {
                    if(null!=consultDo){
                        imService.cancelRevisit(consultCode, consultDo.getPatient(), 1);
                    }
                }
                if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
                    String msgUrl = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId=" + outPatientId;
                    prescriptionService.sendZsMsgFlow("OL_WZ_CANCEL", outPatientId, "", msgUrl, "取消问诊(用户)");
                if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                    String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+outPatientId;
                    prescriptionService.sendZsMsgFlow("OL_WZ_CANCEL",outPatientId,"",msgUrl,"取消问诊(用户)");
                }
            } catch (Exception e) {
            }catch (Exception e){
                System.out.println("居民取消复诊失败");
                e.printStackTrace();
            }
            return success(prescriptionService.cancelOutPatient(outPatientId, cancelType, cancelValue, cancelRemark, 1, wxId));
        } catch (Exception e) {
            return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,1,wxId));
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCancelReasonList)
    @ApiOperation(value = "获取居民取消原因字典", notes = "获取居民取消原因字典")
    public ListEnvelop findCancelReasonList() {
    public ListEnvelop findCancelReasonList(){
        try {
            return success(prescriptionService.findCancelReasonList());
        } catch (Exception e) {
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findFastRegisterDate)
    @ApiOperation(value = "獲取快速咨詢時間", notes = "獲取快速咨詢時間")
    public ListEnvelop findFastRegisterDate() {
    public ListEnvelop findFastRegisterDate(){
        try {
            return success(prescriptionService.findFastRegisterDate());
        } catch (Exception e) {
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByTimeSlot)
    @ApiOperation(value = "获取快速咨询时间分段", notes = "获取快速咨询时间分段")
    public ListEnvelop findByTimeSlot(@ApiParam(name = "startTime", value = "开始时间")
                                      @RequestParam(value = "startTime", required = false) String startTime,
                                      @RequestParam(value = "startTime", required = false)String startTime,
                                      @ApiParam(name = "endTime", value = "结束时间")
                                      @RequestParam(value = "endTime", required = false) String endTime) {
                                      @RequestParam(value = "endTime", required = false)String endTime) {
        try {
            return success(prescriptionService.findByTimeSlot(startTime, endTime));
        } catch (Exception e) {
            return success(prescriptionService.findByTimeSlot(startTime,endTime));
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWorkTimeByMonth)
    @ApiOperation(value = "查询某个医生某个月份排班记录", notes = "查询某个医生某个月份排班记录")
    public ListEnvelop findDoctorWorkTimeByMonth(@ApiParam(name = "doctor", value = "医生code")
                                                 @RequestParam(value = "doctor", required = true) String doctor,
                                                 @RequestParam(value = "doctor", required = true)String doctor,
                                                 @ApiParam(name = "date", value = "年份和月份,yyyy-MM")
                                                 @RequestParam(value = "date", required = false) String date,
                                                 @RequestParam(value = "date", required = false)String date,
                                                 @ApiParam(name = "startDate", value = "yyyy-MM-dd")
                                                 @RequestParam(value = "startDate", required = false) String startDate,
                                                 @RequestParam(value = "startDate", required = false)String startDate,
                                                 @ApiParam(name = "endDate", value = "yyyy-MM-dd")
                                                 @RequestParam(value = "endDate", required = false) String endDate) {
                                                 @RequestParam(value = "endDate", required = false)String endDate) {
        try {
            return success(prescriptionService.findDoctorWorkTimeByMonth(doctor, date, startDate, endDate));
        } catch (Exception e) {
            return success(prescriptionService.findDoctorWorkTimeByMonth(doctor,date,startDate,endDate));
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWorkRule)
    @ApiOperation(value = "查询排班规则", notes = "查询排班规则")
    public ListEnvelop findWorkRule(@ApiParam(name = "hospital", value = "医生code")
                                    @RequestParam(value = "hospital", required = true) String hospital) {
                                    @RequestParam(value = "hospital", required = true)String hospital) {
        try {
            return success(prescriptionService.findWorkRule("Scheduling", hospital));
        } catch (Exception e) {
            return success(prescriptionService.findWorkRule("Scheduling",hospital));
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateWorkRule)
    @ApiOperation(value = "保存排班规则", notes = "保存排班规则")
    public ObjEnvelop updateWorkRule(@ApiParam(name = "workRoleJsons", value = "排班规则json")
                                     @RequestParam(value = "workRoleJsons", required = true) String workRoleJsons) {
                                     @RequestParam(value = "workRoleJsons", required = true)String workRoleJsons) {
        try {
            return success(prescriptionService.updateWorkRule(workRoleJsons));
        } catch (Exception e) {
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorWorkTimeJson)
    @ApiOperation(value = "排班批量保存接口", notes = "排班批量保存接口")
    public ObjEnvelop saveDoctorWorkTimeJson(@ApiParam(name = "type", value = "1.全医院,2.科室,3.医生")
                                             @RequestParam(value = "type", required = true) String type,
                                             @RequestParam(value = "type", required = true)String type,
                                             @ApiParam(name = "codes", value = "1.医院code,2.科室code,‘,’分割,3.医生code,‘,’分割")
                                             @RequestParam(value = "codes", required = true) String codes,
                                             @RequestParam(value = "codes", required = true)String codes,
                                             @ApiParam(name = "workTimeJson", value = "排班列表json")
                                             @RequestParam(value = "workTimeJson", required = true) String workTimeJson,
                                             @RequestParam(value = "workTimeJson", required = true)String workTimeJson,
                                             @ApiParam(name = "date", value = "yyyy-MM,支持‘,’分割")
                                             @RequestParam(value = "date", required = false) String date) throws Exception {
                                             @RequestParam(value = "date", required = false)String date)throws Exception {
        try {
            return success(prescriptionService.saveDoctorWorkTimeJson(type, codes, workTimeJson, date));
        } catch (Exception e) {
            return success(prescriptionService.saveDoctorWorkTimeJson(type,codes,workTimeJson,date));
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
@ -1182,13 +1143,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.doctorSaveWorkTimeJson)
    @ApiOperation(value = "医生自主排班保存接口", notes = "医生自主排班保存接口")
    public ObjEnvelop doctorSaveWorkTimeJson(@ApiParam(name = "codes", value = "医生code,‘,’分割")
                                             @RequestParam(value = "codes", required = true) String codes,
                                             @RequestParam(value = "codes", required = true)String codes,
                                             @ApiParam(name = "workTimeJson", value = "排班列表json")
                                             @RequestParam(value = "workTimeJson", required = true) String workTimeJson,
                                             @RequestParam(value = "workTimeJson", required = true)String workTimeJson,
                                             @ApiParam(name = "date", value = "yyyy-MM,支持‘,’分割")
                                             @RequestParam(value = "date", required = false) String date) throws Exception {
                                             @RequestParam(value = "date", required = false)String date)throws Exception {
        try {
            return success(prescriptionService.doctorSaveWorkTimeJson(codes, workTimeJson, date));
            return success(prescriptionService.doctorSaveWorkTimeJson(codes,workTimeJson,date));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -1198,20 +1159,19 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateWorkTime)
    @ApiOperation(value = "医生自主排班编辑接口", notes = "医生自主排班编辑接口")
    public ObjEnvelop doctorUpdateWorkTimeJson(@ApiParam(name = "workTimeJson", value = "排班列表json")
                                               @RequestParam(value = "workTimeJson", required = true) String workTimeJson,
                                               @ApiParam(name = "codes", value = "医生code,‘,’分割")
                                               @RequestParam(value = "codes", required = true) String codes) throws Exception {
                                             @RequestParam(value = "workTimeJson", required = true)String workTimeJson,
                                             @ApiParam(name = "codes", value = "医生code,‘,’分割")
                                             @RequestParam(value = "codes", required = true)String codes)throws Exception {
        try {
            return success(prescriptionService.doctorUpdateWorkTimeJson(workTimeJson, codes));
            return success(prescriptionService.doctorUpdateWorkTimeJson(workTimeJson,codes));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.deleteWorkTime)
    @ApiOperation(value = "医生自主排班删除接口", notes = "医生自主排班删除接口")
    public ObjEnvelop deleteWorkTime(@ApiParam(name = "code", value = "排班id")
                                     @RequestParam(value = "code", required = true) String code) throws Exception {
                                             @RequestParam(value = "code", required = true)String code)throws Exception {
        try {
            return success(prescriptionService.deleteWorkTime(code));
        } catch (Exception e) {
@ -1224,57 +1184,56 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public Envelop test()throws Exception {
        return success(prescriptionService.test());
    }*/
    
    @PostMapping(value = "test2")
    @ApiOperation(value = "test2", notes = "test2")
    public Envelop test(String no) throws Exception {
    public Envelop test(String no)throws Exception {
        try {
            return success(prescriptionService.test2(no));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    
    @PostMapping(value = "/sendMes")
    @ApiOperation(value = "心脏模板消息推送", notes = "心脏模板消息推送")
    public Envelop sendMes(@ApiParam(name = "wxId", value = "wxId")
                           @RequestParam(value = "wxId", required = true) String wxId,
                           @RequestParam(value = "wxId", required = true)String wxId,
                           @ApiParam(name = "patient", value = "居民ID")
                           @RequestParam(value = "patient", required = false) String patient,
                           @RequestParam(value = "patient", required = false)String patient,
                           @ApiParam(name = "cardNo", value = "卡号")
                           @RequestParam(value = "cardNo", required = false) String cardNo,
                           @RequestParam(value = "cardNo", required = false)String cardNo,
                           @ApiParam(name = "first", value = "头部")
                           @RequestParam(value = "first", required = true) String first,
                           @RequestParam(value = "first", required = true)String first,
                           @ApiParam(name = "noticeContent", value = "内容")
                           @RequestParam(value = "noticeContent", required = true) String noticeContent,
                           @RequestParam(value = "noticeContent", required = true)String noticeContent,
                           @ApiParam(name = "remark", value = "备注")
                           @RequestParam(value = "remark", required = true) String remark,
                           @RequestParam(value = "remark", required = true)String remark,
                           @ApiParam(name = "redirectUrl", value = "跳转链接")
                           @RequestParam(value = "redirectUrl", required = true) String redirectUrl) {
        return success(xzzxEntranceService.sendMes(wxId, patient, cardNo, first, noticeContent, remark, redirectUrl));
                           @RequestParam(value = "redirectUrl", required = true)String redirectUrl) {
        return success(xzzxEntranceService.sendMes(wxId,patient,cardNo,first,noticeContent,remark,redirectUrl));
    }
    @PostMapping(value = "/sendXCXMes")
    @ApiOperation(value = "心脏模板消息推送小程序跳转", notes = "心脏模板消息推送小程序跳转")
    public Envelop sendXCXMes(@ApiParam(name = "wxId", value = "wxId")
                              @RequestParam(value = "wxId", required = true) String wxId,
                              @RequestParam(value = "wxId", required = true)String wxId,
                              @ApiParam(name = "patient", value = "居民ID")
                              @RequestParam(value = "patient", required = false) String patient,
                              @RequestParam(value = "patient", required = false)String patient,
                              @ApiParam(name = "cardNo", value = "卡号")
                              @RequestParam(value = "cardNo", required = false) String cardNo,
                              @RequestParam(value = "cardNo", required = false)String cardNo,
                              @ApiParam(name = "first", value = "头部")
                              @RequestParam(value = "first", required = true) String first,
                              @RequestParam(value = "first", required = true)String first,
                              @ApiParam(name = "noticeContent", value = "内容")
                              @RequestParam(value = "noticeContent", required = true) String noticeContent,
                              @RequestParam(value = "noticeContent", required = true)String noticeContent,
                              @ApiParam(name = "remark", value = "备注")
                              @RequestParam(value = "remark", required = true) String remark,
                              @RequestParam(value = "remark", required = true)String remark,
                              @ApiParam(name = "redirectUrl", value = "跳转链接")
                              @RequestParam(value = "redirectUrl", required = true) String miniProgramPagepath,
                              @RequestParam(value = "redirectUrl", required = true)String miniProgramPagepath,
                              @ApiParam(name = "miniProgramAppId", value = "APPID")
                              @RequestParam(value = "miniProgramAppId", required = true) String miniProgramAppId) {
        return success(xzzxEntranceService.sendXCXMes(wxId, patient, cardNo, first, noticeContent, remark, miniProgramPagepath, miniProgramAppId));
                              @RequestParam(value = "miniProgramAppId", required = true)String miniProgramAppId  ) {
        return success(xzzxEntranceService.sendXCXMes( wxId, patient, cardNo, first, noticeContent, remark, miniProgramPagepath, miniProgramAppId));
    }
    
    @PostMapping(value = "/sendXZMes")
    @ApiOperation(value = "心脏模板消息推送小程序跳转", notes = "心脏模板消息推送小程序跳转")
    public Envelop ehospitalNotice(
@ -1293,62 +1252,62 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "contentString", value = "内容明细串")
            @RequestParam(value = "contentString", required = false) String contentString) throws Exception {
        String rs = xzzxEntranceService.ehospitalNotice(userName, idCard, phone, title, url, content, contentString);
        if ("1".equals(rs)) {
        if("1".equals(rs)){
            return success("推送成功");
        }
        return failed("推送失败");
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientInfo)
    @ApiOperation(value = "获取居民信息接口", notes = "获取居民信息接口")
    public ObjEnvelop findPatientInfo(@ApiParam(name = "patient", value = "居民ID")
                                      @RequestParam(value = "patient", required = true) String patient) {
                                      @RequestParam(value = "patient", required = true)String patient){
        try {
            return success(prescriptionService.findPatientInfo(patient));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updatePatientInfo)
        @PostMapping(value = BaseHospitalRequestMapping.Prescription.updatePatientInfo)
    @ApiOperation(value = "修改居民信息", notes = "修改居民信息")
    public ObjEnvelop findPatientInfo(@ApiParam(name = "patient", value = "居民ID")
                                      @RequestParam(value = "patient", required = true) String patient,
                                      @RequestParam(value = "patient", required = true)String patient,
                                      @ApiParam(name = "name", value = "居民名称")
                                      @RequestParam(value = "name", required = true) String name,
                                      @RequestParam(value = "name", required = true)String name,
                                      @ApiParam(name = "ssc", value = "社保卡")
                                      @RequestParam(value = "ssc", required = true) String ssc,
                                      @RequestParam(value = "ssc", required = true)String ssc,
                                      @ApiParam(name = "idcard", value = "居民身份证")
                                      @RequestParam(value = "idcard", required = true) String idcard,
                                       @RequestParam(value = "idcard", required = true)String idcard,
                                      @ApiParam(name = "sex", value = "性别")
                                      @RequestParam(value = "sex", required = false) Integer sex,
                                          @RequestParam(value = "sex", required = false)Integer sex,
                                      @ApiParam(name = "town", value = "所在区code")
                                      @RequestParam(value = "town", required = false) String town,
                                          @RequestParam(value = "town", required = false)String town,
                                      @ApiParam(name = "townName", value = "所在区名称")
                                      @RequestParam(value = "townName", required = false) String townName,
                                          @RequestParam(value = "townName", required = false)String townName,
                                      @ApiParam(name = "committeeCode", value = "居委会code")
                                      @RequestParam(value = "committeeCode", required = false) String committeeCode,
                                          @RequestParam(value = "committeeCode", required = false)String committeeCode,
                                      @ApiParam(name = "committeeName", value = "居委会code")
                                      @RequestParam(value = "committeeName", required = false) String committeeName,
                                          @RequestParam(value = "committeeName", required = false)String committeeName,
                                      @ApiParam(name = "address", value = "常驻地址")
                                      @RequestParam(value = "address", required = false) String address,
                                          @RequestParam(value = "address", required = false)String address,
                                      @ApiParam(name = "photo", value = "头像")
                                      @RequestParam(value = "photo", required = false) String photo,
                                          @RequestParam(value = "photo", required = false)String photo,
                                      @ApiParam(name = "mobile", value = "手机号")
                                      @RequestParam(value = "mobile", required = false) String mobile,
                                          @RequestParam(value = "mobile", required = false)String mobile,
                                      @ApiParam(name = "province", value = "所在省code")
                                      @RequestParam(value = "province", required = false) String province,
                                          @RequestParam(value = "province", required = false)String province,
                                      @ApiParam(name = "provinceName", value = "所在省名称")
                                      @RequestParam(value = "provinceName", required = false) String provinceName,
                                          @RequestParam(value = "provinceName", required = false)String provinceName,
                                      @ApiParam(name = "city", value = "市code")
                                      @RequestParam(value = "city", required = false) String city,
                                          @RequestParam(value = "city", required = false)String city,
                                      @ApiParam(name = "cityName", value = "市名称")
                                      @RequestParam(value = "cityName", required = false) String cityName) {
                                          @RequestParam(value = "cityName", required = false)String cityName){
        try {
            return success(prescriptionService.updatePatientInfo(patient, name, idcard, ssc, sex, town, townName, committeeCode, committeeName, address, photo, mobile, province, provinceName, city, cityName));
        } catch (Exception e) {
            return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc,sex,town,townName,committeeCode,committeeName,address,photo,mobile,province,provinceName,city,cityName));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
@ -1356,519 +1315,515 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
    public Envelop saveDoctorOnlineWork(@ApiParam(name = "onlineWorkJson", value = "保存在线排班json")
                                        @RequestParam(value = "onlineWorkJson", required = true) String onlineWorkJson) throws Exception {
                                        @RequestParam(value = "onlineWorkJson", required = true)String onlineWorkJson)throws Exception {
        try {
            return prescriptionService.saveDoctorOnlineWork(onlineWorkJson);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.delDoctorOnlineWork)
    @ApiOperation(value = "删除在线排班", notes = "删除在线排班")
    public Envelop delDoctorOnlineWork(@ApiParam(name = "id", value = "保存在线排班ID")
                                       @RequestParam(value = "id", required = true) String id) throws Exception {
                                       @RequestParam(value = "id", required = true)String id)throws Exception {
        try {
            return prescriptionService.delDoctorOnlineWork(id);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorOnlineWorkList)
    @ApiOperation(value = "查询医生在线排班", notes = "查询医生在线排班")
    public ListEnvelop findDoctorOnlineWorkList(@ApiParam(name = "doctor", value = "医生code")
                                                @RequestParam(value = "doctor", required = true) String doctor,
                                                @RequestParam(value = "doctor", required = true)String doctor,
                                                @ApiParam(name = "startDate", value = "开始时间,YYYY-MM-dd")
                                                @RequestParam(value = "startDate", required = true) String startDate,
                                                @RequestParam(value = "startDate", required = true)String startDate,
                                                @ApiParam(name = "endDate", value = "结束时间,YYYY-MM-dd")
                                                @RequestParam(value = "endDate", required = true) String endDate) throws Exception {
                                                @RequestParam(value = "endDate", required = true)String endDate)throws Exception {
        try {
            return success(prescriptionService.findDoctorOnlineWorkList(doctor, startDate, endDate));
            return success(prescriptionService.findDoctorOnlineWorkList(doctor,startDate,endDate));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.cooperativeOutpatient)
    @ApiOperation(value = "发起协同门诊", notes = "发起协同门诊")
    public ObjEnvelop cooperativeOutpatient(@ApiParam(name = "outpatientJson", value = "复诊实体json")
                                            @RequestParam(value = "outpatientJson", required = true) String outpatientJson,
                                            @RequestParam(value = "outpatientJson", required = true)String outpatientJson,
                                            @ApiParam(name = "registerJson", value = "预约实体json")
                                            @RequestParam(value = "registerJson", required = false) String registerJson,
                                            @RequestParam(value = "registerJson", required = false)String registerJson,
                                            @ApiParam(name = "chargeType", value = "号别")
                                            @RequestParam(value = "chargeType", required = false) String chargeType) throws Exception {
                                            @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        try {
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.cooperativeOutpatient(outpatientJson, registerJson, chargeType);
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType);
            if (wlyyOutpatientDO.getPayStatus() != null && wlyyOutpatientDO.getPayStatus() == 1) {
            if (wlyyOutpatientDO.getPayStatus()!=null&&wlyyOutpatientDO.getPayStatus()==1){
                //构建系统消息
                SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO, payFlag);
                SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
                //发送系统消息
                hospitalSystemMessageService.sendImMessage(systemMessageDO);
            }
            //发送医生抢单消息
            if (StringUtils.isBlank(wlyyOutpatientDO.getDoctor())) {
            if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
                hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
            }
            return success(wlyyOutpatientDO);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveOutpatientDoctor)
    @ApiOperation(value = "设置门诊医生", notes = "设置门诊医生")
    public ObjEnvelop saveOutpatientDoctor(@ApiParam(name = "outpatientJson", value = "复诊实体json")
                                           @RequestParam(value = "outpatientJson", required = true) String outpatientJson,
                                           @RequestParam(value = "outpatientJson", required = true)String outpatientJson,
                                           @ApiParam(name = "registerJson", value = "预约实体json")
                                           @RequestParam(value = "registerJson", required = false) String registerJson,
                                           @RequestParam(value = "registerJson", required = false)String registerJson,
                                           @ApiParam(name = "chargeType", value = "号别")
                                           @RequestParam(value = "chargeType", required = false) String chargeType) throws Exception {
                                           @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        try {
            return success(prescriptionService.saveOutpatientDoctor(outpatientJson, registerJson, chargeType));
        } catch (Exception e) {
            return success(prescriptionService.saveOutpatientDoctor(outpatientJson,registerJson,chargeType));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOauthQRCode)
    @ApiOperation(value = "验证授权", notes = "验证授权")
    public ObjEnvelop checkOauthQRCode(@ApiParam(name = "authorizeNo", value = "流水编号")
                                       @RequestParam(value = "authorizeNo", required = true) String authorizeNo) throws Exception {
                                       @RequestParam(value = "authorizeNo", required = true)String authorizeNo)throws Exception {
        return success(prescriptionService.checkOauthQRCode(authorizeNo));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByGeneralDoctor)
    @ApiOperation(value = "全科医生协同门诊列表", notes = "全科医生协同门诊列表")
    public Envelop findByGeneralDoctor(@ApiParam(name = "generalDoctor", value = "全科医生")
                                       @RequestParam(value = "generalDoctor", required = true) String generalDoctor,
                                       @RequestParam(value = "generalDoctor", required = true)String generalDoctor,
                                       @ApiParam(name = "startDate", value = "开始时间")
                                       @RequestParam(value = "startDate", required = false) String startDate,
                                       @RequestParam(value = "startDate", required = false)String startDate,
                                       @ApiParam(name = "endDate", value = "结束时间")
                                       @RequestParam(value = "endDate", required = false) String endDate,
                                       @RequestParam(value = "endDate", required = false)String endDate,
                                       @ApiParam(name = "status", value = "状态")
                                       @RequestParam(value = "status", required = false) String status,
                                       @RequestParam(value = "status", required = false)String status,
                                       @ApiParam(name = "sort", value = "排序")
                                       @RequestParam(value = "sort", required = false) String sort,
                                       @RequestParam(value = "sort", required = false)String sort,
                                       @ApiParam(name = "page", value = "第几页")
                                       @RequestParam(value = "page", required = true) Integer page,
                                       @RequestParam(value = "page", required = true)Integer page,
                                       @ApiParam(name = "size", value = "每页大小")
                                       @RequestParam(value = "size", required = true) Integer size) {
                                       @RequestParam(value = "size", required = true)Integer size) {
        try {
            return prescriptionService.findByGeneralDoctor(generalDoctor, startDate, endDate, status, sort, page, size, wxId);
        } catch (Exception e) {
            return prescriptionService.findByGeneralDoctor(generalDoctor,startDate,endDate,status,sort,page,size,wxId);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findGeneralDoctorInfo)
    @ApiOperation(value = "全科医生首页统计信息", notes = "全科医生首页统计信息")
    public ObjEnvelop findGeneralDoctorInfo(@ApiParam(name = "generalDoctor", value = "全科医生")
                                            @RequestParam(value = "generalDoctor", required = true) String generalDoctor) {
                                            @RequestParam(value = "generalDoctor", required = true)String generalDoctor) {
        try {
            return success(prescriptionService.findGeneralDoctorInfo(generalDoctor));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.sendWlyyOutpatientMes)
    @ApiOperation(value = "发送i健康系统消息", notes = "发送i健康系统消息")
    public ObjEnvelop sendWlyyOutpatientMes(@ApiParam(name = "doctor", value = "全科医生Id")
                                            @RequestParam(value = "doctor", required = true) String doctor,
                                            @RequestParam(value = "doctor", required = true)String doctor,
                                            @ApiParam(name = "outPatientId", value = "门诊id")
                                            @RequestParam(value = "outPatientId", required = true) String outPatientId) {
        return success(wlyyBusinessService.sendWlyyOutpatientMes(doctor, outPatientId));
                                            @RequestParam(value = "outPatientId", required = true)String outPatientId) {
        return success(wlyyBusinessService.sendWlyyOutpatientMes(doctor,outPatientId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.readWlyyOutpatientMes)
    @ApiOperation(value = "设置I健康消息已读", notes = "设置I健康消息已读")
    public ObjEnvelop readWlyyOutpatientMes(@ApiParam(name = "outPatientId", value = "门诊id")
                                            @RequestParam(value = "outPatientId", required = true) String outPatientId) {
                                            @RequestParam(value = "outPatientId", required = true)String outPatientId){
        return success(wlyyBusinessService.readWlyyOutpatientMes(outPatientId));
    }
    //===========
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getTodayOutpatinetList)
    @ApiOperation(value = "居民获取当日就诊列表", notes = "居民获取当日就诊列表")
    public ListEnvelop getTodayOutpatinetList(@ApiParam(name = "patient", value = "居民ID")
                                              @RequestParam(value = "patient", required = true) String patient) {
        try {
            return success(prescriptionService.getTodayOutpatinetList(patient, wxId));
        } catch (Exception e) {
                                              @RequestParam(value = "patient", required = true) String patient){
        try{
            return success(prescriptionService.getTodayOutpatinetList(patient,wxId));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorMapping)
    @ApiOperation(value = "获取医生mappingcode", notes = "获取医生mappingcode")
    public ObjEnvelop getDoctorMapping(@ApiParam(name = "doctor", value = "医生code")
                                       @RequestParam(value = "doctor", required = true) String doctor,
                                       @RequestParam(value = "doctor", required = true)String doctor,
                                       @ApiParam(name = "orgCode", value = "机构code")
                                       @RequestParam(value = "orgCode", required = true) String orgCode) {
                                       @RequestParam(value = "orgCode", required = true)String orgCode){
        try {
            return success(prescriptionService.getDoctorMapping(doctor, orgCode));
            return success(prescriptionService.getDoctorMapping(doctor,orgCode));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getInspectionDictionary)
    @ApiOperation(value = "获取检查检验", notes = "获取检查检验")
    public ListEnvelop getInspectionDictionary(@ApiParam(name = "pyKey", value = "拼音码")
                                               @RequestParam(value = "pyKey", required = false) String pyKey,
                                               @RequestParam(value = "pyKey", required = false)String pyKey,
                                               @ApiParam(name = "winNo", value = "6总部7金榜8夏禾10检查11检验")
                                               @RequestParam(value = "winNo", required = true) String winNo,
                                               @RequestParam(value = "winNo", required = true)String winNo,
                                               @ApiParam(name = "codes", value = "检查检验收费码codes,用逗号分割")
                                               @RequestParam(value = "codes", required = false) String codes) throws Exception {
        if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
            if ("10".equalsIgnoreCase(winNo)) {
                                               @RequestParam(value = "codes", required = false)String codes)throws Exception{
        if("xm_xzzx_wx".equalsIgnoreCase(wxId)){
            if ("10".equalsIgnoreCase(winNo)){
                //检查
                return success(xzzxEntranceService.selectExamApply(pyKey));
            } else {
            }else {
                //检验
                return success(xzzxEntranceService.selectLisApply(pyKey));
            }
        }
        if ("sd_tnzyy_wx".equalsIgnoreCase(wxId)) {
            return success(tnyyEntranceService.findVpacsBw(pyKey));
        } else {
            return success(prescriptionService.getInspectionDictionary(pyKey, codes, winNo));
        }if("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
            return  success(tnyyEntranceService.findVpacsBw(pyKey));
        }else {
            return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionLogByPreId)
    @ApiOperation(value = "查询处方日志", notes = "查询处方日志")
    public ListEnvelop findPrescriptionLogByPreId(@ApiParam(name = "prescriptionCode", value = "处方code")
                                                  @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) throws Exception {
        try {
                                                  @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
        try{
            return success(prescriptionLogService.findPrescriptionLogByPreId(prescriptionCode));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByPrescriptionCodeByStatus)
    @ApiOperation(value = "查询处方流程", notes = "查询处方流程")
    public ListEnvelop findByPrescriptionCodeByStatus(@ApiParam(name = "prescriptionCode", value = "处方code")
                                                      @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) throws Exception {
                                                      @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
        try {
            return success(prescriptionLogService.findByPrescriptionCodeByStatus(prescriptionCode));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxFindByPartsCode)
    @ApiOperation(value = "心脏查询部位字典", notes = "心脏查询部位字典")
    public ListEnvelop xzzxFindByPartsCode(@ApiParam(name = "spellCode", value = "拼音首字母")
                                           @RequestParam(value = "spellCode", required = false) String spellCode) throws Exception {
                                       @RequestParam(value = "spellCode", required = false)String spellCode)throws Exception{
        return success(xzzxEntranceService.selectCheckBody(spellCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByPartsCode)
    @ApiOperation(value = "查询部位字典", notes = "查询部位字典")
    public ListEnvelop findByPartsCode(@ApiParam(name = "parentCode", value = "父节点ID,第一层为0")
                                       @RequestParam(value = "parentCode", required = false) String parentCode) throws Exception {
                                       @RequestParam(value = "parentCode", required = false)String parentCode)throws Exception{
        return success(inspectionService.findByPartsCode(parentCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDictByName)
    @ApiOperation(value = "查询检查检验字典", notes = "查询检查检验字典")
    public ListEnvelop findDictByName(@ApiParam(name = "hospital", value = "医院")
                                      @RequestParam(value = "hospital", required = true) String hospital,
                                      @RequestParam(value = "hospital", required = true)String hospital,
                                      @ApiParam(name = "name", value = "字典名称,类型:InspectionType;固定液体 :InspectionFixativeType")
                                      @RequestParam(value = "name", required = true) String name) throws Exception {
        return success(inspectionService.findDictByName(hospital, name));
                                      @RequestParam(value = "name", required = true)String name)throws Exception{
        return success(inspectionService.findDictByName(hospital,name));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getJymb)
    @ApiOperation(value = "检验模板接口")
    public ListEnvelop getJymb(@ApiParam(name = "bz_code", value = "入参条件为第一节点代码")
                               @RequestParam(value = "bz_code", defaultValue = "") String bz_code,
                               @RequestParam(value = "bz_code",defaultValue = "") String bz_code,
                               @ApiParam(name = "tc_no", value = "二级节点代码")
                               @RequestParam(value = "tc_no", defaultValue = "") String tc_no,
                               @RequestParam(value = "tc_no",defaultValue = "") String tc_no,
                               @ApiParam(name = "flag", value = "入参条件为第一节点代码")
                               @RequestParam(value = "flag", defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getJymb(bz_code, tc_no, flag));
                               @RequestParam(value = "flag",defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getJymb(bz_code,tc_no,flag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getJcmb)
    @ApiOperation(value = "检查模板接口")
    public ListEnvelop getJcmb(
            @ApiParam(name = "bz_code", value = "入参条件为第一节点代码")
            @RequestParam(value = "bz_code", defaultValue = "") String bz_code,
            @RequestParam(value = "bz_code",defaultValue = "") String bz_code,
            @ApiParam(name = "tc_no", value = "二级节点代码")
            @RequestParam(value = "tc_no", defaultValue = "") String tc_no,
            @RequestParam(value = "tc_no",defaultValue = "") String tc_no,
            @ApiParam(name = "flag", value = "入参条件为第一节点代码")
            @RequestParam(value = "flag", defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getJcmb(bz_code, tc_no, flag));
            @RequestParam(value = "flag",defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getJcmb(bz_code,tc_no,flag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getTcChild)
    @ApiOperation(value = "套餐子项目字典接口")
    public ListEnvelop getTcChild(
            @ApiParam(name = "parent_code", value = "入参条件为子项目编码")
            @RequestParam(value = "parent_code", defaultValue = "") String parent_code) throws Exception {
            @RequestParam(value = "parent_code",defaultValue = "") String parent_code) throws Exception {
        return success(prescriptionService.getTcChild(parent_code));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getInsChild)
    @ApiOperation(value = "主项目绑定子项目字典接口")
    public ListEnvelop getInsChild(
            @ApiParam(name = "zd_charge_code", value = "入参条件为项目代码")
            @RequestParam(value = "zd_charge_code", defaultValue = "") String zd_charge_code) throws Exception {
            @RequestParam(value = "zd_charge_code",defaultValue = "") String zd_charge_code) throws Exception {
        return success(prescriptionService.getInsChild(zd_charge_code));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getTcxz)
    @ApiOperation(value = "套餐选择接口")
    public ListEnvelop getTcxz(
            @ApiParam(name = "bz_code", value = "入参条件为收费项目代码")
            @RequestParam(value = "bz_code", defaultValue = "") String charge_code,
            @RequestParam(value = "bz_code",defaultValue = "") String charge_code,
            @ApiParam(name = "tc_no", value = "二级节点代码")
            @RequestParam(value = "tc_no", defaultValue = "") String tc_no,
            @RequestParam(value = "tc_no",defaultValue = "") String tc_no,
            @ApiParam(name = "flag", value = "入参条件为第一节点代码")
            @RequestParam(value = "flag", defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getTcxz(charge_code, tc_no, flag));
            @RequestParam(value = "flag",defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getTcxz(charge_code,tc_no,flag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorPreSign)
    @ApiOperation(value = "获取医生签名")
    public ObjEnvelop getDoctorPreSign(@ApiParam(name = "doctor", value = "医生编码")
                                       @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
                                       @RequestParam(value = "doctor",required = false) String doctor)throws Exception{
        return success(doctorPreSignService.getDoctorSign(doctor));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorIntroduction)
    @ApiOperation(value = "获取医生简介")
    public ObjEnvelop getDoctorIntroduction(@ApiParam(name = "doctor", value = "医生编码")
                                            @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
                                            @RequestParam(value = "doctor",required = false) String doctor)throws Exception{
        try {
            return success(prescriptionService.getDoctorIntroduction(doctor));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByDict)
    @ApiOperation(value = "查询医院字典", notes = "查询医院字典")
    public ListEnvelop findByDict(@ApiParam(name = "name", value = "字典名称")
                                  @RequestParam(value = "name", required = true) String name,
                                  @RequestParam(value = "name", required = true)String name,
                                  @ApiParam(name = "hospital", value = "医生code")
                                  @RequestParam(value = "hospital", required = true) String hospital) {
                                  @RequestParam(value = "hospital", required = true)String hospital) {
        try {
            return success(prescriptionService.findByDict(name, hospital));
            return success(prescriptionService.findByDict(name,hospital));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getPatientAccetokenByIdcard)
    @ApiOperation(value = "根据居民CODE换取居民请求秘钥")
    public Envelop getPatientAccetokenByIdcard(@ApiParam(name = "patientCode", value = "居民CODE")
                                               @RequestParam(value = "patientCode", required = true) String patientCode,
                                               @RequestParam(value = "patientCode",required = true) String patientCode,
                                               @ApiParam(name = "wxid", value = "wxid")
                                               @RequestParam(value = "wxid", required = false) String wxid) throws Exception {
        if (StringUtils.isNoneBlank(wxid)) {
                                               @RequestParam(value = "wxid",required = false) String wxid)throws Exception{
        if (StringUtils.isNoneBlank(wxid)){
            wxId = wxid;
        }
        String doctorId = getUID();
        return success(wlyyBusinessService.wlyyGetPatientAccetokenByIdcard(patientCode, wxId, doctorId));
        String doctorId=getUID();
        return success(wlyyBusinessService.wlyyGetPatientAccetokenByIdcard(patientCode,wxId,doctorId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWlyyPatient)
    @ApiOperation(value = "获取居民信息")
    public Envelop findWlyyPatient(@ApiParam(name = "idcard", value = "idcard")
                                   @RequestParam(value = "idcard", required = true) String idcard) throws Exception {
                                   @RequestParam(value = "idcard",required = true) String idcard)throws Exception{
        return success(wlyyBusinessService.findWlyyPatient(idcard));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientListBySscOrIdCard)
    @ApiOperation(value = "获取居民身份证信息")
    public Envelop findPatientListBySscOrIdCard(@ApiParam(name = "idcard", value = "idcard")
                                                @RequestParam(value = "idcard", required = false) String idcard,
                                                @RequestParam(value = "idcard",required = false) String idcard,
                                                @ApiParam(name = "ssc", value = "社保卡")
                                                @RequestParam(value = "ssc", required = false) String ssc) throws Exception {
        if (StringUtils.isNotBlank(idcard) && idcard.length() >= 6) {
            return success(wlyyBusinessService.findPatientListBySscOrIdCard(idcard, null));
                                                @RequestParam(value = "ssc",required = false) String ssc)throws Exception{
        if(StringUtils.isNotBlank(idcard)&&idcard.length()>=6){
            return success(wlyyBusinessService.findPatientListBySscOrIdCard(idcard,null));
        }
        if (StringUtils.isNotBlank(ssc) && ssc.length() >= 6) {
            return success(wlyyBusinessService.findPatientListBySscOrIdCard(null, ssc));
        if(StringUtils.isNotBlank(ssc)&&ssc.length()>=6){
            return success(wlyyBusinessService.findPatientListBySscOrIdCard(null,ssc));
        }
        return failed("身份证或医保卡格式有误");
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.makeBase64Qrcode)
    @ApiOperation(value = "获取医生二维码")
    public ObjEnvelop makeBase64Qrcode(@ApiParam(name = "doctor", value = "医生ID")
                                       @RequestParam(value = "doctor", required = true) String doctor) throws Exception {
        return success("获取医生二维码成功", wlyyBusinessService.makeBase64Qrcode(doctor));
                                       @RequestParam(value = "doctor",required = true) String doctor)throws Exception{
        return success("获取医生二维码成功",wlyyBusinessService.makeBase64Qrcode(doctor));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.doctorUpcomingList)
    @ApiOperation(value = "医生待办事项列表")
    public Envelop doctorUpcomingList(@ApiParam(name = "doctorCode", value = "医生CODE")
                                      @RequestParam(value = "doctorCode", required = true) String doctorCode,
                                      @RequestParam(value = "doctorCode",required = true) String doctorCode,
                                      @ApiParam(name = "type", value = "类型:1.视频复诊(16)、2.专科协同(12)、3.图文复诊(9)、4.专家咨询(1,15)")
                                      @RequestParam(value = "type", required = true) String type) throws Exception {
                                      @RequestParam(value = "type",required = true) String type)throws Exception{
        com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
        List<Map<String, Object>> data = imService.doctorUpcomingList(doctorCode, type);
        List<Map<String,Object>>  data = imService.doctorUpcomingList(doctorCode, type);
        if (data != null) {
            for (Map<String, Object> consult : data) {
                if ("1,15,17".equals(type)) {//专家咨询
                    Integer consultType = Integer.parseInt(consult.get("type").toString());
                    if (1 == consultType) {//专家咨询
                        consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_1");
                    } else if (15 == consultType) {//家医求助
                        consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_" + consult.get("doctorCode").toString() + "_15");
                    } else if (17 == consultType) {//视频咨询
                        consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_17");
            for (Map<String,Object> consult : data) {
                if("1,15,17".equals(type)){//专家咨询
                    Integer consultType =  Integer.parseInt(consult.get("type").toString());
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else if (17==consultType){//视频咨询
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_17");
                    }
                } else if ("9".equals(type)) {//图文复诊
                    consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_9");
                    consult.put("type", type);
                } else if ("16".equals(type)) {//视频复诊
                    consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_16");
                    consult.put("type", type);
                } else if ("12".equals(type)) {//协同门诊
                    consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_12");
                    consult.put("type", type);
                } else {
                }
                }else if("9".equals(type)){//图文复诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_9");
                    consult.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_16");
                    consult.put("type",type);
                }else if("12".equals(type)){//协同门诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_12");
                    consult.put("type",type);
                }else{}
                
                array.add(consult);
            }
        }
        return success(array);
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.setRecord)
    @ApiOperation(value = "his建立档案与互联网医院账户同步")
    public Envelop setRecord(@ApiParam(name = "json", value = "档案实体json")
                             @RequestParam(value = "json", required = true) String json,
                             @RequestParam(value = "json",required = true) String json,
                             @ApiParam(name = "type", value = "1.需要his建档,2.仅同步互联网医院账户")
                             @RequestParam(value = "type", required = true) String type) throws Exception {
        return success(prescriptionService.setRecord(json, type));
                             @RequestParam(value = "type",required = true)String type)throws Exception{
        return success(prescriptionService.setRecord(json,type));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientRecord)
    @ApiOperation(value = "获取HIIS居民档案信息")
    public Envelop findPatientRecord(@ApiParam(name = "idcard", value = "居民身份证")
                                     @RequestParam(value = "idcard", required = false) String idcard,
                                     @RequestParam(value = "idcard",required = false) String idcard,
                                     @ApiParam(name = "patient", value = "居民code")
                                     @RequestParam(value = "patient", required = false) String patient,
                                     @RequestParam(value = "patient",required = false)String patient,
                                     @ApiParam(name = "admitNum", value = "就诊次数")
                                     @RequestParam(value = "admitNum", required = false) String admitNum,
                                     @RequestParam(value = "admitNum",required = false)String admitNum,
                                     @ApiParam(name = "ybcard", value = "医保卡")
                                     @RequestParam(value = "ybcard", required = false) String ybcard) throws Exception {
        return success(prescriptionService.findPatientRecord(idcard, patient, admitNum, ybcard));
                                     @RequestParam(value = "ybcard",required = false)String ybcard)throws Exception{
        return success(prescriptionService.findPatientRecord(idcard,patient,admitNum,ybcard));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByName)
    @ApiOperation(value = "获取医生信息")
    public ListEnvelop findDoctorByName(@ApiParam(name = "hospital", value = "医院code")
                                        @RequestParam(value = "hospital", required = false) String hospital,
                                        @RequestParam(value = "hospital",required = false)String hospital,
                                        @ApiParam(name = "name", value = "医生名称")
                                        @RequestParam(value = "name", required = false) String name,
                                        @RequestParam(value = "name",required = false)String name,
                                        @ApiParam(name = "chargeType", value = "号别")
                                        @RequestParam(value = "chargeType", required = false) String chargeType,
                                        @RequestParam(value = "chargeType",required = false)String chargeType,
                                        @ApiParam(name = "dept", value = "科室")
                                        @RequestParam(value = "dept", required = false) String dept) {
                                            @RequestParam(value = "dept",required = false)String dept) {
        try {
            return success(prescriptionService.findDoctorByName(hospital, name, chargeType, dept));
        } catch (Exception e) {
            return success(prescriptionService.findDoctorByName(hospital,name,chargeType,dept));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptWithDoctorWorkTime)
    @ApiOperation(value = "获取带排班部门")
    public ListEnvelop findDeptWithDoctorWorkTime(@ApiParam(name = "hospital", value = "医院code")
                                                  @RequestParam(value = "hospital", required = false) String hospital,
                                                  @RequestParam(value = "hospital",required = false)String hospital,
                                                  @ApiParam(name = "keyWord", value = "科室关键字")
                                                  @RequestParam(value = "keyWord", required = false) String keyWord,
                                                  @RequestParam(value = "keyWord",required = false)String keyWord,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page", required = false) Integer page,
                                                  @RequestParam(value = "page",required = false)Integer page,
                                                  @ApiParam(name = "pagesize", value = "每页大小")
                                                  @RequestParam(value = "pagesize", required = false) Integer pagesize) {
                                                  @RequestParam(value = "pagesize",required = false)Integer pagesize) {
        try {
            return success(prescriptionService.findDeptWithDoctorWorkTime(hospital, keyWord, page, pagesize));
        } catch (Exception e) {
            return success(prescriptionService.findDeptWithDoctorWorkTime(hospital,keyWord,page,pagesize));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.findWorkTimeRule)
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.findWorkTimeRule)
    @ApiOperation(value = "查询排班规则")
    public ObjEnvelop findWorkTimeRule(@ApiParam(name = "hospital", value = "医院code")
                                       @RequestParam(value = "hospital", required = true) String hospital) {
                                       @RequestParam(value = "hospital",required = true)String hospital) {
        try {
            return success(workTimeService.findWorkTimeRule(hospital));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveWorkTimeRule)
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveWorkTimeRule)
    @ApiOperation(value = "保存排班规则")
    public ObjEnvelop saveWorkTimeRule(@ApiParam(name = "workTimeRuleJson", value = "保存排班规则")
                                       @RequestParam(value = "workTimeRuleJson", required = true) String workTimeRuleJson,
                                       @RequestParam(value = "workTimeRuleJson",required = true)String workTimeRuleJson,
                                       @ApiParam(name = "isDoctorWorkJson", value = "判断是否排班json数据")
                                       @RequestParam(value = "isDoctorWorkJson", required = false) String isDoctorWorkJson) throws Exception {
                                       @RequestParam(value = "isDoctorWorkJson",required = false)String isDoctorWorkJson) throws Exception{
        try {
            return success(workTimeService.saveWorkTimeRule(workTimeRuleJson, isDoctorWorkJson));
            return success(workTimeService.saveWorkTimeRule(workTimeRuleJson,isDoctorWorkJson));
        } catch (Exception e) {
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.checkDoctorWork)
    
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.checkDoctorWork)
    @ApiOperation(value = "判断医生是否在班")
    public ObjEnvelop checkDoctorWork(@ApiParam(name = "doctor", value = "判断医生是否在班")
                                      @RequestParam(value = "doctor", required = true) String doctor,
                                      @RequestParam(value = "doctor",required = true)String doctor,
                                      @ApiParam(name = "ywCode", value = "业务code")
                                      @RequestParam(value = "ywCode", required = false) String ywCode) throws Exception {
                                      @RequestParam(value = "ywCode",required = false) String ywCode) throws Exception{
        try {
            return success(workTimeService.checkDoctorWork(doctor, ywCode));
        } catch (Exception e) {
            return success(workTimeService.checkDoctorWork(doctor,ywCode));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.importDoctorWork)
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.importDoctorWork)
    @ApiOperation(value = "导入排班信息")
    public ListEnvelop importDoctorWork(@ApiParam(name = "file", value = "文件", required = true)
                                        @RequestPart(value = "file") MultipartFile file,
                                        @ApiParam(name = "hospital", value = "医院编码")
                                        @RequestParam(value = "hospital", required = true) String hospital,
                                        @RequestParam(value = "hospital",required = true)String hospital,
                                        @ApiParam(name = "dateMoth", value = "年-月,格式:2020-03")
                                        @RequestParam(value = "dateMoth", required = true) String dateMoth,
                                        HttpServletRequest request) throws Exception {
                                        @RequestParam(value = "dateMoth",required = true)String dateMoth,
                                        HttpServletRequest request)throws Exception{
        try {
            request.setCharacterEncoding("UTF-8");
            DoctorWorkTimeExcelReader reader = new DoctorWorkTimeExcelReader();
            reader.read(file);
            if ("-1".equals(reader.getCode())) {
            if("-1".equals(reader.getCode())) {
                ListEnvelop envelop = new ListEnvelop();
                envelop.setStatus(-1);
                envelop.setMessage("目前仅支持200位医生同时导入!");
@ -1877,7 +1832,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            List<DoctorWorkTimeMainExcelDO> errorLs = reader.getErrorLs();
            List<DoctorWorkTimeMainExcelDO> correctLs = reader.getCorrectLs();
            if (errorLs != null && errorLs.size() > 0) {
            if(errorLs!=null&&errorLs.size()>0){
                ListEnvelop envelop = new ListEnvelop();
                envelop.setStatus(-1);
                envelop.setMessage("格式错误!");
@ -1885,46 +1840,45 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                return envelop;
            }
            Map<String, Object> rs = workTimeService.getExcelWorkInfo(correctLs, dateMoth, hospital);
            List<DoctorWorkTimeMainExcelDO> error = (List<DoctorWorkTimeMainExcelDO>) rs.get("error");
            Map<String,Object> rs = workTimeService.getExcelWorkInfo(correctLs,dateMoth,hospital);
            List<DoctorWorkTimeMainExcelDO> error = (List<DoctorWorkTimeMainExcelDO>)rs.get("error");
            Integer errorTotal = (Integer) rs.get("errorTotal");
            Integer succTotal = (Integer) rs.get("succTotal");
            if (error != null && error.size() > 0) {
            if(error!=null&&error.size()>0){
                ListEnvelop envelop = new ListEnvelop();
                envelop.setStatus(-1);
                envelop.setMessage(succTotal + "位医生,更新成功!" + "," + errorTotal + "位医生,身份信息错误!更新失败!");
                envelop.setMessage(succTotal+"位医生,更新成功!"+","+errorTotal+"位医生,身份信息错误!更新失败!");
                envelop.setDetailModelList(error);
                return envelop;
            }
            ListEnvelop envelop = new ListEnvelop();
            envelop.setStatus(200);
            envelop.setMessage("导入成功!" + succTotal + "位医生排班数据!");
            envelop.setMessage("导入成功!"+succTotal+"位医生排班数据!");
            envelop.setDetailModelList(error);
            return envelop;
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    
    /**
     * 易联众统一支付
     *
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.selectOrderByRelationCode)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderByRelationCode)
    @ApiOperation("统一支付")
    public ObjEnvelop selectOrderByRelationCode(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true) String relationCode,
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "depositType", value = "depositType", required = true)
            @RequestParam(required = true) String depositType) throws Exception {
            @RequestParam(required = true)String depositType) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.reChargeJSON(relationCode, depositType, wxId));
            return ObjEnvelop.getSuccess("ok",businessOrderService.reChargeJSON(relationCode,depositType,wxId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
@ -1932,24 +1886,23 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    /**
     * 易联众统一支付
     *
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.ylzRechargeJson)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.ylzRechargeJson)
    @ApiOperation("统一支付--预交金支付")
    public ObjEnvelop ylzRechargeJson(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true) String relationCode,
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "depositType", value = "depositType", required = true)
            @RequestParam(required = true) String depositType,
            @RequestParam(required = true)String depositType,
            @ApiParam(name = "cardType", value = "cardType", required = true)
            @RequestParam(required = true) String cardType,
            @RequestParam(required = true)String cardType,
            @ApiParam(name = "cardNo", value = "cardNo", required = true)
            @RequestParam(required = true) String cardNo) throws Exception {
            @RequestParam(required = true)String cardNo) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargeJson(relationCode, depositType, wxId, cardType, cardNo, demoFlag));
            return ObjEnvelop.getSuccess("ok",businessOrderService.ylzRechargeJson(relationCode,depositType,wxId,cardType,cardNo,demoFlag));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
@ -1958,7 +1911,6 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    /**
     * 充值卡一支付
     *
     * @param mzhm
     * @param jkje
     * @param type
@ -1967,78 +1919,75 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.yktMedicalCardTopUp)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.yktMedicalCardTopUp)
    @ApiOperation("眼科--充值卡支付")
    public ObjEnvelop yktMedicalCardTopUp(
            @ApiParam(name = "mzhm", value = "卡号", required = true)
            @RequestParam(required = true) String mzhm,
            @RequestParam(required = true)String mzhm,
            @ApiParam(name = "jkje", value = "充值金额", required = true)
            @RequestParam(required = true) Double jkje,
            @RequestParam(required = true)Double jkje,
            @ApiParam(name = "type", value = "类型0 就诊卡号 1 门诊卡号", required = true)
            @RequestParam(required = true) Integer type,
            @RequestParam(required = true)Integer type,
            @ApiParam(name = "paymentType", value = "1支付宝 2微信", required = true)
            @RequestParam(required = true) Integer paymentType,
            @RequestParam(required = true)Integer paymentType,
            @ApiParam(name = "patientId", value = "居民code", required = true)
            @RequestParam(required = true) String patientId,
            @RequestParam(required = true)String patientId,
            @ApiParam(name = "hospitalId", value = "医院Ccode", required = true)
            @RequestParam(required = true) String hospitalId,
            @RequestParam(required = true)String hospitalId,
            @ApiParam(name = "wxPayType", value = "微信交易类型 公众号支付:JSAPI  原生扫码支付:NATIVE", required = true)
            @RequestParam(required = true) String wxPayType,
            @RequestParam(required = true)String wxPayType,
            @ApiParam(name = "geetestChallenge", value = "geetestChallenge")
            @RequestParam(value = "geetestChallenge", required = false) String geetestChallenge,
            @RequestParam(value = "geetestChallenge", required = false)String geetestChallenge,
            @ApiParam(name = "geetestValidate", value = "geetestValidate")
            @RequestParam(value = "geetestValidate", required = false) String geetestValidate,
            @RequestParam(value = "geetestValidate", required = false)String geetestValidate,
            @ApiParam(name = "geetestSeccode", value = "geetestSeccode")
            @RequestParam(value = "geetestSeccode", required = false) String geetestSeccode,
            @RequestParam(value = "geetestSeccode", required = false)String geetestSeccode,
            @ApiParam(name = "appletCode", value = "appletCode", required = false)
            @RequestParam(required = false) String appletCode) throws Exception {
            @RequestParam(required = false)String appletCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.yktMedicalCardTopUp(mzhm, jkje, type, paymentType, patientId, wxId, hospitalId, wxPayType, appletCode, geetestChallenge, geetestValidate, geetestSeccode));
            return ObjEnvelop.getSuccess("ok",businessOrderService.yktMedicalCardTopUp(mzhm,jkje,type,paymentType,patientId,wxId,hospitalId,wxPayType,appletCode,geetestChallenge,geetestValidate,geetestSeccode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    /**
     * 查询支付状态
     *
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.selectOrderStatus)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderStatus)
    @ApiOperation("查询支付状态")
    public ObjEnvelop selectOrderStatus(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true) String relationCode,
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "flag", value = "flag", required = false)
            @RequestParam(required = false) String flag) throws Exception {
            @RequestParam(required = false)String flag) throws Exception {
        try {
            if (StringUtils.isNoneBlank(flag)) {
            if (StringUtils.isNoneBlank(flag)){
                Integer id = Integer.parseInt(relationCode);
                return ObjEnvelop.getSuccess("ok", businessOrderService.selectById(id));
                return ObjEnvelop.getSuccess("ok",businessOrderService.selectById(id));
            }
            return ObjEnvelop.getSuccess("ok", businessOrderService.selectStatus(relationCode));
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectStatus(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查询支付状态
     *
     * @param id
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.selectOrderStatusById)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderStatusById)
    @ApiOperation("查询支付状态")
    public ObjEnvelop selectOrderStatusById(
            @ApiParam(name = "id", value = "订单id", required = true)
            @RequestParam(required = true) Integer id) throws Exception {
            @RequestParam(required = true)Integer id) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.selectStatusById(id));
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectStatusById(id));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -2046,47 +1995,47 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    /**
     * 查询支付info
     *
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.selectOrderListStatus)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.selectOrderListStatus)
    @ApiOperation("查询支付info")
    public ObjEnvelop selectOrderListStatus(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true) String relationCode) throws Exception {
            @RequestParam(required = true)String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.selectListStatus(relationCode));
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectListStatus(relationCode));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    /**
     * 易联众统一退款
     *
     *
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.ylzRefund)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.ylzRefund)
    @ApiOperation("易联众统一退款")
    public ObjEnvelop ylzRefund(
            @ApiParam(name = "patient", value = "patient", required = true)
            @RequestParam(required = true) String patient,
            @RequestParam(required = true)String patient,
            @ApiParam(name = "orderNo", value = "orderNo", required = true)
            @RequestParam(required = true) String orderNo,
            @RequestParam(required = true)String orderNo,
            @ApiParam(name = "refundPrice", value = "refundPrice", required = true)
            @RequestParam(required = true) Double refundPrice,
            @RequestParam(required = true)Double refundPrice,
            @ApiParam(name = "description", value = "description", required = true)
            @RequestParam(required = true) String description) throws Exception {
            @RequestParam(required = true)String description) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.ylzOrderRefund(wxId, patient, orderNo, refundPrice, description));
            return ObjEnvelop.getSuccess("ok",businessOrderService.ylzOrderRefund(wxId,patient,orderNo,refundPrice,description));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
     * 易联众统一订单查询
     *
@ -2095,84 +2044,83 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.tradeQuery)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.tradeQuery)
    @ApiOperation("易联众统一订单查询")
    public ObjEnvelop tradeQuery(
            @ApiParam(name = "tradeType", value = "tradeType", required = true)
            @RequestParam(required = true) String tradeType,
            @RequestParam(required = true)String tradeType,
            @ApiParam(name = "orderNo", value = "orderNo", required = true)
            @RequestParam(required = true) String orderNo) throws Exception {
            @RequestParam(required = true)String orderNo) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.tradeQuery(orderNo, tradeType));
            return ObjEnvelop.getSuccess("ok",businessOrderService.tradeQuery(orderNo,tradeType));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.selectPrescriptionList)
    @ApiOperation(value = "查询处方列表")
    public ListEnvelop findPrescriptionList(@ApiParam(name = "hospital", value = "医院code")
                                            @RequestParam(value = "hospital", required = false) String hospital,
                                            @RequestParam(value = "hospital",required = false)String hospital,
                                            @ApiParam(name = "dept", value = "科室code")
                                            @RequestParam(value = "dept", required = false) String dept,
                                            @RequestParam(value = "dept",required = false)String dept,
                                            @ApiParam(name = "status", value = "状态")
                                            @RequestParam(value = "status", required = false) String status,
                                            @RequestParam(value = "status",required = false)String status,
                                            @ApiParam(name = "startTime", value = "开始时间")
                                            @RequestParam(value = "startTime", required = false) String startTime,
                                            @RequestParam(value = "startTime",required = false)String startTime,
                                            @ApiParam(name = "endTime", value = "结束时间")
                                            @RequestParam(value = "endTime", required = false) String endTime,
                                            @RequestParam(value = "endTime",required = false)String endTime,
                                            @ApiParam(name = "nameinfo", value = "医生名字/患者名字")
                                            @RequestParam(value = "nameinfo", required = false) String nameinfo,
                                            @RequestParam(value = "nameinfo",required = false)String nameinfo,
                                            @ApiParam(name = "page", value = "第几页")
                                            @RequestParam(value = "page", required = false) Integer page,
                                            @RequestParam(value = "page",required = false)Integer page,
                                            @ApiParam(name = "pagesize", value = "每页大小")
                                            @RequestParam(value = "pagesize", required = false) Integer pagesize) {
                                            @RequestParam(value = "pagesize",required = false)Integer pagesize) {
        try {
            return success(prescriptionService.selectByCondition(hospital, dept, status, startTime, endTime, nameinfo, page, pagesize, wxId));
        } catch (Exception e) {
            return success(prescriptionService.selectByCondition(hospital,dept,status,startTime,endTime,nameinfo,page,pagesize,wxId));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateStatus)
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.updateStatus)
    @ApiOperation("完成自取")
    public ObjEnvelop updateStatus(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true) String prescriptionId,
            @RequestParam(required = true)String prescriptionId,
            @ApiParam(name = "status", value = "status", required = true)
            @RequestParam(required = true) Integer status) throws Exception {
            @RequestParam(required = true)Integer status) throws Exception {
        try {
            prescriptionService.updateStatus(prescriptionId, status);
            return ObjEnvelop.getSuccess("ok", null);
            prescriptionService.updateStatus(prescriptionId,status);
            return ObjEnvelop.getSuccess("ok",null);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    /**
     * 更改单号
     *
     * @param id
     * @param mailNo
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateMailNoById)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.updateMailNoById)
    @ApiOperation("更改单号")
    public ObjEnvelop updateMailNoById(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(required = true) String id,
            @RequestParam(required = true)String id,
            @ApiParam(name = "mailNo", value = "mailNo", required = true)
            @RequestParam(required = true) String mailNo) throws Exception {
            @RequestParam(required = true)String mailNo) throws Exception {
        try {
            prescriptionService.updateMailNoById(id, mailNo);
            return ObjEnvelop.getSuccess("ok", null);
            prescriptionService.updateMailNoById(id,mailNo);
            return ObjEnvelop.getSuccess("ok",null);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    /**
     * 处方-- 审方
     *
@ -2184,65 +2132,65 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.prescriptionCheck)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.prescriptionCheck)
    @ApiOperation("处方-审方")
    public ObjEnvelop prescriptionCheck(
            @ApiParam(name = "operate", value = "审核人", required = true)
            @RequestParam(required = true) String operate,
            @RequestParam(required = true)String operate,
            @ApiParam(name = "operateName", value = "审核人名字", required = true)
            @RequestParam(required = true) String operateName,
            @RequestParam(required = true)String operateName,
            @ApiParam(name = "reason", value = "审核原因", required = true)
            @RequestParam(required = true) String reason,
            @RequestParam(required = true)String reason,
            @ApiParam(name = "status", value = "0未审核1审核退回2审核通过", required = true)
            @RequestParam(required = true) Integer status,
            @RequestParam(required = true)Integer status,
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true) String prescriptionId) throws Exception {
        WlyyPrescriptionCheckDO wlyyPrescriptionCheckDO = prescriptionService.saveCheck(operate, operateName, reason, status, prescriptionId, wxId);
            @RequestParam(required = true)String prescriptionId) throws Exception {
    
        WlyyPrescriptionCheckDO wlyyPrescriptionCheckDO = prescriptionService.saveCheck(operate,operateName,reason,status,prescriptionId,wxId);
        try {
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionService.findPrescriptionDo(prescriptionId);
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(wlyyPrescriptionDO.getOutpatientId());
            if (status == 1) {
            if (status==1){
                com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
                msgObj.put("outpatientid", wlyyPrescriptionDO.getOutpatientId());
                msgObj.put("prescriptionId", prescriptionId);
                msgObj.put("reason", reason);
                String immsg = imService.pushPrescriptionBackMsg(msgObj, operate, operateName, wlyyPrescriptionDO.getOutpatientId(), wlyyOutpatientDO.getConsumer(), wlyyOutpatientDO.getOutpatientType(), wlyyOutpatientDO.getType());
                System.out.println("发送诊断消息成功:" + immsg);
            } else if (status == 2) {
                msgObj.put("outpatientid",wlyyPrescriptionDO.getOutpatientId());
                msgObj.put("prescriptionId",prescriptionId);
                msgObj.put("reason",reason);
                String immsg = imService.pushPrescriptionBackMsg(msgObj,operate,operateName,wlyyPrescriptionDO.getOutpatientId(),wlyyOutpatientDO.getConsumer(),wlyyOutpatientDO.getOutpatientType(),wlyyOutpatientDO.getType());
                System.out.println("发送诊断消息成功:"+immsg);
            }else if (status==2){
                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
                System.out.println("wlyyPrescriptionDO参数入参" + object.toJSONString());
                WlyyPrescriptionVO prescriptionVO = JSONObject.toJavaObject(object, WlyyPrescriptionVO.class);
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(), 1);
                System.out.println("wlyyPrescriptionDO参数入参"+object.toJSONString());
                WlyyPrescriptionVO prescriptionVO = JSONObject.toJavaObject(object,WlyyPrescriptionVO.class);
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO : wlyyPrescriptionInfoDOS) {
                for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                    System.out.println("wlyyPrescriptionInfoDO参数入参" + jsonObject.toJSONString());
                    WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(jsonObject, WlyyPrescriptionInfoVO.class);
                    System.out.println("wlyyPrescriptionInfoDO参数入参"+jsonObject.toJSONString());
                    WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionInfoVO.class);
                    wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                }
                prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(), 1);
                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO : wlyyPrescriptionDiagnosisDOS) {
                for (WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO:wlyyPrescriptionDiagnosisDOS){
                    JSONObject jsonObject = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDiagnosisDO);
                    System.out.println("wlyyPrescriptionDiagnosisDO参数入参" + jsonObject.toJSONString());
                    WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = JSONObject.toJavaObject(jsonObject, WlyyPrescriptionDiagnosisVO.class);
                    System.out.println("wlyyPrescriptionDiagnosisDO参数入参"+jsonObject.toJSONString());
                    WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = JSONObject.toJavaObject(jsonObject,WlyyPrescriptionDiagnosisVO.class);
                    wlyyPrescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
                }
                prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
                imService.pushPrescriptionImMessage(prescriptionVO);
            }
        } catch (Exception e) {
            System.out.println("发送诊断消息失败:" + e.getMessage());
        }catch (Exception e){
            System.out.println("发送诊断消息失败:"+e.getMessage());
//            e.printStackTrace();
        }
        return ObjEnvelop.getSuccess("ok", wlyyPrescriptionCheckDO);
    
        return ObjEnvelop.getSuccess("ok",wlyyPrescriptionCheckDO);
    }
    
    
    /**
     * 医生端-处方处理
     *
@ -2253,26 +2201,26 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.savePrescriptionCheck)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.savePrescriptionCheck)
    @ApiOperation("医生端-处方处理")
    public ObjEnvelop savePrescriptionCheck(
            @ApiParam(name = "operate", value = "操作人code", required = true)
            @RequestParam(required = true) String operate,
            @RequestParam(required = true)String operate,
            @ApiParam(name = "reason", value = "处理原因", required = true)
            @RequestParam(required = true) String reason,
            @RequestParam(required = true)String reason,
            @ApiParam(name = "status", value = "3处方修改4执行处方", required = true)
            @RequestParam(required = true) Integer status,
            @RequestParam(required = true)Integer status,
            @ApiParam(name = "prescriptionId", value = "处方id", required = true)
            @RequestParam(required = true) String prescriptionId) throws Exception {
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            //String operate,String operateName,String reason,Integer status,String prescriptionId
            return ObjEnvelop.getSuccess("ok", prescriptionService.savePrescriptionCheck(operate, reason, status, prescriptionId));
            return ObjEnvelop.getSuccess("ok",prescriptionService.savePrescriptionCheck(operate,reason,status,prescriptionId));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    
    /**
     * 查询审核历史记录
     *
@ -2280,65 +2228,64 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.prescriptionCheckList)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.prescriptionCheckList)
    @ApiOperation("查询审核历史记录")
    public ObjEnvelop prescriptionCheckList(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true) String prescriptionId) throws Exception {
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", prescriptionService.findPrescriptionCheck(prescriptionId));
            
            return ObjEnvelop.getSuccess("ok",prescriptionService.findPrescriptionCheck(prescriptionId));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    
    /**
     * 查询单条处方记录
     *
     * @param prescriptionId
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.selectByPrescriptionId)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.selectByPrescriptionId)
    @ApiOperation("查询单条处方记录")
    public ObjEnvelop selectByPrescriptionId(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true) String prescriptionId) throws Exception {
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", prescriptionService.selectByPrescriptionId(prescriptionId));
            
            return ObjEnvelop.getSuccess("ok",prescriptionService.selectByPrescriptionId(prescriptionId));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.deleteById)
    
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.deleteById)
    @ApiOperation("医生端-逻辑删除业务数据")
    public ObjEnvelop deleteById(
            @ApiParam(name = "flag", value = "1药品2诊断3检查", required = true)
            @RequestParam(required = true) Integer flag,
            @RequestParam(required = true)Integer flag,
            @ApiParam(name = "id", value = "业务id", required = true)
            @RequestParam(required = true) String id) throws Exception {
            @RequestParam(required = true)String id) throws Exception {
        try {
            prescriptionService.deleteById(flag, id);
            return ObjEnvelop.getSuccess("ok", null);
            prescriptionService.deleteById(flag,id);
            return ObjEnvelop.getSuccess("ok",null);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.selectExpireTime)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.selectExpireTime)
    @ApiOperation("查询过期时间")
    public ObjEnvelop selectExpireTime(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true) String relationCode) throws Exception {
            @RequestParam(required = true)String relationCode) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.selectOrderTime(relationCode));
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderTime(relationCode));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -2367,18 +2314,17 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    /**
     * 查询电子病历
     *
     * @param prescriptionId
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findEmrByPrescriptionId)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.findEmrByPrescriptionId)
    @ApiOperation("查询电子病历")
    public ObjEnvelop findByPrescriptionId(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true) String prescriptionId) throws Exception {
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", prescriptionService.findByPrescriptionId(prescriptionId));
            return ObjEnvelop.getSuccess("ok",prescriptionService.findByPrescriptionId(prescriptionId));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -2418,18 +2364,17 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    /**
     * 查询his电子病历
     *
     * @param registerSn
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findHisEmr)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.findHisEmr)
    @ApiOperation("查询电子病历")
    public ObjEnvelop findHisEmr(
            @ApiParam(name = "registerSn", value = "registerSn", required = true)
            @RequestParam(required = true) String registerSn) throws Exception {
            @RequestParam(required = true)String registerSn) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", prescriptionService.readOutPatient(registerSn));
            return ObjEnvelop.getSuccess("ok",prescriptionService.readOutPatient(registerSn));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -2437,34 +2382,33 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    /**
     * 查询his电子病历
     *
     * @param registerSn
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findHisEmrXml)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.findHisEmrXml)
    @ApiOperation("查询电子病历")
    public ObjEnvelop findHisEmrXml(
            @ApiParam(name = "registerSn", value = "registerSn", required = true)
            @RequestParam(required = true) String registerSn) throws Exception {
            @RequestParam(required = true)String registerSn) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", prescriptionService.readOutPatientXml(registerSn));
            return ObjEnvelop.getSuccess("ok",prescriptionService.readOutPatientXml(registerSn));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.outpatient)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.outpatient)
    @ApiOperation("门诊病历列表信息")
    public ObjEnvelop outpatient(
            @ApiParam(name = "patient", value = "patient", required = true)
            @RequestParam(required = true) String patient) throws Exception {
            @RequestParam(required = true)String patient) throws Exception {
        try {
            String doctorId = getUID();
            if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
                return ObjEnvelop.getSuccess("ok", xzzxEntranceService.selectHistoryEmrFromEntrance(patient, null));
            } else {
                return ObjEnvelop.getSuccess("ok", prescriptionService.outpatient(patient, doctorId));
            String doctorId=getUID();
            if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectHistoryEmrFromEntrance(patient,null));
            }else {
                return ObjEnvelop.getSuccess("ok",prescriptionService.outpatient(patient,doctorId));
            }
        } catch (Exception e) {
@ -2473,85 +2417,86 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.outpmedicaldoc)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.outpmedicaldoc)
    @ApiOperation("医疗文书列表信息")
    public ObjEnvelop outpmedicaldoc(
            @ApiParam(name = "patient", value = "patient", required = true)
            @RequestParam(required = true) String patient) throws Exception {
            @RequestParam(required = true)String patient) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", prescriptionService.outpmedicaldoc(patient));
            return ObjEnvelop.getSuccess("ok",prescriptionService.outpmedicaldoc(patient));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getPatInfoDataXml)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.getPatInfoDataXml)
    @ApiOperation("获取病历的PDF流")
    public ObjEnvelop getPatInfoDataXml(
            @ApiParam(name = "opid", value = "门诊病历", required = false)
            @RequestParam(required = false) String opid,
            @RequestParam(required = false)String opid,
            @ApiParam(name = "recSn", value = "医疗文书", required = false)
            @RequestParam(required = false) String recSn) throws Exception {
            @RequestParam(required = false)String recSn) throws Exception {
        try {
            if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
                return ObjEnvelop.getSuccess("ok", xzzxEntranceService.selectBrowseSingleEMR(opid));
            } else {
                return ObjEnvelop.getSuccess("ok", prescriptionService.getPatInfoDataXml(opid, recSn));
            if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectBrowseSingleEMR(opid));
            }else {
                return ObjEnvelop.getSuccess("ok",prescriptionService.getPatInfoDataXml(opid,recSn));
            }
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveEmr)
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveEmr)
    @ApiOperation("写入his电子病历")
    public ObjEnvelop findHisEmr(
            @ApiParam(name = "registerSn", value = "registerSn", required = true)
            @RequestParam(required = true) String registerSn,
            @RequestParam(required = true)String registerSn,
            @ApiParam(name = "chiefComplaint", value = "chiefComplaint", required = true)
            @RequestParam(required = true) String chiefComplaint,
            @RequestParam(required = true)String chiefComplaint,
            @ApiParam(name = "hpi", value = "hpi", required = true)
            @RequestParam(required = true) String hpi,
            @RequestParam(required = true)String hpi,
            @ApiParam(name = "elapsemhis", value = "elapsemhis", required = true)
            @RequestParam(required = true) String elapsemhis,
            @RequestParam(required = true)String elapsemhis,
            @ApiParam(name = "bodycheck", value = "bodycheck", required = true)
            @RequestParam(required = true) String bodycheck,
            @RequestParam(required = true)String bodycheck,
            @ApiParam(name = "assistanTcheck", value = "assistanTcheck", required = true)
            @RequestParam(required = true) String assistanTcheck,
            @RequestParam(required = true)String assistanTcheck,
            @ApiParam(name = "doctor", value = "doctor", required = true)
            @RequestParam(required = true) String doctor,
            @RequestParam(required = true)String doctor,
            @ApiParam(name = "doctorName", value = "doctorName", required = true)
            @RequestParam(required = true) String doctorName) throws Exception {
            @RequestParam(required = true)String doctorName) throws Exception {
        //String registerSn,String chiefComplaint,String hpi,String elapsemhis,String bodycheck,String assistanTcheck
        try {
            return ObjEnvelop.getSuccess("ok", prescriptionService.writeOutPatient(registerSn, chiefComplaint, hpi, elapsemhis, bodycheck, assistanTcheck, doctor, doctorName));
            return ObjEnvelop.getSuccess("ok",prescriptionService.writeOutPatient(registerSn,chiefComplaint,hpi,elapsemhis,bodycheck,assistanTcheck,doctor,doctorName));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientAllPrescription)
    @ApiOperation(value = "查询患者所有处方信息", notes = "查询患者所有处方信息")
    public PageEnvelop findPatientAllPrescription(@ApiParam(name = "keyName", value = "搜索关键字")
                                                  @RequestParam(value = "keyName", required = false) String keyName,
                                                  @RequestParam(value = "keyName", required = false)String keyName,
                                                  @ApiParam(name = "status[]", value = "状态")
                                                  @RequestParam(value = "status[]", required = false) String status,
                                                  @RequestParam(value = "status[]", required = false)String status,
                                                  @ApiParam(name = "isSelectDrug", value = "1查询处方药品1是0查询检查")
                                                  @RequestParam(value = "isSelectDrug", required = false) String isSelectDrug,
                                                      @RequestParam(value = "isSelectDrug", required = false)String isSelectDrug,
                                                  @ApiParam(name = "patient", value = "患者id")
                                                  @RequestParam(value = "patient", required = false) String patient,
                                                      @RequestParam(value = "patient", required = false)String patient,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
                                                  @RequestParam(value = "page",required = false,defaultValue = "1") Integer page,
                                                  @ApiParam(name = "size", value = "页面大小")
                                                  @RequestParam(value = "size", required = false, defaultValue = "10") Integer size) throws Exception {
                                                  @RequestParam(value = "size",required = false,defaultValue = "10") Integer size)throws Exception {
        try {
            boolean consumerflag = false;
            if (!StringUtils.isNoneBlank(patient)) {
                patient = getUID();
                consumerflag = true;
            boolean consumerflag = false ;
            if (!StringUtils.isNoneBlank(patient)){
                patient=getUID();
                consumerflag=true;
            }
            return prescriptionService.findPatientAllPrescription(keyName, status, page, size, patient, isSelectDrug, consumerflag);
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size,patient,isSelectDrug,consumerflag);
        } catch (Exception e) {
            return failedPageEnvelopException(e);
        }
@ -2560,13 +2505,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDrugAddress)
    @ApiOperation(value = "查看取药地址", notes = "查看取药地址")
    public MixEnvelop findDrugAddress(@ApiParam(name = "outpatientId", value = "关联门诊code")
                                      @RequestParam(value = "outpatientId", required = true) String outpatientId,
                                      @RequestParam(value = "outpatientId", required = true)String outpatientId,
                                      @ApiParam(name = "longitude", value = "经度")
                                      @RequestParam(value = "longitude", required = true) String longitude,
                                      @RequestParam(value = "longitude",required = true) String longitude,
                                      @ApiParam(name = "dimension", value = "维度")
                                      @RequestParam(value = "dimension", required = true) String dimension) throws Exception {
                                      @RequestParam(value = "dimension",required = true) String dimension)throws Exception {
        try {
            return prescriptionService.findDrugAddress(outpatientId, longitude, dimension);
            return prescriptionService.findDrugAddress(outpatientId,longitude,dimension);
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
@ -2575,7 +2520,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCommity)
    @ApiOperation(value = "获取居委会列表")
    public ListEnvelop<BaseCommitteeVO> findCommity(
    public ListEnvelop<BaseCommitteeVO> findCommity (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -2586,7 +2531,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            List<BaseCommitteeDO> baseProvinces = baseCommitteeService.search(fields, filters, sorts);
            return success(baseProvinces, BaseCommitteeVO.class);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -2594,7 +2539,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findTown)
    @ApiOperation(value = "获取区列表")
    public ListEnvelop<BaseTownVO> list(
    public ListEnvelop<BaseTownVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -2602,10 +2547,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        try {
        try{
            List<BaseTownDO> baseTowns = baseTownService.search(fields, filters, sorts);
            return success(baseTowns, BaseTownVO.class);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -2613,7 +2558,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findProvince)
    @ApiOperation(value = "获取省列表")
    public ListEnvelop<BaseProvinceVO> findProvince(
    public ListEnvelop<BaseProvinceVO> findProvince (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -2624,14 +2569,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            List<BaseProvinceDO> baseProvinces = baseProvinceService.search(fields, filters, sorts);
            return success(baseProvinces, BaseProvinceVO.class);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCity)
    @ApiOperation(value = "获取市列表")
    public ListEnvelop<BaseCityVO> findCity(
    public ListEnvelop<BaseCityVO> findCity (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -2642,35 +2587,33 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            List<BaseCityDO> baseCitys = baseCityService.search(fields, filters, sorts);
            return success(baseCitys, BaseCityVO.class);
        } catch (Exception e) {
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    /**
     * 获取诊间支付url
     *
     * @param prescriptionId
     * @return
     * @throws Exception
     */
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.selectByUrl)
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.selectByUrl)
    @ApiOperation("获取诊间支付url")
    public ObjEnvelop selectByUrl(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = false)
            @RequestParam(required = false) String prescriptionId,
            @RequestParam(required = false)String prescriptionId,
            @ApiParam(name = "oupatientId", value = "oupatientId", required = false)
            @RequestParam(required = false) String oupatientId,
            @RequestParam(required = false)String oupatientId,
            @ApiParam(name = "flag", value = "flag", required = false)
            @RequestParam(required = false) String flag,
            @RequestParam(required = false)String flag,
            @ApiParam(name = "channel", value = "WX、ALI", required = false)
            @RequestParam(required = false) String channel) throws Exception {
            @RequestParam(required = false)String channel) throws Exception {
        try {
            if (StringUtils.isNoneBlank(flag)) {
            if (StringUtils.isNoneBlank(flag)){
                Integer id = Integer.parseInt(oupatientId);
                return ObjEnvelop.getSuccess("ok", prescriptionService.selectByUrlHsjc(id, wxId, channel));
            } else {
                return ObjEnvelop.getSuccess("ok", prescriptionService.selectByUrl(oupatientId, prescriptionId, wxId));
                return ObjEnvelop.getSuccess("ok",prescriptionService.selectByUrlHsjc(id,wxId,channel));
            }else {
                return ObjEnvelop.getSuccess("ok",prescriptionService.selectByUrl(oupatientId,prescriptionId,wxId));
            }
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
@ -2679,32 +2622,32 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientOpenId)
    @ApiOperation(value = "获取居民OpenId")
    public MixEnvelop findCity(
    public MixEnvelop findCity (
            @ApiParam(name = "patientCode", value = "居民code")
            @RequestParam(value = "patientCode", required = false) String patientCode) throws Exception {
        try {
            return prescriptionService.findPatientOpenId(patientCode);
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
      try {
          return   prescriptionService.findPatientOpenId(patientCode);
      } catch (Exception e) {
          return failedMixEnvelopException(e);
      }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.updatePayStatus)
    @ApiOperation(value = "无需支付时调用")
    public ObjEnvelop updatePayStatus(
    public ObjEnvelop updatePayStatus (
            @ApiParam(name = "relationCode", value = "业务code")
            @RequestParam(value = "relationCode", required = false) String relationCode) throws Exception {
        try {
            BusinessOrderDO businessOrderDO = businessOrderService.updatePayStatusByRelation(relationCode, wxId);
            if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")) {
            BusinessOrderDO businessOrderDO = businessOrderService.updatePayStatusByRelation(relationCode,wxId);
            if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
                SystemMessageDO systemMessageDO = new SystemMessageDO();
                systemMessageDO.setType("1");
                systemMessageDO.setReceiver(businessOrderDO.getDoctor());
                systemMessageDO.setSender(businessOrderDO.getPatient());
                //发送IM消息
                hospitalSystemMessageService.sendImMessage(systemMessageDO);
            } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("3")) {
            }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
                SystemMessageDO systemMessageDO = new SystemMessageDO();
                systemMessageDO.setType("2");
                systemMessageDO.setReceiver(businessOrderDO.getDoctor());
@ -2712,7 +2655,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                //发送IM消息
                hospitalSystemMessageService.sendImMessage(systemMessageDO);
            }
            return ObjEnvelop.getSuccess("ok", businessOrderDO);
            return ObjEnvelop.getSuccess("ok",businessOrderDO);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -2721,43 +2664,40 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatNoByPatient)
    @ApiOperation(value = "patient映射信息")
    public ObjEnvelop findPatNoByPatient(
    public ObjEnvelop findPatNoByPatient (
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = false) String code) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", patientMappingService.findPatientNoByPatientCode(code));
            return ObjEnvelop.getSuccess("ok",patientMappingService.findPatientNoByPatientCode(code));
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.popularityIncrease)
    @ApiOperation(value = "医生人气值增长")
    public Envelop popularityIncrease(
    public Envelop popularityIncrease (
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
        try {
            BaseDoctorDO baseDoctorDO = baseDoctorInfoService.popularityIncrease(doctor);
            return success("操作成功", baseDoctorDO);
        } catch (Exception e) {
            BaseDoctorDO baseDoctorDO=baseDoctorInfoService.popularityIncrease(doctor);
            return  success("操作成功",baseDoctorDO);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxSelectExamApply)
    @ApiOperation(value = "检查项目查询接口")
    public ListEnvelop selectExamApply(
            @ApiParam(name = "spellCode", value = "拼音首字母")
            @RequestParam(value = "spellCode", defaultValue = "") String spellCode) throws Exception {
            @RequestParam(value = "spellCode",defaultValue = "") String spellCode) throws Exception {
        return success(xzzxEntranceService.selectExamApply(spellCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxSelectLisApply)
    @ApiOperation(value = "检验项目查询接口")
    public ListEnvelop selectLisApply(
            @ApiParam(name = "spellCode", value = "拼音首字母")
            @RequestParam(value = "spellCode", defaultValue = "") String spellCode) throws Exception {
            @RequestParam(value = "spellCode",defaultValue = "") String spellCode) throws Exception {
        return success(xzzxEntranceService.selectLisApply(spellCode));
    }
@ -2765,156 +2705,150 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "合理用药审核接口")
    public Envelop xzzxCheckInfo(
            @ApiParam(name = "prescriptionOnly", value = "处方唯一标识")
            @RequestParam(value = "prescriptionOnly", defaultValue = "") String prescriptionOnly,
            @RequestParam(value = "prescriptionOnly",defaultValue = "") String prescriptionOnly,
            @ApiParam(name = "payType", value = "付款方式0自费;1医保")
            @RequestParam(value = "payType", defaultValue = "") String payType,
            @RequestParam(value = "payType",defaultValue = "") String payType,
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", defaultValue = "") String doctor,
            @RequestParam(value = "doctor",defaultValue = "") String doctor,
            @ApiParam(name = "patient", value = "病人id")
            @RequestParam(value = "patient", defaultValue = "") String patient,
            @RequestParam(value = "patient",defaultValue = "") String patient,
            @ApiParam(name = "diagnosisDOS", value = "诊断json")
            @RequestParam(value = "diagnosisDOS", defaultValue = "") String diagnosisDOS,
            @RequestParam(value = "diagnosisDOS",defaultValue = "") String diagnosisDOS,
            @ApiParam(name = "infos", value = "药品json")
            @RequestParam(value = "infos", defaultValue = "") String infos) throws Exception {
            @RequestParam(value = "infos",defaultValue = "") String infos) throws Exception {
        JSONArray druginfos = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i = 0; i < druginfos.size(); i++) {
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(druginfos.get(i).toString(), WlyyPrescriptionInfoDO.class);
        for (int i=0;i<druginfos.size();i++){
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(druginfos.get(i).toString(),WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONArray diagnosis = JSONArray.parseArray(diagnosisDOS);
        List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = new ArrayList<>();
        for (int i = 0; i < diagnosis.size(); i++) {
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(), WlyyPrescriptionDiagnosisDO.class);
        for (int i=0;i<diagnosis.size();i++){
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(),WlyyPrescriptionDiagnosisDO.class);
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(xzzxEntranceService.checkInputInfo(prescriptionOnly, payType, doctor, patient, wlyyPrescriptionDiagnosisDOS, wlyyPrescriptionInfoDOS));
        return success(xzzxEntranceService.checkInputInfo(prescriptionOnly,payType,doctor,patient,wlyyPrescriptionDiagnosisDOS,wlyyPrescriptionInfoDOS));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.xzzxSaveCheckInfo)
    @ApiOperation(value = "合理用药审核通过后保存接口")
    public Envelop xzzxSaveCheckInfo(
            @ApiParam(name = "prescriptionOnly", value = "处方唯一标识")
            @RequestParam(value = "prescriptionOnly", defaultValue = "") String prescriptionOnly,
            @RequestParam(value = "prescriptionOnly",defaultValue = "") String prescriptionOnly,
            @ApiParam(name = "payType", value = "付款方式0自费;1医保")
            @RequestParam(value = "payType", defaultValue = "") String payType,
            @RequestParam(value = "payType",defaultValue = "") String payType,
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", defaultValue = "") String doctor,
            @RequestParam(value = "doctor",defaultValue = "") String doctor,
            @ApiParam(name = "patient", value = "病人id")
            @RequestParam(value = "patient", defaultValue = "") String patient,
            @RequestParam(value = "patient",defaultValue = "") String patient,
            @ApiParam(name = "diagnosisDOS", value = "诊断json")
            @RequestParam(value = "diagnosisDOS", defaultValue = "") String diagnosisDOS,
            @RequestParam(value = "diagnosisDOS",defaultValue = "") String diagnosisDOS,
            @ApiParam(name = "infos", value = "药品json")
            @RequestParam(value = "infos", defaultValue = "") String infos) throws Exception {
            @RequestParam(value = "infos",defaultValue = "") String infos) throws Exception {
        JSONArray druginfos = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i = 0; i < druginfos.size(); i++) {
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(druginfos.get(i).toString(), WlyyPrescriptionInfoDO.class);
        for (int i=0;i<druginfos.size();i++){
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(druginfos.get(i).toString(),WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONArray diagnosis = JSONArray.parseArray(diagnosisDOS);
        List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = new ArrayList<>();
        for (int i = 0; i < diagnosis.size(); i++) {
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(), WlyyPrescriptionDiagnosisDO.class);
        for (int i=0;i<diagnosis.size();i++){
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(),WlyyPrescriptionDiagnosisDO.class);
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(xzzxEntranceService.saveCheckInputInfo(prescriptionOnly, payType, doctor, patient, wlyyPrescriptionDiagnosisDOS, wlyyPrescriptionInfoDOS));
        return success(xzzxEntranceService.saveCheckInputInfo(prescriptionOnly,payType,doctor,patient,wlyyPrescriptionDiagnosisDOS,wlyyPrescriptionInfoDOS));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.xzzxDeleteCheckInfo)
    @ApiOperation(value = "合理用药作废处方接口")
    public Envelop deleteCheckInputInfo(
            @ApiParam(name = "prescriptionOnly", value = "处方唯一标识")
            @RequestParam(value = "prescriptionOnly", defaultValue = "") String prescriptionOnly,
            @RequestParam(value = "prescriptionOnly",defaultValue = "") String prescriptionOnly,
            @ApiParam(name = "payType", value = "付款方式0自费;1医保")
            @RequestParam(value = "payType", defaultValue = "") String payType,
            @RequestParam(value = "payType",defaultValue = "") String payType,
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", defaultValue = "") String doctor,
            @RequestParam(value = "doctor",defaultValue = "") String doctor,
            @ApiParam(name = "patient", value = "病人id")
            @RequestParam(value = "patient", defaultValue = "") String patient,
            @RequestParam(value = "patient",defaultValue = "") String patient,
            @ApiParam(name = "diagnosisDOS", value = "诊断json")
            @RequestParam(value = "diagnosisDOS", defaultValue = "") String diagnosisDOS) throws Exception {
            @RequestParam(value = "diagnosisDOS",defaultValue = "") String diagnosisDOS) throws Exception {
        JSONArray diagnosis = JSONArray.parseArray(diagnosisDOS);
        List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = new ArrayList<>();
        for (int i = 0; i < diagnosis.size(); i++) {
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(), WlyyPrescriptionDiagnosisDO.class);
        for (int i=0;i<diagnosis.size();i++){
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(),WlyyPrescriptionDiagnosisDO.class);
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(xzzxEntranceService.deleteCheckInputInfo(prescriptionOnly, payType, doctor, patient, wlyyPrescriptionDiagnosisDOS));
        return success(xzzxEntranceService.deleteCheckInputInfo(prescriptionOnly,payType,doctor,patient,wlyyPrescriptionDiagnosisDOS));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updatePatientDiagnosis)
    @ApiOperation(value = "更新患者诊断记录")
    public Envelop updatePatientDiagnosis(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", defaultValue = "", required = true) String outpatientId,
            @RequestParam(value = "outpatientId",defaultValue = "",required = true) String outpatientId,
            @ApiParam(name = "icd10", value = "诊断码")
            @RequestParam(value = "icd10", defaultValue = "") String icd10,
            @RequestParam(value = "icd10",defaultValue = "") String icd10,
            @ApiParam(name = "icd10Name", value = "诊断名称")
            @RequestParam(value = "icd10Name", defaultValue = "") String icd10Name) throws Exception {
            @RequestParam(value = "icd10Name",defaultValue = "") String icd10Name) throws Exception {
        try {
            return prescriptionService.updatePatientDiagnosis(outpatientId, icd10, icd10Name);
        } catch (Exception e) {
            return prescriptionService.updatePatientDiagnosis(outpatientId,icd10,icd10Name);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.delHisPrescriptionByHisNo)
    @ApiOperation(value = "删除his处方信息")
    public ObjEnvelop delHisPrescriptionByHisNo(
            @ApiParam(name = "realOrder", value = "realOrder")
            @RequestParam(value = "realOrder", defaultValue = "", required = true) String realOrder) throws Exception {
            @RequestParam(value = "realOrder",defaultValue = "",required = true) String realOrder) throws Exception {
        ObjEnvelop objEnvelop = new ObjEnvelop();
        objEnvelop.setObj(xzzxEntranceService.deletePrescriptionToEntrance(realOrder));
        return objEnvelop;
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveEmrToEntrance)
    @ApiOperation(value = "保存电子病历")
    public ObjEnvelop saveEmr(
            @ApiParam(name = "prescriptionId", value = "prescriptionId")
            @RequestParam(value = "prescriptionId", defaultValue = "", required = true) String prescriptionId,
            @RequestParam(value = "prescriptionId",defaultValue = "",required = true) String prescriptionId,
            @ApiParam(name = "baseSign", value = "baseSign")
            @RequestParam(value = "baseSign", defaultValue = "", required = false) String baseSign) throws Exception {
            @RequestParam(value = "baseSign",defaultValue = "",required = false) String baseSign) throws Exception {
        ObjEnvelop objEnvelop = new ObjEnvelop();
        objEnvelop.setObj(xzzxEntranceService.saveEmrToEntrance(prescriptionId, baseSign));
        objEnvelop.setObj(xzzxEntranceService.saveEmrToEntrance(prescriptionId,baseSign));
        return objEnvelop;
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.prescriptionManage)
    @ApiOperation(value = "处方管理")
    public MixEnvelop prescriptionManage(
            @ApiParam(name = "keyWord", value = "患者姓名或证件号或就诊卡")
            @RequestParam(value = "keyWord", defaultValue = "", required = false) String keyWord,
            @RequestParam(value = "keyWord",defaultValue = "",required = false) String keyWord,
            @ApiParam(name = "doctorId", value = "医生id")
            @RequestParam(value = "doctorId", defaultValue = "", required = false) String doctorId,
            @RequestParam(value = "doctorId",defaultValue = "",required = false) String doctorId,
            @ApiParam(name = "startTime", value = "开始时间")
            @RequestParam(value = "startTime", defaultValue = "", required = false) String startTime,
            @RequestParam(value = "startTime",defaultValue = "",required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间")
            @RequestParam(value = "endTime", defaultValue = "", required = false) String endTime,
            @RequestParam(value = "endTime",defaultValue = "",required = false) String endTime,
            @ApiParam(name = "checkStatus", value = "处方审核状态")
            @RequestParam(value = "checkStatus", defaultValue = "", required = false) String checkStatus,
            @RequestParam(value = "checkStatus",defaultValue = "",required = false) String checkStatus,
            @ApiParam(name = "status", value = "处方状态")
            @RequestParam(value = "status", defaultValue = "", required = false) String status,
            @RequestParam(value = "status",defaultValue = "",required = false) String status,
            @ApiParam(name = "page", value = "页数")
            @RequestParam(value = "page", defaultValue = "", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "页大小")
            @RequestParam(value = "pageSize", defaultValue = "", required = false) Integer pageSize) throws Exception {
            @RequestParam(value = "page",defaultValue = "",required = false) Integer page,
            @ApiParam(name = "pageSize",value = "页大小")
            @RequestParam(value = "pageSize",defaultValue = "",required = false) Integer pageSize) throws Exception {
        try {
            return prescriptionService.prescriptionManage(keyWord, doctorId, startTime, endTime, checkStatus, status, page, pageSize);
        } catch (Exception e) {
            return prescriptionService.prescriptionManage(keyWord,doctorId,startTime,endTime,checkStatus,status,page,pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.disablePrescription)
    @ApiOperation(value = "作废处方")
    public Envelop disablePrescription(
            @ApiParam(name = "prescriptionId", value = "prescriptionId")
            @RequestParam(value = "prescriptionId", defaultValue = "", required = true) String prescriptionId) throws Exception {
            @RequestParam(value = "prescriptionId",defaultValue = "",required = true) String prescriptionId) throws Exception {
        return success(prescriptionService.disablePrescription(prescriptionId));
    }
@ -2924,50 +2858,47 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "生成小程序秘钥")
    public Envelop appletSign(
            @ApiParam(name = "userId", value = "userId")
            @RequestParam(value = "userId", defaultValue = "", required = true) String userId,
            @RequestParam(value = "userId",defaultValue = "",required = true) String userId,
            @ApiParam(name = "channelName", value = "channelName")
            @RequestParam(value = "channelName", defaultValue = "", required = false) String channelName,
            @RequestParam(value = "channelName",defaultValue = "",required = false) String channelName,
            @ApiParam(name = "flag", value = "flag")
            @RequestParam(value = "flag", defaultValue = "", required = false) String flag) throws Exception {
        if (StringUtils.isNoneBlank(flag) && flag.equalsIgnoreCase("yx")) {
            return success(prescriptionService.yxToken2(userId, channelName));
        } else {
            @RequestParam(value = "flag",defaultValue = "",required = false) String flag) throws Exception {
        if (StringUtils.isNoneBlank(flag)&&flag.equalsIgnoreCase("yx")){
            return success(prescriptionService.yxToken2(userId,channelName));
        }else {
            return success(prescriptionService.appletSign(userId));
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.yxToken20)
    @ApiOperation(value = "云信token2.0")
    public Envelop yxToken20(
            @ApiParam(name = "userId", value = "userId")
            @RequestParam(value = "userId", defaultValue = "", required = true) String userId,
            @RequestParam(value = "userId",defaultValue = "",required = true) String userId,
            @ApiParam(name = "channelName", value = "channelName")
            @RequestParam(value = "channelName", defaultValue = "", required = false) String channelName) throws Exception {
            @RequestParam(value = "channelName",defaultValue = "",required = false) String channelName) throws Exception {
        return success(prescriptionService.yxToken(userId, channelName));
        return success(prescriptionService.yxToken(userId,channelName));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.doorServiceTest)
    @ApiOperation(value = "测试上门复诊数据同步")
    public Envelop doorServiceTest(
            @ApiParam(name = "orderId", value = "orderId")
            @RequestParam(value = "orderId", defaultValue = "", required = false) String orderId,
            @RequestParam(value = "orderId",defaultValue = "",required = false) String orderId,
            @ApiParam(name = "prId", value = "prId")
            @RequestParam(value = "prId", defaultValue = "", required = false) String prId) throws Exception {
            @RequestParam(value = "prId",defaultValue = "",required = false) String prId) throws Exception {
        return success(prescriptionService.savePrescriptionToDoorService(orderId, prId));
        return success(prescriptionService.savePrescriptionToDoorService(orderId,prId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.selectMzRecord)
    @ApiOperation(value = "查询门诊记录下的患者列表")
    public Envelop selectMzRecord(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor", defaultValue = "", required = true) String doctor,
            @RequestParam(value = "doctor",defaultValue = "",required = true) String doctor,
            @ApiParam(name = "patientName", value = "patientName")
            @RequestParam(value = "patientName", defaultValue = "", required = false) String patientName) throws Exception {
            @RequestParam(value = "patientName",defaultValue = "",required = false) String patientName) throws Exception {
        return success(tnyyEntranceService.selectMzRecord(doctor, patientName));
        return success(tnyyEntranceService.selectMzRecord(doctor,patientName));
    }
@ -2975,11 +2906,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询住院记录下的患者列表")
    public Envelop selectZyRecord(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor", defaultValue = "", required = true) String doctor,
            @RequestParam(value = "doctor",defaultValue = "",required = true) String doctor,
            @ApiParam(name = "patientName", value = "patientName")
            @RequestParam(value = "patientName", defaultValue = "", required = false) String patientName) throws Exception {
            @RequestParam(value = "patientName",defaultValue = "",required = false) String patientName) throws Exception {
        return success(tnyyEntranceService.selectZyRecord(doctor, patientName));
        return success(tnyyEntranceService.selectZyRecord(doctor,patientName));
    }
@ -2987,7 +2918,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询某个患者的住院记录")
    public Envelop findJKTA_V_ZKSG_HZCX_HIS(
            @ApiParam(name = "brid", value = "患者id")
            @RequestParam(value = "brid", defaultValue = "", required = true) String brid) throws Exception {
            @RequestParam(value = "brid",defaultValue = "",required = true) String brid) throws Exception {
        return success(tnyyEntranceService.findJKTA_V_ZKSG_HZCX_HIS(brid));
    }
@ -2997,42 +2928,40 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询某个患者的住院记录")
    public Envelop findJKTA_ZY_RECORD(
            @ApiParam(name = "brid", value = "患者id")
            @RequestParam(value = "brid", defaultValue = "", required = true) String brid) throws Exception {
            @RequestParam(value = "brid",defaultValue = "",required = true) String brid) throws Exception {
        return success(tnyyEntranceService.findJKTA_ZY_RECORD(brid));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.doctorUpcomingList2)
    @ApiOperation(value = "医生待办事项列表")
    public Envelop doctorUpcomingList2(@ApiParam(name = "doctorCode", value = "医生CODE")
                                       @RequestParam(value = "doctorCode", required = true) String doctorCode,
                                       @ApiParam(name = "type", value = "类型:1.视频复诊(16)、2.专科协同(12)、3.图文复诊(9)、4.专家咨询(1,15)")
                                       @RequestParam(value = "type", required = true) String type) throws Exception {
                                      @RequestParam(value = "doctorCode",required = true) String doctorCode,
                                      @ApiParam(name = "type", value = "类型:1.视频复诊(16)、2.专科协同(12)、3.图文复诊(9)、4.专家咨询(1,15)")
                                      @RequestParam(value = "type",required = true) String type)throws Exception{
        com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
        List<Map<String, Object>> data = imService.doctorUpcomingList2(doctorCode, type);
        List<Map<String,Object>>  data = imService.doctorUpcomingList2(doctorCode, type);
        if (data != null) {
            for (Map<String, Object> consult : data) {
                if ("1,15,17".equals(type)) {//专家咨询
                    Integer consultType = Integer.parseInt(consult.get("type").toString());
                    if (1 == consultType) {//专家咨询
                        consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_1");
                    } else if (15 == consultType) {//家医求助
                        consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_" + consult.get("doctorCode").toString() + "_15");
                    } else if (17 == consultType) {//视频咨询
                        consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_17");
            for (Map<String,Object> consult : data) {
                if("1,15,17".equals(type)){//专家咨询
                    Integer consultType =  Integer.parseInt(consult.get("type").toString());
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else if (17==consultType){//视频咨询
                        consult.put("session_id", consult.get("consumer").toString()+"_"+ consult.get("outpatientId").toString()+"_17");
                    }
                } else if ("9".equals(type)) {//图文复诊
                    consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_9");
                    consult.put("type", type);
                } else if ("16".equals(type)) {//视频复诊
                    consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_16");
                    consult.put("type", type);
                } else if ("12".equals(type)) {//协同门诊
                    consult.put("session_id", consult.get("consumer").toString() + "_" + consult.get("outpatientId").toString() + "_12");
                    consult.put("type", type);
                } else {
                }
                }else if("9".equals(type)){//图文复诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_9");
                    consult.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_16");
                    consult.put("type",type);
                }else if("12".equals(type)){//协同门诊
                    consult.put("session_id", consult.get("consumer").toString()+"_"+consult.get("outpatientId").toString()+"_12");
                    consult.put("type",type);
                }else{}
                array.add(consult);
            }
@ -3043,23 +2972,23 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping("/BS10142")
    public ListEnvelop BS10142(
            @ApiParam(name = "deptCode", value = "deptCode")
            @RequestParam(value = "deptCode", required = false) String deptCode,
            @RequestParam(value = "deptCode",required = false)String deptCode,
            @ApiParam(name = "docCode", value = "docCode")
            @RequestParam(value = "docCode", required = false) String docCode,
            @RequestParam(value = "docCode",required = false)String docCode,
            @ApiParam(name = "chargeType", value = "chargeType")
            @RequestParam(value = "chargeType", required = false) String chargeType) throws Exception {
        if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            return success(entranceService.BS10142(deptCode, docCode, chargeType, demoFlag));
        } else if ("xm_tasy_wx".equalsIgnoreCase(wxId)) {
            String res = tasyNatService.departMent(deptCode);
            String dept = "";
            @RequestParam(value = "chargeType",required = false)String chargeType) throws Exception {
        if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            return success(entranceService.BS10142(deptCode,docCode,chargeType,demoFlag));
        }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
            String res=tasyNatService.departMent(deptCode);
            String dept="";
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("tasyNatDept");
            if (wlyyHospitalSysDictDO != null) {
                dept = wlyyHospitalSysDictDO.getDictValue();
            if (wlyyHospitalSysDictDO!=null){
                dept=wlyyHospitalSysDictDO.getDictValue();
            }
            JSONObject deptres = JSON.parseObject(res);
            if (deptres != null) {
                if (deptres.getString("success").equalsIgnoreCase("true")) {
            if (deptres!=null){
                if (deptres.getString("success").equalsIgnoreCase("true")){
                    /*JSONObject data = JSON.parseObject(deptres.getString("data"));
                    String depts=data.getString("Dept");
                    JSONArray jsonArray1 = JSON.parseArray(depts);
@ -3074,45 +3003,44 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                        }
                    }*/
                    String json = tasyNatService.GetDoctorWorkDate("3", dept);
                    String json=tasyNatService.GetDoctorWorkDate("3",dept);
                    JSONObject jsonObject = JSON.parseObject(json);
                    jsonObject.put("dept", dept);
                    jsonObject.put("dept",dept);
                    com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
                    jsonArray.add(jsonObject);
                    return success(jsonArray);
                } else {
                }else {
                    return ListEnvelop.getError("获取部门编码失败");
                }
            } else {
            }else {
                return ListEnvelop.getError("无效部门");
            }
        } else {
        }else {
            return ListEnvelop.getError("未开放");
        }
    }
    @GetMapping("/BS10143")
    public ListEnvelop BS10143(@ApiParam(name = "day", value = "day")
                               @RequestParam(value = "day", required = false) String day,
                               @RequestParam(value = "day",required = false)String day,
                               @ApiParam(name = "dept", value = "dept")
                               @RequestParam(value = "dept", required = false) String dept,
                               @RequestParam(value = "dept",required = false)String dept,
                               @ApiParam(name = "doctor", value = "doctor")
                               @RequestParam(value = "doctor", required = false) String doctor,
                                   @RequestParam(value = "doctor",required = false)String doctor,
                               @ApiParam(name = "IsAll", value = "IsAll")
                               @RequestParam(value = "IsAll", required = false) String IsAll,
                                   @RequestParam(value = "IsAll",required = false)String IsAll,
                               @ApiParam(name = "pm", value = "pm")
                               @RequestParam(value = "pm", required = false) String pm) throws Exception {
        if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            return success(entranceService.BS10143(day, pm, false));
        } else if ("xm_tasy_wx".equalsIgnoreCase(wxId)) {
            String res = tasyNatService.GetOrderSource(dept, doctor, day, "3", IsAll, pm);
            String xml = "";
            if (!org.apache.axis.utils.StringUtils.isEmpty(res)) {
                               @RequestParam(value = "pm",required = false)String pm) throws Exception {
        if("xm_zsyy_wx".equalsIgnoreCase(wxId)){
            return success(entranceService.BS10143(day,pm,false));
        }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
            String res=tasyNatService.GetOrderSource(dept,doctor,day,"3",IsAll,pm);
            String xml="";
            if (!org.apache.axis.utils.StringUtils.isEmpty(res)){
                JSONObject jsonObject = JSON.parseObject(res);
                System.out.println("=====" + jsonObject.getString("success"));
                if (jsonObject != null && jsonObject.getString("success").equalsIgnoreCase("true")) {
                    xml = jsonObject.getString("data");
                System.out.println("====="+jsonObject.getString("success"));
                if (jsonObject!=null&&jsonObject.getString("success").equalsIgnoreCase("true")){
                    xml=jsonObject.getString("data");
                    XMLSerializer xmlSerializer = new XMLSerializer();
                    String json = xmlSerializer.read(xml).toString();
                    JSONObject jsonObjectRes = JSON.parseObject(json);
@ -3122,99 +3050,98 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                }
            }
            return ListEnvelop.getError("查询失败");
        } else {
        }else {
            return ListEnvelop.getError("未开放");
        }
    }
    @GetMapping("/BS10144")
    public Envelop BS10144(@ApiParam(name = "deptCode", value = "deptCode")
                           @RequestParam(value = "deptCode", required = false) String deptCode,
                               @RequestParam(value = "deptCode",required = false)String deptCode,
                           @ApiParam(name = "docCode", value = "docCode")
                           @RequestParam(value = "docCode", required = false) String docCode,
                           @RequestParam(value = "docCode",required = false)String docCode,
                           @ApiParam(name = "startTime", value = "startTime")
                           @RequestParam(value = "startTime", required = false) String startTime,
                               @RequestParam(value = "startTime",required = false)String startTime,
                           @ApiParam(name = "sSID", value = "sSID")
                           @RequestParam(value = "sSID", required = false) String sSID,
                               @RequestParam(value = "sSID",required = false)String sSID,
                           @ApiParam(name = "patientName", value = "patientName")
                           @RequestParam(value = "patientName", required = false) String patientName,
                               @RequestParam(value = "patientName",required = false)String patientName,
                           @ApiParam(name = "patientID", value = "patientID")
                           @RequestParam(value = "patientID", required = false) String patientID,
                               @RequestParam(value = "patientID",required = false)String patientID,
                           @ApiParam(name = "patientPhone", value = "patientPhone")
                           @RequestParam(value = "patientPhone", required = false) String patientPhone,
                               @RequestParam(value = "patientPhone",required = false)String patientPhone,
                           @ApiParam(name = "pm", value = "pm")
                           @RequestParam(value = "pm", required = false) String pm) throws Exception {
        return success(entranceService.BS10144(deptCode, docCode, startTime, sSID, patientName, patientID, patientPhone, pm, demoFlag));
                               @RequestParam(value = "pm",required = false)String pm) throws Exception {
        return success(entranceService.BS10144(deptCode,docCode,startTime,sSID,patientName,patientID,patientPhone,pm,demoFlag));
    }
    @GetMapping("/BS10145")
    public Envelop BS10145(@ApiParam(name = "id", value = "id")
                           @RequestParam(value = "id", required = false) Integer id,
                               @RequestParam(value = "id",required = false)Integer id,
                           @ApiParam(name = "patientId", value = "patientId")
                           @RequestParam(value = "patientId", required = false) String patientId) throws Exception {
                               @RequestParam(value = "patientId",required = false)String patientId) throws Exception {
        try {
            return success(prescriptionService.cancelNatAppointment(id, patientId));
            return success(prescriptionService.cancelNatAppointment(id,patientId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping("/saveNatAppointment")
    @ApiOperation(value = "核酸检测预约接口")
    public Envelop saveNatAppointment(@ApiParam(name = "chargeAmount", value = "chargeAmount")
                                      @RequestParam(value = "chargeAmount", required = false) String chargeAmount,
                                          @RequestParam(value = "chargeAmount",required = false)String chargeAmount,
                                      @ApiParam(name = "inspectionName", value = "inspectionName")
                                      @RequestParam(value = "inspectionName", required = false) String inspectionName,
                                      @ApiParam(name = "mediaCard", value = "mediaCard")
                                      @RequestParam(value = "mediaCard", required = false) String mediaCard,
                                          @RequestParam(value = "inspectionName",required = false)String inspectionName,
            @ApiParam(name = "mediaCard", value = "mediaCard")
                                          @RequestParam(value = "mediaCard",required = false)String mediaCard,
                                      @ApiParam(name = "patientId", value = "patientId")
                                      @RequestParam(value = "patientId", required = false) String patientId,
                                          @RequestParam(value = "patientId",required = false)String patientId,
                                      @ApiParam(name = "name", value = "name")
                                      @RequestParam(value = "name", required = false) String name,
                                          @RequestParam(value = "name",required = false)String name,
                                      @ApiParam(name = "cardNo", value = "cardNo")
                                      @RequestParam(value = "cardNo", required = false) String cardNo,
                                          @RequestParam(value = "cardNo",required = false)String cardNo,
                                      @ApiParam(name = "cardType", value = "cardType")
                                      @RequestParam(value = "cardType", required = false) String cardType,
                                          @RequestParam(value = "cardType",required = false)String cardType,
                                      @ApiParam(name = "mobile", value = "mobile")
                                      @RequestParam(value = "mobile", required = false) String mobile,
                                          @RequestParam(value = "mobile",required = false)String mobile,
                                      @ApiParam(name = "firstJobCode", value = "firstJobCode")
                                      @RequestParam(value = "firstJobCode", required = false) String firstJobCode,
                                          @RequestParam(value = "firstJobCode",required = false)String firstJobCode,
                                      @ApiParam(name = "firstJobName", value = "firstJobName")
                                      @RequestParam(value = "firstJobName", required = false) String firstJobName,
                                          @RequestParam(value = "firstJobName",required = false)String firstJobName,
                                      @ApiParam(name = "secondJobCode", value = "secondJobCode")
                                      @RequestParam(value = "secondJobCode", required = false) String secondJobCode,
                                          @RequestParam(value = "secondJobCode",required = false)String secondJobCode,
                                      @ApiParam(name = "secondJobName", value = "secondJobName")
                                      @RequestParam(value = "secondJobName", required = false) String secondJobName,
                                          @RequestParam(value = "secondJobName",required = false)String secondJobName,
                                      @ApiParam(name = "natTime", value = "natTime")
                                      @RequestParam(value = "natTime", required = false) String natTime,
                                          @RequestParam(value = "natTime",required = false)String natTime,
                                      @ApiParam(name = "address", value = "address")
                                      @RequestParam(value = "address", required = false) String address,
                                          @RequestParam(value = "address",required = false)String address,
                                      @ApiParam(name = "provinceName", value = "provinceName")
                                      @RequestParam(value = "provinceName", required = false) String provinceName,
                                          @RequestParam(value = "provinceName",required = false)String provinceName,
                                      @ApiParam(name = "cityName", value = "cityName")
                                      @RequestParam(value = "cityName", required = false) String cityName,
                                          @RequestParam(value = "cityName",required = false)String cityName,
                                      @ApiParam(name = "townName", value = "townName")
                                      @RequestParam(value = "townName", required = false) String townName,
                                          @RequestParam(value = "townName",required = false)String townName,
                                      @ApiParam(name = "streetName", value = "streetName")
                                      @RequestParam(value = "streetName", required = false) String streetName,
                                          @RequestParam(value = "streetName",required = false)String streetName,
                                      @ApiParam(name = "pm", value = "pm")
                                      @RequestParam(value = "pm", required = false) String pm,
                                          @RequestParam(value = "pm",required = false)String pm,
                                      @ApiParam(name = "checkPart", value = "checkPart")
                                      @RequestParam(value = "checkPart", required = false) String checkPart,
                                          @RequestParam(value = "checkPart",required = false)String checkPart,
                                      @ApiParam(name = "pushFlag", value = "pushFlag")
                                      @RequestParam(value = "pushFlag", required = false) String pushFlag,
                                          @RequestParam(value = "pushFlag",required = false)String pushFlag,
                                      @ApiParam(name = "cardNoType", value = "cardNoType")
                                      @RequestParam(value = "cardNoType", required = false) String cardNoType,
                                          @RequestParam(value = "cardNoType",required = false)String cardNoType,
                                      @ApiParam(name = "chargeFlag", value = "chargeFlag")
                                      @RequestParam(value = "chargeFlag", required = false) String chargeFlag,
                                          @RequestParam(value = "chargeFlag",required = false)String chargeFlag,
                                      @ApiParam(name = "chargeCode", value = "chargeCode")
                                      @RequestParam(value = "chargeCode", required = false) String chargeCode,
                                          @RequestParam(value = "chargeCode",required = false)String chargeCode,
                                      @ApiParam(name = "icdCode", value = "icdCode")
                                      @RequestParam(value = "icdCode", required = false) String icdCode) {
                                          @RequestParam(value = "icdCode",required = false)String icdCode,
                                      @ApiParam(name = "preNo", value = "preNo")
                                          @RequestParam(value = "preNo",required = false)String preNo){
        try {
            return success(prescriptionService.saveNatAppointment(chargeAmount, inspectionName, mediaCard, patientId, name, cardNo, cardType, mobile, firstJobCode, firstJobName, secondJobCode, secondJobName, natTime, address, provinceName,
                    cityName, townName, streetName, pm, pushFlag, cardNoType, getUID(), checkPart, chargeFlag, chargeCode, icdCode));
            return success(prescriptionService.saveNatAppointment(chargeAmount,inspectionName,mediaCard,patientId,name,cardNo,cardType,mobile,firstJobCode,firstJobName,secondJobCode,secondJobName,natTime,address,provinceName,
                    cityName,townName,streetName,pm,pushFlag,cardNoType,getUID(),checkPart,chargeFlag,chargeCode,icdCode,preNo));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
@ -3223,14 +3150,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping("/sendMessage")
    @ApiOperation(value = "预约成功发送模板消息")
    public Envelop sendMessage(@ApiParam(name = "pushChannel", value = "pushChannel")
                               @RequestParam(value = "pushChannel", required = false) String pushChannel,
                               @ApiParam(name = "pushFlag", value = "pushFlag")
                               @RequestParam(value = "pushFlag", required = false) String pushFlag,
                               @ApiParam(name = "id", value = "id")
                               @RequestParam(value = "id", required = false) Integer id) throws Exception {
        try {
            return success(prescriptionService.sendMessage(id, pushChannel, pushFlag));
    public Envelop sendMessage( @ApiParam(name = "pushChannel", value = "pushChannel")
                                          @RequestParam(value = "pushChannel",required = false)String pushChannel,
                                      @ApiParam(name = "pushFlag", value = "pushFlag")
                                          @RequestParam(value = "pushFlag",required = false)String pushFlag,
                                      @ApiParam(name = "id", value = "id")
                                          @RequestParam(value = "id",required = false)Integer id) throws Exception {
        try {
            return success(prescriptionService.sendMessage(id,pushChannel,pushFlag));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
@ -3238,19 +3165,19 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping("/sendAlipayMessage")
    public Envelop sendAlipayMessage(@ApiParam(name = "code", value = "code")
                                     @RequestParam(value = "code", required = false) String code,
                                     @ApiParam(name = "patientId", value = "patientId")
                                     @RequestParam(value = "patientId", required = false) String patientId,
                                     @ApiParam(name = "fee", value = "fee")
                                     @RequestParam(value = "fee", required = false) String fee,
                                     @ApiParam(name = "redirdctUrl", value = "redirdctUrl")
                                     @RequestParam(value = "redirdctUrl", required = false) String redirdctUrl,
                                     @ApiParam(name = "realorder", value = "realorder")
                                     @RequestParam(value = "realorder", required = false) String realorder,
                                     @ApiParam(name = "reserverTime", value = "reserverTime")
                                     @RequestParam(value = "reserverTime", required = false) String reserverTime) throws Exception {
        try {
            return success(prescriptionService.sendAlipayMessage(patientId, code, fee, redirdctUrl, reserverTime, realorder));
                           @RequestParam(value = "code",required = false)String code,
                           @ApiParam(name = "patientId", value = "patientId")
                           @RequestParam(value = "patientId",required = false)String patientId,
                           @ApiParam(name = "fee", value = "fee")
                           @RequestParam(value = "fee",required = false)String fee,
                           @ApiParam(name = "redirdctUrl", value = "redirdctUrl")
                           @RequestParam(value = "redirdctUrl",required = false)String redirdctUrl,
                          @ApiParam(name = "realorder", value = "realorder")
                          @RequestParam(value = "realorder",required = false)String realorder,
                          @ApiParam(name = "reserverTime", value = "reserverTime")
                          @RequestParam(value = "reserverTime",required = false)String reserverTime) throws Exception {
        try {
            return success(prescriptionService.sendAlipayMessage(patientId,code,fee,redirdctUrl,reserverTime,realorder));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
@ -3284,24 +3211,24 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "isSuccess", value = "1成功  0失败")
            @RequestParam(value = "isSuccess", required = false) Integer isSuccess,
            @ApiParam(name = "orderNo", value = "订单号")
            @RequestParam(value = "orderNo", required = false) String orderNo,
            @RequestParam(value = "orderNo", required = false) String  orderNo,
            @ApiParam(name = "page", value = "页数")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页大小")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return prescriptionService.getNatAppointmentList(realOrder, name, hospitalFlag, mobile, idcard, payStatus, medicare, createTimeStart, createTimeEnd, appointmentTimeStart, appointmentTimeEnd, isSuccess, page, pageSize, orderNo);
        } catch (Exception e) {
            return prescriptionService.getNatAppointmentList(realOrder, name, hospitalFlag, mobile, idcard, payStatus, medicare, createTimeStart, createTimeEnd, appointmentTimeStart,appointmentTimeEnd,isSuccess, page, pageSize,orderNo);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping("/syncPrescription")
    @ApiOperation(value = "同步泰安处方")
    public Envelop syncPrescription(@ApiParam(name = "code", value = "code")
                                    @RequestParam(value = "code", required = false) String code) throws Exception {
    public Envelop syncPrescription( @ApiParam(name = "code", value = "code")
                                @RequestParam(value = "code",required = false)String code) throws Exception {
        try {
            return success(tnyyEntranceService.findByRealOrder(code, demoFlag));
            return success(tnyyEntranceService.findByRealOrder(code,demoFlag));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
@ -3309,42 +3236,41 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping("/findOperateLogs")
    @ApiOperation(value = "查询操作日志")
    public Envelop findOperateLogs(@ApiParam(name = "code", value = "code")
                                   @RequestParam(value = "code", required = false) String code,
                                   @ApiParam(name = "name", value = "name")
                                   @RequestParam(value = "name", required = false) String name,
                                   @ApiParam(name = "patientName", value = "patientName")
                                   @RequestParam(value = "patientName", required = false) String patientName,
                                   @ApiParam(name = "doctorName", value = "doctorName")
                                   @RequestParam(value = "doctorName", required = false) String doctorName,
                                   @ApiParam(name = "startTime", value = "startTime")
                                   @RequestParam(value = "startTime", required = false) String startTime,
                                   @ApiParam(name = "endTime", value = "endTime")
                                   @RequestParam(value = "endTime", required = false) String endTime,
                                   @ApiParam(name = "page", value = "page")
                                   @RequestParam(value = "page", required = false) Integer page,
                                   @ApiParam(name = "pageSize", value = "pageSize")
                                   @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return success(baseOperateLogService.findOperateLogList(code, name, patientName, doctorName, startTime, endTime, page, pageSize));
    public Envelop findOperateLogs( @ApiParam(name = "code", value = "code")
                                     @RequestParam(value = "code",required = false)String code,
                                    @ApiParam(name = "name", value = "name")
                                    @RequestParam(value = "name",required = false)String name,
                                    @ApiParam(name = "patientName", value = "patientName")
                                        @RequestParam(value = "patientName",required = false)String patientName,
                                    @ApiParam(name = "doctorName", value = "doctorName")
                                        @RequestParam(value = "doctorName",required = false)String doctorName,
                                    @ApiParam(name = "startTime", value = "startTime")
                                        @RequestParam(value = "startTime",required = false)String startTime,
                                    @ApiParam(name = "endTime", value = "endTime")
                                        @RequestParam(value = "endTime",required = false)String endTime,
                                    @ApiParam(name = "page", value = "page")
                                        @RequestParam(value = "page",required = false)Integer page,
                                    @ApiParam(name = "pageSize", value = "pageSize")
                                        @RequestParam(value = "pageSize",required = false)Integer pageSize) throws Exception {
        try {
            return success(baseOperateLogService.findOperateLogList(code,name,patientName,doctorName,startTime,endTime,page,pageSize));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/treatment")
    @ApiOperation(value = "下诊断", notes = "下诊断接口")
    public Envelop treatment(
            @ApiParam(name = "infoJsons", value = "药品json")
            @RequestParam(value = "infoJsons", required = false) String infoJsons,
            @ApiParam(name = "treatmentJson", value = "治疗方案json")
            @RequestParam(value = "treatmentJson", required = false) String treatmentJson) throws Exception {
        try {
            BaseAdviceTreatmentDO baseAdviceTreatmentDO = inspectionService.saveTreatment(infoJsons, treatmentJson);
            return success("操作成功");
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
                                    @ApiParam(name = "infoJsons", value = "药品json")
                                    @RequestParam(value = "infoJsons", required = false)String infoJsons,
                                    @ApiParam(name = "treatmentJson", value = "治疗方案json")
                                    @RequestParam(value = "treatmentJson", required = false)String treatmentJson)throws Exception {
       try {
           BaseAdviceTreatmentDO baseAdviceTreatmentDO = inspectionService.saveTreatment(infoJsons,treatmentJson);
           return success("操作成功");
       }catch (Exception e){
           return Envelop.getError(e.getMessage());
       }
    }
    /*@GetMapping("/findDoctorChargeType")
@ -3399,11 +3325,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取患者待结算信息页面", notes = "获取患者待结算信息页面")
    public Envelop getSettlementInfo(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId) throws Exception {
            @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception {
        try {
            return success("操作成功", prescriptionService.getSettlementInfo(outpatientId));
        } catch (Exception e) {
            return success("操作成功",prescriptionService.getSettlementInfo(outpatientId));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
@ -3412,12 +3338,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "确认医保结算", notes = "确认医保结算")
    public Envelop getSettlementInfo(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId,
            @RequestParam(value = "outpatientId", required = false)String outpatientId,
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = false) String code) throws Exception {
            @RequestParam(value = "code", required = false)String code)throws Exception {
        try {
            return success("操作成功", prescriptionService.confirmSettlementInfo(outpatientId, code));
        } catch (Exception e) {
            return success("操作成功",prescriptionService.confirmSettlementInfo(outpatientId,code));
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }