Browse Source

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

yeshijie 4 years ago
parent
commit
de8fa58909
32 changed files with 1657 additions and 259 deletions
  1. 7 0
      business/base-service/pom.xml
  2. 14 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorPatientDao.java
  3. 725 159
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 12 8
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java
  5. 13 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  6. 7 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  7. 7 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  8. 4 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  9. 90 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java
  10. 23 13
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  11. 1 0
      business/base-service/src/main/java/com/yihu/jw/order/pay/utils/PayLogService.java
  12. 121 0
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  13. 2 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BaseDoctorPatientFollowDao.java
  14. 53 11
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  15. 1 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  16. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  17. 74 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorPatientDO.java
  18. 23 5
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  19. 33 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java
  20. 33 0
      common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java
  21. 37 2
      common/common-util/src/main/java/com/yihu/jw/util/wechat/WeiXinPayUtils.java
  22. 68 0
      common/common-util/src/main/java/com/yihu/jw/util/wechat/wxhttp/HttpUtil.java
  23. 0 2
      gateway/ag-basic/src/main/resources/application.yml
  24. 11 0
      server/svr-authentication/pom.xml
  25. 17 15
      server/svr-authentication/src/main/resources/application.yml
  26. 7 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java
  27. 22 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  28. 6 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  29. 53 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  30. 3 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  31. 175 12
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  32. 1 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

+ 7 - 0
business/base-service/pom.xml

@ -93,6 +93,13 @@
            <version>1.0</version>
            <version>1.0</version>
        </dependency>
        </dependency>
        <!--解析html-->
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.11.2</version>
        </dependency>
        <dependency>
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <artifactId>json-lib</artifactId>

+ 14 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorPatientDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.doctor.dao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorPatientDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/6/1
 */
public interface BaseDoctorPatientDao extends PagingAndSortingRepository<BaseDoctorPatientDO, String>, JpaSpecificationExecutor<BaseDoctorPatientDO> {
}

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

@ -5,10 +5,13 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorPatientDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorPatientDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorVo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -22,6 +25,7 @@ import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
@ -35,20 +39,24 @@ import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
@ -56,9 +64,14 @@ import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
@ -70,8 +83,12 @@ import com.ylzinfo.ehc.trans.TransResponse;
import jxl.write.*;
import jxl.write.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JSONObject;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -187,8 +204,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PrescriptionEmrDao prescriptionEmrDao;
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    @Autowired
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    @Autowired
    private BaseDoctorPatientDao baseDoctorPatientDao;
    @Autowired
    private BaseUserAgent userAgent;
    @Autowired
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private YlzPayService ylzPayService;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Value("${demo.flag}")
    @Value("${demo.flag}")
@ -489,10 +517,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param size
     * @param size
     * @return
     * @return
     */
     */
    public MixEnvelop findPrescriptionList(String patient, String status,String startTime, String endTime, Integer page, Integer size){
    public MixEnvelop findPrescriptionList(String patient, String status,String startTime, String endTime, Integer page, Integer size,String wxId){
        String totalSql ="SELECT " +
        String totalSql ="SELECT " +
                " count(1) AS total " +
                " count(1) AS \"total\" " +
                " FROM " +
                " FROM " +
                " wlyy_prescription p ";
                " wlyy_prescription p ";
        totalSql += " WHERE 1=1 ";
        totalSql += " WHERE 1=1 ";
@ -503,10 +531,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            totalSql+=" AND p.status IN ("+status+")";
            totalSql+=" AND p.status IN ("+status+")";
        }
        }
        if(StringUtils.isNotBlank(startTime)){
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >='"+startTime+" 00:00:00'";
            if("xm_ykyy_wx".equals(wxId)){
                totalSql +=" and create_time >= to_date('"+startTime+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                totalSql += " AND create_time >='"+startTime+" 00:00:00'";
            }
        }
        }
        if(StringUtils.isNotBlank(endTime)){
        if(StringUtils.isNotBlank(endTime)){
            totalSql += " AND create_time <='"+endTime+" 23:59:59'";
            if("xm_ykyy_wx".equals(wxId)){
                totalSql +=" and create_time <= to_date('"+startTime+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }else {
                totalSql += " AND create_time <='"+endTime+" 23:59:59'";
            }
        }
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
@ -516,48 +554,48 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        }
        String sql ="SELECT " +
        String sql ="SELECT " +
                " p.id, " +
                " p.real_order AS realOrder," +
                " p.origin_real_order AS originRealOrder," +
                " p.adm_no AS admNo," +
                " p.origin_adm_no AS originAdmNo," +
                " p.serial_no AS serialNo," +
                " p.type AS type, " +
                " p.patient_code AS patientCode, " +
                " p.patient_name AS patientName, " +
                " p.ssc AS ssc, " +
                " p.doctor AS doctor, " +
                " p.doctor_name AS doctorName, " +
                " p.`status` AS `status`, " +
                " p.mk_fail_reason AS mkFailReason, " +
                " p.mk_time AS mk_time, " +
                " p.prescribe_reason AS prescribeReason, " +
                " p.prescribe_time AS prescribeTime, " +
                " p.pay_time AS payTime, " +
                " p.dosage_time AS dosageTime, " +
                " p.finish_time AS finishTime, " +
                " p.create_time AS createTime, " +
                " p.dept AS dept, " +
                " p.dept_name AS deptName, " +
                " p.hospital AS hospital, " +
                " p.hospital_name AS hospitalName, " +
                " p.consult AS consult, " +
                " p.dispensary_type AS dispensaryType, " +
                " p.reason AS reason, " +
                " p.remark AS remark, " +
                " p.cancel_reason AS cancelReason, " +
                " p.ca_cert_data AS caCertData, " +
                " p.ca_message AS caMessage, " +
                " p.digital_sign_no AS digitalSignNo, " +
                " p.original_data_abstract AS originalDataAbstract, " +
                " p.str_original_data AS strOriginalData, " +
                " p.his_dept_code AS hisDeptCode, " +
                " p.his_doctor_code AS hisDoctorCode, " +
                " p.his_gister_type_code AS hisGisterTypeCode, " +
                " p.his_rate_type_code AS hisRateTypeCode, " +
                " p.his_hospital AS hisHospital, " +
                " p.his_register_fee AS hisRegisterFee, " +
                " p.pay_status AS payStatus " +
                " p.id as \"id\", " +
                " p.real_order AS \"realOrder\"," +
                " p.origin_real_order AS \"originRealOrder\"," +
                " p.adm_no AS \"admNo\"," +
                " p.origin_adm_no AS \"originAdmNo\"," +
                " p.serial_no AS \"serialNo\"," +
                " p.type AS \"type\", " +
                " p.patient_code AS \"patientCode\", " +
                " p.patient_name AS \"patientName\", " +
                " p.ssc AS \"ssc\", " +
                " p.doctor AS \"doctor\", " +
                " p.doctor_name AS \"doctorName\", " +
                " p.status AS \"status\", " +
                " p.mk_fail_reason AS \"mkFailReason\", " +
                " p.mk_time AS \"mk_time\", " +
                " p.prescribe_reason AS \"prescribeReason\", " +
                " p.prescribe_time AS \"prescribeTime\", " +
                " p.pay_time AS \"payTime\", " +
                " p.dosage_time AS \"dosageTime\", " +
                " p.finish_time AS \"finishTime\", " +
                " p.create_time AS \"createTime\", " +
                " p.dept AS \"dept\", " +
                " p.dept_name AS \"deptName\", " +
                " p.hospital AS \"hospital\", " +
                " p.hospital_name AS \"hospitalName\", " +
                " p.consult AS \"consult\", " +
                " p.dispensary_type AS \"dispensaryType\", " +
                " p.reason AS \"reason\", " +
                " p.remark AS \"remark\", " +
                " p.cancel_reason AS \"cancelReason\", " +
                " p.ca_cert_data AS \"caCertData\", " +
                " p.ca_message AS \"caMessage\", " +
                " p.digital_sign_no AS \"digitalSignNo\", " +
                " p.original_data_abstract AS \"originalDataAbstract\", " +
                " p.str_original_data AS \"strOriginalData\", " +
                " p.his_dept_code AS \"hisDeptCode\", " +
                " p.his_doctor_code AS \"hisDoctorCode\", " +
                " p.his_gister_type_code AS \"hisGisterTypeCode\", " +
                " p.his_rate_type_code AS \"hisRateTypeCode\", " +
                " p.his_hospital AS \"hisHospital\", " +
                " p.his_register_fee AS \"hisRegisterFee\", " +
                " p.pay_status AS \"payStatus\" " +
                " FROM " +
                " FROM " +
                " wlyy_prescription p " +
                " wlyy_prescription p " +
                " WHERE 1=1 ";
                " WHERE 1=1 ";
@ -568,10 +606,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql+=" AND p.status IN ("+status+")";
            sql+=" AND p.status IN ("+status+")";
        }
        }
        if(StringUtils.isNotBlank(startTime)){
        if(StringUtils.isNotBlank(startTime)){
            sql += " AND create_time >='"+startTime+" 00:00:00'";
            if("xm_ykyy_wx".equals(wxId)){
                sql +=" and create_time >= to_date('"+startTime+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql += " AND create_time >='"+startTime+" 00:00:00'";
            }
        }
        }
        if(StringUtils.isNotBlank(endTime)){
        if(StringUtils.isNotBlank(endTime)){
            sql += " AND create_time <='"+endTime+" 23:59:59'";
            if("xm_ykyy_wx".equals(wxId)){
                sql +=" and create_time <= to_date('"+startTime+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql += " AND create_time <='"+endTime+" 23:59:59'";
            }
        }
        }
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyPrescriptionVO.class));
        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyPrescriptionVO.class));
@ -647,6 +693,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //1.保存就诊实体
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
        outpatientDO.setMjz("mz");
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
        outpatientDO.setStatus("0");
@ -654,15 +701,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setOutpatientType("1");
        outpatientDO.setOutpatientType("1");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setPayStatus(0);
        if(outpatientDO.getRegisterDate()==null){
        if(outpatientDO.getRegisterDate()==null){
            outpatientDO.setRegisterDate(new Date());
            outpatientDO.setRegisterDate(new Date());
        }
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        Double price = 0.0;
        if(doctorDO!=null&&StringUtils.isNoneBlank(doctorDO.getFee())){
             price = Double.parseDouble(doctorDO.getFee());
        }
        if(price==0.0){
            outpatientDO.setPayStatus(1);
        }else {
            outpatientDO.setPayStatus(0);
        }
        Double price = 0.01;
        businessOrderService.recharge(outpatient.getId(),"复诊-诊查费","2","复诊-诊查费",patientDO.getId(),patientDO.getName(),outpatient.getDoctor(),price);
        businessOrderService.recharge(outpatient.getId(),"复诊-诊查费","2","复诊-诊查费",patientDO.getId(),patientDO.getName(),outpatient.getDoctor(),price);
@ -2006,7 +2062,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                result.put("mes", "诊断完成");
                result.put("mes", "诊断完成");
                return result;
                return result;
            }else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            }else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                Double price = 0.01;
                Double price = prescription.getDrugFee();
                businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
                businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
                //上传his开方
                //上传his开方
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
@ -2961,9 +3017,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//            //协同门诊量
//            //协同门诊量
//            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
//            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
//            rs.put("coordinationCout",coordinationCout);
//            rs.put("coordinationCout",coordinationCout);
            //医生关注
            List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctor(doctor);
            if (doctorPatientFollowDOS!=null&&doctorPatientFollowDOS.size()>0){
                rs.put("attention","1");
            }else {
                rs.put("attention","0");
            }
    
            //专家咨询
            //专家咨询
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
            List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
@ -3130,7 +3192,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param operator 1居民 2医生
     * @param operator 1居民 2医生
     * @return
     * @return
     */
     */
    public Map<String,Object> cancelOutPatient(String outPatientId,String cancelType,String cancelValue,String cancelRemark,Integer operator){
    public Map<String,Object> cancelOutPatient(String outPatientId,String cancelType,String cancelValue,String cancelRemark,Integer operator,String wxId) {
        Map<String,Object> rs = new HashedMap();
        Map<String,Object> rs = new HashedMap();
        //判断医生是否接诊
        //判断医生是否接诊
@ -3151,16 +3213,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //更改门诊状态
        //更改门诊状态
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outPatientId);
        wlyyOutpatientDO.setStatus("-1");
        wlyyOutpatientDO.setStatus("-1");
        String description = null;
        if (1 == operator){
        if (1 == operator){
            //居民取消
            //居民取消
            wlyyOutpatientDO.setPatientCancelRemark(cancelRemark);
            wlyyOutpatientDO.setPatientCancelRemark(cancelRemark);
            wlyyOutpatientDO.setPatientCancelType(cancelType);
            wlyyOutpatientDO.setPatientCancelType(cancelType);
            wlyyOutpatientDO.setPatientCancelValue(cancelValue);
            wlyyOutpatientDO.setPatientCancelValue(cancelValue);
            description = "居民取消";
        }else{
        }else{
            //医生拒绝接诊
            //医生拒绝接诊
            wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
            wlyyOutpatientDO.setDoctorCancelRemark(cancelRemark);
            wlyyOutpatientDO.setDoctorCancelType(cancelType);
            wlyyOutpatientDO.setDoctorCancelType(cancelType);
            wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
            wlyyOutpatientDO.setDoctorCancelValue(cancelValue);
            description = "医生拒绝接诊";
        }
        }
        outpatientDao.save(wlyyOutpatientDO);
        outpatientDao.save(wlyyOutpatientDO);
@ -3170,7 +3235,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(list!=null&&list.size()>0){
        if(list!=null&&list.size()>0){
            patientRegisterTimeDao.delete(list);
            patientRegisterTimeDao.delete(list);
        }
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
        try {
            if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                businessOrderService.orderRefund(wxId,wlyyOutpatientDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),description);
            }else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                businessOrderService.ylzOrderRefund(wxId,wlyyOutpatientDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),description);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        rs.put("code",1);
        rs.put("code",1);
        rs.put("mes","取消成功");
        rs.put("mes","取消成功");
        return  rs;
        return  rs;
@ -3323,14 +3398,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> findWaitingRoomPatient(String dept, Integer type) {
    public List<Map<String,Object>> findWaitingRoomPatient(String dept, Integer type) {
        
        
        String sql ="SELECT " +
        String sql ="SELECT " +
                "patient.id AS id," +
                "patient.name AS name," +
                "patient.sex AS sex," +
                "patient.idcard AS idcard," +
                "patient.photo AS photo," +
                "waitingroom.reservation_type AS type," +
                "waitingroom.consult_type AS consult_type," +
                "waitingroom.reservation_time AS reservation_time " +
                "patient.id AS \"id\"," +
                "patient.name AS \"name\"," +
                "patient.sex AS \"sex\"," +
                "patient.idcard AS \"idcard\"," +
                "patient.photo AS \"photo\"," +
                "waitingroom.reservation_type AS \"type\"," +
                "waitingroom.consult_type AS \"consult_type\"," +
                "waitingroom.reservation_time AS \"reservation_time\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room waitingroom," +
                "wlyy_hospital_waiting_room waitingroom," +
                "base_patient patient " +
                "base_patient patient " +
@ -3348,11 +3423,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return list;
        return list;
    }
    }
    
    
    public JSONObject findWaitingRoomStatusCount(String dept) {
    public JSONObject findWaitingRoomStatusCount(String dept,String wxId) {
        
        
        String totalSql = "SELECT count(id) AS total FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
        totalSql += " AND reservation_time >='"+DateUtil.dateToStrShort(new Date())+" 00:00:00'";
        totalSql += " AND reservation_time <='"+DateUtil.dateToStrShort(new Date())+" 23:59:59'";
        String totalSql = "SELECT count(id) AS \"total\" FROM wlyy_hospital_waiting_room WHERE visit_status=1 ";
        if("xm_ykyy_wx".equals(wxId)){
            totalSql +=" and reservation_time >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            totalSql +=" and reservation_time <= to_date('"+DateUtil.dateToStrShort(new Date())+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
        }else {
            totalSql += " AND reservation_time >='"+DateUtil.dateToStrShort(new Date())+" 00:00:00'";
            totalSql += " AND reservation_time <='"+DateUtil.dateToStrShort(new Date())+" 23:59:59'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
        if (rstotal != null && rstotal.size() > 0) {
@ -3369,7 +3449,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return result;
        return result;
    }
    }
    
    
    public List<JSONObject> findClinicRoomList(String dept,String date,String consult_status) {
    public List<JSONObject> findClinicRoomList(String dept,String date,String consult_status,String wxId) {
        if(StringUtils.isBlank(date)){
        if(StringUtils.isBlank(date)){
            date = DateUtil.getStringDateShort();
            date = DateUtil.getStringDateShort();
        }
        }
@ -3380,7 +3460,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNoneBlank(dept)){
        if(StringUtils.isNoneBlank(dept)){
            doctorsql = doctorsql + " and dept = '"+dept+"' ";
            doctorsql = doctorsql + " and dept = '"+dept+"' ";
        }
        }
        doctorsql = doctorsql+ " GROUP BY doctor";
        doctorsql = doctorsql+ " GROUP BY doctor,doctor_name,dept,dept_name";
    
    
        List<Map<String,Object>> doctorlist = jdbcTemplate.queryForList(doctorsql);
        List<Map<String,Object>> doctorlist = jdbcTemplate.queryForList(doctorsql);
    
    
@ -3408,24 +3488,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        }
        
        
        //获取预约了今天的候诊居民
        //获取预约了今天的候诊居民
        String waitingSql ="SELECT count(op.id) AS waitCount," +
                "room.doctor AS doctor, " +
                "room.doctor_name AS doctorName " +
        String waitingSql ="SELECT count(op.id) AS \"waitCount\"," +
                "room.doctor AS \"doctor\", " +
                "room.doctor_name AS \"doctorName\" " +
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
                "WHERE op.status=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "WHERE op.status=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "AND room.doctor IS NOT NULL ";
                "AND room.doctor IS NOT NULL ";
        if(StringUtils.isNoneBlank(dept)){
        if(StringUtils.isNoneBlank(dept)){
            waitingSql = waitingSql + " and op.dept = '"+dept+"' ";
            waitingSql = waitingSql + " and op.dept = '"+dept+"' ";
        }
        }
        waitingSql = waitingSql + "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor; ";
    
        if("xm_ykyy_wx".equals(wxId)){
            waitingSql +=" AND room.reservation_time >= to_date('"+date+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            waitingSql +=" AND room.reservation_time <= to_date('"+date+" 23:59:59','YYYY-MM-DD HH24:MI:SS') GROUP BY room.doctor,room.doctor_name";
        }else {
            waitingSql = waitingSql + "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor,room.doctor_name; ";
        }
        List<Map<String,Object>> waitinglist = jdbcTemplate.queryForList(waitingSql);
        List<Map<String,Object>> waitinglist = jdbcTemplate.queryForList(waitingSql);
        if(waitinglist!=null&&waitinglist.size()>0){
        if(waitinglist!=null&&waitinglist.size()>0){
            //根据身份证计算年龄
            //根据身份证计算年龄
            for(Map<String,Object> waitObj :waitinglist){
            for(Map<String,Object> waitObj :waitinglist){
                String doctor = (String) waitObj.get("doctor");
                String doctor = (String) waitObj.get("doctor");
                if(StringUtils.isNoneBlank(doctor)){
                if(StringUtils.isNoneBlank(doctor)){
                    Long waitCount = (Long) waitObj.get("waitCount");
                    Long waitCount = Long.parseLong(waitObj.get("waitCount").toString()) ;
                    if(result.keySet().contains(doctor)){
                    if(result.keySet().contains(doctor)){
                        result.get(doctor).put("waiting_count",waitCount);
                        result.get(doctor).put("waiting_count",waitCount);
                    }else{
                    }else{
@ -3448,18 +3534,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        
        
        //获取进行中的居民
        //获取进行中的居民
        String onlineSql ="SELECT " +
        String onlineSql ="SELECT " +
                "room.outpatient_id AS id," +
                "room.patient_id AS patient_id," +
                "room.patient_name AS patient_name," +
                "patient.sex AS sex," +
                "patient.idcard AS idcard," +
                "patient.photo AS photo," +
                "patient.birthday AS birthday," +
                "room.consult_type AS consult_type," +
                "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS time," +
                "TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS time_cost," +
                "room.doctor AS doctor, " +
                "room.doctor_name AS doctorName " +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
                "room.patient_name AS \"patient_name\"," +
                "patient.sex AS \"sex\"," +
                "patient.idcard AS \"idcard\"," +
                "patient.photo AS \"photo\"," +
                "patient.birthday AS \"birthday\"," +
                "room.consult_type AS \"consult_type\",";
        if("xm_ykyy_wx".equals(wxId)){
            onlineSql = onlineSql + "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",ceil((sysdate-to_date(to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'))* 24 * 60) AS \"time_cost\",";
        }else{
            onlineSql = onlineSql + "date_format(room.reservation_time,'%Y-%m-%d %H:%i:%S' )  AS \"time\",TIMESTAMPDIFF(MINUTE, room.reservation_time,NOW()) AS \"time_cost\",";
        }
                onlineSql=onlineSql+"room.doctor AS \"doctor\", " +
                "room.doctor_name AS \"doctorName\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
                "base_patient patient," +
                "base_patient patient," +
@ -3474,18 +3563,40 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNoneBlank(dept)){
        if(StringUtils.isNoneBlank(dept)){
            onlineSql = onlineSql + " and outpatient.dept = '"+dept+"' ";
            onlineSql = onlineSql + " and outpatient.dept = '"+dept+"' ";
        }
        }
/*
        onlineSql = onlineSql+ "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor";
        onlineSql = onlineSql+ "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' GROUP BY room.doctor";
        
*/
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            onlineSql +=" AND room.reservation_time >= to_date('"+date+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            onlineSql +=" AND room.reservation_time <= to_date('"+date+" 23:59:59','YYYY-MM-DD HH24:MI:SS') ";
        }else {
            onlineSql = onlineSql+ "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' ";
        }
        List<Map<String,Object>> onlinelist = jdbcTemplate.queryForList(onlineSql);
        List<Map<String,Object>> onlinelist = jdbcTemplate.queryForList(onlineSql);
        if(onlinelist!=null&&onlinelist.size()>0){
        if(onlinelist!=null&&onlinelist.size()>0){
            //根据身份证计算年龄
            //根据身份证计算年龄
            for(Map<String,Object> onlineObj :onlinelist){
            List<String> doctors = new ArrayList<>();
            List<Map<String,Object>> onlines = new ArrayList<>();
            for (Map<String,Object> onlineObj :onlinelist){
                String doctor = (String) onlineObj.get("doctor");
                if (doctors!=null&&doctors.size()!=0){
                    if (!doctors.contains(doctor)){
                        doctors.add(doctor);
                        onlines.add(onlineObj);
                    }
                }else {
                    doctors.add(doctor);
                    onlines.add(onlineObj);
                }
            }
            for(Map<String,Object> onlineObj :onlines){
                String doctor = (String) onlineObj.get("doctor");
                String doctor = (String) onlineObj.get("doctor");
                if(StringUtils.isNoneBlank(doctor)){
                if(StringUtils.isNoneBlank(doctor)){
                    if(result.keySet().contains(doctor)){
                    if(result.keySet().contains(doctor)){
                        result.get(doctor).put("visit_status",2);
                        result.get(doctor).put("visit_status",2);
                        result.get(doctor).put("patient_name",(String) onlineObj.get("patient_name"));
                        result.get(doctor).put("patient_name",(String) onlineObj.get("patient_name"));
                        result.get(doctor).put("time_cost",(Long) onlineObj.get("time_cost"));
                        result.get(doctor).put("time_cost",Long.parseLong(onlineObj.get("time_cost").toString()));
                    }else{
                    }else{
                        JSONObject jsonObject = new JSONObject();
                        JSONObject jsonObject = new JSONObject();
                        jsonObject.put("id",doctor);
                        jsonObject.put("id",doctor);
@ -3498,7 +3609,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        jsonObject.put("visit_status",2);
                        jsonObject.put("visit_status",2);
                        jsonObject.put("waiting_count",0);
                        jsonObject.put("waiting_count",0);
                        jsonObject.put("patient_name",(String) onlineObj.get("patient_name"));
                        jsonObject.put("patient_name",(String) onlineObj.get("patient_name"));
                        jsonObject.put("time_cost",(Long) onlineObj.get("time_cost"));
                        jsonObject.put("time_cost",Long.parseLong(onlineObj.get("time_cost").toString()));
                        result.put(doctor,jsonObject);
                        result.put(doctor,jsonObject);
                    }
                    }
                }
                }
@ -3592,7 +3703,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String patientid,String orgCode, String dept,
    public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String patientid,String orgCode, String dept,
                                                                          String diseaseKey, String doctorNameKey,
                                                                          String diseaseKey, String doctorNameKey,
                                                                          String jobTitleNameKey, String outpatientType,
                                                                          String jobTitleNameKey, String outpatientType,
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) {
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,String isAttention,Integer page,Integer pagesize) {
      /*  if(page >=1){
      /*  if(page >=1){
            page --;
            page --;
@ -3616,14 +3727,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.outpatient_type AS \"outpatientType\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " a.total AS \"consultTotal\"," +
                " h.org_name AS \"orgName\"," +
                " h.org_name AS \"orgName\"," +
                " follow.patient AS \"followid\"," +
                " h.org_code AS \"orgCode\"" +
                " h.org_code AS \"orgCode\"" +
                " FROM " +
                " FROM " +
                " base_doctor d " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
                " Left join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient='"+patientid+"'"+
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 2 GROUP BY doctor ) a on a.doctor = d.id ";
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 2 GROUP BY doctor ) a on a.doctor = d.id ";
        if ("1".equalsIgnoreCase(isAttention)){
            sql+=" join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='"+patientid+"' ";
        }
        if ("0".equalsIgnoreCase(isAttention)) {
            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
        }
        if(StringUtils.isNotBlank(diseaseKey)){
        if(StringUtils.isNotBlank(diseaseKey)){
            sql+=" left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
            sql+=" left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
        }
        }
@ -3965,12 +4080,58 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    }
    public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc){
    public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address,String photo,String mobile,String province,String provinceName,String city,String cityName){
        Map<String,Object> rs = new HashedMap();
        Map<String,Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        basePatientDO.setName(name);
        basePatientDO.setIdcard(idcard);
        if (StringUtils.isNoneBlank(name)){
            basePatientDO.setName(name);
        }
        if (StringUtils.isNoneBlank(idcard)){
            basePatientDO.setIdcard(idcard);
        }
        if (sex!=null){
            basePatientDO.setSex(sex);
        }
        if (StringUtils.isNoneBlank(province)){
            basePatientDO.setProvinceCode(province);
        }
        if (StringUtils.isNoneBlank(provinceName)){
            basePatientDO.setProvinceName(provinceName);
        }
        if (StringUtils.isNoneBlank(city)){
            basePatientDO.setCityCode(city);
        }
        if (StringUtils.isNoneBlank(cityName)){
            basePatientDO.setCityName(cityName);
        }
        if (StringUtils.isNoneBlank(townCode)){
            basePatientDO.setTownCode(townCode);
        }
        if (StringUtils.isNoneBlank(townName)){
            basePatientDO.setTownName(townName);
        }
        if (StringUtils.isNoneBlank(committeeCode)){
            basePatientDO.setCommitteeCode(committeeCode);
        }
        if (StringUtils.isNoneBlank(committeeName)){
            basePatientDO.setCommitteeName(committeeName);
        }
        if (StringUtils.isNoneBlank(address)){
            basePatientDO.setAddress(address);
        }
        if (StringUtils.isNoneBlank(photo)){
            basePatientDO.setPhoto(photo);
        }
        if (StringUtils.isNoneBlank(mobile)){
            basePatientDO.setMobile(mobile);
        }
        basePatientDO = basePatientDao.save(basePatientDO);
        basePatientDO = basePatientDao.save(basePatientDO);
        if (patientMedicareCardDO!=null){
        if (patientMedicareCardDO!=null){
            patientMedicareCardDO.setCode(ssc);
            patientMedicareCardDO.setCode(ssc);
@ -4285,7 +4446,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    
        Long videoOnlineCount = 0l;
        Long videoOnlineCount = 0l;
        if (rstotal != null && rstotal.size() > 0) {
        if (rstotal != null && rstotal.size() > 0) {
            videoOnlineCount = (Long) rstotal.get(0).get("total");
            videoOnlineCount = Long.parseLong(rstotal.get(0).get("total").toString()) ;
        }
        }
    
    
        return videoOnlineCount;
        return videoOnlineCount;
@ -4396,9 +4557,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param type 1图文 2视频
     * @param type 1图文 2视频
     * @return
     * @return
     */
     */
    public Long getWaitVideoCount(String doctor,String type,String outpatient_type) {
    public Long getWaitVideoCount(String doctor,String type,String outpatient_type,String wxId) {
        String sql ="SELECT " +
        String sql ="SELECT " +
                "count(outpatient.id) AS total " +
                "count(outpatient.id) AS \"total\" " +
                "FROM " +
                "FROM " +
                "wlyy_outpatient outpatient," +
                "wlyy_outpatient outpatient," +
                "base_patient patient " +
                "base_patient patient " +
@ -4411,11 +4572,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if("1".equals(outpatient_type)){//复诊
        if("1".equals(outpatient_type)){//复诊
            sql =  sql + " AND outpatient.type= '"+type+"' ";
            sql =  sql + " AND outpatient.type= '"+type+"' ";
            if("2".equals(type)){//视频复诊才需要判断时间,
            if("2".equals(type)){//视频复诊才需要判断时间,
                sql =  sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
                if("xm_ykyy_wx".equals(wxId)){
                    sql +=" AND outpatient.register_date is not null and outpatient.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql =  sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
                }
            }
            }
        }else if("2".equals(outpatient_type)){
        }else if("2".equals(outpatient_type)){
            //协同门诊也需要判断时间
            //协同门诊也需要判断时间
            sql =  sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
            if("xm_ykyy_wx".equals(wxId)){
                sql +=" AND outpatient.register_date is not null and outpatient.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql =  sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
            }
        }
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
    
    
@ -4527,9 +4696,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if("1".equals(outpatient.getType())){
                if("1".equals(outpatient.getType())){
                    systemMessageDO.setTitle("图文复诊");
                    systemMessageDO.setTitle("图文复诊");
                    systemMessageDO.setType("1");
                    systemMessageDO.setType("1");
                    saveInquirySystemMessage(outpatient);
                }else {
                }else {
                    systemMessageDO.setTitle("视频复诊");
                    systemMessageDO.setTitle("视频复诊预约成功");
                    systemMessageDO.setType("2");
                    systemMessageDO.setType("2");
                    saveInquirySystemMessage(outpatient);
                }
                }
            }
            }
            systemMessageDO.setReceiver(outpatient.getDoctor());
            systemMessageDO.setReceiver(outpatient.getDoctor());
@ -4544,6 +4715,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("question",outpatient.getDescription());
            data.put("question",outpatient.getDescription());
            String msg="您的视频复诊已预约成功。\n" +
                    "预计"+outpatient.getDoctorName()+"医生将于"+outpatient.getRegisterDate()+" 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
            data.put("msg",msg);
            systemMessageDO.setData(data.toString());
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
            systemMessageService.saveMessage(systemMessageDO);
@ -4555,6 +4729,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return systemMessageDO;
        return systemMessageDO;
    }
    }
    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient){
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        String msg="";
        String type="";
        if("1".equals(outpatient.getType())){
            type="9";
            msg=outpatient.getPatientName()+",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        }else {
            type="16";
            msg=outpatient.getPatientName()+",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        }
        systemMessageDO.setTitle("支付提醒");
        systemMessageDO.setType("11");
        systemMessageDO.setSender(outpatient.getDoctor());
        systemMessageDO.setSenderName(outpatient.getDoctorName());
        systemMessageDO.setRelationCode(outpatient.getId());
        systemMessageDO.setReceiver(outpatient.getPatient());
        systemMessageDO.setReceiverName(outpatient.getPatientName());
        JSONObject data = new JSONObject();
        try {
            data.put("name",outpatient.getPatientName());
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("question",outpatient.getDescription());
            data.put("msg",msg);
            data.put("type",type);
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
    /**
     * 指定门诊医生医生
     * 指定门诊医生医生
     * @param outpatientJson
     * @param outpatientJson
@ -4716,7 +4927,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param status
     * @param status
     * @return
     * @return
     */
     */
    public Envelop findByGeneralDoctor(String generalDoctor,String startDate,String endDate,String status,String sort,Integer page,Integer size){
    public Envelop findByGeneralDoctor(String generalDoctor,String startDate,String endDate,String status,String sort,Integer page,Integer size,String wxId){
        String sqlTotal ="SELECT " +
        String sqlTotal ="SELECT " +
                " count(1) AS total "+
                " count(1) AS total "+
@ -4725,10 +4936,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " WHERE " +
                " WHERE " +
                " o.general_doctor = '"+generalDoctor+"'";
                " o.general_doctor = '"+generalDoctor+"'";
        if(StringUtils.isNotBlank(startDate)){
        if(StringUtils.isNotBlank(startDate)){
            sqlTotal += " AND o.register_date >='"+startDate+" 00:00:00' ";
            if("xm_ykyy_wx".equals(wxId)){
                sqlTotal +=" and o.register_date >= to_date('"+startDate+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sqlTotal += " AND o.register_date >='"+startDate+" 00:00:00' ";
            }
        }
        }
        if(StringUtils.isNotBlank(endDate)){
        if(StringUtils.isNotBlank(endDate)){
            sqlTotal += " AND o.register_date <='"+endDate+" 23:59:59' ";
            if("xm_ykyy_wx".equals(wxId)){
                sqlTotal +=" and o.register_date <= to_date('"+endDate+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sqlTotal += " AND o.register_date <='"+endDate+" 23:59:59' ";
            }
        }
        }
        if(StringUtils.isNotBlank(status)){
        if(StringUtils.isNotBlank(status)){
            sqlTotal += " AND o.status ='"+status+"'";
            sqlTotal += " AND o.status ='"+status+"'";
@ -4738,66 +4959,74 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Long total = 0l;
        Long total = 0l;
        if (rstotal != null && rstotal.size() > 0) {
        if (rstotal != null && rstotal.size() > 0) {
            total = (Long) rstotal.get(0).get("total");
            total = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        }
        String sql ="SELECT " +
        String sql ="SELECT " +
                " o.id AS id, " +
                " o.adm_no AS admNo, " +
                " o.origin_adm_no AS originAdmNo, " +
                " o.register_no AS registerNo, " +
                " o.origin_register_no AS originRegisterNo, " +
                " o.origin_con_no AS originConNo, " +
                " o.con_no AS conNo, " +
                " o.outpatient_type AS outpatientType, " +
                " o.type AS type, " +
                " o.hospital AS hospital, " +
                " o.hospital_name AS hospitalName, " +
                " o.win_no AS winNo, " +
                " o.dept AS dept, " +
                " o.dept_name AS deptName, " +
                " o.patient AS patient, " +
                " o.patient_name AS patientName, " +
                " o.doctor AS doctor, " +
                " o.doctor_name AS doctorName, " +
                " o.general_doctor AS generalDoctor, " +
                " o.general_doctor_name AS generalDoctorName, " +
                " o.idcard AS idcard, " +
                " o.card_no AS cardNo, " +
                " o.mjz AS mjz, " +
                " o.icd10 AS icd10, "+
                " o.icd10_name AS icd10Name, " +
                " o.advice AS advice, " +
                " o.adm_date AS admDate, " +
                " o.description AS description, " +
                " o.disease_img AS diseaseImg, " +
                " o.create_time AS createTime, " +
                " o.con_date AS conDate, " +
                " o.patient_cancel_type AS patientCancelType, " +
                " o.patient_cancel_value AS patientCancelValue, " +
                " o.patient_cancel_remark AS patientCancelRemark, " +
                " o.register_date AS registerDate, " +
                " o.`status` AS STATUS, " +
                " o.evaluate_status AS evaluateStatus " +
                " o.id AS \"id\", " +
                " o.adm_no AS \"admNo\", " +
                " o.origin_adm_no AS \"originAdmNo\", " +
                " o.register_no AS \"registerNo\", " +
                " o.origin_register_no AS \"originRegisterNo\", " +
                " o.origin_con_no AS \"originConNo\", " +
                " o.con_no AS \"conNo\", " +
                " o.outpatient_type AS \"outpatientType\", " +
                " o.type AS \"type\", " +
                " o.hospital AS \"hospital\", " +
                " o.hospital_name AS \"hospitalName\", " +
                " o.win_no AS \"winNo\", " +
                " o.dept AS \"dept\", " +
                " o.dept_name AS \"deptName\", " +
                " o.patient AS \"patient\", " +
                " o.patient_name AS \"patientName\", " +
                " o.doctor AS \"doctor\", " +
                " o.doctor_name AS \"doctorName\", " +
                " o.general_doctor AS \"generalDoctor\", " +
                " o.general_doctor_name AS \"generalDoctorName\", " +
                " o.idcard AS \"idcard\", " +
                " o.card_no AS \"cardNo\", " +
                " o.mjz AS \"mjz\", " +
                " o.icd10 AS \"icd10\", "+
                " o.icd10_name AS \"icd10Name\", " +
                " o.advice AS \"advice\", " +
                " o.adm_date AS \"admDate\", " +
                " o.description AS \"description\", " +
                " o.disease_img AS \"diseaseImg\", " +
                " o.create_time AS \"createTime\", " +
                " o.con_date AS \"conDate\", " +
                " o.patient_cancel_type AS \"patientCancelType\", " +
                " o.patient_cancel_value AS \"patientCancelValue\", " +
                " o.patient_cancel_remark AS \"patientCancelRemark\", " +
                " o.register_date AS \"registerDate\", " +
                " o.status AS \"STATUS\", " +
                " o.evaluate_status AS \"evaluateStatus\" " +
                " FROM " +
                " FROM " +
                " wlyy_outpatient o " +
                " wlyy_outpatient o " +
                " WHERE " +
                " WHERE " +
                " o.general_doctor = '"+generalDoctor+"'";
                " o.general_doctor = '"+generalDoctor+"'";
        if(StringUtils.isNotBlank(startDate)){
        if(StringUtils.isNotBlank(startDate)){
            sql+=" AND o.register_date >='"+startDate+" 00:00:00'";
            if("xm_ykyy_wx".equals(wxId)){
                sql +=" and o.register_date >= to_date('"+startDate+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql += " AND o.register_date >='"+startDate+" 00:00:00' ";
            }
        }
        }
        if(StringUtils.isNotBlank(endDate)){
        if(StringUtils.isNotBlank(endDate)){
            sql+=" AND o.register_date <='"+endDate+" 23:59:59'";
            if("xm_ykyy_wx".equals(wxId)){
                sql +=" and o.register_date <= to_date('"+endDate+" 23:59:59','YYYY-MM-DD HH24:MI:SS')";
            }else {
                sql += " AND o.register_date <='"+endDate+" 23:59:59' ";
            }
        }
        }
        if(StringUtils.isNotBlank(status)){
        if(StringUtils.isNotBlank(status)){
            sql+=" AND o.status ='"+status+"'";
            sql+=" AND o.status ='"+status+"'";
        }
        }
        if(StringUtils.isNotBlank(sort)){
        if(StringUtils.isNotBlank(sort)){
            sql += " ORDER BY o.register_date "+sort+" LIMIT " + (page - 1) * size + "," + size + "";
            sql += " ORDER BY o.register_date "+sort;
        }else{
        }else{
            sql += " ORDER BY o.register_date ASC LIMIT " + (page - 1) * size + "," + size + "";
            sql += " ORDER BY o.register_date ASC ";
        }
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,size);
        //List<WlyyOutpatientDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientDO.class));
        //List<WlyyOutpatientDO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientDO.class));
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, total);
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, total);
    }
    }
@ -4835,7 +5064,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //统计科预约医生
        //统计科预约医生
        String sql = "SELECT " +
        String sql = "SELECT " +
                " COUNT(1) AS total " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " FROM " +
                " base_doctor d " +
                " base_doctor d " +
                " JOIN base_doctor_role r ON d.id = r.doctor_code " +
                " JOIN base_doctor_role r ON d.id = r.doctor_code " +
@ -4854,7 +5083,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //统计在线医生
        //统计在线医生
        String onlineSql="SELECT " +
        String onlineSql="SELECT " +
                " COUNT(1) AS total " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " FROM " +
                " base_doctor d " +
                " base_doctor d " +
                " JOIN base_doctor_role r ON d.id = r.doctor_code " +
                " JOIN base_doctor_role r ON d.id = r.doctor_code " +
@ -4867,7 +5096,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Long onlineTotal = 0l;
        Long onlineTotal = 0l;
        if (oltotal != null && oltotal.size() > 0) {
        if (oltotal != null && oltotal.size() > 0) {
            onlineTotal = (Long) oltotal.get(0).get("total");
            onlineTotal = Long.parseLong(oltotal.get(0).get("total").toString());
        }
        }
        rs.put("onlineTotal",onlineTotal);
        rs.put("onlineTotal",onlineTotal);
@ -4888,7 +5117,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    
        //总数
        //总数
        String sqlAll = "SELECT " +
        String sqlAll = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                " COUNT(room.outpatient_id) AS \"total\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "wlyy_outpatient outpatient " +
@ -4907,7 +5136,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    
        //图文复诊
        //图文复诊
        String imgAll = "SELECT " +
        String imgAll = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                " COUNT(room.outpatient_id) AS \"total\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "wlyy_outpatient outpatient " +
@ -4926,7 +5155,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    
        //视频复诊
        //视频复诊
        String spsql = "SELECT " +
        String spsql = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                " COUNT(room.outpatient_id) AS \"total\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "wlyy_outpatient outpatient " +
@ -4946,7 +5175,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        
        
        //协同门诊
        //协同门诊
        String xtsql = "SELECT " +
        String xtsql = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                " COUNT(room.outpatient_id) AS \"total\" " +
                "FROM " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "wlyy_outpatient outpatient " +
@ -5469,11 +5698,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (status==2){
        if (status==2){
            /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
            /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
            logger.info("开始====="+wlyyPrescriptionDO.getCheckStatus());
            logger.info("开始====="+wlyyPrescriptionDO.getCheckStatus());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                try {
                try {
                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
                    /*List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                    DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                    DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                    //his处方拼接开方条件
                    //his处方拼接开方条件
@ -5482,12 +5711,37 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        //设置his药品查询条件
                        //设置his药品查询条件
                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, info, outpatientDO.getIcd10());
                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, info, outpatientDO.getIcd10());
                    }
                    }
                    for (WlyyInspectionDO ins:inspectionDOS){
                    for (WlyyInspectionDO ins:inspectionDOS){
                        //设置his药品查询条件
                        //设置his药品查询条件
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
                    }
                    }
                    sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                    Map<String,Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                    if (map.get("code").toString().equalsIgnoreCase("0")){*/
                        //  * @param applyDepaName @param applyDoctorName
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
                        String patientCode = prescriptionDO.getPatientCode();
                        String realerOrder = prescriptionDO.getRealOrder();
                        String free  = prescriptionDO.getDrugFee()+"";
                        String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(),"yyyyMMddHHmmss");
                        String applyDepaName = prescriptionDO.getDeptName();
                        String applyDoctorName = prescriptionDO.getDoctorName();
                        BasePatientDO patientDO = basePatientDao.findById(patientCode);
                        String userName = null;
                        String idcard = null;
                        if (patientDO!=null){
                            userName = patientDO.getName();
                            idcard = patientDO.getIdcard();
                        }
                        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientCode);
                        String userNo = null;
                        if (patientMappingDO!=null){
                            userNo = patientMappingDO.getMappingCode();
                        }
                        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientCode,"1");
                        ylzPayService.msgPush("01",patientMedicareCardDO.getCode(),"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
                /*    }*/
                    //sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                } catch (Exception e) {
                } catch (Exception e) {
                    e.printStackTrace();
                    e.printStackTrace();
                }
                }
@ -5496,6 +5750,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyPrescriptionDO.setCheckStatus(2);
            wlyyPrescriptionDO.setCheckStatus(2);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(20);
            wlyyPrescriptionDO.setStatus(20);
            //发送系统消息 处方支付提醒
            SystemMessageDO messageDO = new SystemMessageDO();
            messageDO.setType("6");
            messageDO.setTitle("处方支付提醒");
            messageDO.setSender(outpatientDO.getDoctor());
            messageDO.setSenderName(outpatientDO.getDoctorName());
            messageDO.setRelationCode(outpatientDO.getId()+","+wlyyPrescriptionDO.getId());
            messageDO.setReceiver(outpatientDO.getPatient());
            messageDO.setReceiverName(outpatientDO.getPatientName());
            try {
                JSONObject data = new JSONObject();
                data.put("name",outpatientDO.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatientDO.getIdcard()));
                data.put("gender",IdCardUtil.getSexForIdcard_new(outpatientDO.getIdcard()));
                data.put("question","");
                String msg=outpatientDO.getPatientName()+",您好!医生已为您开具处方,请及时支付。如您已支付请忽略本条信息。";
                data.put("msg",msg);
                messageDO.setData(data.toString());
                systemMessageService.saveMessage(messageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }else{
        }else{
            wlyyPrescriptionDO.setCheckStatus(status);
            wlyyPrescriptionDO.setCheckStatus(status);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setCheckReason(reason);
@ -5505,6 +5784,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (status==2||status==1){
        if (status==2||status==1){
            sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName);
            sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName);
        }
        }
        return prescriptionCheckDO;
        return prescriptionCheckDO;
    }
    }
@ -5762,7 +6043,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
    /**
     * 保存排班规则
     * 保存排班规则
     * @param workRoleJsons
     * @param advicesJson
     * @return
     * @return
     */
     */
    public Boolean sendOutPatientSuggest(String advicesJson){
    public Boolean sendOutPatientSuggest(String advicesJson){
@ -5804,6 +6085,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                params);
                params);
        logger.info("调用电子病历查询接口请求成功,返回值xmlstr:" + returnValue);
        logger.info("调用电子病历查询接口请求成功,返回值xmlstr:" + returnValue);
        XMLSerializer xmlSerializer = new XMLSerializer();
        net.sf.json.JSON json = xmlSerializer.read(returnValue);
        logger.info("返回json"+json);
        Object retInfo=  ((JSONObject) json).get("HtResponse");
        logger.info("retInfo:"+retInfo);
        if(retInfo!=null){
            JSONObject jsonObject = (JSONObject)retInfo;
            String content =jsonObject.getString("XML_CONT");
            Document doc = Jsoup.parse(content);
            Elements rows = doc.select("table[class=list]").get(0).select("tr");
        }
        return returnValue;
        return returnValue;
    }
    }
@ -5841,4 +6134,277 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 关注医生
     * @param doctorId
     * @return
     */
//    public Envelop attentionDoctor(String doctorId){
//        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
//        if (doctorDO==null){
//            return Envelop.getError("医生不存在");
//        }
//        BaseDoctorPatientDO doctorPatientDO = new BaseDoctorPatientDO();
//        doctorPatientDO.setDoctorCode(doctorId);
//        doctorPatientDO.setDoctorName(doctorDO.getName());
//        String uid = userAgent.getUID();
//        BasePatientDO patientDO = basePatientDao.findById(uid);
//        if (patientDO==null){
//            return ObjEnvelop.getError("患者不存在");
//        }
//        doctorPatientDO.setPatientCode(uid);
//        doctorPatientDO.setPatientName(patientDO.getName());
//        doctorPatientDO.setStatus(1);
//        baseDoctorPatientDao.save(doctorPatientDO);
//        return ObjEnvelop.getSuccess("关注成功");
//    }
    /**
     *查询患者关注的医生
     * @param keyWord
     * @param outPatient
     * @param jobTitleCode
     * @param shift
     * @param page
     * @param pagesize
     * @return
     */
//    public PageEnvelop findAllAttentionDoctor(String keyWord, Integer outPatient, String jobTitleCode, Integer shift, Integer page, Integer pagesize) {
//        StringBuffer sql = new StringBuffer("SELECT DISTINCT\n" +
//                "\tc.*, e.org_name,\n" +
//                "\te.dept_name,\n" +
//                "\tIFNULL(k.disease_name,NULL)\n" +
//                "\tdisease_name\n" +
//                "FROM\n" +
//                "\tbase_doctor c\n" +
//                "RIGHT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\tdoctor_code\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_paitent\n" +
//                "\tWHERE\n" + " patient_code = '"+userAgent.getUID()+"'\n" +
//                " ) d ON c.id = d.doctor_code\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\twlyy_doctor_special_disease\n" +
//                ") k ON k.doctor_code = c.id\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_hospital\n" +
//                ") e ON e.doctor_code = c.id");
//        StringBuffer countSql = new StringBuffer("SELECT DISTINCT\n" +
//                "\tc.*, e.org_name,\n" +
//                "\te.dept_name,\n" +
//                "\tk.disease_name\n" +
//                "FROM\n" +
//                "\tbase_doctor c\n" +
//                "RIGHT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\tdoctor_code\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_paitent\n" +
//                "\tWHERE\n" + " patient_code = '"+userAgent.getUID()+"'\n" +
//                " ) d ON c.id = d.doctor_code\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\twlyy_doctor_special_disease\n" +
//                ") k ON k.doctor_code = c.id\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_hospital\n" +
//                ") e ON e.doctor_code = c.id");
//
//        if (shift==1){
//            sql.append(" JOIN (\n" +
//                    "\tSELECT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\tbase_doctor_hospital\n" +
//                    "\tWHERE\n" +
//                    "\t\tdept_name = '发热门诊'\n" +
//                    ") h ON h.doctor_code = c.id ");
//            countSql.append(" JOIN (\n" +
//                    "\tSELECT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\tbase_doctor_hospital\n" +
//                    "\tWHERE\n" +
//                    "\t\tdept_name = '发热门诊'\n" +
//                    ") h ON h.doctor_code = c.id ");
//        }
//        if (StringUtils.isNotEmpty(jobTitleCode)){
//            sql.append(" AND c.job_title_code =").append(jobTitleCode);
//            countSql.append(" AND c.job_title_code =").append(jobTitleCode);
//        }
//        if (outPatient==1){
//            sql.append(" JOIN (\n" +
//                    "\tSELECT DISTINCT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\twlyy_doctor_work_time\n" +
//                    "\tGROUP BY\n" +
//                    "\t\tdoctor\n" +
//                    ") f ON f.doctor = c.id");
//            countSql.append(" JOIN (\n" +
//                    "\tSELECT DISTINCT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\twlyy_doctor_work_time\n" +
//                    "\tGROUP BY\n" +
//                    "\t\tdoctor\n" +
//                    ") f ON f.doctor = c.id");
//        }
//        if(StringUtils.isNotEmpty(keyWord)){
//            sql.append(" WHERE\n" +
//                    "\t(\n" +
//                    " c.`name` LIKE  '%"+keyWord+"%'" +
//                    " OR e.dept_name LIKE '%"+keyWord+"%' " +
//                    " OR e.org_name LIKE  '%"+keyWord+"%'" +
//                    " OR c.expertise LIKE  '%"+keyWord+"%'" +
//                    " OR c.introduce LIKE  '%"+keyWord+"%'" +
//                    " OR k.disease_name LIKE  '%"+keyWord+"%'" +
//                    ") ");
//            countSql.append(" WHERE\n" +
//                    "\t(\n" +
//                    " c.`name` LIKE  '%"+keyWord+"%'" +
//                    " OR e.dept_name LIKE '%"+keyWord+"%' " +
//                    " OR e.org_name LIKE  '%"+keyWord+"%'" +
//                    " OR c.expertise LIKE  '%"+keyWord+"%'" +
//                    " OR c.introduce LIKE  '%"+keyWord+"%'" +
//                    " OR k.disease_name LIKE  '%"+keyWord+"%'" +
//                    ") ");
//        }
//        countSql.append(" GROUP BY c.id");
//        List<Map<String, Object>> countList = jdbcTemplate.queryForList(countSql.toString());
//        long count=countList.size();
//
//        sql.append(" ORDER BY C.update_time LIMIT ").append((page-1)*pagesize).append(",").append(pagesize);
//
//        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql.toString());
//        List<BaseDoctorVO> list = new ArrayList<>();
//
//        mapList.forEach(one->{
//            String json = com.alibaba.fastjson.JSONObject.toJSONString(one);
//            BaseDoctorDO doctorDO = com.alibaba.fastjson.JSONObject.parseObject(json, BaseDoctorDO.class);
//            BaseDoctorVO doctorVO = convertToModel(doctorDO, BaseDoctorVO.class);
//            if (one.get("org_name")!=null&&StringUtils.isNotEmpty(one.get("org_name").toString())){
//                doctorVO.setHospital(one.get("org_name").toString());
//            }
//            if(one.get("dept_name")!=null&&StringUtils.isNotEmpty(one.get("dept_name").toString())){
//                ArrayList<String> deptList = new ArrayList<>();
//                deptList.add(one.get("dept_name").toString());
//                doctorVO.setDepartment(deptList);
//            }
//            if (one.get("disease_name")!=null&&StringUtils.isNotEmpty(one.get("disease_name").toString())){
//                ArrayList<String> disList = new ArrayList<>();
//                disList.add(one.get("disease_name").toString());
//                doctorVO.setDisease(disList);
//            }
//
//            if (list!=null&&list.size()>0){
//                list.forEach(tow->{
//                    if (doctorVO.getId().equalsIgnoreCase(tow.getId())){
//                        if (tow.getDepartment()!=null&&StringUtils.isNotEmpty(tow.getDepartment().get(0))){
//                            doctorVO.getDepartment().add(tow.getDepartment().get(0));
//                        }
//                        if (tow.getDisease()!=null&&StringUtils.isNotEmpty(tow.getDisease().get(0))){
//                            doctorVO.getDisease().add(tow.getDisease().get(0));
//                        }
//                        list.remove(tow);
//                    }
//                });
//            }
//
//            list.add(doctorVO);
//        });
//
//
//
//        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,pagesize,count);
//    }
    /**
     * 查询患者所有处方信息
     * @param page
     * @param size
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) {
        String uid = userAgent.getUID();
        StringBuffer sql = new StringBuffer("select a.* from wlyy_prescription a,wlyy_prescription_info b where a.patient_code ='");
        StringBuffer countSql = new StringBuffer("select COUNT(a.id) count from wlyy_prescription a,wlyy_prescription_info b  where a.patient_code ='");
        sql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id");
        countSql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id ");
        if (StringUtils.isNotEmpty(keyName)){
            sql.append(" AND (" +
                    " a.doctor_name LIKE '%"+keyName+"%' " +
                    " OR a.dept_name LIKE'%"+keyName+"%' " +
                    " OR a.hospital_name LIKE '%"+keyName+"%' " +
                    " OR b.drug_name LIKE '%"+keyName+"%' " +
                    " OR a.real_order LIKE '%"+keyName+"%' " +
                    ")");
            countSql.append(" AND (" +
                    " a.doctor_name LIKE '%"+keyName+"%' " +
                    " OR a.dept_name LIKE'%"+keyName+"%' " +
                    " OR a.hospital_name LIKE '%"+keyName+"%' " +
                    " OR b.drug_name LIKE '%"+keyName+"%' " +
                    " OR a.real_order LIKE '%"+keyName+"%' " +
                    ")");
        }
        if (StringUtils.isNotEmpty(status)){
            status= status.substring(1, status.length() - 1);
            sql.append(" AND a.status IN(").append(status).append(")");
            countSql.append(" AND a.status IN(").append(status).append(")");
        }
        sql.append(" order by a.prescribe_time limit ").append((page-1)*size).append(",").append(size);
        List<WlyyPrescriptionDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());
        logger.info("sql="+sql.toString());
        logger.info("countSql="+countSql.toString());
        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,size,count);
    }
    /**
     * 查询取药地址
     * @param outpatientId
     * @param longitude
     * @param dimension
     * @return
     */
    public MixEnvelop findDrugAddress(String outpatientId, String longitude, String dimension) {
        String sql="SELECT\n" +
                "\ta.*\n" +
                "FROM\n" +
                "\tbase_org a\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tc.*\n" +
                "\tFROM\n" +
                "\t\twlyy_prescription_expressage c\n" +
                "\tWHERE\n" +
                " c.outpatient_id = '"+outpatientId+"'" +
                " ) d ON a.`code` = d.hospital_code";
        BaseOrgDO baseOrgDO = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BaseOrgDO.class)).get(0);
        Map<String, String> rs = new HashMap<>();
        rs.put("hospital",baseOrgDO.getName());
        rs.put("address",baseOrgDO.getAddress());
        String distance = LatitudeUtils.getDistance(longitude, dimension, baseOrgDO.getLongitude(), baseOrgDO.getLatitude());
        rs.put("distance",distance);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,rs);
    }
}
}

+ 12 - 8
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java

@ -118,14 +118,18 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        }
        }
        String doctorFlag =  doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode();
        String doctorFlag =  doctorMappingDO.getDoctorName()+"/"+doctorMappingDO.getMappingCode();
        JSONArray response =  xzzxEntranceService.registeredOperate(doctorFlag,outpatientDO.getDept(),patientMappingDO.getMappingCode(),doctorDO.getChargeType());
        JSONObject res = response.getJSONObject(0);
        logger.info("挂号结果 res: " + response.toString());
        String rsCode = res.getString("registerNo");
        JSONObject res =  xzzxEntranceService.registeredOperate(doctorFlag,outpatientDO.getDept(),patientMappingDO.getMappingCode(),doctorDO.getChargeType());
        logger.info("挂号结果 res: " + res.toString());
        JSONObject object = res.getJSONObject("returnContents");
        String rsCode = "";
        if (object!=null){
        if ("0".equals(rsCode)) {
        }
        rsCode = object.getString("registerNo");
        if (StringUtils.isNoneBlank(rsCode)) {
            //存储挂号号
            //存储挂号号
            String serialNo = (String) res.get("registerNo");
            String serialNo = object.getString("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: ");
            logger.info("挂号流水 registerNo: ");
@ -178,9 +182,9 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        log.setName("挂号");
        log.setName("挂号");
        log.setPatient(outpatientDO.getPatient());
        log.setPatient(outpatientDO.getPatient());
        log.setDoctor(doctor);
        log.setDoctor(doctor);
        log.setResponse(response.toString());
        log.setResponse(res.toString());
        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
        log.setStatus(rsCode);
        log.setStatus("1");
        log.setCreateTime(new Date());
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        wlyyHttpLogDao.save(log);
        return res;
        return res;

+ 13 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
@ -26,6 +27,7 @@ import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.wx.WeChatConfig;
@ -33,6 +35,10 @@ import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
@ -42,6 +48,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import java.lang.Boolean;
import java.lang.Boolean;
@ -83,6 +90,9 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private BasePatientWechatDao patientWechatDao;
    private BasePatientWechatDao patientWechatDao;
    @Autowired
    @Autowired
    private BusinessOrderService businessOrderService;
    private BusinessOrderService businessOrderService;
    @Autowired
    private BaseUserAgent userAgent;
    @Value("${demo.flag}")
    @Value("${demo.flag}")
@ -307,7 +317,8 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            object.put("charge_code",map.get("ypdm"));
            object.put("charge_code",map.get("ypdm"));
            object.put("drugname",map.get("ypmc"));
            object.put("drugname",map.get("ypmc"));
            object.put("specification",map.get("yfgg"));
            object.put("specification",map.get("yfgg"));
            object.put("pack_unit_name",map.get("yfdw"));
            object.put("pack_unit_name",map.get("jldw"));
            object.put("yfdw",map.get("yfdw"));
            object.put("pack_size",map.get("yfbz"));
            object.put("pack_size",map.get("yfbz"));
            object.put("yfsx",map.get("yfsx"));//药房属性
            object.put("yfsx",map.get("yfsx"));//药房属性
            object.put("ypjl",map.get("ypjl"));//药剂量
            object.put("ypjl",map.get("ypjl"));//药剂量
@ -363,6 +374,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            JSONObject object = new JSONObject();
            JSONObject object = new JSONObject();
            object.put("FREQ_CODE",map.get("pcmc"));
            object.put("FREQ_CODE",map.get("pcmc"));
            object.put("FREQ_NAME",map.get("pcmc1"));
            object.put("FREQ_NAME",map.get("pcmc1"));
            object.put("MRSC",map.get("mrcs"));
            array.add(object);
            array.add(object);
        }
        }
        return array;
        return array;

+ 7 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -1772,7 +1772,10 @@ public class EntranceService {
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            if (null != jsonObjectMgsInfo) {
            if (null != jsonObjectMgsInfo) {
                for (Object object : jsonObjectMgsInfo) {
                for (Object object : jsonObjectMgsInfo) {
                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    JSONArray jsonArray = JSONArray.fromObject(object);
                    net.sf.json.JSONObject jsonArraySub = jsonArray.getJSONObject(0);
//                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    jsonObjectMgsInfo = (JSONArray) jsonArraySub.get("body");
                    jsonObjectMgsInfo = (JSONArray) jsonArraySub.get("body");
                    if (jsonObjectMgsInfo instanceof JSONArray) {
                    if (jsonObjectMgsInfo instanceof JSONArray) {
                        for (Object objectSub : jsonObjectMgsInfo) {
                        for (Object objectSub : jsonObjectMgsInfo) {
@ -2332,7 +2335,9 @@ public class EntranceService {
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            if (null != jsonObjectMgsInfo) {
            if (null != jsonObjectMgsInfo) {
                for (Object object : jsonObjectMgsInfo) {
                for (Object object : jsonObjectMgsInfo) {
                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    JSONArray jsonArray = JSONArray.fromObject(object);
                    net.sf.json.JSONObject jsonArraySub = jsonArray.getJSONObject(0);
//                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    jsonObjectMgsInfo = (JSONArray) jsonArraySub.get("body");
                    jsonObjectMgsInfo = (JSONArray) jsonArraySub.get("body");
                    if (jsonObjectMgsInfo instanceof JSONArray) {
                    if (jsonObjectMgsInfo instanceof JSONArray) {
                        for (Object objectSub : jsonObjectMgsInfo) {
                        for (Object objectSub : jsonObjectMgsInfo) {

+ 7 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -876,6 +876,7 @@ public class XzzxEntranceService{
                "   <certificate>"+key+"</certificate> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
                "</root>";
        String condition ="";
        String condition ="";
        logger.info("clinicclass:"+clinicclass);
        if (!StringUtils.isEmpty(doctor)&&!doctor.equalsIgnoreCase("null")){
        if (!StringUtils.isEmpty(doctor)&&!doctor.equalsIgnoreCase("null")){
            condition += "<doctor>"+doctor+"</doctor>";
            condition += "<doctor>"+doctor+"</doctor>";
        }
        }
@ -1492,17 +1493,18 @@ public class XzzxEntranceService{
     * @param clinicclass 挂号类别(必填)
     * @param clinicclass 挂号类别(必填)
     * @return
     * @return
     */
     */
    public JSONArray registeredOperate(String doctor,String dept,String sickId,String clinicclass){
        JSONArray array = new JSONArray();
    public JSONObject registeredOperate(String doctor,String dept,String sickId,String clinicclass){
        JSONObject jsonObject= new JSONObject();
        String response="";
        String response="";
        String url = entranceUrl+"registered?doctor="+doctor+"&dept="+dept+"&sickId="+sickId+"&clinicclass"+clinicclass;
        logger.info("clinicclass:"+clinicclass);
        String url = entranceUrl+"registered?doctor="+doctor+"&dept="+dept+"&sickId="+sickId+"&clinicclass="+clinicclass;
        response = httpClientUtil.get(url,"GBK");
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("status")==200){
        if (object.getInteger("status")==200){
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
            jsonObject = JSONObject.parseObject(object.getString("obj"));
        }
        }
        return array;
        return jsonObject;
    }
    }

+ 4 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -53,9 +53,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.transaction.Transactional;
import java.security.acl.LastOwnerException;
import java.util.*;
import java.util.*;
/**
/**
@ -1203,7 +1203,7 @@ public class YkyyEntranceService {
     * @return
     * @return
     */
     */
    public JSONArray findSypc(String pcbm) throws Exception {
    public JSONArray findSypc(String pcbm) throws Exception {
        String sql = "select s.pcbm as \"pcbm\",s.pcmc as \"pcmc\",s.pcmc1 as \"pcmc1\" from v_hlw_sypc s where 1=1 ";
        String sql = "select s.mrcs as \"mrcs\",s.pcbm as \"pcbm\",s.pcmc as \"pcmc\",s.pcmc1 as \"pcmc1\" from v_hlw_sypc s where 1=1 ";
        if (StringUtils.isNoneBlank(pcbm)){
        if (StringUtils.isNoneBlank(pcbm)){
            sql+=" and lower(s.pcbm)='"+pcbm.toLowerCase()+"' ";
            sql+=" and lower(s.pcbm)='"+pcbm.toLowerCase()+"' ";
        }
        }
@ -1803,7 +1803,7 @@ public class YkyyEntranceService {
                    hlwCf02DO.setFYGB(17);//费用归并
                    hlwCf02DO.setFYGB(17);//费用归并
                    hlwCf02DO.setZFBL(1.0);//自负比例
                    hlwCf02DO.setZFBL(1.0);//自负比例
                    hlwCf02DO.setYFDW(wlyyPrescriptionInfoVO.getPackUnitName());
                    hlwCf02DO.setYFDW(wlyyPrescriptionInfoVO.getPackUnitName());
                    hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
                    hlwCf02DO.setMRCS(StringUtils.isNoneBlank(wlyyPrescriptionInfoVO.getGroupNo())?Integer.parseInt(wlyyPrescriptionInfoVO.getGroupNo()):0);//每日次数
                    hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                    hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                    hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                    hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                    hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
                    hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());

+ 90 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java

@ -0,0 +1,90 @@
package com.yihu.jw.hospital.prescription.service.useragent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * 用户头部信息获取
 * Created by Trick on 2018/10/30.
 */
@Component
public class BaseUserAgent {
    /**
     * 获取当前登录人ID
     * @return
     */
    public String getUID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取登录人姓名
     * @return
     */
    public String getUNAME(){
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            String info = json.getString("uname");
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取角色ID
     * @return
     */
    public String getROLEID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getUserAgent(){
        try{
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
        }
    }
}

+ 23 - 13
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -38,6 +38,7 @@ import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.WeiXinPayUtils;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
@ -275,7 +276,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        businessOrderDO.setStatus(0);
        businessOrderDO.setStatus(0);
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setOrderNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setOrderNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
        String openId = "";
        String openId = "";
@ -332,13 +333,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     * @throws Exception
     * @throws Exception
     */
     */
    @Transactional(rollbackFor = Exception.class)
    @Transactional(rollbackFor = Exception.class)
    public Map<String,Object> refund(Map<String,String> par,String appKey) throws Exception {
        String xml = WeiXinPayUtils.getXmlBeforUnifiedorder(par, appKey);
        Map<String, Object> map = WeiXinPayUtils.refund(xml,true);
        //创建日志记录
        createLog(par,xml,map);
        map.remove("wxPayResult");
        return map;
    public String refund(Map<String,String> par,String appKey) throws Exception {
        String xml= WeiXinPayUtils.getXmlBeforUnifiedorder(par, appKey);
        logger.info("xml:"+xml);
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("REFUND");
        return HttpUtil.doRefund("https://api.mch.weixin.qq.com/secapi/pay/refund",xml,hospitalSysDictDO.getDictCode(),hospitalSysDictDO.getDictValue());
    }
    }
@ -410,7 +409,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        map.put("spbill_create_ip",getServerIp());
        map.put("spbill_create_ip",getServerIp());
        map.put("notify_url",notifyUrl);
        map.put("notify_url",notifyUrl);
        map.put("trade_type", tradeType);
        map.put("trade_type", tradeType);
        map.put("openid", openId);
        if (tradeType.equalsIgnoreCase("JSAPI")){
            map.put("openid", openId);
        }
      /*  String token_url = "https://api.weixin.qq.com/cgi-bin/token";
      /*  String token_url = "https://api.weixin.qq.com/cgi-bin/token";
        String params = "grant_type=client_credential&appid=" + wxWechatDO.getAppId() + "&secret=" + wxWechatDO.getAppSecret();
        String params = "grant_type=client_credential&appid=" + wxWechatDO.getAppId() + "&secret=" + wxWechatDO.getAppSecret();
        String result = HttpUtil.sendGet(token_url, params);
        String result = HttpUtil.sendGet(token_url, params);
@ -486,7 +487,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (patientDO==null){
        if (patientDO==null){
            throw new Exception("this patient not exit");
            throw new Exception("this patient not exit");
        }
        }
        BusinessOrderRefundDO orderRefundDO = new BusinessOrderRefundDO();
        BusinessOrderRefundDO orderRefundDO = orderRefundDao.selectByOrderNo(orderNo);
        if (orderRefundDO==null){
            orderRefundDO = new BusinessOrderRefundDO();
        }
        orderRefundDO.setCreateTime(new Date());
        orderRefundDO.setCreateTime(new Date());
        orderRefundDO.setUpdateTime(new Date());
        orderRefundDO.setUpdateTime(new Date());
        orderRefundDO.setStatus(1);
        orderRefundDO.setStatus(1);
@ -495,12 +499,15 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        orderRefundDO.setRefundPrice(refundPrice);
        orderRefundDO.setRefundPrice(refundPrice);
        orderRefundDO.setAppId(wxWechatDO.getAppId());
        orderRefundDO.setAppId(wxWechatDO.getAppId());
        orderRefundDO.setMchId(wxWechatDO.getMchId());
        orderRefundDO.setMchId(wxWechatDO.getMchId());
        orderRefundDO.setOutRefundNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        orderRefundDO.setOutRefundNo("HLWYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        orderRefundDO.setPatient(patient);
        orderRefundDO.setPatient(patient);
        orderRefundDO.setPatientName(patientDO.getName());
        orderRefundDO.setPatientName(patientDO.getName());
        orderRefundDO.setRefundDesc(description);
        orderRefundDO.setRefundDesc(description);
        orderRefundDO = orderRefundDao.save(orderRefundDO);
        orderRefundDO = orderRefundDao.save(orderRefundDO);
        Map<String,Object> map = refund(wechatId,orderRefundDO.getOrderNo(),orderRefundDO.getOutRefundNo(),orderRefundDO.getOrderPrice().toString(),orderRefundDO.getRefundPrice().toString(),orderRefundDO.getRefundDesc());
        Integer orderPrice = orderRefundDO.getOrderPrice().intValue();
        Integer refundPrice1 = orderRefundDO.getRefundPrice().intValue();
        Map<String,Object> map = refund(wechatId,orderRefundDO.getOrderNo(),orderRefundDO.getOutRefundNo(),orderPrice.toString(),refundPrice1.toString(),orderRefundDO.getRefundDesc());
        logger.info("map"+map);
        if (map.get("return_code").toString().equalsIgnoreCase("SUCCESS")){
        if (map.get("return_code").toString().equalsIgnoreCase("SUCCESS")){
            orderRefundDO.setStatus(2);
            orderRefundDO.setStatus(2);
            orderRefundDO.setRefundTime(new Date());
            orderRefundDO.setRefundTime(new Date());
@ -531,7 +538,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        map.put("refund_fee",refundFee);
        map.put("refund_fee",refundFee);
        map.put("total_fee",totalFee);
        map.put("total_fee",totalFee);
        map.put("refund_desc",descrption);
        map.put("refund_desc",descrption);
        Map<String, Object> refund = refund(map, wxWechatDO.getAppKey());
        logger.info("map:"+map);
        String res = refund(map, wxWechatDO.getAppKey());
        Map<String, Object> refund  =  XMLUtil.xmltoMap(res);
        return refund;
        return refund;
    }
    }

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/order/pay/utils/PayLogService.java

@ -19,6 +19,7 @@ public class PayLogService {
    public String onepayType = "0"; //诊断支付
    public String onepayType = "0"; //诊断支付
    public String pushType = "3"; //推送
    public String onepayRecipeType = "1";     //1续方支付
    public String onepayRecipeType = "1";     //1续方支付
    public String shoppatType="2";//商城支付
    public String shoppatType="2";//商城支付

+ 121 - 0
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -225,4 +225,125 @@ public class YlzPayService {
        logService.saveHttpLog(isSuccess, "hop.trade.tradeQuery", "互联网医院查询订单", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        logService.saveHttpLog(isSuccess, "hop.trade.tradeQuery", "互联网医院查询订单", "POST", null,JSON.toJSONString(param), object, error,logService.onepayType);
        return object;
        return object;
    }
    }
    /**
     * 统一平台推送消息
     * @param cardType
     * @param cardNo
     * @param accountType
     * @param contactNumber
     * @param feeType
     * @param userNo
     * @param userName
     * @param idNo
     * @param voucherNo
     * @param applyDepaName
     * @param applyDoctorName
     * @param recipeTime
     * @param fee
     * @param recipeNum
     * @return
     */
    public String msgPush(String cardType,String cardNo,String accountType,String contactNumber,String feeType,String userNo,String userName,String idNo,String voucherNo,
                          String applyDepaName,String applyDoctorName,String recipeTime,String fee,String recipeNum){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("cardType",cardType);//卡类型01 社保卡 06 临时卡
            jsonObject.put("cardNo",cardNo);//卡号
            jsonObject.put("accountType",accountType);//帐户类型
            jsonObject.put("contactNumber",contactNumber);//手机号码
            jsonObject.put("feeType",feeType);//费用类型(病人身份)
            jsonObject.put("userNo",userNo);//用户编号
            jsonObject.put("userName",userName);//用户姓名
            jsonObject.put("idNo",idNo);//身份证号
            jsonObject.put("voucherNo",voucherNo);//单据号
            jsonObject.put("applyDepaName",applyDepaName);//申请科室名称
            jsonObject.put("applyDoctorName",applyDoctorName);//申请医生姓名
            jsonObject.put("recipeTime",recipeTime);//处方时间yyyyMMddHHmmss
            jsonObject.put("fee",fee);//总费用
            jsonObject.put("recipeNum",recipeNum);//处方数
            //jsonObject.put("extra")
            ResponseParams<MmpPushResult> response = onepayClient.mmpMsgPush(jsonObject);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(response);
                error = "请求失败,返回结果:" + response.getRespCode() + "," + response.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.mmpay.msg.push", "互联网医院消息推送", "POST", null,JSON.toJSONString(jsonObject), object, error,logService.pushType);
        return object;
    }
    /**
     * 生成门诊结算url
     * @param accId
     * @param openId
     * @param cardNo
     * @param channel
     * @return
     */
    public String createSicardPayUrl(String accId,String openId,String cardNo,String channel){
        String object  = null;
        Boolean isSuccess = true;
        String error = null;
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("accId", accId);// 第三方应用原始ID微信公众号(支付宝)原始ID市民卡APP商户(医院)Id平安APP商户(医院)Id银联商户(医院)Id如:gh_54ec946bd3cd
            jsonObject.put("openId", openId);// openid
            jsonObject.put("cardNo",cardNo);//就诊卡或社保卡
            jsonObject.put("channel", channel);//WX: 微信 (默认)ALI: 支付宝PA: 平安SMK:市民卡APP
            //jsonObject.put("extra")
            ResponseParams<JSONObject> response = onepayClient.createSicardUrl(jsonObject);
            if (response.getRespCode().equals("000000")){
                object = JSON.toJSONString(response);
            }else {
                isSuccess = false;
                object = JSON.toJSONString(response);
                error = "请求失败,返回结果:" + response.getRespCode() + "," + response.getRespMsg();
            }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.mmpay.msg.push", "互联网医院消息推送", "POST", null,JSON.toJSONString(jsonObject), object, error,logService.pushType);
        return object;
    }
}
}

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BaseDoctorPatientFollowDao.java

@ -13,4 +13,6 @@ import java.util.List;
public interface BaseDoctorPatientFollowDao extends PagingAndSortingRepository<BaseDoctorPatientFollowDO, String>, JpaSpecificationExecutor<BaseDoctorPatientFollowDO> {
public interface BaseDoctorPatientFollowDao extends PagingAndSortingRepository<BaseDoctorPatientFollowDO, String>, JpaSpecificationExecutor<BaseDoctorPatientFollowDO> {
	
	
	List<BaseDoctorPatientFollowDO> findByDoctorAndPatient(String doctor, String patient);
	List<BaseDoctorPatientFollowDO> findByDoctorAndPatient(String doctor, String patient);
	List<BaseDoctorPatientFollowDO> findByDoctor(String doctorId);
}
}

+ 53 - 11
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -18,12 +18,15 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.dao.ConsultDao;
@ -162,6 +165,9 @@ public class ImService {
	@Autowired
	@Autowired
	private HibenateUtils hibenateUtils;
	private HibenateUtils hibenateUtils;
	@Autowired
	private SystemMessageService systemMessageService;
	
	
	@Value("${wechat.id}")
	@Value("${wechat.id}")
	private String wxId;
	private String wxId;
@ -1343,9 +1349,50 @@ public class ImService {
//		returnJson = imUtil.sendIM(consultTeam.getDoctor(), consultTeam.getPatient(), "28", evalueContent.toString());
//		returnJson = imUtil.sendIM(consultTeam.getDoctor(), consultTeam.getPatient(), "28", evalueContent.toString());
//		String response = imUtil.sendTopicIM(consultTeam.getDoctor(), doctor.getName(), consult, "28", evalueContent.toString(),null);
//		String response = imUtil.sendTopicIM(consultTeam.getDoctor(), doctor.getName(), consult, "28", evalueContent.toString(),null);
//		String response = imUtil.sendImMsg(consultTeam.getDoctor(), doctor.getName(), session_id, "28", evalueContent.toString(),null);
//		String response = imUtil.sendImMsg(consultTeam.getDoctor(), doctor.getName(), session_id, "28", evalueContent.toString(),null);
		
		
		
		//保存系统消息服务评价
		SystemMessageDO messageDO = new SystemMessageDO();
		messageDO.setType("10");
		messageDO.setTitle("服务评价");
		messageDO.setSender(doctor.getId());
		messageDO.setSenderName(doctor.getName());
		messageDO.setRelationCode(consult);
		messageDO.setReceiver(patient.getId());
		messageDO.setReceiverName(patient.getName());
		net.sf.json.JSONObject data = new net.sf.json.JSONObject();
		data.put("name",patient.getName());
		data.put("age",IdCardUtil.getAgeForIdcard(patient.getIdcard()));
		data.put("gender",patient.getSex().toString());
		data.put("question",consultTeam.getSymptoms());
		if (cons.getType()!=null&&1==cons.getType()){
			String msg =patient.getName()+ ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","1");
		}
		if (cons.getType()!=null&&9==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","9");
		}
		if (cons.getType()!=null&&16==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","16");
		}
		if (cons.getType()!=null&&17==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
			data.put("type","17");
		}
		messageDO.setData(data.toString());
		try {
			systemMessageService.saveMessage(messageDO);
		} catch (Exception e) {
			e.printStackTrace();
		}
		String endName = "";
		String endName = "";
		String endId = "";
		String endId = "";
		JSONObject obj = new JSONObject();
		JSONObject obj = new JSONObject();
@ -1374,8 +1421,6 @@ public class ImService {
		if (obj.getInteger("status") == -1) {
		if (obj.getInteger("status") == -1) {
			throw new RuntimeException(String.valueOf(obj.get("message")));
			throw new RuntimeException(String.valueOf(obj.get("message")));
		}
		}
		
		
//		//推送给IM文字消息
//		//推送给IM文字消息
//		if (endType == 1) {
//		if (endType == 1) {
@ -1661,7 +1706,7 @@ public class ImService {
		
		
		//获取诊断
		//获取诊断
		List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = wlyyPrescriptionVO.getDiagnosisVOs();
		List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = wlyyPrescriptionVO.getDiagnosisVOs();
		if(!wlyyPrescriptionDiagnosisVOS.isEmpty()){
		if(wlyyPrescriptionDiagnosisVOS!=null&&wlyyPrescriptionDiagnosisVOS.size()!=0){
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
		}
		}
		
		
@ -1672,8 +1717,8 @@ public class ImService {
		object.put("outpatientid",wlyyPrescriptionVO.getOutpatientId());
		object.put("outpatientid",wlyyPrescriptionVO.getOutpatientId());
		object.put("prescriptionid",wlyyPrescriptionVO.getId());
		object.put("prescriptionid",wlyyPrescriptionVO.getId());
		object.put("ispay",wlyyPrescriptionVO.getPayStatus());
		object.put("ispay",wlyyPrescriptionVO.getPayStatus());
		if(!infoVOs.isEmpty()){
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(infoVOs),"1");
		if(infoVOs!=null&&infoVOs.size()!=0){
			String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(object),"1");
		}
		}
//		imUtil.sendImMsg("402803816babc778016babca6d540008", "梁敬兴", "3ae2673512154d5280d1dcf5ffa5626d_808080eb6c84eacb016c8dc118e9002f_9", "24", "[{\"id\":\"808080eb6c84eacb016c8dc172810037\",\"createTime\":null,\"createUser\":null,\"createUserName\":null,\"updateTime\":null,\"updateUser\":null,\"updateUserName\":null,\"prescriptionId\":\"808080eb6c84eacb016c8dc1727f0036\",\"code\":\"D21.002  \",\"name\":\"耳软骨良性肿瘤\",\"type\":1}]","1");
//		imUtil.sendImMsg("402803816babc778016babca6d540008", "梁敬兴", "3ae2673512154d5280d1dcf5ffa5626d_808080eb6c84eacb016c8dc118e9002f_9", "24", "[{\"id\":\"808080eb6c84eacb016c8dc172810037\",\"createTime\":null,\"createUser\":null,\"createUserName\":null,\"updateTime\":null,\"updateUser\":null,\"updateUserName\":null,\"prescriptionId\":\"808080eb6c84eacb016c8dc1727f0036\",\"code\":\"D21.002  \",\"name\":\"耳软骨良性肿瘤\",\"type\":1}]","1");
@ -1705,11 +1750,8 @@ public class ImService {
	
	
	/**
	/**
	 * 发送咨询建议
	 * 发送咨询建议
	 * @param jsonObject
	 * @param doctor
	 * @param doctor
	 * @param doctorName
	 * @param doctorName
	 * @param outpatientId
	 * @param patient
	 * @return
	 * @return
	 * @throws Exception
	 * @throws Exception
	 */
	 */

+ 1 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -25,9 +25,7 @@ public abstract class IntegerIdentityEntity implements Serializable {
//==========mysql 环境 id策略 end======================================================
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
/*
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
*/
/*    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
    public Integer getId() {
        return id;
        return id;

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -190,6 +190,11 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     */
     */
    private String consultStatus;
    private String consultStatus;
    /**
     * 医生费用
     */
    private String fee;
	@Column(name = "password")
	@Column(name = "password")
    public String getPassword() {
    public String getPassword() {
        return password;
        return password;
@ -463,4 +468,13 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    public void setEnabled(Integer enabled) {
    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
        this.enabled = enabled;
    }
    }
    @Column(name = "fee")
    public String getFee() {
        return fee;
    }
    public void setFee(String fee) {
        this.fee = fee;
    }
}
}

+ 74 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorPatientDO.java

@ -0,0 +1,74 @@
package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/6/1
 */
@Entity
@Table(name = "base_doctor_paitent")
public class BaseDoctorPatientDO extends UuidIdentityEntityWithOperator {
    @Column(name = "doctor_code")
    private String doctorCode;//医生ID
    @Column(name = "doctor_name")
    private String doctorName;//医生名称
    @Column(name = "patient_code")
    private String patientCode;//居民ID
    @Column(name = "patient_name")
    private String patientName;//居民名称
    @Column(name = "status")
    private Integer status;//关注状态 1:关注  0:取消关注
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

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

@ -43,6 +43,10 @@ public class BaseHospitalRequestMapping {
         * 获取门诊记录
         * 获取门诊记录
         */
         */
        public static final String findOutpatientList = "/findOutpatientList";
        public static final String findOutpatientList = "/findOutpatientList";
        /**
         * 修改居民信息
         */
        public static final String updatePatientInfo = "/updatePatientInfo";
        /**
        /**
         * 查询单条门诊记录接口
         * 查询单条门诊记录接口
@ -66,6 +70,14 @@ public class BaseHospitalRequestMapping {
         * 查询患者就诊卡
         * 查询患者就诊卡
         */
         */
        public static final String prescriptionPay = "/prescriptionPay";
        public static final String prescriptionPay = "/prescriptionPay";
        /**
         * 查询患者所有处方信息
         */
        public static final String findPatientAllPrescription = "/findPatientAllPrescription";
        /**
         * 查看取药地址
         */
        public static final String findDrugAddress = "/findDrugAddress";
        /**
        /**
@ -237,11 +249,6 @@ public class BaseHospitalRequestMapping {
         */
         */
        public static final String findPatientInfo = "/findPatientInfo";
        public static final String findPatientInfo = "/findPatientInfo";
        /**
         * 获取居民基础信息
         */
        public static final String updatePatientInfo = "/updatePatientInfo";
        /**
        /**
         * 保存医生在线排班
         * 保存医生在线排班
         */
         */
@ -417,9 +424,20 @@ public class BaseHospitalRequestMapping {
        public static final String findEmrByPrescriptionId="/findEmrByPrescriptionId";
        public static final String findEmrByPrescriptionId="/findEmrByPrescriptionId";
        /*
        关注医生信息
         */
        public static final String attentionDoctor="/attentionDoctor";
        public static final String findAllAttentionDoctor="/findAllAttentionDoctor";
        public static final String findHisEmr="/findHisEmr";
        public static final String findHisEmr="/findHisEmr";
        public static final String findTown="/findTown";
        public static final String findCommity="/findCommity";
        public static final String findProvince="/findProvince";
        public static final String findCity="/findCity";
    }
    }

+ 33 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java

@ -5,6 +5,7 @@ import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.Date;
import java.util.List;
/**
/**
@ -185,6 +186,15 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
	 */
	 */
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
    private String del;
    private String del;
//新增字段 实体类没有新增 shw
    @ApiModelProperty("医生归属医院")
    private String hospital;
    @ApiModelProperty("医生疾病门诊")
    private List<String> disease;
    @ApiModelProperty("医生归属科室")
    private List<String> department;
    public String getPassword() {
    public String getPassword() {
        return password;
        return password;
@ -376,4 +386,27 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
    }
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public List<String> getDisease() {
        return disease;
    }
    public void setDisease(List<String> disease) {
        this.disease = disease;
    }
    public List<String> getDepartment() {
        return department;
    }
    public void setDepartment(List<String> department) {
        this.department = department;
    }
}
}

+ 33 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java

@ -21,6 +21,12 @@ public class LatitudeUtils {
     */
     */
    public static final String ak = "wm9Cih17l010vL91nOfTbu8M";
    public static final String ak = "wm9Cih17l010vL91nOfTbu8M";
    private static double EARTH_RADIUS = 6378.137;
    private static double rad(double lat1) {
        return lat1 * Math.PI / 180.0;
    }
@ -71,6 +77,33 @@ public class LatitudeUtils {
        return null;
        return null;
    }
    }
    /**
     * 根据两个位置的经纬度,来计算两地的距离(单位为KM)
     * 参数为String类型
     * @param lat1Str 用户经度
     * @param lng1Str 用户纬度
     * @param lat2Str 商家经度
     * @param lng2Str 商家纬度
     * @return
     */
    public static String getDistance(String lat1Str, String lng1Str, String lat2Str, String lng2Str) {
        double lat1 = Double.parseDouble(lat1Str);
        double lng1 = Double.parseDouble(lng1Str);
        double lat2 = Double.parseDouble(lat2Str);
        double lng2 = Double.parseDouble(lng2Str);
        double patm = 2;
        double radLat1 = rad(lat1);
        double radLat2 = rad(lat2);
        double difference = radLat1 - radLat2;
        double mdifference = rad(lng1) - rad(lng2);
        double distance = patm * Math.asin(Math.sqrt(Math.pow(Math.sin(difference / patm), patm)
                + Math.cos(radLat1) * Math.cos(radLat2)
                * Math.pow(Math.sin(mdifference / patm), patm)));
        distance = distance * EARTH_RADIUS;
        String distanceStr = String.valueOf(distance);
        return distanceStr;
    }
//    public static void main(String args[]){
//    public static void main(String args[]){
//        try {
//        try {
//            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("浦东区张杨路1725号");
//            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("浦东区张杨路1725号");

+ 37 - 2
common/common-util/src/main/java/com/yihu/jw/util/wechat/WeiXinPayUtils.java

@ -43,6 +43,22 @@ public class WeiXinPayUtils {
    }
    }
    public static Map<String, String> getXmlBeforRefund(Map<String, String> param,String appKey) throws Exception {
        synchronized (WeiXinPayUtils.class) {
            param.put("nonce_str",generateNonceStr());
            WXPayConstants.SignType  wxSignType = WXPayConstants.SignType.MD5;
            String signType = param.get("sign_type");
            if("HMAC-SHA256".equalsIgnoreCase(signType)){
                wxSignType = WXPayConstants.SignType.HMACSHA256;
            }
            //获取微信签名
            String signature = WeiXinPayUtils.generateSignature(param, appKey, wxSignType);
            param.put("sign",signature);
            return param;
        }
    }
    /**
    /**
     * 调起支付的接口
     * 调起支付的接口
     * @param param
     * @param param
@ -271,9 +287,12 @@ public class WeiXinPayUtils {
        return sb.toString().toUpperCase();
        return sb.toString().toUpperCase();
    }
    }
    public static void main(String[] args) throws Exception {
    public static void main(String[] args) throws Exception {
        HashMap<String, String> map = new HashMap<>();
        HashMap<String, String> map = new HashMap<>();
        map.put("appid","wx0a06b75a40b28f2a");
       /* map.put("appid","wx0a06b75a40b28f2a");
        map.put("mch_id","1516700601");
        map.put("mch_id","1516700601");
        map.put("body","腾讯充值中心-QQ会员充值");
        map.put("body","腾讯充值中心-QQ会员充值");
        map.put("out_trade_no","20181127112445");
        map.put("out_trade_no","20181127112445");
@ -281,8 +300,24 @@ public class WeiXinPayUtils {
        map.put("spbill_create_ip","192.168.6.109");
        map.put("spbill_create_ip","192.168.6.109");
        map.put("notify_url","http://www.baidu.com");
        map.put("notify_url","http://www.baidu.com");
        map.put("trade_type","JSAPI");
        map.put("trade_type","JSAPI");
        map.put("openid", "oDGGt0QrJvH-YbDCHFgjd3Exc0Sw");
        map.put("openid", "oDGGt0QrJvH-YbDCHFgjd3Exc0Sw");*/
        map.put("refund_desc","居民取消");
        map.put("out_trade_no","HLWYY11590725608773494100");
        map.put("out_refund_no","HLWYY11590732364418");
        map.put("appid","wxa67b466e6ab64bba");
        map.put("refund_fee","1.0");
        map.put("total_fee","1.0");
        map.put("mch_id","1588010801");
        map.put("sign","E0177065CD96FC04061BEFDB8507A909");
        map.put("nonce_str","U3AVJwvwRhaiWqLFETMbZWPWoVb4CgHF");
        map.put("refund_fee_type","CNY");
        map.put("sign_type","MD5");
/*
        Map<String, Object> pay = unifiedorder(map, "yF4e9Rr1sVdqCF6c7cqqMPSNsCjYGyf9");
        Map<String, Object> pay = unifiedorder(map, "yF4e9Rr1sVdqCF6c7cqqMPSNsCjYGyf9");
*/
        Map<String, Object> pay = refund(map, "a27cbed6078fa7195e51902d9ab18497");
        System.out.println("123123"+pay);
        System.out.println("--------------"+pay);
        System.out.println("--------------"+pay);
    }
    }

+ 68 - 0
common/common-util/src/main/java/com/yihu/jw/util/wechat/wxhttp/HttpUtil.java

@ -1,14 +1,26 @@
package com.yihu.jw.util.wechat.wxhttp;
package com.yihu.jw.util.wechat.wxhttp;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import javax.net.ssl.SSLContext;
import java.io.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLConnection;
import java.security.KeyStore;
/**
/**
 * Created by Trick on 2018/8/21.
 * Created by Trick on 2018/8/21.
@ -210,4 +222,60 @@ public class HttpUtil {
        return buffer.toString();
        return buffer.toString();
    }
    }
/*
    public static String SSLCERT_PATH="";//证书的路径
    public static String SSLCERT_PASSWORD=;//证书的密籍*/
    public static String doRefund(String url,String data,String path,String password) throws Exception {
        String SSLCERT_PATH=path;
        String SSLCERT_PASSWORD=password;
        //注意PKCS12证书 是从微信商户平台-》账户设置-》 API安全 中下载的
        KeyStore keyStore = KeyStore.getInstance("PKCS12");
        //指向你的证书的绝对路径,带着证书去访问
        FileInputStream instream = new FileInputStream(new File(SSLCERT_PATH));//P12文件目录
        try {
            //下载证书时的密码、默认密码是你的MCHID mch_id
            keyStore.load(instream, SSLCERT_PASSWORD.toCharArray());//这里写密码
        } finally {
            instream.close();
        }
        //下载证书时的密码、默认密码是你的MCHID mch_id
        SSLContext sslcontext = SSLContexts.custom()
                .loadKeyMaterial(keyStore, SSLCERT_PASSWORD.toCharArray())//这里也是写密码的
                .build();
        // Allow TLSv1 protocol only
        SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
                sslcontext,
                new String[] { "TLSv1" },
                null,
                SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
        CloseableHttpClient httpclient = HttpClients.custom()
                .setSSLSocketFactory(sslsf)
                .build();
        try {
            logger.info("进入2");
            HttpPost httpost = new HttpPost(url); // 设置响应头信息
            httpost.addHeader("Connection", "keep-alive");
            httpost.addHeader("Accept", "*/*");
            httpost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
            httpost.addHeader("Host", "api.mch.weixin.qq.com");
            httpost.addHeader("X-Requested-With", "XMLHttpRequest");
            httpost.addHeader("Cache-Control", "max-age=0");
            httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
            httpost.setEntity(new StringEntity(data, "UTF-8"));
            logger.info("进入1");
            CloseableHttpResponse response = httpclient.execute(httpost);
            try {
                HttpEntity entity = response.getEntity();
                String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
                EntityUtils.consume(entity);
                return jsonStr;
            } finally {
                response.close();
            }
        } finally {
            httpclient.close();
        }
    }
}
}

+ 0 - 2
gateway/ag-basic/src/main/resources/application.yml

@ -32,8 +32,6 @@ hystrix:
  command:
  command:
    default:
    default:
      execution:
      execution:
        timeout:
          enabled: true
        isolation:
        isolation:
          thread:
          thread:
            timeoutInMilliseconds: 4800000
            timeoutInMilliseconds: 4800000

+ 11 - 0
server/svr-authentication/pom.xml

@ -75,6 +75,11 @@
            <groupId>org.springframework.boot</groupId>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <!-- <scope>runtime</scope> -->
        </dependency>
        <!-- Redis  -->
        <!-- Redis  -->
        <dependency>
        <dependency>
@ -119,6 +124,12 @@
            <groupId>com.yihu</groupId>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        </dependency>
        <!-- 易联众工具-->
        <!-- 易联众工具-->

+ 17 - 15
server/svr-authentication/src/main/resources/application.yml

@ -5,21 +5,23 @@ server:
spring:
spring:
  datasource:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 100
    max-idle: 100 #最大空闲连接
    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: 100 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
    test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    hikari:
      registerMbeans: true
      max-active: 100
      max-idle: 100 #最大空闲连接
      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: 100 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  redis:
  redis:
    database: 0 # Database index used by the connection factory.
    database: 0 # Database index used by the connection factory.
    timeout: 0 # Connection timeout in milliseconds.
    timeout: 0 # Connection timeout in milliseconds.

+ 7 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java

@ -96,7 +96,6 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
        syncDataDO.setUpdateTime(DateUtil.getNowDate());
        syncDataDO.setUpdateTime(DateUtil.getNowDate());
        syncDataDO.setStyle(1);
        syncDataDO.setStyle(1);
        try {
        try {
            //眼科中心
            //眼科中心
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                logger.info("======================眼科中心同步开始========================");
                logger.info("======================眼科中心同步开始========================");
@ -180,6 +179,13 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
                    logger.info("======================同步科室简介信息失败========================");
                    logger.info("======================同步科室简介信息失败========================");
                }
                }
                Integer integer1 = entranceService.syncDoctorInfo();
                Integer integer1 = entranceService.syncDoctorInfo();
                if (integer1==200){
                    logger.info("======================同步单个医生信息成功========================");
                }else {
                    logger.info("======================同步单个医生信息失败========================");
                }
                if (syncMS02003==200&&syncBS16010==200&&syncBS16011==200&&integer1==200){
                if (syncMS02003==200&&syncBS16010==200&&syncBS16011==200&&integer1==200){
                    syncDataDO.setSyncResult("同步成功");
                    syncDataDO.setSyncResult("同步成功");
                    logger.info("======================中山医院信息同步成功========================");
                    logger.info("======================中山医院信息同步成功========================");

+ 22 - 1
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.axis.utils.StringUtils;
import org.apache.axis.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.io.IOException;
@ -49,6 +50,8 @@ public class YkyyController extends EnvelopRestEndpoint {
    private BaseDoctorDao baseDoctorDao;
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    @Autowired
    private HibenateUtils hibenateUtils;
    private HibenateUtils hibenateUtils;
    @Value("${wechat.id}")
    private String wxId;
    @GetMapping(value = "/createSQLQuery")
    @GetMapping(value = "/createSQLQuery")
    @ApiOperation(value = "视图统一查询")
    @ApiOperation(value = "视图统一查询")
@ -128,9 +131,16 @@ public class YkyyController extends EnvelopRestEndpoint {
            Long cfhm = 0L;
            Long cfhm = 0L;
            if (cfsbList!=null&&cfsbList.size()!=0){
            if (cfsbList!=null&&cfsbList.size()!=0){
                cfsb = Long.parseLong(cfsbList.get(0).get("total").toString());
                cfsb = Long.parseLong(cfsbList.get(0).get("total").toString());
                System.out.println("cfsb:"+cfsb);
                String updateCfsb = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF01'";
                hibenateUtils.updateBySql(updateCfsb);
            }
            }
            if (cfhmList!=null&&cfhmList.size()!=0){
            if (cfhmList!=null&&cfhmList.size()!=0){
                cfhm = Long.parseLong(cfhmList.get(0).get("total").toString());
                cfhm = Long.parseLong(cfhmList.get(0).get("total").toString());
                System.out.println("cfhm:"+cfhm);
                String updateCfhm = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF01_CFHM'";
                hibenateUtils.updateBySql(updateCfhm);
            }
            }
            hlwCf01VO.setCFSB(cfsb.intValue());
            hlwCf01VO.setCFSB(cfsb.intValue());
            hlwCf01VO.setCFHM(cfhm+"");
            hlwCf01VO.setCFHM(cfhm+"");
@ -138,6 +148,7 @@ public class YkyyController extends EnvelopRestEndpoint {
            object1.put("cfsb",cfsb);
            object1.put("cfsb",cfsb);
            object1.put("cfhm",cfhm);
            object1.put("cfhm",cfhm);
            ykyyEntranceService.save(hlwCf01VO);
            ykyyEntranceService.save(hlwCf01VO);
            envelop.setObj(object1);
            envelop.setObj(object1);
        }else if (table.equalsIgnoreCase("HLW_CF02")){
        }else if (table.equalsIgnoreCase("HLW_CF02")){
            HlwCf02DO hlwCf02VO =  JSONObject.toJavaObject(object,HlwCf02DO.class);
            HlwCf02DO hlwCf02VO =  JSONObject.toJavaObject(object,HlwCf02DO.class);
@ -146,12 +157,15 @@ public class YkyyController extends EnvelopRestEndpoint {
            Long sbxh = 0L;
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateSbxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF02'";
                hibenateUtils.updateBySql(updateSbxh);
            }
            }
            JSONObject object1 = new JSONObject();
            JSONObject object1 = new JSONObject();
            object1.put("sbxh",sbxh);
            object1.put("sbxh",sbxh);
            envelop.setObj(object1);
            envelop.setObj(object1);
            hlwCf02VO.setSBXH(sbxh.intValue());
            hlwCf02VO.setSBXH(sbxh.intValue());
            ykyyEntranceService.save(hlwCf02VO);
            ykyyEntranceService.save(hlwCf02VO);
        }else if(table.equalsIgnoreCase("HlwYsMzJbzdDO")){
        }else if(table.equalsIgnoreCase("HlwYsMzJbzdDO")){
            // portal_his.gy_identity_ms@xec_link
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJbzdDO hlwYsMzJbzdDO =  JSONObject.toJavaObject(object,HlwYsMzJbzdDO.class);
            HlwYsMzJbzdDO hlwYsMzJbzdDO =  JSONObject.toJavaObject(object,HlwYsMzJbzdDO.class);
@ -160,6 +174,8 @@ public class YkyyController extends EnvelopRestEndpoint {
            Long jlbh = 0L;
            Long jlbh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
            if (sbxhList!=null&&sbxhList.size()!=0){
                jlbh = Long.parseLong(sbxhList.get(0).get("total").toString());
                jlbh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateJlbh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'YS_MZ_JBZD'";
                hibenateUtils.updateBySql(updateJlbh);
            }
            }
            JSONObject object1 = new JSONObject();
            JSONObject object1 = new JSONObject();
            object1.put("jlbh",jlbh);
            object1.put("jlbh",jlbh);
@ -174,12 +190,15 @@ public class YkyyController extends EnvelopRestEndpoint {
            Long sbxh = 0L;
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateSbxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_GHMX'";
                hibenateUtils.updateBySql(updateSbxh);
            }
            }
            JSONObject object1 = new JSONObject();
            JSONObject object1 = new JSONObject();
            object1.put("sbxh",sbxh);
            object1.put("sbxh",sbxh);
            envelop.setObj(object1);
            envelop.setObj(object1);
            hlwGhmxDO.setSBXH(sbxh.intValue());
            hlwGhmxDO.setSBXH(sbxh.intValue());
            ykyyEntranceService.save(hlwGhmxDO);
            ykyyEntranceService.save(hlwGhmxDO);
        }else if(table.equalsIgnoreCase("HlwYsMzJzLsDO")){
        }else if(table.equalsIgnoreCase("HlwYsMzJzLsDO")){
            // portal_his.gy_identity_ms@xec_link
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJzLsDO hlwYsMzJzLsDO =  JSONObject.toJavaObject(object,HlwYsMzJzLsDO.class);
            HlwYsMzJzLsDO hlwYsMzJzLsDO =  JSONObject.toJavaObject(object,HlwYsMzJzLsDO.class);
@ -188,6 +207,8 @@ public class YkyyController extends EnvelopRestEndpoint {
            Long jzxh = 0L;
            Long jzxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
            if (sbxhList!=null&&sbxhList.size()!=0){
                jzxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                jzxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateJzxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'YS_MZ_JZLS'";
                hibenateUtils.updateBySql(updateJzxh);
            }
            }
            JSONObject object1 = new JSONObject();
            JSONObject object1 = new JSONObject();
            object1.put("jzxh",jzxh);
            object1.put("jzxh",jzxh);
@ -213,7 +234,7 @@ public class YkyyController extends EnvelopRestEndpoint {
        }
        }
        //专家咨询
        //专家咨询
        result.put("zxCount",imService.sessionCountByType(doctor.getId(),1,0));
        result.put("zxCount",imService.sessionCountByType(doctor.getId(),1,0));
        result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1",wxId));//图文复诊数量
        return success("请求成功",result);
        return success("请求成功",result);
    }
    }

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

@ -129,7 +129,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "dept", value = "部门CODE")
			@ApiParam(name = "dept", value = "部门CODE")
			@RequestParam(value = "dept",required = false) String dept){
			@RequestParam(value = "dept",required = false) String dept){
//		String result = "{\"waiting_count\":20,\"outpatient_count\":30,\"waiting_count_difference\":5,\"outpatient_count_difference\":-5,\"yesterday_waiting_count\":15,\"yesterday_outpatient_count\":25}";
//		String result = "{\"waiting_count\":20,\"outpatient_count\":30,\"waiting_count_difference\":5,\"outpatient_count_difference\":-5,\"yesterday_waiting_count\":15,\"yesterday_outpatient_count\":25}";
		return success("请求成功",prescriptionService.findWaitingRoomStatusCount(dept));
		return success("请求成功",prescriptionService.findWaitingRoomStatusCount(dept,wxId));
	}
	}
	
	
	
	
@ -143,7 +143,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "consult_status", value = "0离线,1空闲,2接诊中")
			@ApiParam(name = "consult_status", value = "0离线,1空闲,2接诊中")
			@RequestParam(value = "consult_status",required = false) String consult_status){
			@RequestParam(value = "consult_status",required = false) String consult_status){
//		String result = "[{\"id\":\"XXD2019887711\",\"doctor_name\":\"蔡建春\",\"visit_status\":0,\"patient_name\":\"张三\",\"visit_time\":\"2019-06-21 08:30:00\",\"time_cost\":50,\"waiting_count\":26,\"room_name\":\"01诊室\"},{\"id\":\"XXD2019887712\",\"doctor_name\":\"蔡阿梅\",\"visit_status\":1,\"patient_name\":\"李四\",\"visit_time\":\"2019-06-21 09:30:00\",\"time_cost\":60,\"waiting_count\":33,\"room_name\":\"02诊室\"}]";
//		String result = "[{\"id\":\"XXD2019887711\",\"doctor_name\":\"蔡建春\",\"visit_status\":0,\"patient_name\":\"张三\",\"visit_time\":\"2019-06-21 08:30:00\",\"time_cost\":50,\"waiting_count\":26,\"room_name\":\"01诊室\"},{\"id\":\"XXD2019887712\",\"doctor_name\":\"蔡阿梅\",\"visit_status\":1,\"patient_name\":\"李四\",\"visit_time\":\"2019-06-21 09:30:00\",\"time_cost\":60,\"waiting_count\":33,\"room_name\":\"02诊室\"}]";
		return success("请求成功",prescriptionService.findClinicRoomList(dept,date,consult_status));
		return success("请求成功",prescriptionService.findClinicRoomList(dept,date,consult_status,wxId));
	}
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.findClinicRoomStatus)
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.findClinicRoomStatus)
@ -455,7 +455,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	                                   @ApiParam(name = "cancelRemark", value = "取消原因详细说明")
	                                   @ApiParam(name = "cancelRemark", value = "取消原因详细说明")
	                                   @RequestParam(value = "cancelRemark", required = false)String cancelRemark) {
	                                   @RequestParam(value = "cancelRemark", required = false)String cancelRemark) {
		
		
		return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,2));
		return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,2,wxId));
	}
	}
	
	
	
	
@ -534,9 +534,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	                                            @RequestParam(value = "doctor",required = true) String doctor){
	                                            @RequestParam(value = "doctor",required = true) String doctor){
		JSONObject result = new JSONObject();
		JSONObject result = new JSONObject();
		logger.info("action:doctorReviewConsultCount--start:"+DateUtil.dateToStrLong(new Date()));
		logger.info("action:doctorReviewConsultCount--start:"+DateUtil.dateToStrLong(new Date()));
		result.put("imgCount",prescriptionService.getWaitVideoCount(doctor,"1","1"));//图文复诊数量
		result.put("videoCount",prescriptionService.getWaitVideoCount(doctor,"2","1"));//视频复诊数量
		result.put("xtCount",prescriptionService.getWaitVideoCount(doctor,"","2"));//协同门诊候诊数量
		result.put("imgCount",prescriptionService.getWaitVideoCount(doctor,"1","1",wxId));//图文复诊数量
		result.put("videoCount",prescriptionService.getWaitVideoCount(doctor,"2","1",wxId));//视频复诊数量
		result.put("xtCount",prescriptionService.getWaitVideoCount(doctor,"","2",wxId));//协同门诊候诊数量
		logger.info("action:doctorReviewConsultCount--end:"+DateUtil.dateToStrLong(new Date()));
		logger.info("action:doctorReviewConsultCount--end:"+DateUtil.dateToStrLong(new Date()));
		return success("请求成功",result);
		return success("请求成功",result);
	}
	}

+ 53 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -4,14 +4,17 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -88,6 +91,12 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	@Autowired
	private BusinessOrderService businessOrderService;
	private BusinessOrderService businessOrderService;
	@Autowired
	private SystemMessageService systemMessageService;
	@Autowired
	private ConsultDao consultDao;
	
	
	@Value("${fastDFS.fastdfs_file_url}")
	@Value("${fastDFS.fastdfs_file_url}")
	private String fastdfs_file_url;
	private String fastdfs_file_url;
@ -323,6 +332,10 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                                                @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
	                                                @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                   @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                   @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                   @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
                                                   @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
													@ApiParam(name = "isAttention", value = "是否关注")
													@RequestParam(value = "isAttention", required = false)String isAttention,
	                                                 @ApiParam(name = "page", value = "第几页")
	                                                 @ApiParam(name = "page", value = "第几页")
	                                                     @RequestParam(value = "page",required = false) Integer page,
	                                                     @RequestParam(value = "page",required = false) Integer page,
	                                                 @ApiParam(name = "pagesize", value = "分页大小")
	                                                 @ApiParam(name = "pagesize", value = "分页大小")
@ -334,7 +347,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				orgCode,dept,
				orgCode,dept,
				diseaseKey,doctorNameKey,
				diseaseKey,doctorNameKey,
				jobTitleNameKey,outpatientType,
				jobTitleNameKey,outpatientType,
				keyName,workingTime,consultStatus,chargType,consutlSort,page,pagesize));
				keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize));
	}
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.Prescription.findHotDeptAndDiseaseDict)
	@GetMapping(value = BaseHospitalRequestMapping.Prescription.findHotDeptAndDiseaseDict)
@ -401,6 +414,34 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
//			res = re.getInteger("status");
//			res = re.getInteger("status");
//			dts = re.containsKey("doctor")?re.getJSONArray("doctor"):null;
//			dts = re.containsKey("doctor")?re.getJSONArray("doctor"):null;
			//线上问诊支付提醒
			if (type==17||type==1){
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				systemMessageDO.setTitle("支付提醒");
				systemMessageDO.setType("11");
				systemMessageDO.setSender(re.getString("doctor"));
				systemMessageDO.setSenderName(re.getString("doctorName"));
				systemMessageDO.setRelationCode(re.getString("consult"));
				systemMessageDO.setReceiver(re.getString("patient"));
				systemMessageDO.setReceiverName(re.getString("patientName"));
				net.sf.json.JSONObject data = new net.sf.json.JSONObject();
				data.put("name",re.getString("patientName"));
				data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
				data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
				data.put("question",symptoms);
                data.put("type",type);
				String msg= "";
				if (type==17){
					msg=re.getString("patientName")+",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
				}else {
					msg=re.getString("patientName")+",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
				}
				data.put("msg",msg);
				systemMessageDO.setData(data.toString());
				systemMessageService.saveMessage(systemMessageDO);
			}
			//发送系统消息
			//发送系统消息
			SystemMessageDO systemMessageDO = new SystemMessageDO();
			SystemMessageDO systemMessageDO = new SystemMessageDO();
			systemMessageDO.setTitle("新增专家咨询");
			systemMessageDO.setTitle("新增专家咨询");
@ -443,7 +484,15 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
					}
					}
					businessOrderService.saveOrder(businessOrderDO);
					businessOrderService.saveOrder(businessOrderDO);
				}else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
				}else if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
					Double price = 0.01;
					Double price = 0.0;
					if(d!=null&& org.apache.commons.lang3.StringUtils.isNoneBlank(d.getFee())){
						price = Double.parseDouble(d.getFee());
					}
					ConsultDo consultDo = consultDao.findOne(re.getString("consult"));
					if (price==0.0){
						consultDo.setPayStatus(1);
						consultDao.save(consultDo);
					}
					businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
					businessOrderService.recharge(re.getString("consult"),"新增专家咨询","1","专家咨询费",patient,re.getString("patientName"),doctor,price);
				}
				}
			}catch (Exception e){
			}catch (Exception e){
@ -678,9 +727,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@PostMapping(value = BaseHospitalRequestMapping.Prescription.followOrgByPatient)
	@PostMapping(value = BaseHospitalRequestMapping.Prescription.followOrgByPatient)
	@ApiOperation(value = "居民关注医院", notes = "居民关注医院")
	@ApiOperation(value = "居民关注医院", notes = "居民关注医院")
	public Envelop followOrgByPatient(
	public Envelop followOrgByPatient(
			@ApiParam(name = "patientid", value = "发送者id", defaultValue = "")
			@ApiParam(name = "patientid", value = "居民ID", defaultValue = "")
			@RequestParam(value = "patientid", required = true) String patientid,
			@RequestParam(value = "patientid", required = true) String patientid,
			@ApiParam(name = "orgid", value = "发送者姓名", defaultValue = "")
			@ApiParam(name = "orgid", value = "医生ID", defaultValue = "")
			@RequestParam(value = "orgid", required = true) String orgid,
			@RequestParam(value = "orgid", required = true) String orgid,
			@ApiParam(name = "type", value = "1关注 0取消关注", defaultValue = "")
			@ApiParam(name = "type", value = "1关注 0取消关注", defaultValue = "")
			@RequestParam(value = "type", required = true) String type
			@RequestParam(value = "type", required = true) String type

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

@ -130,6 +130,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                             @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                             @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                             @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                             @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                             @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
                                                             @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
                                                             @ApiParam(name = "isAttention", value = "是否关注 1:关注 0:不关注 不传:查所有")
                                                                 @RequestParam(value = "isAttention", required = false)String isAttention,
                                                             @ApiParam(name = "page", value = "第几页")
                                                             @ApiParam(name = "page", value = "第几页")
                                                             @RequestParam(value = "page",required = false) Integer page,
                                                             @RequestParam(value = "page",required = false) Integer page,
                                                             @ApiParam(name = "pagesize", value = "分页大小")
                                                             @ApiParam(name = "pagesize", value = "分页大小")
@ -141,7 +143,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                orgCode,dept,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,
                jobTitleNameKey,outpatientType,
                keyName,workingTime,consultStatus,chargType,consutlSort,page,pagesize));
                keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize));
    }
    }

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

@ -1,8 +1,16 @@
package com.yihu.jw.hospital.endpoint.prescription;
package com.yihu.jw.hospital.endpoint.prescription;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.area.service.BaseCityService;
import com.yihu.jw.area.service.BaseCommitteeService;
import com.yihu.jw.area.service.BaseProvinceService;
import com.yihu.jw.area.service.BaseTownService;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.base.area.BaseCityDO;
import com.yihu.jw.entity.base.area.BaseCommitteeDO;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
import com.yihu.jw.entity.base.area.BaseTownDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.hospital.prescription.*;
@ -18,16 +26,18 @@ import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.base.area.BaseCityVO;
import com.yihu.jw.restmodel.base.area.BaseCommitteeVO;
import com.yihu.jw.restmodel.base.area.BaseProvinceVO;
import com.yihu.jw.restmodel.base.area.BaseTownVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
@ -91,7 +101,16 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private PrescriptionInfoDao prescriptionInfoDao;
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    
    @Autowired
    private BaseCommitteeService baseCommitteeService;
    @Autowired
    private BaseTownService baseTownService;
    @Autowired
    private BaseProvinceService baseProvinceService;
    @Autowired
    private BaseCityService baseCityService;
    @Value("${demo.flag}")
    @Value("${demo.flag}")
    private boolean demoFlag;
    private boolean demoFlag;
    
    
@ -164,7 +183,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                                                  @RequestParam(value = "page", required = false)Integer page,
                                                                                  @RequestParam(value = "page", required = false)Integer page,
                                                                                  @ApiParam(name = "size", value = "每页大小")
                                                                                  @ApiParam(name = "size", value = "每页大小")
                                                                                  @RequestParam(value = "size", required = true) Integer size) {
                                                                                  @RequestParam(value = "size", required = true) Integer size) {
        return prescriptionService.findPrescriptionList(patient,status,startTime,endTime,page,size);
        return prescriptionService.findPrescriptionList(patient,status,startTime,endTime,page,size,wxId);
    }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientList)
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientList)
@ -544,7 +563,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @ApiParam(name = "cancelRemark", value = "取消原因详细说明")
                                       @ApiParam(name = "cancelRemark", value = "取消原因详细说明")
                                       @RequestParam(value = "cancelRemark", required = false)String cancelRemark) {
                                       @RequestParam(value = "cancelRemark", required = false)String cancelRemark) {
        
        
        return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,1));
        return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,1,wxId));
    }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCancelReasonList)
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCancelReasonList)
@ -702,11 +721,35 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @ApiParam(name = "ssc", value = "社保卡")
                                      @ApiParam(name = "ssc", value = "社保卡")
                                      @RequestParam(value = "ssc", required = true)String ssc,
                                      @RequestParam(value = "ssc", required = true)String ssc,
                                      @ApiParam(name = "idcard", value = "居民身份证")
                                      @ApiParam(name = "idcard", value = "居民身份证")
                                       @RequestParam(value = "idcard", required = true)String idcard){
        return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc));
                                       @RequestParam(value = "idcard", required = true)String idcard,
                                      @ApiParam(name = "sex", value = "性别")
                                          @RequestParam(value = "sex", required = false)Integer sex,
                                      @ApiParam(name = "town", value = "所在区code")
                                          @RequestParam(value = "town", required = false)String town,
                                      @ApiParam(name = "townName", value = "所在区名称")
                                          @RequestParam(value = "townName", required = false)String townName,
                                      @ApiParam(name = "committeeCode", value = "居委会code")
                                          @RequestParam(value = "committeeCode", required = false)String committeeCode,
                                      @ApiParam(name = "committeeName", value = "居委会code")
                                          @RequestParam(value = "committeeName", required = false)String committeeName,
                                      @ApiParam(name = "address", value = "常驻地址")
                                          @RequestParam(value = "address", required = false)String address,
                                      @ApiParam(name = "photo", value = "头像")
                                          @RequestParam(value = "photo", required = false)String photo,
                                      @ApiParam(name = "mobile", value = "手机号")
                                          @RequestParam(value = "mobile", required = false)String mobile,
                                      @ApiParam(name = "province", value = "所在省code")
                                          @RequestParam(value = "province", required = false)String province,
                                      @ApiParam(name = "provinceName", value = "所在省名称")
                                          @RequestParam(value = "provinceName", required = false)String provinceName,
                                      @ApiParam(name = "city", value = "市code")
                                          @RequestParam(value = "city", required = false)String city,
                                      @ApiParam(name = "cityName", value = "市名称")
                                          @RequestParam(value = "cityName", required = false)String cityName){
        return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc,sex,town,townName,committeeCode,committeeName,address,photo,mobile,province,provinceName,city,cityName));
    }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
    public Envelop saveDoctorOnlineWork(@ApiParam(name = "onlineWorkJson", value = "保存在线排班json")
    public Envelop saveDoctorOnlineWork(@ApiParam(name = "onlineWorkJson", value = "保存在线排班json")
@ -789,7 +832,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "page", required = true)Integer page,
                                       @RequestParam(value = "page", required = true)Integer page,
                                       @ApiParam(name = "size", value = "每页大小")
                                       @ApiParam(name = "size", value = "每页大小")
                                       @RequestParam(value = "size", required = true)Integer size) {
                                       @RequestParam(value = "size", required = true)Integer size) {
        return prescriptionService.findByGeneralDoctor(generalDoctor,startDate,endDate,status,sort,page,size);
        return prescriptionService.findByGeneralDoctor(generalDoctor,startDate,endDate,status,sort,page,size,wxId);
    }
    }
    
    
    
    
@ -1494,6 +1537,37 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    }
    }
//    @GetMapping(value= BaseHospitalRequestMapping.Prescription.attentionDoctor)
//    @ApiOperation("患者关注医生信息")
//    public Envelop attentionDoctor(
//            @ApiParam(name = "doctorId", value = "doctorId", required = true)
//            @RequestParam(required = true)String doctorId) throws Exception {
//        try {
//            return prescriptionService.attentionDoctor(doctorId);
//        } catch (Exception e) {
//            return ObjEnvelop.getError(e.getMessage());
//        }
//    }
//    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllAttentionDoctor)
//    @ApiOperation(value = "查询所有关注医生", notes = "查询所有关注医生")
//    public PageEnvelop findAllAttentionDoctor(@ApiParam(name = "keyWord", value = "关键字")
//                                         @RequestParam(value = "keyWord", required = false)String keyWord,
//                                              @ApiParam(name = "outPatient", value = "发热门诊",defaultValue = "0")
//                                         @RequestParam(value = "outPatient", required = false)Integer outPatient,
//                                              @ApiParam(name = "jobTitleCode", value = "医生职称")
//                                         @RequestParam(value = "jobTitleCode", required = false)String jobTitleCode,
//                                              @ApiParam(name = "shift", value = "排班",defaultValue = "0")
//                                         @RequestParam(value = "shift", required = false)Integer shift,
//                                              @ApiParam(name = "page", value = "第几页",defaultValue = "1")
//                                         @RequestParam(value = "page",required = false) Integer page,
//                                              @ApiParam(name = "pagesize", value = "分页大小",defaultValue = "10")
//                                         @RequestParam(value = "pagesize",required = false) Integer pagesize) {
//        return prescriptionService.findAllAttentionDoctor(keyWord,outPatient,jobTitleCode,shift,page,pagesize);
//    }
    /**
    /**
     * 查询his电子病历
     * 查询his电子病历
     * @param registerSn
     * @param registerSn
@ -1534,5 +1608,94 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
            return ObjEnvelop.getError(e.getMessage());
        }
        }
    }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientAllPrescription)
    @ApiOperation(value = "查询患者所有处方信息", notes = "查询患者所有处方信息")
    public PageEnvelop findPatientAllPrescription(@ApiParam(name = "keyName", value = "搜索关键字")
                                                  @RequestParam(value = "keyName", required = false)String keyName,
                                                  @ApiParam(name = "status[]", value = "状态")
                                                  @RequestParam(value = "status[]", required = false)String status,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page",required = false,defaultValue = "1") Integer page,
                                                  @ApiParam(name = "size", value = "页面大小")
                                                  @RequestParam(value = "size",required = false,defaultValue = "10") Integer size)throws Exception {
        try {
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size);
        } catch (Exception e) {
            return PageEnvelop.getError(e.getMessage(),-1);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDrugAddress)
    @ApiOperation(value = "查看取药地址", notes = "查看取药地址")
    public MixEnvelop findDrugAddress(@ApiParam(name = "outpatientId", value = "关联门诊code")
                                      @RequestParam(value = "outpatientId", required = true)String outpatientId,
                                      @ApiParam(name = "longitude", value = "经度")
                                      @RequestParam(value = "longitude",required = true) String longitude,
                                      @ApiParam(name = "dimension", value = "维度")
                                      @RequestParam(value = "dimension",required = true) String dimension)throws Exception {
        try {
            return prescriptionService.findDrugAddress(outpatientId,longitude,dimension);
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCommity)
    @ApiOperation(value = "获取居委会列表")
    public ListEnvelop<BaseCommitteeVO> findCommity (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseCommitteeDO> baseProvinces = baseCommitteeService.search(fields, filters, sorts);
        return success(baseProvinces, BaseCommitteeVO.class);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findTown)
    @ApiOperation(value = "获取区列表")
    public ListEnvelop<BaseTownVO> list (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseTownDO> baseTowns = baseTownService.search(fields, filters, sorts);
        return success(baseTowns, BaseTownVO.class);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findProvince)
    @ApiOperation(value = "获取省列表")
    public ListEnvelop<BaseProvinceVO> findProvince (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseProvinceDO> baseProvinces = baseProvinceService.search(fields, filters, sorts);
        return success(baseProvinces, BaseProvinceVO.class);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCity)
    @ApiOperation(value = "获取市列表")
    public ListEnvelop<BaseCityVO> findCity (
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseCityDO> baseCitys = baseCityService.search(fields, filters, sorts);
        return success(baseCitys, BaseCityVO.class);
    }
}
}

+ 1 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -15,10 +15,7 @@ import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;