فهرست منبع

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 3 سال پیش
والد
کامیت
18dd60cf66
30فایلهای تغییر یافته به همراه6851 افزوده شده و 5227 حذف شده
  1. 124 24
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 127 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  3. 4304 4015
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  4. 3 0
      common/common-entity/sql记录
  5. 4 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  6. 20 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DeviceDetail.java
  7. 0 9
      common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java
  8. 20 0
      common/common-entity/src/main/java/com/yihu/jw/entity/care/prescription/BaseCarePrescriptionDO.java
  9. 6 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 16 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/MixEnvelop.java
  11. 4 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/prescription/BaseCarePrescriptionDao.java
  12. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java
  13. 16 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/prescription/PrescriptionEndpoint.java
  14. 69 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java
  15. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  16. 34 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/prescription/BaseCarePrescriptionService.java
  17. 2 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java
  18. 0 8
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java
  19. 9 3
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java
  20. 19 4
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/HvDeviceService.java
  21. 34 15
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/OnenetService.java
  22. 4 4
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  23. 152 0
      svr/svr-cloud-transfor/pom.xml
  24. 24 0
      svr/svr-cloud-transfor/src/main/java/com/yihu/SvrCloudTransforApplication.java
  25. 430 0
      svr/svr-cloud-transfor/src/main/java/com/yihu/jw/care/controller/TransforController.java
  26. 63 0
      svr/svr-cloud-transfor/src/main/java/com/yihu/jw/care/service/AqgService.java
  27. 97 0
      svr/svr-cloud-transfor/src/main/resources/application.yml
  28. 0 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  29. 42 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  30. 1214 1140
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

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

@ -3312,22 +3312,42 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            sql = sql + "date_format(p.pay_time,'%Y-%m-%d %H:%i:%S' )  AS \"payTime\",";
        }
        sql = sql + " e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " p.status as \"status\", " +
                " p.id AS \"prescriptionId\" ," +
                " e.id AS \"expressageId\" ,"+
                " p.real_order AS \"realOrder\" ,"+
                " p.origin_real_order AS \"originRealOrder\"," +
                " o.patient_name as \"patientName\" "+
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
                " JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id " +
                " WHERE" +
                " 1=1";
        sql = sql + "IFNULL(p.create_time,' ') as time,\n" +
                "IFNULL(e.name,' ') as \"name\", \n" +
                "IFNULL(p.pay_time,' ') AS \"pay_time\" ,\n" +
                "IFNULL(p.real_order,' ') AS \"realOrder\" ,\n" +
                "IFNULL(o.patient_name,' ') as \"patientName\",\n" +
                "IFNULL(i.drug_name,' ') as \"infoName\",\n" +
                "IF(p.create_time = NULL,'否','是') as \"create_time\" ,\n" +
                "case e.oneself_pickup_flg\n" +
                "when 1 then '自取'\n" +
                "when 2 then '快递配送'\n" +
                "else ' ' end oneself_pickup_flg,\n" +
                "CASE p.status\n" +
                "when -4 then '已作废'\n" +
                "when -3 then '支付过期取消'\n" +
                "when -2 then '患者自己取消'\n" +
                "when -1 then '医生取消'\n" +
                "when 0 then '候诊中'\n" +
                "when 10 then '诊断中'\n" +
                "when 11 then '药师审核失败 / 调整中'\n" +
                "when 12 then '药师审核完成'\n" +
                "when 13 then '开方失败/调整中'\n" +
                "when 20 then '诊断完成/开方成功/待支付'\n" +
                "when 21 then '支付失败/待支付中'\n" +
                "when 30 then '支付成功/等待配药'\n" +
                "when 31 then '配药成功/等待取药'\n" +
                "when 32 then '配送中'\n" +
                "when 100 then '已完成/未评价'\n" +
                "when 101 then '已完成/已经评价'\n" +
                "else ' ' END status\n" +
                "FROM \n" +
                "wlyy_outpatient o\n" +
                "left JOIN wlyy_prescription p ON p.outpatient_id = o.id\n" +
                "left JOIN wlyy_prescription_expressage e ON e.outpatient_id = o.id \n" +
                "left JOIN wlyy_prescription_info i on i.prescription_id = p.id\n" +
                "WHERE\n" +
                "1=1 ";
        if (StringUtils.isNotBlank(status)) {
            sql += " AND p.status in(" + status + ") ";
        }
@ -3368,16 +3388,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql +=" order by p.create_time desc ";
        /*       sql += " LIMIT " + (page - 1) * size + "," + size + "";*/
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, page, size);
        for (Map<String, Object> map : list) {
        List<Map<String, Object>> mapList = hibenateUtils.createSQLQuery(sql);
        for (Map<String, Object> map : mapList) {
            if (map.get("prescriptionId") != null) {
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(map.get("prescriptionId").toString(), 1);
                map.put("info", wlyyPrescriptionInfoDOS);
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
        return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, mapList);
    }
    public Boolean setMailno(String mailno, String expressageId) {
@ -3394,7 +3412,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            String[] header = {"订单日期", "收货人", "诊断结果", "配送方式", "订单状态"};
            String[] header = {"订单日期", "处方编号", "就诊人姓名", "收货人", "订单药品", "配送方式", "支付时间", "是否开方", "订单状态"};//"订单日期", "收货人", "诊断结果", "配送方式", "订单状态"
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
@ -3403,11 +3421,92 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            int i = 1;
            for (Map<String, Object> m : ls) {
                addCell(ws, i, 0, m.get("createTime").toString());
                addCell(ws, i, 0, m.get("time").toString());
                addCell(ws, i, 1, m.get("realOrder").toString());
                addCell(ws, i, 2, m.get("patientName").toString());
                addCell(ws, i, 3, m.get("name").toString());
                addCell(ws, i, 4, m.get("infoName").toString());
                addCell(ws, i, 5, (String) m.get("oneself_pickup_flg"));
                addCell(ws, i, 6, m.get("pay_time").toString());
                addCell(ws, i, 7, m.get("create_time").toString());
                addCell(ws, i, 8, (String) m.get("status"));
                /*addCell(ws, i, 0, m.get("createTime").toString());
                addCell(ws, i, 1, (String) m.get("name"), "");
                addCell(ws, i, 2, (String) m.get("icd10Name"), "");
                addCell(ws, i, 3, getOneselfPickupFlgString((Integer) m.get("oneselfPickupFlg")), "");
                addCell(ws, i, 4, getStatusName((Integer) m.get("status")), "");
                addCell(ws, i, 4, getStatusName((Integer) m.get("status")), "");*/
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    public void searchRecordWrite(OutputStream os, List<Map<String, Object>> list) throws Exception{
        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            String[] header = {"患者姓名","问诊医生","就诊科室","问诊类型","发起时间","接诊时间","结束时间","咨询问题","是否开方","咨询状态"};
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
                k++;
            }
            int i = 1;
            for (Map<String, Object> m : list) {
                addCell(ws, i, 0, (String) m.get("pname"));
                addCell(ws, i, 1, (String) m.get("dname"));
                addCell(ws, i, 2, (String) m.get("dept"));
                addCell(ws, i, 3, (String) m.get("type"));
                addCell(ws, i, 4, (String) m.get("ctime"));
                addCell(ws, i, 5, (String) m.get("rtime"));
                addCell(ws, i, 6, (String) m.get("etime"));
                addCell(ws, i, 7, (String) m.get("des"));
                addCell(ws, i, 8, (String) m.get("pay"));
                addCell(ws, i, 9, (String) m.get("status"));
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    public void pushYktCardChargeWrite(OutputStream os, List<Map<String, Object>> list) throws Exception{
        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            String[] header = {"序号","充值时间","商户订单号","医院订单号","患者姓名","证件号码","就诊卡号","手机号码","金额","状态"};
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
                k++;
            }
            int i = 1;
            for (Map<String, Object> m : list) {
                addCell(ws, i, 0, (String) m.get("id"));
                addCell(ws, i, 1, (String) m.get("payTime"));
                addCell(ws, i, 2, (String) m.get("orderNo"));
                addCell(ws, i, 3, (String) m.get("ykOrderNo"));
                addCell(ws, i, 4, (String) m.get("patientName"));
                addCell(ws, i, 5, (String) m.get("idcard"));
                addCell(ws, i, 6, (String) m.get("meidcard"));
                addCell(ws, i, 7, (String) m.get("mobile"));
                addCell(ws, i, 8, (String) m.get("payPrice"));
                addCell(ws, i, 9, (String) m.get("status"));
                i++;
            }
            wwb.write();
@ -3419,6 +3518,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    }
    /**
     * @return
     */

+ 127 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -35,6 +35,7 @@ import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
@ -2037,6 +2038,132 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        mixEnvelop.setTotalCount(listCount==null?0:listCount.size());
        return mixEnvelop;
    }
    public MixEnvelop pushYktCardCharge(String startTime, String endTime, String orderNo, String yktOrderNo, String patientName
            , String idCard, String medicard,Integer status, Integer page, Integer pageSize,String orderType,String orderCategory){
        String sql = " SELECT\n" +
                "\tIFNULL(t.id, ' ') AS \"id\",\n" +
                "\tIFNULL(t.patient, ' ') AS \"patient\",\n" +
                "\tIFNULL(t.patient_name, ' ') AS \"patientName\",\n" +
                "\tIFNULL(t.order_no, ' ') AS \"orderNo\",\n" +
                "\tIFNULL(t.order_type, ' ') AS \"orderType\",\n" +
                "\tIFNULL(t.relation_code, ' ') AS \"relationCode\",\n" +
                "\tIFNULL(t.relation_name, ' ') AS \"relationName\",\n" +
                "\tIFNULL(t.description, ' ') AS \"description\",\n" +
                "\tIFNULL(t.pay_type, ' ') AS \"payType\",\n" +
                "\tIFNULL(t.pay_price, ' ') AS \"payPrice\",\n" +
                "\tIFNULL(t.pay_time, ' ') AS \"payTime\",\n" +
                "\tIFNULL(t.upload_status, ' ') AS \"uploadStatus\",\n" +
                "\tIFNULL(t.create_time, ' ') AS \"createTime\",\n" +
                "\tIFNULL(t.remark, ' ') AS \"remark\",\n" +
                "\tIFNULL(t.relation_code, ' ') AS \"medicard\",\n" +
                "\tIFNULL(t.yk_order_no, ' ') AS \"ykOrderNo\",\n" +
                "\tIFNULL(t.yk_order_id, ' ') AS \"ykOrderId\",\n" +
                "\tIFNULL(b.idcard, ' ') AS \"idcard\",\n" +
                "\tIFNULL(b.mobile, ' ') AS \"mobile\",\n" +
                "\tCASE t. STATUS\n" +
                "WHEN 0 THEN\n" +
                "\t'未支付'\n" +
                "WHEN 1 THEN\n" +
                "\t'已支付'\n" +
                "WHEN 2 THEN\n" +
                "\t'交易关闭'\n" +
                "WHEN 3 THEN\n" +
                "\t'支付超时'\n" +
                "WHEN 4 THEN\n" +
                "\t'交易完成'\n" +
                "WHEN 5 THEN\n" +
                "\t'交易进行中'\n" +
                "WHEN 6 THEN\n" +
                "\t'退款申请'\n" +
                "WHEN 9 THEN\n" +
                "\t'退款完成'\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt. STATUS\n" +
                "END AS \"status\",\n" +
                "\tCASE t.order_category\n" +
                "WHEN '2' THEN\n" +
                "\t'2'\n" +
                "WHEN '3' THEN\n" +
                "\t'2'\n" +
                "WHEN NULL THEN\n" +
                "\t' '\n" +
                "ELSE\n" +
                "\tt.order_category\n" +
                "END AS \"orderCategory\"\n" +
                "FROM\n" +
                "\tbase_business_order_pay t\n" +
                "LEFT JOIN base_patient b ON t.patient = b.id\n" +
                "WHERE\n" +
                "\t1 = 1";
        if (StringUtils.isNoneBlank(startTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                    sql+=" and t.create_time > '" + startTime + "'";
                }else {
                    sql+=" and t.create_time > to_date('" + startTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
                }
            }else{
                sql+=" and t.create_time > '" + startTime + "'";
            }
        }
        if (StringUtils.isNoneBlank(endTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                    sql+=" and t.create_time <= '" + endTime + "'";
                }else {
                    sql+=" and t.create_time <= to_date('" + endTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
                }
            }else{
                sql+=" and t.create_time <= '" + endTime + "'";
            }
        }
        if (StringUtils.isNoneBlank(orderNo)){
            sql+=" and t.order_no ='"+orderNo+"'";
        }
        if (StringUtils.isNoneBlank(yktOrderNo)){
            sql+=" and t.yk_order_no ='"+yktOrderNo+"'";
        }
        if (StringUtils.isNoneBlank(patientName)){
            sql+=" and t.patient_name  like '%"+patientName+"%'";
        }
        if (StringUtils.isNoneBlank(idCard)){
            sql+=" and b.idcard ='"+idCard+"'";
        }
        if (StringUtils.isNoneBlank(medicard)){
            sql+=" and t.relation_code ='"+medicard+"'";
        }
        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>> mapList = hibenateUtils.createSQLQuery(sql);
        /*for (Map<String,Object> map:list){
            if (map.get("createTime")!=null){
                map.put("createTime",);
            }
        }*/
        return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, mapList);
    }
    public  JSONObject validateGeet( String geetestChallenge,String geetestValidate,String geetestSeccode,String isPatient){
        String validateUrl = "http://localhost:8088/validate";

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 4304 - 4015
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java


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

@ -1550,3 +1550,6 @@ CREATE TABLE `base_yunxing_channel` (
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='云信会话关联表';
-- 2021-10-14 ysj
ALTER table wlyy_devices add column collect_num int(20) default null COMMENT '采集数据次数';
ALTER table wlyy_devices add column abnormal_num int(20) default null COMMENT '异常指标数据次数';

+ 4 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -238,6 +238,10 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String userId;
    /**
     * 互联网医院 眼科通id
     * 医养项目 照护类型 2置顶 1重点照护
     */
    private String yktId;
    private String register;

+ 20 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DeviceDetail.java

@ -54,6 +54,8 @@ public class DeviceDetail extends IdEntity {
    private String imsi;//设备物联卡imsi
    private String categoryCode; // 设备类型 dm_device表定义
    private Long collectNum;//采集数据次数
    private Long abnormalNum;//异常指标数据次数
    //导入设备错误信息
    private String errorMsg;
@ -376,6 +378,24 @@ public class DeviceDetail extends IdEntity {
        this.categoryCode = categoryCode;
    }
    @Column(name = "collect_num")
    public Long getCollectNum() {
        return collectNum;
    }
    public void setCollectNum(Long collectNum) {
        this.collectNum = collectNum;
    }
    @Column(name = "abnormal_num")
    public Long getAbnormalNum() {
        return abnormalNum;
    }
    public void setAbnormalNum(Long abnormalNum) {
        this.abnormalNum = abnormalNum;
    }
    @Transient
    public String getErrorMsg() {
        return errorMsg;

+ 0 - 9
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientDevice.java

@ -68,7 +68,6 @@ public class DevicePatientDevice extends IdEntity {
    //设备类型为报警器时,需要填写投放地址 category_code = 7
    private String sosAddress;
    private Integer onlineStatus;// 0不在线 1在线
  //========================非表字段======================
    //患者居住地址
@ -333,14 +332,6 @@ public class DevicePatientDevice extends IdEntity {
        this.deviceImgUrl = deviceImgUrl;
    }
    public Integer getOnlineStatus() {
        return onlineStatus;
    }
    public void setOnlineStatus(Integer onlineStatus) {
        this.onlineStatus = onlineStatus;
    }
    public Integer getDeviceType() {
        return deviceType;
    }

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

@ -26,6 +26,8 @@ public class BaseCarePrescriptionDO extends UuidIdentityEntityWithCreateTime {
    private String sex;
    private String age;
    private String photo;
    private String type;
    @Column(name = "patient")
    public String getPatient() {
@ -125,4 +127,22 @@ public class BaseCarePrescriptionDO extends UuidIdentityEntityWithCreateTime {
    public void setAge(String age) {
        this.age = age;
    }
    @Transient
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    @Transient
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}

+ 6 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -40,6 +40,7 @@ public class BaseHospitalRequestMapping {
        public static final String findDoctorByIdCard = "/findDoctorByIdCard";
        public static final String testJpush = "/testJpush";
        public static final String findYkCardCharge = "/findYkCardCharge";
        public static final String pushYkCardCharge = "/pushYkCardCharge";
        public static final String zsMsgFlowTest = "/zsMsgFlowTest";
        public static final String updateChannelId = "/updateChannelId";
@ -224,6 +225,11 @@ public class BaseHospitalRequestMapping {
         */
        public static final String pushListWrite="/pushListWrite";
        /**
         *咨询导出
         */
        public static final String searchRecordWrite="/searchRecordWrite";
        /**
         * 获取号别字典
         */

+ 16 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/MixEnvelop.java

@ -137,6 +137,22 @@ public class MixEnvelop<T, J> extends Envelop {
        return envelop;
    }
    public static MixEnvelop getPushList(String message, List list) {
        MixEnvelop envelop = new MixEnvelop();
        envelop.setMessage(message);
        envelop.setDetailModelList(list);
        envelop.setStatus(200);
        return envelop;
    }
    public static MixEnvelop getSuccessListWithPage2(String message, List mapList) {
        MixEnvelop envelop = new MixEnvelop();
        envelop.setMessage(message);
        envelop.setDetailModelList(mapList);
        envelop.setStatus(200);
        return envelop;
    }
    public static MixEnvelop getError(String message, int errorCode) {
        MixEnvelop envelop = new MixEnvelop();
        envelop.setMessage(message);

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

@ -3,10 +3,14 @@ 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.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/10/11.
 */
public interface BaseCarePrescriptionDao  extends PagingAndSortingRepository<BaseCarePrescriptionDO,String>, JpaSpecificationExecutor<BaseCarePrescriptionDO> {
    @Query(value = " select * from base_care_prescription a where a.patient =?1 order by a.create_time desc limit 1",nativeQuery = true)
    BaseCarePrescriptionDO selectOneByPatient(String patient);
}

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorToDoWorkEndpoint.java

@ -42,6 +42,18 @@ public class DoctorToDoWorkEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "todoworkTotal")
    @ApiOperation("待办工作总数")
    public ObjEnvelop  todoworkTotal(@ApiParam(name = "doctor", value = "doctor")
                                         @RequestParam(value = "doctor", required = true) String doctor){
        try {
            return ObjEnvelop.getSuccess("查询成功",doctorMessageService.todoworkTotal(doctor));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    /**************************v1.1.0新增 设备异常动态************************************/
    @GetMapping(value = "getHealthMonitoringListNew")
    @ApiOperation(value = "体征监测/安防监护")

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

@ -72,6 +72,22 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getPrescriptionInfo")
    @ApiOperation(value = "获取续方详情")
    public ObjEnvelop getPrescriptionInfo(
            @ApiParam(name = "id", value = "续方id") @RequestParam(value = "id", required = false) String id,
            @ApiParam(name = "patient", value = "patient") @RequestParam(value = "patient", required = false) String patient) {
        try{
            JSONObject obj =  prescriptionService.getPrescriptionInfo(id,patient);
            if (obj.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(obj.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("查询成功",obj.getJSONObject(ResponseContant.resultMsg));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "applyPrescription")
    @ApiOperation(value = "申请续方")
    public ObjEnvelop applyPrescription(@ApiParam(name = "applyImgs", value = "申请图片")

+ 69 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/DoctorMessageService.java

@ -7,6 +7,7 @@ import com.yihu.jw.care.dao.apply.PatientBedApplyDao;
import com.yihu.jw.care.dao.message.OrgNoticeDao;
import com.yihu.jw.care.dao.message.UserNoticeDao;
import com.yihu.jw.care.dao.security.SecurityMonitoringOrderDao;
import com.yihu.jw.care.service.doctor.DoctorServicePermissionsService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -47,6 +48,10 @@ public class DoctorMessageService {
    private UserNoticeDao userNoticeDao;
    @Autowired
    private SystemMessageDao messageDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private DoctorServicePermissionsService doctorServicePermissionsService;
    /**
     *
@ -317,4 +322,68 @@ public class DoctorMessageService {
        return systemMessageDOS;
    }
    public Integer todoworkTotal(String doctor){
        Integer total=0;
        BaseDoctorDO  doctorDO = baseDoctorDao.findById(doctor);
        String sql = "";
        if (null!=doctorDO){
            if (1==doctorDO.getLevel()){//社区医生
                //健康咨询+待处理续方
                 sql = " SELECT count(a.id)  FROM wlyy_consult a,wlyy_consult_team b,base_patient d WHERE a.id=b.consult " +
                        " AND b.patient=d.id  AND b.doctor='"+doctor+"'  and b.status = 0 AND a.type in (25) ";
                total += jdbcTemplate.queryForObject(sql,Integer.class);
                sql = " SELECT count(distinct a.id) 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 = '"+doctor+"'  and a.status = 1 ";
                total += jdbcTemplate.queryForObject(sql,Integer.class);
            }
            if (2==doctorDO.getLevel()){//助老员
                //紧急救助、安防、生活
                if(doctorServicePermissionsService.isPermission(doctor,8)==1){
                    sql = " select count(ord.id) from base_emergency_assistance_order ord where 1=1  AND EXISTS (SELECT sr.patient from " +
                            " base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ,base_team_member m " +
                            " where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                            " r.service_package_id = i.service_package_id and  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1 " +
                            " and i.code='emergencyAssistance' and m.doctor_code = '"+doctor+"' and m.del = '1') " +
                            " and ord.status in ( '1') ";
                    total += jdbcTemplate.queryForObject(sql,Integer.class);
                }
                if(doctorServicePermissionsService.isPermission(doctor,10)==1){
                    sql = " select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                            " where 1=1    and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, " +
                            " base_service_package_item i ,base_team_member m where ord.patient = CONVERT(sr.patient USING utf8) and " +
                            "  sr.id = r.sign_id and sr.status=1 and  r.service_package_id = i.service_package_id and " +
                            "  m.team_code = r.team_code  and i.del = 1 and sr.`status`=1 and m.doctor_code = '"+doctor+"' and m.del = '1') " +
                            "  and ord.status='1'  ";
                    total += jdbcTemplate.queryForObject(sql,Integer.class);
                }
                if(doctorServicePermissionsService.isPermission(doctor,7)==1){
                    List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByDoctorCode(doctor);
                    if (doctorHospitalDOs.size()>0){
                        String hospital = doctorHospitalDOs.get(0).getOrgCode();
                        sql =" SELECT count(o.id)   FROM  base_life_care_order o LEFT JOIN base_patient p ON o.patient = p.id  " +
                                "WHERE  o.hospital = '"+hospital+"'  AND (o.`status` = 1 or -100 = 1) and o.pay_status>0 and o.status<>0 ";
                        total += jdbcTemplate.queryForObject(sql,Integer.class);
                    }
                }
            }
            if (3==doctorDO.getLevel()){//教师
                //上门、在线咨询
                sql = " SELECT count(a.id)  FROM wlyy_consult a,wlyy_consult_team b,base_patient d WHERE a.id=b.consult " +
                        " AND b.patient=d.id  AND b.doctor='"+doctor+"'  and b.status = 0 AND a.type in (23) ";
                total += jdbcTemplate.queryForObject(sql,Integer.class);
                sql = "  select count(DISTINCT o.id) as total  from base_door_coach_order o LEFT JOIN base_org h on h.code=o.hospital " +
                        " and h.del=1 where 1=1  and o.status in (3,4,5)and o.doctor= '"+doctor+"' ";
                total += jdbcTemplate.queryForObject(sql,Integer.class);
            }
        }
        return total;
    }
}

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

@ -609,7 +609,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
     */
    public List<Map<String,Object>> findOld(String name,String residentialArea,String limit,String filter1){
        String sql = "SELECT a.id,a.name,a.photo,a.idcard,CAST(IFNULL(a.birthday,'') AS char ) birthday,a.residential_area residentialArea,a.sex " +
                ", case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online,IFNULL(sign_status,0) signStatus from base_patient a " +
                ",a.ykt_id yktId, case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online,IFNULL(sign_status,0) signStatus from base_patient a " +
                " WHERE a.archive_type = 1 and a.del = '1' ";
        //case 1 WHEN openid is not null then 1 WHEN a.on_line = '1' then 1 ELSE 0 end as online
@ -621,7 +621,7 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
            sql+= " and residential_area = '"+residentialArea+"' ";
        }
        sql += filter1;
        sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex,online,signStatus ";
        sql += " GROUP BY a.id,a.name,a.photo,a.idcard,a.birthday,a.residential_area,a.sex,a.ykt_id,online,signStatus ";
        sql += " ORDER BY online desc,a.ykt_id desc,signStatus desc";
        sql += limit;
        List<Map<String,Object>>  list = jdbcTemplate.queryForList(sql);

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

@ -1,6 +1,8 @@
package com.yihu.jw.care.service.prescription;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yihu.jw.care.dao.prescription.BaseCarePrescriptionDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
@ -10,6 +12,7 @@ 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 com.yihu.jw.util.common.IdCardUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -52,7 +55,8 @@ public class BaseCarePrescriptionService {
                "     case p.sex " +
                "     when 1 then '男'  " +
                "     when 2 then '女' " +
                "     end AS sex, " +
                "     end AS sex," +
                "     'prescription' as type, " +
                "     TIMESTAMPDIFF(year,p.birthday,NOW()) AS age  ";
        String filters = "from base_care_prescription a" +
                " LEFT JOIN base_patient p ON a.patient = p.id," +
@ -96,6 +100,35 @@ public class BaseCarePrescriptionService {
        return result;
    }
    public JSONObject getPrescriptionInfo(String id,String patient){
        JSONObject result = new JSONObject();
        BaseCarePrescriptionDO prescriptionDO = null;
        if (StringUtils.isNotBlank(id)){
            prescriptionDO =  carePrescriptionDao.findOne(id);
        }
        else if (StringUtils.isNotBlank(patient)){
            prescriptionDO = carePrescriptionDao.selectOneByPatient(patient);
        }
        if (null==prescriptionDO){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"续方记录不存在");
        }else {
            BasePatientDO patientDO = patientDao.findById(prescriptionDO.getPatient());
            if (null!=patientDO){
                Integer sex = patientDO.getSex();
                prescriptionDO.setSex(null==sex?null:1==sex?"男":"女");
                prescriptionDO.setPhoto(patientDO.getPhoto());
                try{
                    prescriptionDO.setAge(IdCardUtil.getAgeByIdcardOrBirthday(patientDO.getIdcard(),patientDO.getBirthday())+"");
                }catch (Exception e){}
            }
            JSONObject objDo = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(prescriptionDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
            result.put(ResponseContant.resultFlag,ResponseContant.success);
            result.put(ResponseContant.resultMsg,objDo);
        }
        return result;
    }
    /**
     * 居民端列表查询
     * @param patientId

+ 2 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/wechat/WeiXinEventProcess.java

@ -168,7 +168,8 @@ public class WeiXinEventProcess {
        Map<String, String> articleFamily = new HashMap<>();
        // 图文URL
        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2FlifeCare%2Findex&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2FlifeCare%2Findex%3Ftype%3D2&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
//        String urlFamily = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri=https%3A%2F%2Fzhyzh.gongshu.gov.cn%2Fmedical-care-patient%2FlifeCare%2Findex%3Ftype%3D2&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect";
        urlFamily = urlFamily.replace("{appId}", appId);
        articleFamily.put("Url", urlFamily);
        articleFamily.put("Title", "上门预约");

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

@ -877,14 +877,6 @@ public class DeviceService {
    @Async
    public void byOnlineStatus(String device,String onlinestatu,String time_begin){
        try {
            if(StringUtils.isNotBlank(device)){
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(device);
                if (devicePatientDeviceDos.size()>0){
                    DevicePatientDevice tmp = devicePatientDeviceDos.get(0);
                    tmp.setOnlineStatus(Integer.parseInt(onlinestatu));
                    patientDeviceDao.save(tmp);
                }
            }
            DeviceDetail deviceDetail = deviceDetailDao.findBySn(device);
            if(deviceDetail!=null){
                deviceDetail.setContactStatus(Integer.parseInt(onlinestatu));

+ 9 - 3
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceUploadService.java

@ -191,6 +191,9 @@ public class DeviceUploadService {
                        content_notice = content_notice.substring(0,content_notice.length()-1);
                        message.put("content_notice","您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1",content_notice));
                        hvDeviceService.updContactStatus(deviceSn,1,true);
                    }else{
                        hvDeviceService.updContactStatus(deviceSn,1,false);
                    }
                    patientHealthIndexDao.save(result);
                    systemMessageDao.save(messageDO);
@ -490,6 +493,7 @@ public class DeviceUploadService {
                        }
                        double dulat =Double.parseDouble(lat);
                        double dulon = Double.parseDouble(lon);
                        boolean flag = false;
                        if (!(dulat==0.0&&dulon==0.0)){//判断是否触发工单
                            com.alibaba.fastjson.JSONObject position = gpsUtil.Gps84_To_bd09(dulat,dulon);
                            dulat = position.getDouble("lat");
@ -524,6 +528,7 @@ public class DeviceUploadService {
                                        addressInfo.put("lon",dulon+"");
                                        addressInfo.put("address",LatitudeUtils.getLocationAddress(dulat+"",dulon+""));
                                        orderUtil.createSecurityOrder(sn,null,null,addressInfo,8,"1","preventLost",null);
                                        flag = true;
                                    }
                                }
                            }
@ -534,7 +539,7 @@ public class DeviceUploadService {
                        deviceIndex.setLat(dulat+"");
                        deviceIndex.setLon(dulon+"");
                        yxDeviceIndexDao.save(deviceIndex);
                        hvDeviceService.updContactStatus(sn,1);
                        hvDeviceService.updContactStatus(sn,1,flag);
                    }
                    if ("AL".equals(tmp1[0])){//触发报警 SOS
                        String lat,lon;
@ -548,7 +553,7 @@ public class DeviceUploadService {
                        double dulat =Double.parseDouble(lat);
                        double dulon = Double.parseDouble(lon);
                        boolean flag = false;
                        if ((dulat==0.0&&dulon==0.0)){
                            String sql=" SELECT * FROM base_yxdevice_index WHERE sn = '"+sn+"' " +
                                    "AND create_time LIKE '"+DateUtil.getStringDateShort()+"%' AND lon != 0 AND lat != 0 ORDER BY create_time DESC  ";
@ -601,6 +606,7 @@ public class DeviceUploadService {
                            logDO.setSosLat(dulat+"");
                            logDO.setSosLon(dulon+"");
                            logDO.setSosAddress(LatitudeUtils.getLocationAddress(dulat+"",dulon+""));
                            flag = true;
                            orderUtil.createEmeOrder(logDO,"4");
                        }
                        BaseYxDeviceIndex deviceIndex = new BaseYxDeviceIndex();
@ -608,7 +614,7 @@ public class DeviceUploadService {
                        deviceIndex.setLat(dulat+"");
                        deviceIndex.setLon(dulon+"");
                        yxDeviceIndexDao.save(deviceIndex);
                        hvDeviceService.updContactStatus(sn,1);
                        hvDeviceService.updContactStatus(sn,1,flag);
                    }
                }
            }

+ 19 - 4
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/HvDeviceService.java

@ -166,7 +166,7 @@ public class HvDeviceService {
                list.add(index);
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"烟探测器监测信息接收");
            }
            updContactStatus(resourceSerial,1);
            updContactStatus(resourceSerial,1,false);
        }
        if(list.size()>0){
            deviceHealthIndexDao.save(list);
@ -185,17 +185,18 @@ public class HvDeviceService {
            List<HvDeviceRecord> list = hvdeviceRecordDao.findByDeviceId(deviceID);
            dataPushLogUtil.savePushLog(deviceID,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"气感烟感探测器监测信息接收");
            if(list.size()>0){
                updContactStatus(list.get(0).getDeviceSn(),Integer.valueOf(deviceStatus));
                updContactStatus(list.get(0).getDeviceSn(),Integer.valueOf(deviceStatus),null);
            }
        }
    }
    /**
     * 更新在线状态
     * 更新在线状态 及次数
     * @param sn
     * @param status
     * @param flag 状态 true 异常 false 正常 null其他
     */
    public void updContactStatus(String sn,Integer status){
    public void updContactStatus(String sn,Integer status,Boolean flag){
        DeviceDetail deviceDetail = deviceDetailDao.findBySn(sn);
        if(deviceDetail!=null){
            deviceDetail.setContactStatus(status);
@ -205,6 +206,20 @@ public class HvDeviceService {
               deviceLostMessageUtil.deviceLostMessage(sns);
            }
            deviceDetail.setContactStatusTime(new Date());
            if(deviceDetail.getCollectNum()==null){
                deviceDetail.setCollectNum(0L);
            }
            if(deviceDetail.getAbnormalNum()==null){
                deviceDetail.setAbnormalNum(0L);
            }
            if(flag!=null){
                deviceDetail.setCollectNum(deviceDetail.getCollectNum()+1L);
                if(flag){
                    deviceDetail.setAbnormalNum(deviceDetail.getAbnormalNum()+1L);
                }
            }
            deviceDetailDao.save(deviceDetail);
        }
    }

+ 34 - 15
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/OnenetService.java

@ -93,27 +93,29 @@ public class OnenetService {
            }else if("15".equals(categoryCode)){
                title = "烟探测器监测信息接收";
            }
            hvDeviceService.updContactStatus(deviceSn,1);
            dataPushLogUtil.savePushLog(deviceSn,msg.toJSONString(),title);
            //未来鹰设备 类型2是设备状态(不准)
            Integer type = msg.getInteger("type");
            String value = msg.getString("value");
            boolean flag = false;
            if("1".equals(onenetDevice.getDeviceType())){
                if ("14".equals(categoryCode)){//燃气
                    wlyDateDelGas(categoryCode,msg);
                    flag = wlyDateDelGas(categoryCode,msg);
                }
                if ("15".equals(categoryCode)){//烟雾设备
                    wlyDateDelSmoke(msg);
                    flag = wlyDateDelSmoke(msg);
                }
            }else if("2".equals(onenetDevice.getDeviceType())){
                //海康设备
                if("14".equals(onenetDevice.getCategoryCode())){
                    hkDeviceQi(onenetDevice,msg);
                    flag = hkDeviceQi(onenetDevice,msg);
                }else if("15".equals(onenetDevice.getCategoryCode())){
                    hkDeviceYan(onenetDevice,msg);
                    flag = hkDeviceYan(onenetDevice,msg);
                }
            }
            hvDeviceService.updContactStatus(deviceSn,1,flag);
            record.setContent(msg.toJSONString());
            record.setStatus(1);
@ -166,7 +168,8 @@ public class OnenetService {
    /**
     * 海康设备解析-烟感
     */
    public void hkDeviceYan(OnenetDevice onenetDevice,JSONObject jsonObject){
    public boolean hkDeviceYan(OnenetDevice onenetDevice,JSONObject jsonObject){
        boolean flag = false;
        String value = jsonObject.getString("value");
        String byMessageId = value.substring(0,2);
//        String byDevType = value.substring(4,6);
@ -190,7 +193,7 @@ public class OnenetService {
                    addDeviceIndex(resourceSerial,monitorValue,time,"2","%");
                    dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
                }
                return;
                return flag;
            }
        }
@ -220,15 +223,16 @@ public class OnenetService {
                        tmp.put("smoke",monitorValue);
                        orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                        dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"烟感探测器报警信息接收");
                        flag = true;
                    }
                    addDeviceIndex(resourceSerial,monitorValue,time,"2","%");
                }
                return;
                return flag;
            }
        }
        //其他信息暂时不处理
        // 03消音 04自检 05故障 06信号查询 07注册 08注销 ...
        return flag;
    }
    /**
@ -252,7 +256,8 @@ public class OnenetService {
    /**
     * 海康设备解析-气感
     */
    public void hkDeviceQi(OnenetDevice onenetDevice,JSONObject jsonObject){
    public boolean hkDeviceQi(OnenetDevice onenetDevice,JSONObject jsonObject){
        boolean flag = false;
        String value = jsonObject.getString("value");
        String byMessageId = value.substring(0,2);
//        String byDevType = value.substring(4,6);
@ -274,7 +279,7 @@ public class OnenetService {
                addDeviceIndex(resourceSerial,monitorValue,time,"1","%LEL");
                dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器监测信息接收");
            }
            return;
            return flag;
        }
        if("02".equals(byMessageId)){
            //报警
@ -304,6 +309,7 @@ public class OnenetService {
                        tmp.put("gas",monitorValue);
                        orderUtil.createSecurityOrder(resourceSerial,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                        dataPushLogUtil.savePushLog(resourceSerial,jsonObject.toJSONString(jsonObject,SerializerFeature.WriteMapNullValue),"可燃气体探测器报警信息接收");
                        flag = true;
                    }
                    addDeviceIndex(resourceSerial,monitorValue,time,"1","%LEL");
                }
@ -311,7 +317,7 @@ public class OnenetService {
        }
        //其他信息暂时不处理
        // 03消音 04自检 05故障 06信号查询 07注册 08注销 ...
        return flag;
    }
    /**
@ -372,7 +378,8 @@ public class OnenetService {
     * 未来鹰设备烟雾数据处理
     * @param msg
     */
    public void wlyDateDelSmoke(JSONObject msg){
    public boolean wlyDateDelSmoke(JSONObject msg){
        boolean flag = false;
        String dsId = msg.getString("ds_id");
        String msgId = dsId.split("_")[2];
        String value = msg.getString("value");
@ -387,6 +394,7 @@ public class OnenetService {
                    JSONObject tmp = new JSONObject();
                    tmp.put("smoke",value);
                    orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                    flag = true;
                }
            }
            DeviceHealthIndex index = new DeviceHealthIndex();
@ -406,12 +414,21 @@ public class OnenetService {
                    JSONObject tmp = new JSONObject();
                    tmp.put("smoke","100");
                    orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,7,"10","preventFire",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                    flag = true;
                }
            }
        }
        return flag;
    }
    public void wlyDateDelGas(String categoryCode,JSONObject msg){
    /**
     * 返回数据是否异常 true异常
     * @param categoryCode
     * @param msg
     * @return
     */
    public boolean wlyDateDelGas(String categoryCode,JSONObject msg){
        boolean flag = false;
        String deviceSn = msg.getString("imei");
        Integer type = msg.getInteger("type");
        String value = msg.getString("value");
@ -422,7 +439,6 @@ public class OnenetService {
            Integer gas = Integer.parseInt(gas_Level, 16);
            if(gas>0){
                //气体浓度大于0触发报警
                String sql = "select count(*) from base_device_health_index where device_sn = '"+deviceSn+"'" +
                        " and value>0 and create_time>='"+DateUtil.getNextMinute(-60)+"' ";
                Integer count = jdbcTemplate.queryForObject(sql,Integer.class);
@ -432,6 +448,7 @@ public class OnenetService {
                    JSONObject tmp = new JSONObject();
                    tmp.put("gas",gas);
                    orderUtil.createSecurityOrder(deviceSn,null,new JSONObject(),null,6,"11","preventGasLeakage",JSON.toJSONString(tmp, SerializerFeature.WriteMapNullValue));
                    flag = true;
                }
            }
            DeviceHealthIndex index = new DeviceHealthIndex();
@ -448,5 +465,7 @@ public class OnenetService {
            index.setRecordTime(DateUtil.getStringDate());
            deviceHealthIndexDao.save(index);
        }
        return flag;
    }
}

+ 4 - 4
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -248,7 +248,7 @@ public class PatientDeviceService {
            List<String> lostSN = new ArrayList<>();
            List<String> onContact = new ArrayList<>();
            /*******************未失联**/
            //血糖仪,血压计。30天内有数据上传,则改为未失联
/*            //血糖仪,血压计。30天内有数据上传,则改为未失联
            String sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (1,2) and EXISTS ( " +
                    "select dp.device_sn from device_data_push_log dp where dp.device_sn = pd.device_sn and dp.create_time " +
                    " BETWEEN '"+startTimeDevice1+"' AND '"+endTime+"') ";
@ -265,13 +265,13 @@ public class PatientDeviceService {
            devices = jdbcTemplate.queryForList(sql,String.class) ;
            if (devices.size() > 0) {
                onContact.addAll(devices);
            }
            }*/
            /***************失联**/
            //血糖仪、血压**/
            sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (1,2) and not EXISTS ( " +
            String sql = " SELECT pd.device_sn FROM base.wlyy_patient_device pd  where pd.del=0 and pd.category_code in (1,2) and not EXISTS ( " +
                    "select dp.device_sn from device_data_push_log dp where dp.device_sn = pd.device_sn and dp.create_time " +
                    " BETWEEN '"+startTimeDevice1+"' AND '"+endTime+"') ";
            devices = jdbcTemplate.queryForList(sql,String.class) ;
            List<String> devices = jdbcTemplate.queryForList(sql,String.class) ;
            if (devices.size() > 0) {
                lostSN.addAll(devices);
            }

+ 152 - 0
svr/svr-cloud-transfor/pom.xml

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>wlyy-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>svr-cloud-transfor</artifactId>
    <packaging>jar</packaging>
    <version>${parent.version}</version>
    <dependencies>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
<!--            <scope>provided</scope>-->
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
        </dependency>
        <!-- 支持Tomcat启动 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!-- SPRINGSIDE -->
        <dependency>
            <groupId>org.springside</groupId>
            <artifactId>springside-core</artifactId>
            <version>4.2.3-GA</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-cloud-transfor</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifest>
                            <!-- 是否要把第三方jar加入到类构建路径 -->
                            <addClasspath>true</addClasspath>
                            <!-- 外部依赖jar包的最终位置 -->
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.yihu.SvrCloudTransforApplication</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <!--拷贝依赖到jar外面的lib目录-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-lib</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <!-- 依赖包输出目录,将来不打进jar包里 -->
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <excludeTransitive>false</excludeTransitive>
                            <stripVersion>false</stripVersion>
                            <includeScope>runtime</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--指定配置文件,将resources打成外部resource-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
                        <manifestEntries>
                            <Class-Path>resources/</Class-Path>
                        </manifestEntries>
                    </archive>
                    <!-- 打包时忽略的文件(也就是不打进jar包里的文件) -->
                    <excludes>
                        <exclude>**/*.yml</exclude>
                        <exclude>**/*.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- 拷贝资源文件 外面的resource目录-->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <!-- 资源文件输出目录 -->
                            <outputDirectory>${project.build.directory}/resources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

+ 24 - 0
svr/svr-cloud-transfor/src/main/java/com/yihu/SvrCloudTransforApplication.java

@ -0,0 +1,24 @@
package com.yihu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
/**
 * Created by yeshijie on 2021/10/14.
 */
@SpringBootApplication
@ComponentScan("com.yihu")
public class SvrCloudTransforApplication extends SpringBootServletInitializer {
    public static void main(String[] args)  {
        SpringApplication.run(SvrCloudTransforApplication.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SvrCloudTransforApplication.class);
    }
}

+ 430 - 0
svr/svr-cloud-transfor/src/main/java/com/yihu/jw/care/controller/TransforController.java

@ -0,0 +1,430 @@
package com.yihu.jw.care.controller;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.service.AqgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by yeshijie on 2021/10/14.
 */
@RestController
@RequestMapping(value = "/device",produces = "application/json")
@Api(value = "请求转发相关服务", description = "请求转发相关服务")
public class TransforController {
    private static Logger logger = LoggerFactory.getLogger(TransforController.class);
    @Autowired
    private AqgService aqgService;
    @ApiOperation("爱牵挂设备sos数据接收")
    @RequestMapping(value = "aqgsos", method = {RequestMethod.POST,RequestMethod.GET})
    public String aqgsos(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = false) String imei,
            @ApiParam(name="label_mac",required = false,value="只有主机下有绑定标贴才会发送这个参数,按哪个标贴就报哪个标贴Mac,按主机报警则不会发送",defaultValue = "")
            @RequestParam(value = "label_mac",required = false) String label_mac,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS",defaultValue = "1")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/aqgsos?imei="+imei+"&label_mac="+label_mac+"&time_begin="+time_begin;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂设备sos数据接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂设备开关机数据接收")
    @RequestMapping(value = "aqgSwitch", method = {RequestMethod.POST,RequestMethod.GET})
    public String aqgSwitch(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = false) String imei,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS",defaultValue = "1")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            @ApiParam(name="remaining_power",required = false,value="剩余电量(%) ",defaultValue = "")
            @RequestParam(value = "remaining_power",required = false) String remaining_power,
            @ApiParam(name="type",required = false,value=" 开/关机类型  0开机 2普通  3低电 ",defaultValue = "")
            @RequestParam(value = "type",required = false) String type,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/aqgSwitch?imei="+imei+"&remaining_power="+remaining_power+"&time_begin="+time_begin+"&type="+type;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂设备开关机数据接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂设备消息通知数据接收")
    @RequestMapping(value = "pushdata", method = {RequestMethod.POST,RequestMethod.GET})
    public String pushdata(
            @ApiParam(name="type",required = false,value="根据type来定义给用户推送提示  type=1 SOS,type=5 设备低电, 其他类型非本机型所有",defaultValue = "")
            @RequestParam(value = "type",required = false) int type,
            @ApiParam(name="deviceid",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "deviceid",required = false) String deviceid,
            @ApiParam(name="communityid",required = false,value="机构ID",defaultValue = "1")
            @RequestParam(value = "communityid",required = false) String communityid,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/pushdata?deviceid="+deviceid+"&communityid="+communityid+"&type="+type;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂设备消息通知数据接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂位置接收")
    @RequestMapping(value = "byLocation", method = {RequestMethod.POST,RequestMethod.GET})
    public String byLocation(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS",defaultValue = "1")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            @ApiParam(name="is_reply",required = false,value="是否为响应")
            @RequestParam(value = "is_reply",required = false) boolean is_reply,
            @ApiParam(name="is_track",required = false,value="是否轨迹")
            @RequestParam(value = "is_track",required = false) boolean is_track,
            @ApiParam(name="city",required = false,value="城市")
            @RequestParam(value = "city",required = false) String city,
            @ApiParam(name="address",required = false,value="地址")
            @RequestParam(value = "address",required = false) String address,
            @ApiParam(name="lon",required = false,value="经度")
            @RequestParam(value = "lon",required = false) double lon,
            @ApiParam(name="lat",required = false,value="纬度")
            @RequestParam(value = "lat",required = false) double lat,
            @ApiParam(name="type",required = false,value="类型  0:Gps定位; 1:基站定位")
            @RequestParam(value = "type",required = false) String type,
            HttpServletRequest request){
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/byLocation?imei="+imei+"&is_reply="+is_reply+"&is_track="+is_track+"&city="+city
                    +"&address="+address+"&lon="+lon+"&lat="+lat+"&time_begin="+time_begin+"&type="+type;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂位置接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂心率数据接收")
    @RequestMapping(value = "byHeartRate",  method = {RequestMethod.POST,RequestMethod.GET})
    public String byHeartRate(
            @ApiParam(name = "imei", value = "15位设备唯一序号")
            @RequestParam(value = "imei",required = true)String imei,
            @ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_begin",required = false)String time_begin,
            @ApiParam(name = "heartrate", value = "心率")
            @RequestParam(value = "heartrate",required = false)int heartrate,
            @ApiParam(name = "theshold_heartrate_h", value = "心率阈值上限")
            @RequestParam(value = "theshold_heartrate_h",required = false)int theshold_heartrate_h,
            @ApiParam(name = "theshold_heartrate_l", value = "心率阈值下限")
            @RequestParam(value = "theshold_heartrate_l",required = false)int theshold_heartrate_l,
            HttpServletRequest request){
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/byHeartRate?imei="+imei+"&heartrate="+heartrate+"&time_begin="+time_begin+"&theshold_heartrate_h="+theshold_heartrate_h+"&theshold_heartrate_l="+theshold_heartrate_l;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂心率数据接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂血压数据接收")
    @RequestMapping(value = "byBloodPressure",  method = {RequestMethod.POST,RequestMethod.GET})
    public String byBloodPressure(
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
            @RequestParam(value = "imei",required = true)String imei,
            @ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
            @RequestParam(value = "time_begin",required = false)String time_begin,
            @ApiParam(name = "dbp", value = "舒张压", required = true)
            @RequestParam(value = "dbp",required = false)int dbp,
            @ApiParam(name = "dbp_l", value = "舒张压报警下限", required = true)
            @RequestParam(value = "dbp_l",required = false)int dbp_l,
            @ApiParam(name = "sbp", value = "收缩压", required = true)
            @RequestParam(value = "sbp",required = false)int sbp,
            @ApiParam(name = "sbp_h", value = "收缩压报警上限", required = true)
            @RequestParam(value = "sbp_h",required = false)int sbp_h,
            HttpServletRequest request){
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/byBloodPressure?imei="+imei+"&dbp="+dbp+"&time_begin="+time_begin+"&dbp_l="+dbp_l+"&sbp="+sbp+"&sbp_h="+sbp_h;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂血压数据接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂跌倒数据接收")
    @RequestMapping(value = "byFall",  method = {RequestMethod.POST,RequestMethod.GET})
    public String byFall(
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
            @RequestParam(value = "imei",required = true)String imei,
            @ApiParam(name = "time_begin", value = "发生时间YYYY-MM-DD HH:mm:SS", required = true)
            @RequestParam(value = "time_begin",required = false)String time_begin,
            @ApiParam(name = "city", value = "城市", required = false)
            @RequestParam(value = "city",required = false)String city,
            @ApiParam(name = "address", value = "地址", required = false)
            @RequestParam(value = "address",required = false)String address,
            @ApiParam(name = "lon", value = "经度", required = false)
            @RequestParam(value = "lon",required = false)double lon,
            @ApiParam(name = "lat", value = "纬度", required = false)
            @RequestParam(value = "lat",required = false)double lat,
            @ApiParam(name = "type", value = "纬度", required = false)
            @RequestParam(value = "type",required = false)String type,
            HttpServletRequest request){
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/byFall?imei="+imei+"&city="+city+"&address="+address+"&lon="+lon+"&lat="+lat+"&time_begin="+time_begin+"&type="+type;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂跌倒数据接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("设备步数接收")
    @RequestMapping(value = "bySteps",  method = {RequestMethod.POST,RequestMethod.GET})
    public String bySteps(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            @ApiParam(name="value",required = false,value="步数")
            @RequestParam(value = "value",required = false) int value,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/bySteps?imei="+imei+"&value="+value+"&time_begin="+time_begin;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("设备步数接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    /*******************************************睡眠带begin****************************************************************/
    @ApiOperation("爱牵挂-睡眠带睡眠接收")
    @RequestMapping(value = "bySleep",  method = {RequestMethod.POST,RequestMethod.GET})
    public String bySleep(
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
            @RequestParam(value = "device",required = true) String device,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            @ApiParam(name="heartrate",required = false,value="心率数据(离床或翻身测量失败时为0)")
            @RequestParam(value = "heartrate",required = false) String heartrate,
            @ApiParam(name="breath",required = false,value="呼吸率(离床或翻身测量失败时为0)")
            @RequestParam(value = "breath",required = false) String breath,
            @ApiParam(name="bed_status",required = false,value="在离床状态(0 离床,1 在床) ")
            @RequestParam(value = "bed_status",required = false) String bed_status,
            @ApiParam(name="turn_over",required = false,value="翻身状态(0 没翻身,1 在翻身)")
            @RequestParam(value = "turn_over",required = false)String turn_over,
            @ApiParam(name="is_warn",required = false,value="是否为离床报警(0 否 默认,1 是)")
            @RequestParam(value = "is_warn",required = false)String is_warn,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/bySleep?device="+device+"&heartrate="+heartrate+"&time_begin="+time_begin
                    +"&breath="+breath+"&bed_status="+bed_status+"&turn_over="+turn_over+"&is_warn="+is_warn;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂-睡眠带睡眠接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂-睡眠带睡眠报告接收")
    @RequestMapping(value = "bySleepReport",  method = {RequestMethod.POST,RequestMethod.GET})
    public String bySleep(
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
            @RequestParam(value = "device",required = true) String device,
            @ApiParam(name="date",required = false,value="产生日期 YYYYMMDD")
            @RequestParam(value = "date",required = false) String date,
            @ApiParam(name="fallasleep",required = false,value="入睡时长 (分钟)")
            @RequestParam(value = "fallasleep",required = false) String fallasleep,
            @ApiParam(name="sleepTime",required = false,value="睡眠时长 (分钟)")
            @RequestParam(value = "sleepTime",required = false) String sleepTime,
            @ApiParam(name="restTime",required = false,value="休息时长 (分钟)")
            @RequestParam(value = "restTime",required = false) String restTime,
            @ApiParam(name="bed_status",required = false,value="在离床状态(0 离床,1 在床) ")
            @RequestParam(value = "bed_status",required = false) String bed_status,
            @ApiParam(name="awakeTime",required = false,value="清醒时长 (分钟)")
            @RequestParam(value = "awakeTime",required = false)String awakeTime,
            @ApiParam(name="lightTime",required = false,value="浅睡时长 (分钟)")
            @RequestParam(value = "lightTime",required = false)String lightTime,
            @ApiParam(name="remTime",required = false,value="rem时长  (分钟)")
            @RequestParam(value = "remTime",required = false)String remTime,
            @ApiParam(name="deepTime",required = false,value="深睡时长 (分钟) ")
            @RequestParam(value = "deepTime",required = false)String deepTime,
            @ApiParam(name="bucket",required = false,value="睡眠时段 ['18:00-18:21', '21:30-07:09'] ")
            @RequestParam(value = "bucket",required = false)String[] bucket,
            @ApiParam(name="avghr",required = false,value="平均心率 ")
            @RequestParam(value = "avghr",required = false)String avghr,
            @ApiParam(name="avgbr",required = false,value="平均呼吸率 ")
            @RequestParam(value = "avgbr",required = false)String avgbr,
            @ApiParam(name="awakePer",required = false,value="清醒百分比")
            @RequestParam(value = "awakePer",required = false)String awakePer,
            @ApiParam(name="remPer",required = false,value="rem百分比")
            @RequestParam(value = "remPer",required = false)String remPer,
            @ApiParam(name="lightPer",required = false,value="浅睡百分比")
            @RequestParam(value = "lightPer",required = false)String lightPer,
            @ApiParam(name="deepPer",required = false,value="深睡百分比")
            @RequestParam(value = "deepPer",required = false)String deepPer,
            @ApiParam(name="efficiency",required = false,value="睡眠效率")
            @RequestParam(value = "efficiency",required = false)String efficiency,
            @ApiParam(name="score",required = false,value="睡眠评分 <=0无睡眠数据,<60待改善,<70一般,<85良好 其他,非常好")
            @RequestParam(value = "score",required = false)String score,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/bySleep?device="+device+"&date="+date+"&fallasleep="+fallasleep+"&sleepTime="+sleepTime
                    +"&restTime="+restTime+"&bed_status="+bed_status+"&awakeTime="+awakeTime+"&lightTime="+lightTime
                    +"&remTime="+remTime+"&deepTime="+deepTime+"&bucket="+bucket+"&avghr="+avghr
                    +"&avgbr="+avgbr+"&awakePer="+awakePer+"&remPer="+remPer+"&lightPer="+lightPer
                    +"&deepPer="+deepPer+"&efficiency="+efficiency+"&score="+score;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂-睡眠带睡眠报告接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    @ApiOperation("爱牵挂-睡眠带wifi在线状态接收")
    @RequestMapping(value = "byOnlineStatus",  method = {RequestMethod.POST,RequestMethod.GET})
    public String byOnlineStatus(
            @ApiParam(name="device",required = false,value="睡眠带MAC地址",defaultValue = "")
            @RequestParam(value = "device",required = true) String device,
            @ApiParam(name="onlinestatu",required = false,value="在线状态(0不在线,1在线)")
            @RequestParam(value = "onlinestatu",required = false) String onlinestatu,
            @ApiParam(name="time_begin",required = false,value="发生时间YYYY-MM-DD HH:mm:SS")
            @RequestParam(value = "time_begin",required = false) String time_begin,
            HttpServletRequest request) {
        try {
            long startTime=System.currentTimeMillis();
            String paraString = JSON.toJSONString(request.getParameterMap());
            String url = "device/byOnlineStatus?device="+device+"&onlinestatu="+onlinestatu+"&time_begin="+time_begin;
            String result = aqgService.aqgForward(url);
            long endTime=System.currentTimeMillis();
            logger.info("爱牵挂-睡眠带wifi在线状态接收,请求参数:"+paraString+" "+(endTime-startTime)+"ms; 响应:"+result);
            return success();
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"Device data incoming failure");
        }
    }
    /*******************************************睡眠带end****************************************************************/
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String error(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put("success", false);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 接口处理成功
     * @return
     */
    public String success() {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", 200);
            map.put("success", true);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
    public String write(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put("success", true);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

+ 63 - 0
svr/svr-cloud-transfor/src/main/java/com/yihu/jw/care/service/AqgService.java

@ -0,0 +1,63 @@
package com.yihu.jw.care.service;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.net.URLDecoder;
/**
 * Created with IntelliJ IDEA.
 * 爱牵挂转发
 * @Author: yeshijie
 * @Date: 2021/8/31
 * @Description:
 */
@Service
public class AqgService {
    private Logger logger = LoggerFactory.getLogger(AqgService.class);
    private static final RestTemplate restTemplate = new RestTemplate();
    private static final String baseUrl = "https://zhyzh.gongshu.gov.cn/device/";
//    private static final String baseUrl = "http://ehr.yihu.com/wlyy/aqg";
    public String aqgForward(String method,String body,String uri){
        String res = "";
        try {
            String url;
            if(StringUtils.isBlank(body)){
                uri = URLDecoder.decode(uri,"UTF-8");
                url = baseUrl+uri;
            }else{
                url = baseUrl+method+"?"+body;
            }
            ResponseEntity<String> responseEntity = null;
            logger.info("推送爱牵挂数据给医养项目url="+ url);
            responseEntity = restTemplate.getForEntity(url, String.class);
            res = responseEntity.getBody();
            logger.info("推送爱牵挂数据给医养项目res="+ res);
        }catch (Exception e){
            e.printStackTrace();
        }
        return res;
    }
    public String aqgForward(String url){
        String res = "";
        try {
            ResponseEntity<String> responseEntity = null;
            logger.info("推送爱牵挂数据给医养项目url="+ baseUrl+url);
            responseEntity = restTemplate.getForEntity(baseUrl+url, String.class);
            res = responseEntity.getBody();
            logger.info("推送爱牵挂数据给医养项目res="+ res);
        }catch (Exception e){
            e.printStackTrace();
        }
        return res;
    }
}

+ 97 - 0
svr/svr-cloud-transfor/src/main/resources/application.yml

@ -0,0 +1,97 @@
#通用的配置不用区分环境变量
server:
  port: 10303
spring:
  datasource:
    max-active: 200
    max-idle: 200 #最大空闲连接
    min-idle: 10 #最小空闲连接
    validation-query-timeout: 20
    log-validation-errors: true
    validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
    validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    idle-timeout: 20000
    connection-test-query: SELECT 1
    num-tests-per-eviction-run: 200 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
    test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  http:
    multipart:
      max-file-size: 30MB
      max-request-size: 100MB
#      location: D:/work/soft_dev/IdeaWorkSpace/wlyy2.0/svr/svr-patient/temp_file/
#      resolve-lazily: true
es:
  index:
    servicePackLog: base_service_package_log
  type:
    servicePackLog: base_service_package_log
fast-dfs:
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
  http:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
  pool: #连接池大小
    init-size: 5
    max-size: 20
    wait-time: 500
configDefault: # 默认配置
  saasId: xmjkzl_saasId
---
spring:
  profiles: jwdev
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.26.0.114/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: root
    password: jkzlehr
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 172.26.0.115:9300,172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
base:
  url: http://172.17.110.212:10020/
  hospitalUrl: http://172.26.0.107:10022/
cloudCare:
  deviceUrl: http://172.26.0.107:9112/
---
spring:
  profiles: prod
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.26.0.104/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: ssgg
    password: ssgg@jkzl2019
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 172.26.0.115:9300,172.26.0.115:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://172.26.0.112:9200,http://172.26.0.112:9200
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
base:
  url: http://172.17.110.212:10020/
  hospitalUrl: http://172.26.0.107:10022/
cloudCare:
  deviceUrl: http://172.26.0.107:9112/

+ 0 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -812,7 +812,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
							consult.put("generalDeptName",baseDoctorHospitalDO.getDeptName());
						}
					}
				}
			}

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

@ -2085,6 +2085,48 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.pushYkCardCharge)
    @ApiOperation(value = "导出眼科通充值记录", notes = "")
    public Envelop pushYkCardCharge(@ApiParam(name = "startTime", value = "开始时间")
                                       @RequestParam(value = "startTime", required = false)String startTime,
                                       @ApiParam(name = "endTime", value = "结束时间")
                                       @RequestParam(value = "endTime", required = false)String endTime,
                                       @ApiParam(name = "orderNo", value = "订单号")
                                       @RequestParam(value = "orderNo", required = false)String orderNo,
                                       @ApiParam(name = "yktOrderNo", value = "眼科订单号")
                                       @RequestParam(value = "yktOrderNo", required = false)String yktOrderNo,
                                       @ApiParam(name = "patientName", value = "患者姓名")
                                       @RequestParam(value = "patientName", required = false)String patientName,
                                       @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 = "状态(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,
                                       HttpServletResponse response) {
        try {
            MixEnvelop expressages = businessOrderService.pushYktCardCharge(startTime,endTime,orderNo,yktOrderNo,patientName,idCard,medicard,status,page,pageSize, orderType, orderCategory);
            List<Map<String, Object>> list = expressages.getDetailModelList();
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String("pushYktCardCharge.xls"));
            OutputStream os = response.getOutputStream();
            prescriptionService.pushYktCardChargeWrite(os, list);
            return success(expressages);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    /**
     * 咨询列表
     * @param startDate

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

@ -77,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
@ -143,7 +143,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Value("${demo.flag}")
    private boolean demoFlag;
    
    @Value("${wechat.id}")
    private String wxId;
@ -162,322 +162,322 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @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);
        }
    }
@ -486,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);
        }
    }
@ -501,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("尚未开发!");
        }
    }
@ -702,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();
@ -742,198 +742,234 @@ 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);
        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 = false) String type,
                                     @ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
                                         @RequestParam(value = "status",required = false) 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);
        }
    }
    @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);
        }
    }
@ -941,64 +977,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门诊状态
@ -1011,129 +1047,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);
        }
@ -1143,13 +1179,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);
        }
@ -1159,19 +1195,20 @@ 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) {
@ -1184,56 +1221,57 @@ 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(
@ -1252,62 +1290,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);
        }
    }
@ -1315,515 +1353,519 @@ 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位医生同时导入!");
@ -1832,7 +1874,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("格式错误!");
@ -1840,45 +1882,46 @@ 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());
        }
@ -1886,23 +1929,24 @@ 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());
        }
@ -1911,6 +1955,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    /**
     * 充值卡一支付
     *
     * @param mzhm
     * @param jkje
     * @param type
@ -1919,75 +1964,78 @@ 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);
        }
@ -1995,47 +2043,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());
        }
    }
    
    
    /**
     * 易联众统一订单查询
     *
@ -2044,83 +2092,84 @@ 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);
        }
    }
    
    /**
     * 处方-- 审方
     *
@ -2132,65 +2181,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);
    }
    
    
    /**
     * 医生端-处方处理
     *
@ -2201,26 +2250,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);
        }
    }
    
    
    /**
     * 查询审核历史记录
     *
@ -2228,64 +2277,65 @@ 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);
        }
@ -2314,17 +2364,18 @@ 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);
        }
@ -2364,17 +2415,18 @@ 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);
        }
@ -2382,33 +2434,34 @@ 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) {
@ -2417,86 +2470,85 @@ 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);
        }
@ -2505,13 +2557,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);
        }
@ -2520,7 +2572,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 = "过滤器,为空检索所有条件")
@ -2531,7 +2583,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);
        }
    }
@ -2539,7 +2591,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 = "过滤器,为空检索所有条件")
@ -2547,10 +2599,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);
        }
    }
@ -2558,7 +2610,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 = "过滤器,为空检索所有条件")
@ -2569,14 +2621,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 = "过滤器,为空检索所有条件")
@ -2587,33 +2639,35 @@ 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());
@ -2622,32 +2676,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());
@ -2655,7 +2709,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);
        }
@ -2664,40 +2718,43 @@ 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));
    }
@ -2705,150 +2762,156 @@ 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));
    }
@ -2858,47 +2921,50 @@ 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));
    }
@ -2906,11 +2972,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));
    }
@ -2918,7 +2984,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));
    }
@ -2928,40 +2994,42 @@ 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);
            }
@ -2972,23 +3040,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);
@ -3003,44 +3071,45 @@ 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);
@ -3050,98 +3119,101 @@ 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){
                                      @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,preNo));
            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());
        }
@ -3150,14 +3222,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());
        }
@ -3165,19 +3237,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());
        }
@ -3211,24 +3283,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());
        }
@ -3236,41 +3308,42 @@ 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")
@ -3325,11 +3398,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());
        }
    }
@ -3338,13 +3411,14 @@ 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());
        }
    }
}