Ver código fonte

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

humingfen 4 anos atrás
pai
commit
90ef47905b
28 arquivos alterados com 1059 adições e 313 exclusões
  1. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionCheckDao.java
  2. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  3. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDiagnosisDao.java
  4. 7 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionInfoDao.java
  5. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionLogDao.java
  6. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/WlyyInspectionDao.java
  7. 10 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionLogService.java
  8. 254 31
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  9. 0 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  10. 16 12
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  11. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  12. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionDO.java
  13. 36 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionCheckDO.java
  14. 70 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  15. 13 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDiagnosisDO.java
  16. 8 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  17. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyInspectionVO.java
  18. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionDiagnosisVO.java
  19. 99 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java
  20. 37 0
      common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java
  21. 4 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  22. 68 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  23. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  24. 335 256
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  25. 11 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ylz/YlzNotifyController.java
  26. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  27. 32 5
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java
  28. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionCheckDao.java

@ -18,4 +18,8 @@ public interface PrescriptionCheckDao extends PagingAndSortingRepository<WlyyPre
    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByPrescriptionId(String prescriptionId);
    @Query("select a from WlyyPrescriptionCheckDO a where a.prescriptionId = ?1 and a.status=?2 order by a.createTime desc ")
    List<WlyyPrescriptionCheckDO> findByStatus(String prescriptionId,Integer status);
}

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java

@ -21,6 +21,10 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("update WlyyPrescriptionDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,Integer status);
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.checkStatus=?2,p.checkReason=?3,p.status=?4 where p.id=?1")
    void updateCheckStatus(String id,Integer checkStatus,String reason,Integer status);
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.status=?2 ,p.finishTime =?3 where p.id=?1")
    void updateStatus(String id, Integer status, Date date);

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDiagnosisDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -12,4 +14,8 @@ import java.util.List;
public interface PrescriptionDiagnosisDao extends PagingAndSortingRepository<WlyyPrescriptionDiagnosisDO, String>, JpaSpecificationExecutor<WlyyPrescriptionDiagnosisDO> {
    List<WlyyPrescriptionDiagnosisDO> findByPrescriptionId(String prescriptionId);
    @Modifying
    @Query("update WlyyPrescriptionDiagnosisDO p set p.del=0 where p.id=?1")
    void deleteById(String id);
}

+ 7 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionInfoDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -15,4 +17,9 @@ public interface PrescriptionInfoDao extends PagingAndSortingRepository<WlyyPres
    List<WlyyPrescriptionInfoDO> findByPrescriptionId(String prescriptionId);
    List<WlyyPrescriptionInfoDO> queryAllByPrescriptionIdInAndDel(Set ids,Integer del);
    @Modifying
    @Query("update WlyyPrescriptionInfoDO p set p.del=0 where p.id=?1")
    void deleteById(String id);
}

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionLogDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -14,4 +15,7 @@ public interface PrescriptionLogDao extends PagingAndSortingRepository<WlyyPresc
    List<WlyyPrescriptionLogDO> findByOutpatientIdOrderByCreateTimeDesc(String outpatientId);
    List<WlyyPrescriptionLogDO> findByPrescriptionCodeOrderByCreateTimeDesc(String prescriptionCode);
    @Query("select a from WlyyPrescriptionLogDO a where a.prescriptionCode = ?1 and a.status in(20,30,10,100) order by createTime asc ")
    List<WlyyPrescriptionLogDO> findByPrescriptionCodeByStatus(String prescriptionCode);
}

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/WlyyInspectionDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -14,4 +16,8 @@ public interface WlyyInspectionDao extends PagingAndSortingRepository<WlyyInspec
    List<WlyyInspectionDO> findByOutpatientId(String outpatientId);
    List<WlyyInspectionDO> findByPrescriptionId(String prescriptionId);
    @Modifying
    @Query("update WlyyInspectionDO p set p.del=0 where p.id=?1")
    void deleteById(String id);
}

+ 10 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionLogService.java

@ -77,4 +77,14 @@ public class PrescriptionLogService  extends BaseJpaService<WlyyPrescriptionLogD
    public List<WlyyPrescriptionLogDO> findPrescriptionLogByPreId(String prescriptionCode){
        return logDao.findByPrescriptionCodeOrderByCreateTimeDesc(prescriptionCode);
    }
    /**
     * 查询处方流程
     * @param prescriptionCode
     * @return
     */
    public List<WlyyPrescriptionLogDO> findByPrescriptionCodeByStatus(String prescriptionCode){
        return logDao.findByPrescriptionCodeByStatus(prescriptionCode);
    }
}

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

@ -54,7 +54,6 @@ import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
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.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
@ -72,7 +71,6 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -182,6 +180,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private PrescriptionCheckDao prescriptionCheckDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Value("${demo.flag}")
@ -444,7 +444,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            rs.put("expressage",null);
        }
/*
        //物流配送新
        List<WlyyPrescriptionExpressageLogDO>  expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
@ -454,7 +453,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            rs.put("expressageLogs",null);
        }
*/
        //预约记录
        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
@ -1849,10 +1847,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //============================下诊断==============================================================
        //删除之前诊断
        List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId());
       /* List<WlyyPrescriptionDiagnosisDO> ds = prescriptionDiagnosisDao.findByPrescriptionId(prescription.getId());
        if (ds != null && ds.size() > 0) {
            prescriptionDiagnosisDao.delete(ds);
        }
        }*/
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = (List<WlyyPrescriptionDiagnosisDO>) com.alibaba.fastjson.JSONArray.parseArray(diagnosisJson, WlyyPrescriptionDiagnosisDO.class);
        String Icd10 = "";
@ -1886,15 +1884,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                throw new RuntimeException("未找到医生映射信息");
            }
            //his处方拼接开方条件
            com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
            //===================药品操作======================================================
            // 删除原有药品信息
            List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(prescription.getId());
            /*List<WlyyPrescriptionInfoDO> oldInfos = prescriptionInfoDao.findByPrescriptionId(prescription.getId());
            if (oldInfos != null && oldInfos.size() > 0) {
                prescriptionInfoDao.delete(oldInfos);
            }
            }*/
            //存储药品,构建his开方入参
            if (StringUtils.isNotBlank(infoJsons)) {
@ -1906,8 +1903,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    info.setDel(1);
                    info.setPrescriptionId(prescription.getId());
                    //设置his药品查询条件
                    setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, Icd10);
                }
                //保存药品信息
                prescriptionInfoDao.save(infoDOs);
@ -1923,10 +1919,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //=====================检查检验=======================================================================
            //存储检查检验,构建his开方入参
            //删除之前检查检验
            List<WlyyInspectionDO> inspectionDels = wlyyInspectionDao.findByOutpatientId(outPatientId);
            /*List<WlyyInspectionDO> inspectionDels = wlyyInspectionDao.findByOutpatientId(outPatientId);
            if (inspectionDels != null && inspectionDels.size() > 0) {
                wlyyInspectionDao.delete(inspectionDels);
            }
            }*/
            if (StringUtils.isNotBlank(inspectionJson)) {
                List<WlyyInspectionDO> inspections = (List<WlyyInspectionDO>) com.alibaba.fastjson.JSONArray.parseArray(inspectionJson, WlyyInspectionDO.class);
@ -1936,8 +1932,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    ins.setPrescriptionId(prescription.getId());
                    ins.setOutpatientId(outPatientId);
                    //设置his药品查询条件
                    setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, Icd10);
                }
                //保存检查检验。
                wlyyInspectionDao.save(inspections);
@ -1949,6 +1944,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //保存挂号费用
            prescription.setRegFee(getChargeFee(outpatientDO.getDoctor()));
            //=====================保存日志 start=========================================================
            List<WlyyPrescriptionCheckDO> prescriptionCheckDOS = prescriptionCheckDao.findByStatus(prescription.getId(),5);
            if (prescriptionCheckDOS==null || prescriptionCheckDOS.size() ==0){
                savePrescriptionCheck(prescription.getDoctor(),"开具处方",5,prescription.getId());
            }
            //=====================保存日志 end=========================================================
            //保存费用
            prescriptionDao.save(prescription);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
@ -1973,13 +1975,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                Double price = 0.01;
                businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
                //上传his开方
                return sendHisDiagnosis(jsonData, outpatientDO, prescription);
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
                //zsSynHis(prescription.getId());
                return null;
            }else {
                result.put("code", 1);
                result.put("mes", "诊断完成");
                return result;
            }
        } else {
            outpatientDO.setStatus("2");
            outpatientDao.save(outpatientDO);
@ -5208,7 +5213,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> selectByCondition(String hospital, String dept, String status, String startTime, String endTime, String nameInfo, Integer page, Integer pagesize, String wxId){
    public List<Map<String,Object>> selectByCondition(String hospital, String dept, String checkStatus, String startTime, String endTime, String nameInfo, Integer page, Integer pagesize, String wxId){
        List<Map<String,Object>> maps = new ArrayList<>();
        String sql = "SELECT\n" +
                "\tp.doctor as \"doctor\",\n" +
@ -5227,7 +5232,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }else{
            sql = sql + "date_format(p.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
                sql +="\tp.`status` as \"status\"\n" +
                sql +="\tp.status as \"status\",\n" +
                        "\tp.check_status as \"checkStatus\",\n" +
                        "\tp.check_reason as \"checkReason\",\n" +
                        "\tp.pay_type as \"payType\"\n" +
                "FROM\n" +
                "\twlyy_prescription P\n" +
                "WHERE\n" +
@ -5241,9 +5249,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql +=" and p.dept =:dept";
            params.put("dept",dept);
        }
        if (StringUtils.isNoneBlank(status)){
            sql +=" and p.status =:status";
            params.put("status",status);
        if (StringUtils.isNoneBlank(checkStatus)){
            sql +=" and p.check_status =:checkStatus";
            params.put("checkStatus",checkStatus);
        }
        if (StringUtils.isNoneBlank(startTime)){
            sql +=" and p.create_time >=:startTime";
@ -5270,9 +5278,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sqlTotal +=" and p.dept =:dept";
            params1.put("dept",dept);
        }
        if (StringUtils.isNoneBlank(status)){
            sqlTotal +=" and p.status =:status";
            params1.put("status",status);
        if (StringUtils.isNoneBlank(checkStatus)){
            sqlTotal +=" and p.check_status =:checkStatus";
            params1.put("checkStatus",checkStatus);
        }
        if (StringUtils.isNoneBlank(startTime)){
            sqlTotal +=" and p.create_time >=:startTime";
@ -5330,7 +5338,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param prescriptionId
     * @return
     */
    public WlyyPrescriptionCheckDO saveCheck(String operate,String operateName,String reason,Integer status,String prescriptionId){
    public WlyyPrescriptionCheckDO saveCheck(String operate,String operateName,String reason,Integer status,String prescriptionId,String wxId){
        WlyyPrescriptionCheckDO prescriptionCheckDO = new WlyyPrescriptionCheckDO();
        prescriptionCheckDO.setCreateTime(new Date());
        prescriptionCheckDO.setOperate(operate);
@ -5340,16 +5348,98 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionCheckDO.setCreateUserName(operateName);
        prescriptionCheckDO.setReason(reason);
        prescriptionCheckDO.setStatus(status);
        prescriptionCheckDO.setPrescriptionId(prescriptionId);
        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
        if (status==4){
            prescriptionDao.updateStatus(prescriptionId,12);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (status==2){
            prescriptionDao.updateCheckStatus(prescriptionId,2,reason,12);
            /*if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                try {
                    WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                    //his处方拼接开方条件
                    com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
                    for (WlyyPrescriptionInfoDO info:infoDOS){
                        //设置his药品查询条件
                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
                    }
                    for (WlyyInspectionDO ins:inspectionDOS){
                        //设置his药品查询条件
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
                    }
                    sendHisDiagnosis(jsonData, outpatientDO, prescriptionDO);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }*/
        }else{
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
            wlyyPrescriptionDO.setMkTime(new Date());
            wlyyPrescriptionDO.setMkFailReason(reason);
            wlyyPrescriptionDO.setCheckStatus(status);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(11);
            prescriptionDao.save(wlyyPrescriptionDO);
        }
        if (status==2||status==1){
            sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName);
        }
        return prescriptionCheckDO;
    }
    public WlyyPrescriptionCheckDO savePrescriptionCheck(String operate,String reason,Integer status,String prescriptionId){
        String dept = null;
        String deptName = null;
        String job = null;
        String jobName = null;
        BaseDoctorDO doctorDO = baseDoctorDao.findById(operate);
        String operateName = null;
        if (doctorDO!=null){
            operateName = doctorDO.getName();
            job = doctorDO.getJobTitleCode();
            jobName = doctorDO.getJobTitleName();
        }
        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(operate);
        if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
            BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
            dept = doctorHospitalDO.getDeptCode();
            deptName = doctorHospitalDO.getDeptName();
        }
        WlyyPrescriptionCheckDO prescriptionCheckDO = new WlyyPrescriptionCheckDO();
        prescriptionCheckDO.setCreateTime(new Date());
        prescriptionCheckDO.setOperate(operate);
        prescriptionCheckDO.setOperateName(operateName);
        prescriptionCheckDO.setUpdateTime(new Date());
        prescriptionCheckDO.setCreateUser(operate);
        prescriptionCheckDO.setCreateUserName(operateName);
        prescriptionCheckDO.setReason(reason);
        prescriptionCheckDO.setStatus(status);
        prescriptionCheckDO.setDept(dept);
        prescriptionCheckDO.setDeptName(deptName);
        prescriptionCheckDO.setJob(job);
        prescriptionCheckDO.setJobName(jobName);
        prescriptionCheckDO.setPrescriptionId(prescriptionId);
        prescriptionCheckDO = prescriptionCheckDao.save(prescriptionCheckDO);
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (status==3){
            wlyyPrescriptionDO.setCheckStatus(0);
            wlyyPrescriptionDO.setCheckReason("未审核");
            wlyyPrescriptionDO.setDealStatus(1);
            wlyyPrescriptionDO.setDealReason(reason);
        }else if (status==4){
            wlyyPrescriptionDO.setCheckStatus(0);
            wlyyPrescriptionDO.setCheckReason("未审核");
            wlyyPrescriptionDO.setDealStatus(2);
            wlyyPrescriptionDO.setDealReason(reason);
        }else if (status==5){
            wlyyPrescriptionDO.setCheckStatus(0);
            wlyyPrescriptionDO.setCheckReason("未审核");
        }
        prescriptionDao.save(wlyyPrescriptionDO);
        return prescriptionCheckDO;
    }
@ -5362,4 +5452,137 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<WlyyPrescriptionCheckDO> findPrescriptionCheck(String prescriptionId){
        return  prescriptionCheckDao.findByPrescriptionId(prescriptionId);
    }
    /**
     * 发送处方审核消息
     * @param status
     * @param prescriptionDO
     * @param operate
     * @param operateName
     * @return
     */
    public SystemMessageDO sendCheckMessage(Integer status,WlyyPrescriptionDO prescriptionDO,String operate,String operateName){
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        try{
            systemMessageDO.setType("5");
            systemMessageDO.setReceiver(prescriptionDO.getDoctor());
            systemMessageDO.setReceiverName(prescriptionDO.getDoctorName());
            systemMessageDO.setRelationCode(prescriptionDO.getId());
            systemMessageDO.setSender(operate);
            systemMessageDO.setSenderName(operateName);
            JSONObject data = new JSONObject();
            data.put("name",prescriptionDO.getPatientName());
            data.put("age",IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard()));
            if (status==2){
                systemMessageDO.setTitle("审方通过");
                data.put("message","审方通过");
                data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方已审核通过。");
            } else if (status==1) {
                systemMessageDO.setTitle("审方退回");
                data.put("message","审方退回");
                data.put("message","您为"+prescriptionDO.getPatientName()+"("+IdCardUtil.getAgeForIdcard(prescriptionDO.getIdcard())+"岁 "+IdCardUtil.getSexForIdcard(prescriptionDO.getIdcard())+")开具的处方被审方退回,请尽快处理");
            }
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        }catch (Exception e){
            logger.error("sendPatientGetDrugMes :"+e.toString());
        }
        return systemMessageDO;
    }
    /**
     * 查询单条处方记录
     * @param prescriptionId
     * @return
     * @throws Exception
     */
    public WlyyPrescriptionVO selectByPrescriptionId(String prescriptionId) throws Exception {
        WlyyPrescriptionDO  wlyyPrescriptionDO= prescriptionDao.findOne(prescriptionId);
        if (wlyyPrescriptionDO!=null){
            com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(wlyyPrescriptionDO);
            WlyyPrescriptionVO prescriptionVO =  com.alibaba.fastjson.JSONObject.toJavaObject(objectString,WlyyPrescriptionVO.class);
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(wlyyPrescriptionInfoDO);
                logger.info("wlyyPrescriptionInfoDO参数入参"+object.toJSONString());
                WlyyPrescriptionInfoVO prescriptionInfoVO = com.alibaba.fastjson.JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId);
            List<WlyyPrescriptionDiagnosisVO> wlyyPrescriptionDiagnosisVOS = new ArrayList<>();
            for (WlyyPrescriptionDiagnosisDO prescriptionDiagnosisDO:wlyyPrescriptionDiagnosisDOS){
                com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(prescriptionDiagnosisDO);
                logger.info("prescriptionDiagnosisDO参数入参"+object.toJSONString());
                WlyyPrescriptionDiagnosisVO prescriptionDiagnosisVO = com.alibaba.fastjson.JSONObject.toJavaObject(object,WlyyPrescriptionDiagnosisVO.class);
                wlyyPrescriptionDiagnosisVOS.add(prescriptionDiagnosisVO);
            }
            prescriptionVO.setDiagnosisVOs(wlyyPrescriptionDiagnosisVOS);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
            List<WlyyInspectionVO> inspectionVOList = new ArrayList<>();
            for (WlyyInspectionDO inspectionDO:inspectionDOS){
                com.alibaba.fastjson.JSONObject object = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(inspectionDO);
                logger.info("prescriptionDiagnosisDO参数入参"+object.toJSONString());
                WlyyInspectionVO inspectionVO = com.alibaba.fastjson.JSONObject.toJavaObject(object,WlyyInspectionVO.class);
                inspectionVOList.add(inspectionVO);
            }
            prescriptionVO.setInspectionVOs(inspectionVOList);
            prescriptionVO.setAge(StringUtils.isNoneBlank(wlyyPrescriptionDO.getIdcard())?IdCardUtil.getAgeForIdcard(wlyyPrescriptionDO.getIdcard())+"":null);
            prescriptionVO.setSex(StringUtils.isNoneBlank(wlyyPrescriptionDO.getIdcard())?IdCardUtil.getSexForIdcard_new(wlyyPrescriptionDO.getIdcard()):null);
            return prescriptionVO;
        }
        return null;
    }
    public void deleteById(Integer flag,String id){
        if (flag ==1){
            //药品
            prescriptionInfoDao.deleteById(id);
        }else if (flag==2){
            //诊断
            prescriptionDiagnosisDao.deleteById(id);
        }else if (flag==3){
            //检查检验
            wlyyInspectionDao.deleteById(id);
        }
    }
    public void zsSynHis(String prescriptionId){
        try {
            WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
            List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId);
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
            DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
            //his处方拼接开方条件
            com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
            for (WlyyPrescriptionInfoDO info:infoDOS){
                //设置his药品查询条件
                setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
            }
            for (WlyyInspectionDO ins:inspectionDOS){
                //设置his药品查询条件
                setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
            }
            sendHisDiagnosis(jsonData, outpatientDO, prescriptionDO);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

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

@ -3,8 +3,6 @@ package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.webkit.dom.CSSStyleRuleImpl;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;

+ 16 - 12
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1680,9 +1680,10 @@ public class ImService {
	 * @throws Exception
	 */
	public String pushHuiZhenMsg(com.alibaba.fastjson.JSONObject jsonObject,String doctor,String doctorName,String outpatientId,String patient,String outpatientType) throws Exception {
		if("1".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "31",jsonObject.toString(),"1");
		}else if("2".equals(outpatientType)){
//		if("1".equals(outpatientType)){
//			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "31",jsonObject.toString(),"1");
//		}else
		if("2".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "31",jsonObject.toString(),"1");
		}else{
			return null;
@ -1725,8 +1726,8 @@ public class ImService {
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"d.sex as \"patientSex\"," +
					"d.photo AS \"patientPhoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d " +
@ -1749,12 +1750,12 @@ public class ImService {
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"op.id as \"outpatientid\"," +
					"d.sex as \"patientSex\"," +
					"op.id as \"outpatientId\"," +
					"op.type as \"consultType\"," +
					"op.general_doctor as \"generalDoctor\"," +
					"op.icd10_name as \"icd10Name\"," +
					"d.photo AS \"patientphoto\" " +
					"d.photo AS \"patientPhoto\" " +
					"FROM wlyy_consult_team b," +
					"base_patient d," +
					"wlyy_consult a   " +
@ -2467,11 +2468,14 @@ public class ImService {
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
					"op.description AS \"title\","+
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\"," +
					"op.create_time AS \"czrq\"," +
					"op.status AS \"status\"," +
					"op.description AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
				sql = sql + "to_char(op.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\",";
			}else{
				sql = sql + "date_format(op.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"czrq\",";
			}
					sql =sql +"op.status AS \"status\"," +
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"op.general_doctor AS \"generalDoctor\"," +

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

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
/*    @GeneratedValue(generator = "generator")
    @GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)*/
    @Column(name = "id", unique = true, nullable = false)
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
    /*@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionDO.java

@ -53,6 +53,8 @@ public class WlyyInspectionDO extends UuidIdentityEntity {
    private String mzpg;//麻醉评估 0否,1有
    private String sfzg;//是否做过 0 否 和 1是
    private Integer del;//1可用 0删除
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;//,
@ -289,4 +291,11 @@ public class WlyyInspectionDO extends UuidIdentityEntity {
        this.chargeAmount = chargeAmount;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 36 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionCheckDO.java

@ -25,6 +25,10 @@ public class WlyyPrescriptionCheckDO extends UuidIdentityEntityWithOperator {
    private String reason;
    private String operate;
    private String operateName;
    private String dept;
    private String deptName;
    private String job;
    private String jobName;
    public String getPrescriptionId() {
        return prescriptionId;
@ -66,4 +70,36 @@ public class WlyyPrescriptionCheckDO extends UuidIdentityEntityWithOperator {
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
}

+ 70 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java

@ -238,6 +238,31 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     */
    private String orderId;
    /**
     * 审核状态0未审核1审核退回4审核通过
     */
    private Integer checkStatus;
    /**
     * 审方原因
     */
    private String checkReason;
    /**
     * 处理状态 1处方修改2执行处方
     */
    private Integer dealStatus;
    /**
     * 处理原因
     */
    private String dealReason;
    /**
     * 付款方式(0自费,1医保)
     */
    private Integer payType;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
@ -582,4 +607,49 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    @Column(name = "check_status")
    public Integer getCheckStatus() {
        return checkStatus;
    }
    public void setCheckStatus(Integer checkStatus) {
        this.checkStatus = checkStatus;
    }
    @Column(name = "check_reason")
    public String getCheckReason() {
        return checkReason;
    }
    public void setCheckReason(String checkReason) {
        this.checkReason = checkReason;
    }
    @Column(name = "deal_status")
    public Integer getDealStatus() {
        return dealStatus;
    }
    public void setDealStatus(Integer dealStatus) {
        this.dealStatus = dealStatus;
    }
    @Column(name = "deal_reason")
    public String getDealReason() {
        return dealReason;
    }
    public void setDealReason(String dealReason) {
        this.dealReason = dealReason;
    }
    @Column(name = "pay_type")
    public Integer getPayType() {
        return payType;
    }
    public void setPayType(Integer payType) {
        this.payType = payType;
    }
}

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDiagnosisDO.java

@ -38,6 +38,11 @@ public class WlyyPrescriptionDiagnosisDO extends UuidIdentityEntity {
     */
    private Integer type;
    /**
     * 1可用 0删除
     */
    private Integer del;
    /**
     * 创建时间
     */
@ -85,4 +90,12 @@ public class WlyyPrescriptionDiagnosisDO extends UuidIdentityEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

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

@ -340,6 +340,8 @@ public class BaseHospitalRequestMapping {
        public static final String findPrescriptionLogByPreId = "/findPrescriptionLogByPreId";
        public static final String findByPrescriptionCodeByStatus = "/findByPrescriptionCodeByStatus";
        public static final String findByPartsCode = "/findByPartsCode";
        public static final String findDictByName = "/findDictByName";
@ -397,6 +399,12 @@ public class BaseHospitalRequestMapping {
        public static final  String prescriptionCheckList = "/prescriptionCheckList";
        public static final  String selectByPrescriptionId = "/selectByPrescriptionId";
        public static final String savePrescriptionCheck = "/savePrescriptionCheck";
        public static final String deleteById = "/deleteById";
    }

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyInspectionVO.java

@ -3,6 +3,7 @@ package com.yihu.jw.restmodel.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
@ -50,6 +51,7 @@ public class WlyyInspectionVO extends UuidIdentityVO {
//    private String dCode;//自定义码',
//    private String execUnit;//执行科室',
//    private String winNo;//院区',
    private Integer del;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;//,
@ -281,4 +283,12 @@ public class WlyyInspectionVO extends UuidIdentityVO {
    public void setCheckPartName(String checkPartName) {
        this.checkPartName = checkPartName;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionDiagnosisVO.java

@ -42,6 +42,9 @@ public class WlyyPrescriptionDiagnosisVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "1主诊断 2次诊断", example = "模块1")
    private Integer type;
    @ApiModelProperty(value = "删除标识", example = "模块1")
    private Integer del;
    /**
     * 创建时间
     */
@ -86,4 +89,11 @@ public class WlyyPrescriptionDiagnosisVO extends UuidIdentityVOWithOperator {
        this.createTime = createTime;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 99 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java

@ -324,6 +324,49 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date dispDate;
    /**
     * 审核状态0未审核1审核退回4审核通过
     */
    @ApiModelProperty(value = "审核状态", example = "模块1")
    private Integer checkStatus;
    /**
     * 审方原因
     */
    @ApiModelProperty(value = "审方原因", example = "模块1")
    private String checkReason;
    /**
     * 处理状态 1处方修改2执行处方
     */
    @ApiModelProperty(value = "处理状态", example = "模块1")
    private Integer dealStatus;
    /**
     * 处理原因
     */
    @ApiModelProperty(value = "处理原因", example = "模块1")
    private String dealReason;
    /**
     * 年龄
     */
    @ApiModelProperty(value = "年龄", example = "模块1")
    private String age;//年龄
    /**
     * 性别
     */
    @ApiModelProperty(value = "性别", example = "模块1")
    private String sex;//性别
    /**
     * 付款方式0自费1医保
     */
    @ApiModelProperty(value = "付款方式", example = "模块1")
    private Integer payType;
    @ApiModelProperty(value = "检查检验", example = "模块1")
    private List<WlyyInspectionVO> inspectionVOs;
@ -724,4 +767,60 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public Integer getCheckStatus() {
        return checkStatus;
    }
    public void setCheckStatus(Integer checkStatus) {
        this.checkStatus = checkStatus;
    }
    public String getCheckReason() {
        return checkReason;
    }
    public void setCheckReason(String checkReason) {
        this.checkReason = checkReason;
    }
    public Integer getDealStatus() {
        return dealStatus;
    }
    public void setDealStatus(Integer dealStatus) {
        this.dealStatus = dealStatus;
    }
    public String getDealReason() {
        return dealReason;
    }
    public void setDealReason(String dealReason) {
        this.dealReason = dealReason;
    }
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public Integer getPayType() {
        return payType;
    }
    public void setPayType(Integer payType) {
        this.payType = payType;
    }
}

+ 37 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java

@ -188,4 +188,41 @@ public class IdCardUtil {
        }
        return sex;
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的性别
     * 1 男 2 女 3未知
     *
     * @return
     * @throws Exception
     */
    public static String getSexForIdcard(String CardCode)
            throws Exception {
        String sex = level_sex_3_name;
        try {
            if (CardCode.length() == 18) {
                if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                    // modifid by lyr 2016-09-29
                    sex = level_sex_2_name;
                    // modifid by lyr 2016-09-29
                } else {
                    // modifid by lyr 2016-09-29
                    sex = level_sex_1_name;
                    // modifid by lyr 2016-09-29
                }
            } else if (CardCode.length() == 15) {
                String usex = CardCode.substring(14, 15);// 用户的性别
                if (Integer.parseInt(usex) % 2 == 0) {
                    sex = level_sex_2_name;
                } else {
                    sex = level_sex_1_name;
                }
            }
            return sex;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sex;
    }
}

+ 4 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -174,7 +174,10 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
        UserDO user = userDao.findOne(id);
        RoleDO role = null;
        if (user != null) {
        if (user != null ) {
            if(!user.getEnabled()){
                throw new Exception("用户已失效!");
            }
            userinfo.put("id", user.getId());
            userinfo.put("name", user.getName());
            role = roleDao.findOne(user.getRoleId());

+ 68 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -3,9 +3,12 @@ package com.yihu.jw.service.channel;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
@ -38,6 +41,8 @@ public class PrescriptionStatusUpdateService {
    private static Logger logger = LoggerFactory.getLogger(PrescriptionStatusUpdateService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${wechat.id}")
    private String wechatId;
    @Value("${hlwyyEntrance.url}")
    private String hlwyyEntranceUrl;
    @Autowired
@ -51,6 +56,10 @@ public class PrescriptionStatusUpdateService {
    @Autowired
    private ImService imService;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    public void autoPush() throws Exception {
@ -291,6 +300,65 @@ public class PrescriptionStatusUpdateService {
                    }
                }
                outpatientDao.save(outpatientDOs);
                //退费
                for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    if (businessOrderDO!=null){
                        try {
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
                                businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                logger.info("setOutPatientOver count :"+outpatientDOs.size());
            }else {
                logger.info("setOutPatientOver count :"+0);
            }
        }else{
            logger.info("setOutPatientOver Time is not up ");
        }
        logger.info("setOutPatientOver end ");
    }
    public void setOutPatientStatusOver(){
        logger.info("setOutPatientOver start ");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        int i = calendar.get(Calendar.HOUR_OF_DAY);
        //复诊记录状态状态安全锁,每天0~2点才允许触发,避免误调用
        //将所有的已接诊的处方记录
        if(i==0||i==1){
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus("2");
            if(outpatientDOs!=null&&outpatientDOs.size()>0){
                for(WlyyOutpatientDO outpatientDO:outpatientDOs){
                    //结束门诊
                    outpatientDO.setStatus("0");
                }
                outpatientDao.save(outpatientDOs);
                //退费
                for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    if (businessOrderDO!=null){
                        try {
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
                                businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                logger.info("setOutPatientOver count :"+outpatientDOs.size());

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

@ -194,7 +194,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
						net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
					/*	rsCode="0";
			/*			rsCode="0";
						mes="已挂号";*/
					}

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

@ -49,25 +49,25 @@ import java.util.Map;
@RequestMapping(value = BaseHospitalRequestMapping.Prescription.PREFIX)
@Api(value = "在线复诊", description = "在线复诊接口", tags = {"在线复诊接口"})
public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    
    @Autowired
    private PrescriptionService prescriptionService;
    
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    
    @Autowired
    private InspectionService inspectionService;
    
    @Autowired
    private DoctorPreSignService doctorPreSignService;
    
    @Autowired
    private HospitalSystemMessageService hospitalSystemMessageService;
    
    @Autowired
    private WorkTimeService workTimeService;
    
@ -76,31 +76,31 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    
    @Autowired
    private OutpatientDao outpatientDao;
    
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    
    @Autowired
    private BusinessOrderService businessOrderService;
    
    @Value("${demo.flag}")
    private boolean demoFlag;
    
    @Value("${wechat.id}")
    private String wxId;
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
                               @RequestParam(value = "patient",required = false) String patient,
                               @ApiParam(name = "startTime", value = "开始时间")
                               @RequestParam(value = "startTime",required = false) String startTime,
                               @ApiParam(name = "endTime", value = "结束时间")
                               @RequestParam(value = "endTime",required = false) String endTime) throws Exception {
                                          @RequestParam(value = "patient",required = false) String patient,
                                          @ApiParam(name = "startTime", value = "开始时间")
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag);
        return success(vos);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientInfo)
    @ApiOperation(value = " 查询单条门诊就诊记录")
    public ObjEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民id")
@ -110,7 +110,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,conNo);
        return success(obj);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescriptionList)
    @ApiOperation(value = "门诊下所有处方信息")
    public ListEnvelop findOriginPrescriptionList(
@ -125,7 +125,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        List<WlyyPrescriptionVO> obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        return success(obj);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescription)
    @ApiOperation(value = "历史处方信息(单条)")
    public ObjEnvelop findOriginPrescription(
@ -140,7 +140,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        WlyyPrescriptionVO obj = prescriptionService.findOriginPrescription(registerSn, patNo, admNo,realOrder, demoFlag);
        return success(obj);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionList)
    @ApiOperation(value = "获取续方记录列表", notes = "获取续方记录列表")
    public MixEnvelop<WlyyPrescriptionVO,WlyyPrescriptionVO> findPrescriptionList(@ApiParam(name = "patient", value = "居民code")
@ -157,7 +157,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                                                  @RequestParam(value = "size", required = true) Integer size) {
        return prescriptionService.findPrescriptionList(patient,status,startTime,endTime,page,size);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientList)
    @ApiOperation(value = "查询复诊记录列表", notes = "查询复诊记录列表")
    public MixEnvelop<WlyyOutpatientVO,WlyyOutpatientVO> findReOutpatientList(@ApiParam(name = "patient", value = "居民code")
@ -174,7 +174,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                                              @RequestParam(value = "size", required = true) Integer size) {
        return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,page,size);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientInfo)
    @ApiOperation(value = "查询复诊记录,处方,居民信息,物流(单条)", notes = "查询复诊记录,处方,居民信息,物流(单条)")
    public ObjEnvelop findReOutpatientInfo(@ApiParam(name = "outpatientId", value = "复诊ID")
@ -184,45 +184,45 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        com.alibaba.fastjson.JSONObject obj =  prescriptionService.findReOutpatientInfo(outpatientId,prescriptionId);
        return success(obj);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionInfo)
    @ApiOperation(value = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)", notes = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)")
    public ObjEnvelop<Map<String,Object>> findPrescriptionInfo(@ApiParam(name = "prescriptionId", value = "续方明细")
                                                               @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.findPrescriptionInfo(prescriptionId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkPrescription)
    @ApiOperation(value = "判断是否可续方,true 可以,false不可以", notes = "判断是否可续方,true 可以,false不可以")
    public ObjEnvelop<Boolean> checkPrescription(@ApiParam(name = "patient", value = "续方明细")
                                                               @RequestParam(value = "patient", required = false) String patient) {
                                                 @RequestParam(value = "patient", required = false) String patient) {
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.checkPrescription(patient));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.cancelPrescription)
    @ApiOperation(value = "居民取消续方", notes = "居民取消续方")
    public ObjEnvelop<Boolean> cancelPrescription(@ApiParam(name = "prescriptionId", value = "续方ID")
                                                      @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
                                                  @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.cancelPrescription(prescriptionId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientCard)
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民Code")
                                       @RequestParam(value = "patient", required = true)String patient)throws Exception {
        return success(prescriptionService.findPatientCard(patient));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOutpatient)
    @ApiOperation(value = "判断是否可用发起门诊", notes = "判断是否可用发起门诊")
    public ObjEnvelop checkOutpatient(@ApiParam(name = "patient", value = "续方明细")
                                      @RequestParam(value = "patient", required = true)String patient)throws Exception{
        return success(prescriptionService.checkOutpatient(patient));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllHospital)
    @ApiOperation(value = "查询所有机构", notes = "查询所有机构")
    public ListEnvelop findAllHospital(@ApiParam(name = "level", value = "医院等级")
@ -231,7 +231,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "keyWord", required = false)String keyWord) {
        return success(prescriptionService.findAllHospital(level,keyWord));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByHospital)
    @ApiOperation(value = "查询机构底下部门", notes = "查询机构底下部门")
    public ListEnvelop findDeptByHospital(@ApiParam(name = "orgCode", value = "机构code")
@ -246,14 +246,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByKeyWord)
    @ApiOperation(value = "查询有所有已开放的科室", notes = "查询有所有已开放的科室")
    public ListEnvelop findDeptByKeyWord(@ApiParam(name = "keyWord", value = "关键字")
                                          @RequestParam(value = "keyWord", required = false)String keyWord,
                                         @RequestParam(value = "keyWord", required = false)String keyWord,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page",required = true) Integer page,
                                         @ApiParam(name = "pagesize", value = "分页大小")
                                             @RequestParam(value = "pagesize",required = true) Integer pagesize) {
                                         @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        return success(prescriptionService.findDeptByKeyWord(keyWord,page,pagesize));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDept)
    @ApiOperation(value = "查询部门下医生", notes = "查询部门下医生")
    public ListEnvelop findDoctorByHospitalAndDept(@ApiParam(name = "orgCode", value = "机构code")
@ -276,7 +276,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                   @RequestParam(value = "consultStatus", required = false)String consultStatus) {
        return success(prescriptionService.findDoctorByHospitalAndDept(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
    public ObjEnvelop appointmentRevisit(@ApiParam(name = "outpatientJson", value = "居民门诊json")
@ -287,9 +287,9 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "registerJson", required = false)String registerJson,
                                         @ApiParam(name = "chargeType", value = "预约实体json")
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
    
        
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
    
        
        //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        //发送IM消息
@ -299,18 +299,18 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        }
    
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
    @ApiOperation(value = "获取ICD10诊断编码", notes = "获取ICD10诊断编码")
    public ListEnvelop getICD10(@ApiParam(name = "pyKey", value = "拼音关键字")
                                @RequestParam(value = "pyKey", required = false)String pyKey)throws Exception {
        return success(prescriptionService.getICD10(pyKey));
        
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugDictionary)
    @ApiOperation(value = "获取药品字典", notes = "获取药品字典")
    public ListEnvelop getDrugDictionary(@ApiParam(name = "drugNo", value = "药品编码")
@ -323,7 +323,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "groupNo", required = false)String groupNo)throws Exception {
        return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugUse)
    @ApiOperation(value = "获取用法", notes = "获取用法")
    public ListEnvelop getDrugUse(@ApiParam(name = "pyKey", value = "拼音关键字")
@ -331,34 +331,34 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                  @ApiParam(name = "drugNo", value = "药品编码")
                                  @RequestParam(value = "drugNo", required = false)String drugNo)throws Exception {
        return success(prescriptionService.getDrugUse(drugNo,pyKey));
        
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugFrequency)
    @ApiOperation(value = "获取用药频次", notes = "获取用药频次")
    public ListEnvelop getDrugFrequency()throws Exception {
        return success(prescriptionService.getDrugFrequency());
    }
    
    
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.makeDiagnosis)
    @ApiOperation(value = "下诊断", notes = "下诊断接口")
    public ObjEnvelop makeDiagnosis(@ApiParam(name = "outPatientId", value = "门诊编号")
                                            @RequestParam(value = "outPatientId", required = true)String outPatientId,
                                            @ApiParam(name = "advice", value = "医嘱")
                                            @RequestParam(value = "advice", required = false)String advice,
                                            @ApiParam(name = "type", value = "1需要提交his,2不提交只下诊断")
                                            @RequestParam(value = "type", required = true)String type,
                                            @ApiParam(name = "infoJsons", value = "药品json")
                                            @RequestParam(value = "infoJsons", required = false)String infoJsons,
                                            @ApiParam(name = "diagnosisJson", value = "诊断json")
                                            @RequestParam(value = "diagnosisJson", required = true)String diagnosisJson,
                                            @ApiParam(name = "inspectionJson", value = "检查检验")
                                            @RequestParam(value = "inspectionJson", required = false)String inspectionJson)throws Exception {
                                    @RequestParam(value = "outPatientId", required = true)String outPatientId,
                                    @ApiParam(name = "advice", value = "医嘱")
                                    @RequestParam(value = "advice", required = false)String advice,
                                    @ApiParam(name = "type", value = "1需要提交his,2不提交只下诊断")
                                    @RequestParam(value = "type", required = true)String type,
                                    @ApiParam(name = "infoJsons", value = "药品json")
                                    @RequestParam(value = "infoJsons", required = false)String infoJsons,
                                    @ApiParam(name = "diagnosisJson", value = "诊断json")
                                    @RequestParam(value = "diagnosisJson", required = true)String diagnosisJson,
                                    @ApiParam(name = "inspectionJson", value = "检查检验")
                                    @RequestParam(value = "inspectionJson", required = false)String inspectionJson)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,advice,type,infoJsons,diagnosisJson,inspectionJson);
        try {
    
            
            com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
            
            List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = (List<WlyyPrescriptionDiagnosisDO>) com.alibaba.fastjson.JSONArray.parseArray(diagnosisJson, WlyyPrescriptionDiagnosisDO.class);
@ -384,8 +384,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
        return success(result);
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findExpressageList)
    @ApiOperation(value = "获取订单列表", notes = "获取订单列表")
    public MixEnvelop findExpressageList(@ApiParam(name = "status", value = "流程状态,多状态用‘,’分割")
@ -404,7 +404,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "size", required = false)Integer size) {
        return prescriptionService.findExpressageList(status,oneselfPickupFlg,nameKey,startTime,endTime,page,size,wxId);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.setMailno)
    @ApiOperation(value = "设置订单编号", notes = "设置订单编号")
    public ObjEnvelop setMailno(@ApiParam(name = "mailno", value = "订单号")
@ -413,20 +413,20 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                @RequestParam(value = "expressageId", required = false)String expressageId) {
        return success(prescriptionService.setMailno(mailno,expressageId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.pushListWrite)
    @ApiOperation(value = "订单导出", notes = "订单导出")
    public void pushListWrite(@ApiParam(name = "status", value = "流程状态,多状态用‘,’分割")
                                    @RequestParam(value = "status", required = false)String status,
                                    @ApiParam(name = "oneselfPickupFlg", value = "是否自取 1是 0否")
                                    @RequestParam(value = "oneselfPickupFlg", required = false)String oneselfPickupFlg,
                                    @ApiParam(name = "nameKey", value = "配送员名称")
                                    @RequestParam(value = "nameKey", required = false)String nameKey,
                                    @ApiParam(name = "startTime", value = "开始时间,yyyy-MM-dd")
                                    @RequestParam(value = "startTime", required = false)String startTime,
                                    @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd")
                                    @RequestParam(value = "endTime", required = false)String endTime,
                                    HttpServletResponse response) throws Exception{
                              @RequestParam(value = "status", required = false)String status,
                              @ApiParam(name = "oneselfPickupFlg", value = "是否自取 1是 0否")
                              @RequestParam(value = "oneselfPickupFlg", required = false)String oneselfPickupFlg,
                              @ApiParam(name = "nameKey", value = "配送员名称")
                              @RequestParam(value = "nameKey", required = false)String nameKey,
                              @ApiParam(name = "startTime", value = "开始时间,yyyy-MM-dd")
                              @RequestParam(value = "startTime", required = false)String startTime,
                              @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd")
                              @RequestParam(value = "endTime", required = false)String endTime,
                              HttpServletResponse response) throws Exception{
        MixEnvelop expressages = prescriptionService.findExpressageList(status,oneselfPickupFlg,nameKey,startTime,endTime,1,10000,wxId);
        List<Map<String,Object>> list = expressages.getDetailModelList();
        response.setContentType("octets/stream");
@ -434,21 +434,21 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        OutputStream os = response.getOutputStream();
        prescriptionService.pushListWrite(os,list);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByDeptTypeCode)
    @ApiOperation(value = "就诊费用查询", notes = "就诊费用查询")
    public ListEnvelop findByDeptTypeCode(@ApiParam(name = "deptTypeCode", value = "6总部7金榜8夏禾")
                                @RequestParam(value = "deptTypeCode", required = false)String deptTypeCode) throws Exception{
                                          @RequestParam(value = "deptTypeCode", required = false)String deptTypeCode) throws Exception{
        return success(prescriptionService.findByDeptTypeCode(deptTypeCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getCardInfo)
    @ApiOperation(value = "获取卡信息", notes = "获取卡信息")
    public ObjEnvelop getCardInfo(@ApiParam(name = "cardNo", value = "卡号")
                                  @RequestParam(value = "cardNo", required = false)String cardNo) throws Exception {
        return success(prescriptionService.getCardInfo(cardNo,demoFlag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWithWork)
    @ApiOperation(value = "查询医生带排班", notes = "查询医生带排班")
    public ObjEnvelop findDoctorWithWork(@ApiParam(name = "orgCode", value = "机构code")
@ -473,33 +473,33 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "page", required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true)Integer size) {
        
        return success(prescriptionService.findDoctorWithWork(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus,page,size));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWithMouthWork)
    @ApiOperation(value = "查询医生列表带月份排班状态", notes = "查询医生列表带月份排班状态")
    public ObjEnvelop findDoctorWithMouthWork(@ApiParam(name = "orgCode", value = "机构code")
                                         @RequestParam(value = "orgCode", required = true)String orgCode,
                                         @ApiParam(name = "dept", value = "部门code")
                                         @RequestParam(value = "dept", required = false)String dept,
                                         @ApiParam(name = "date", value = "yyyy-MM")
                                         @RequestParam(value = "date", required = true)String date,
                                         @ApiParam(name = "chargeType", value = "号别")
                                         @RequestParam(value = "chargeType", required = false)String chargeType,
                                         @ApiParam(name = "nameKey", value = "名字关键字")
                                         @RequestParam(value = "nameKey", required = false)String nameKey,
                                         @ApiParam(name = "iswork", value = "不传全部,1.当月已经排班,2.当月未排班")
                                         @RequestParam(value = "iswork", required = false)String iswork,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true)Integer size) {
                                              @RequestParam(value = "orgCode", required = true)String orgCode,
                                              @ApiParam(name = "dept", value = "部门code")
                                              @RequestParam(value = "dept", required = false)String dept,
                                              @ApiParam(name = "date", value = "yyyy-MM")
                                              @RequestParam(value = "date", required = true)String date,
                                              @ApiParam(name = "chargeType", value = "号别")
                                              @RequestParam(value = "chargeType", required = false)String chargeType,
                                              @ApiParam(name = "nameKey", value = "名字关键字")
                                              @RequestParam(value = "nameKey", required = false)String nameKey,
                                              @ApiParam(name = "iswork", value = "不传全部,1.当月已经排班,2.当月未排班")
                                              @RequestParam(value = "iswork", required = false)String iswork,
                                              @ApiParam(name = "page", value = "第几页")
                                              @RequestParam(value = "page", required = true)Integer page,
                                              @ApiParam(name = "size", value = "每页大小")
                                              @RequestParam(value = "size", required = true)Integer size) {
        
        return success(prescriptionService.findDoctorWithMouthWork(orgCode,dept,chargeType,date,nameKey,iswork,page,size));
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWorkTimeInfo)
    @ApiOperation(value = "获取具体号源", notes = "获取具体号源")
    public ListEnvelop findWorkTimeInfo(@ApiParam(name = "id", value = "排班id")
@ -514,14 +514,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "withWork", required = false)String withWork){
        return success(prescriptionService.findDoctorInfo(doctor,withWork));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorBaseInfo)
    @ApiOperation(value = "获取医生基本信息信息", notes = "获取医生基本信息信息")
    public ObjEnvelop findDoctorBaseInfo(@ApiParam(name = "doctor", value = "医生code")
                                     @RequestParam(value = "doctor", required = true)String doctor){
                                         @RequestParam(value = "doctor", required = true)String doctor){
        return success(prescriptionService.findDoctorBaseInfo(doctor));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.cancelOutPatient)
    @ApiOperation(value = "取消复诊", notes = "取消复诊")
    public ObjEnvelop cancelOutPatient(@ApiParam(name = "outPatientId", value = "门诊记录")
@ -532,22 +532,22 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "cancelValue", required = false)String cancelValue,
                                       @ApiParam(name = "cancelRemark", value = "取消原因详细说明")
                                       @RequestParam(value = "cancelRemark", required = false)String cancelRemark) {
        
        return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,1));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCancelReasonList)
    @ApiOperation(value = "获取居民取消原因字典", notes = "获取居民取消原因字典")
    public ListEnvelop findCancelReasonList(){
        return success(prescriptionService.findCancelReasonList());
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findFastRegisterDate)
    @ApiOperation(value = "獲取快速咨詢時間", notes = "獲取快速咨詢時間")
    public ListEnvelop findFastRegisterDate(){
        return success(prescriptionService.findFastRegisterDate());
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByTimeSlot)
    @ApiOperation(value = "获取快速咨询时间分段", notes = "获取快速咨询时间分段")
    public ListEnvelop findByTimeSlot(@ApiParam(name = "startTime", value = "开始时间")
@ -556,8 +556,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "endTime", required = false)String endTime) {
        return success(prescriptionService.findByTimeSlot(startTime,endTime));
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWorkTimeByMonth)
    @ApiOperation(value = "查询某个医生某个月份排班记录", notes = "查询某个医生某个月份排班记录")
    public ListEnvelop findDoctorWorkTimeByMonth(@ApiParam(name = "doctor", value = "医生code")
@ -570,21 +570,21 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                 @RequestParam(value = "endDate", required = false)String endDate) {
        return success(prescriptionService.findDoctorWorkTimeByMonth(doctor,date,startDate,endDate));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWorkRule)
    @ApiOperation(value = "查询排班规则", notes = "查询排班规则")
    public ListEnvelop findWorkRule(@ApiParam(name = "hospital", value = "医生code")
                                    @RequestParam(value = "hospital", required = true)String hospital) {
        return success(prescriptionService.findWorkRule("Scheduling",hospital));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateWorkRule)
    @ApiOperation(value = "保存排班规则", notes = "保存排班规则")
    public ObjEnvelop updateWorkRule(@ApiParam(name = "workRoleJsons", value = "排班规则json")
                                     @RequestParam(value = "workRoleJsons", required = true)String workRoleJsons) {
        return success(prescriptionService.updateWorkRule(workRoleJsons));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorWorkTimeJson)
    @ApiOperation(value = "排班批量保存接口", notes = "排班批量保存接口")
    public ObjEnvelop saveDoctorWorkTimeJson(@ApiParam(name = "type", value = "1.全医院,2.科室,3.医生")
@ -597,19 +597,19 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                             @RequestParam(value = "date", required = false)String date)throws Exception {
        return success(prescriptionService.saveDoctorWorkTimeJson(type,codes,workTimeJson,date));
    }
    
    @PostMapping(value = "test")
    @ApiOperation(value = "test", notes = "test")
    public Envelop test()throws Exception {
        return success(prescriptionService.test());
    }
    
    @PostMapping(value = "test2")
    @ApiOperation(value = "test2", notes = "test2")
    public Envelop test(String no)throws Exception {
        return success(prescriptionService.test2(no));
    }
    
    @PostMapping(value = "/sendMes")
    @ApiOperation(value = "心脏模板消息推送", notes = "心脏模板消息推送")
    public Envelop sendMes(@ApiParam(name = "wxId", value = "wxId")
@ -631,24 +631,24 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "/sendXCXMes")
    @ApiOperation(value = "心脏模板消息推送小程序跳转", notes = "心脏模板消息推送小程序跳转")
    public Envelop sendXCXMes(@ApiParam(name = "wxId", value = "wxId")
                           @RequestParam(value = "wxId", required = true)String wxId,
                           @ApiParam(name = "patient", value = "居民ID")
                           @RequestParam(value = "patient", required = false)String patient,
                           @ApiParam(name = "cardNo", value = "卡号")
                           @RequestParam(value = "cardNo", required = false)String cardNo,
                           @ApiParam(name = "first", value = "头部")
                           @RequestParam(value = "first", required = true)String first,
                           @ApiParam(name = "noticeContent", value = "内容")
                           @RequestParam(value = "noticeContent", required = true)String noticeContent,
                           @ApiParam(name = "remark", value = "备注")
                           @RequestParam(value = "remark", required = true)String remark,
                           @ApiParam(name = "redirectUrl", value = "跳转链接")
                           @RequestParam(value = "redirectUrl", required = true)String miniProgramPagepath,
                           @ApiParam(name = "miniProgramAppId", value = "APPID")
                           @RequestParam(value = "miniProgramAppId", required = true)String miniProgramAppId  ) {
                              @RequestParam(value = "wxId", required = true)String wxId,
                              @ApiParam(name = "patient", value = "居民ID")
                              @RequestParam(value = "patient", required = false)String patient,
                              @ApiParam(name = "cardNo", value = "卡号")
                              @RequestParam(value = "cardNo", required = false)String cardNo,
                              @ApiParam(name = "first", value = "头部")
                              @RequestParam(value = "first", required = true)String first,
                              @ApiParam(name = "noticeContent", value = "内容")
                              @RequestParam(value = "noticeContent", required = true)String noticeContent,
                              @ApiParam(name = "remark", value = "备注")
                              @RequestParam(value = "remark", required = true)String remark,
                              @ApiParam(name = "redirectUrl", value = "跳转链接")
                              @RequestParam(value = "redirectUrl", required = true)String miniProgramPagepath,
                              @ApiParam(name = "miniProgramAppId", value = "APPID")
                              @RequestParam(value = "miniProgramAppId", required = true)String miniProgramAppId  ) {
        return success(xzzxEntranceService.sendXCXMes( wxId, patient, cardNo, first, noticeContent, remark, miniProgramPagepath, miniProgramAppId));
    }
    
    @PostMapping(value = "/sendXZMes")
    @ApiOperation(value = "心脏模板消息推送小程序跳转", notes = "心脏模板消息推送小程序跳转")
    public Envelop ehospitalNotice(
@ -672,30 +672,30 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
        return failed("推送失败");
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientInfo)
    @ApiOperation(value = "获取居民信息接口", notes = "获取居民信息接口")
    public ObjEnvelop findPatientInfo(@ApiParam(name = "patient", value = "居民ID")
                                      @RequestParam(value = "patient", required = true)String patient){
        return success(prescriptionService.findPatientInfo(patient));
        
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
    public Envelop saveDoctorOnlineWork(@ApiParam(name = "onlineWorkJson", value = "保存在线排班json")
                                        @RequestParam(value = "onlineWorkJson", required = true)String onlineWorkJson)throws Exception {
        return prescriptionService.saveDoctorOnlineWork(onlineWorkJson);
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.delDoctorOnlineWork)
    @ApiOperation(value = "删除在线排班", notes = "删除在线排班")
    public Envelop delDoctorOnlineWork(@ApiParam(name = "id", value = "保存在线排班ID")
                                       @RequestParam(value = "id", required = true)String id)throws Exception {
        return prescriptionService.delDoctorOnlineWork(id);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorOnlineWorkList)
    @ApiOperation(value = "查询医生在线排班", notes = "查询医生在线排班")
    public ListEnvelop findDoctorOnlineWorkList(@ApiParam(name = "doctor", value = "医生code")
@ -706,7 +706,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                @RequestParam(value = "endDate", required = true)String endDate)throws Exception {
        return success(prescriptionService.findDoctorOnlineWorkList(doctor,startDate,endDate));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.cooperativeOutpatient)
    @ApiOperation(value = "发起协同门诊", notes = "发起协同门诊")
    public ObjEnvelop cooperativeOutpatient(@ApiParam(name = "outpatientJson", value = "复诊实体json")
@ -716,65 +716,65 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                            @ApiParam(name = "chargeType", value = "号别")
                                            @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType);
    
        
        //构建系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        //发送系统消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
    
        
        //发送医生抢单消息
        if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        }
    
        
        return success(wlyyOutpatientDO);
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveOutpatientDoctor)
    @ApiOperation(value = "设置门诊医生", notes = "设置门诊医生")
    public ObjEnvelop saveOutpatientDoctor(@ApiParam(name = "outpatientJson", value = "复诊实体json")
                                             @RequestParam(value = "outpatientJson", required = true)String outpatientJson,
                                             @ApiParam(name = "registerJson", value = "预约实体json")
                                             @RequestParam(value = "registerJson", required = false)String registerJson,
                                             @ApiParam(name = "chargeType", value = "号别")
                                             @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
                                           @RequestParam(value = "outpatientJson", required = true)String outpatientJson,
                                           @ApiParam(name = "registerJson", value = "预约实体json")
                                           @RequestParam(value = "registerJson", required = false)String registerJson,
                                           @ApiParam(name = "chargeType", value = "号别")
                                           @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        return success(prescriptionService.saveOutpatientDoctor(outpatientJson,registerJson,chargeType));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOauthQRCode)
    @ApiOperation(value = "验证授权", notes = "验证授权")
    public ObjEnvelop checkOauthQRCode(@ApiParam(name = "authorizeNo", value = "流水编号")
                                       @RequestParam(value = "authorizeNo", required = true)String authorizeNo)throws Exception {
        return success(prescriptionService.checkOauthQRCode(authorizeNo));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByGeneralDoctor)
    @ApiOperation(value = "全科医生协同门诊列表", notes = "全科医生协同门诊列表")
    public Envelop findByGeneralDoctor(@ApiParam(name = "generalDoctor", value = "全科医生")
                                           @RequestParam(value = "generalDoctor", required = true)String generalDoctor,
                                           @ApiParam(name = "startDate", value = "开始时间")
                                           @RequestParam(value = "startDate", required = false)String startDate,
                                           @ApiParam(name = "endDate", value = "结束时间")
                                           @RequestParam(value = "endDate", required = false)String endDate,
                                           @ApiParam(name = "status", value = "状态")
                                           @RequestParam(value = "status", required = false)String status,
                                           @ApiParam(name = "sort", value = "排序")
                                           @RequestParam(value = "sort", required = false)String sort,
                                           @ApiParam(name = "page", value = "第几页")
                                           @RequestParam(value = "page", required = true)Integer page,
                                           @ApiParam(name = "size", value = "每页大小")
                                           @RequestParam(value = "size", required = true)Integer size) {
                                       @RequestParam(value = "generalDoctor", required = true)String generalDoctor,
                                       @ApiParam(name = "startDate", value = "开始时间")
                                       @RequestParam(value = "startDate", required = false)String startDate,
                                       @ApiParam(name = "endDate", value = "结束时间")
                                       @RequestParam(value = "endDate", required = false)String endDate,
                                       @ApiParam(name = "status", value = "状态")
                                       @RequestParam(value = "status", required = false)String status,
                                       @ApiParam(name = "sort", value = "排序")
                                       @RequestParam(value = "sort", required = false)String sort,
                                       @ApiParam(name = "page", value = "第几页")
                                       @RequestParam(value = "page", required = true)Integer page,
                                       @ApiParam(name = "size", value = "每页大小")
                                       @RequestParam(value = "size", required = true)Integer size) {
        return prescriptionService.findByGeneralDoctor(generalDoctor,startDate,endDate,status,sort,page,size);
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findGeneralDoctorInfo)
    @ApiOperation(value = "全科医生首页统计信息", notes = "全科医生首页统计信息")
    public ObjEnvelop findGeneralDoctorInfo(@ApiParam(name = "generalDoctor", value = "全科医生")
                                            @RequestParam(value = "generalDoctor", required = true)String generalDoctor) {
        return success(prescriptionService.findGeneralDoctorInfo(generalDoctor));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.sendWlyyOutpatientMes)
    @ApiOperation(value = "发送i健康系统消息", notes = "发送i健康系统消息")
    public ObjEnvelop sendWlyyOutpatientMes(@ApiParam(name = "doctor", value = "全科医生Id")
@ -783,7 +783,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                            @RequestParam(value = "outPatientId", required = true)String outPatientId) {
        return success(wlyyBusinessService.sendWlyyOutpatientMes(doctor,outPatientId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.readWlyyOutpatientMes)
    @ApiOperation(value = "设置I健康消息已读", notes = "设置I健康消息已读")
    public ObjEnvelop readWlyyOutpatientMes(@ApiParam(name = "outPatientId", value = "门诊id")
@ -795,10 +795,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getTodayOutpatinetList)
    @ApiOperation(value = "居民获取当日就诊列表", notes = "居民获取当日就诊列表")
    public ListEnvelop getTodayOutpatinetList(@ApiParam(name = "patient", value = "居民ID")
                                                  @RequestParam(value = "patient", required = true) String patient){
                                              @RequestParam(value = "patient", required = true) String patient){
        return success(prescriptionService.getTodayOutpatinetList(patient,wxId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorMapping)
    @ApiOperation(value = "获取医生mappingcode", notes = "获取医生mappingcode")
    public ObjEnvelop getDoctorMapping(@ApiParam(name = "doctor", value = "医生code")
@ -806,34 +806,41 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @ApiParam(name = "orgCode", value = "机构code")
                                       @RequestParam(value = "orgCode", required = true)String orgCode){
        return success(prescriptionService.getDoctorMapping(doctor,orgCode));
        
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getInspectionDictionary)
    @ApiOperation(value = "获取检查检验", notes = "获取检查检验")
    public ListEnvelop getInspectionDictionary(@ApiParam(name = "pyKey", value = "拼音码")
                                              @RequestParam(value = "pyKey", required = false)String pyKey,
                                              @ApiParam(name = "winNo", value = "6总部7金榜8夏禾")
                                              @RequestParam(value = "winNo", required = true)String winNo,
                                              @ApiParam(name = "codes", value = "检查检验收费码codes,用逗号分割")
                                              @RequestParam(value = "codes", required = false)String codes)throws Exception{
                                               @RequestParam(value = "pyKey", required = false)String pyKey,
                                               @ApiParam(name = "winNo", value = "6总部7金榜8夏禾")
                                               @RequestParam(value = "winNo", required = true)String winNo,
                                               @ApiParam(name = "codes", value = "检查检验收费码codes,用逗号分割")
                                               @RequestParam(value = "codes", required = false)String codes)throws Exception{
        return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionLogByPreId)
    @ApiOperation(value = "查询处方日志", notes = "查询处方日志")
    public ListEnvelop findPrescriptionLogByPreId(@ApiParam(name = "prescriptionCode", value = "处方code")
                                               @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
                                                  @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
        return success(prescriptionLogService.findPrescriptionLogByPreId(prescriptionCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByPrescriptionCodeByStatus)
    @ApiOperation(value = "查询处方流程", notes = "查询处方流程")
    public ListEnvelop findByPrescriptionCodeByStatus(@ApiParam(name = "prescriptionCode", value = "处方code")
                                                      @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
        return success(prescriptionLogService.findByPrescriptionCodeByStatus(prescriptionCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByPartsCode)
    @ApiOperation(value = "查询部位字典", notes = "查询部位字典")
    public ListEnvelop findByPartsCode(@ApiParam(name = "parentCode", value = "父节点ID,第一层为0")
                                                  @RequestParam(value = "parentCode", required = true)String parentCode)throws Exception{
                                       @RequestParam(value = "parentCode", required = true)String parentCode)throws Exception{
        return success(inspectionService.findByPartsCode(parentCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDictByName)
    @ApiOperation(value = "查询检查检验字典", notes = "查询检查检验字典")
    public ListEnvelop findDictByName(@ApiParam(name = "hospital", value = "医院")
@ -842,7 +849,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "name", required = true)String name)throws Exception{
        return success(inspectionService.findDictByName(hospital,name));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getJymb)
    @ApiOperation(value = "检验模板接口")
    public ListEnvelop getJymb(@ApiParam(name = "bz_code", value = "入参条件为第一节点代码")
@ -853,7 +860,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                               @RequestParam(value = "flag",defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getJymb(bz_code,tc_no,flag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getJcmb)
    @ApiOperation(value = "检查模板接口")
    public ListEnvelop getJcmb(
@ -865,7 +872,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "flag",defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getJcmb(bz_code,tc_no,flag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getTcChild)
    @ApiOperation(value = "套餐子项目字典接口")
    public ListEnvelop getTcChild(
@ -873,7 +880,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "parent_code",defaultValue = "") String parent_code) throws Exception {
        return success(prescriptionService.getTcChild(parent_code));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getInsChild)
    @ApiOperation(value = "主项目绑定子项目字典接口")
    public ListEnvelop getInsChild(
@ -881,7 +888,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "zd_charge_code",defaultValue = "") String zd_charge_code) throws Exception {
        return success(prescriptionService.getInsChild(zd_charge_code));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getTcxz)
    @ApiOperation(value = "套餐选择接口")
    public ListEnvelop getTcxz(
@ -893,21 +900,21 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "flag",defaultValue = "1") String flag) throws Exception {
        return success(prescriptionService.getTcxz(charge_code,tc_no,flag));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorPreSign)
    @ApiOperation(value = "获取医生签名")
    public ObjEnvelop getDoctorPreSign(@ApiParam(name = "doctor", value = "医生编码")
                                         @RequestParam(value = "doctor",required = false) String doctor)throws Exception{
                                       @RequestParam(value = "doctor",required = false) String doctor)throws Exception{
        return success(doctorPreSignService.getDoctorSign(doctor));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorIntroduction)
    @ApiOperation(value = "获取医生简介")
    public ObjEnvelop getDoctorIntroduction(@ApiParam(name = "doctor", value = "医生编码")
                                            @RequestParam(value = "doctor",required = false) String doctor)throws Exception{
        return success(prescriptionService.getDoctorIntroduction(doctor));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByDict)
    @ApiOperation(value = "查询医院字典", notes = "查询医院字典")
    public ListEnvelop findByDict(@ApiParam(name = "name", value = "字典名称")
@ -920,17 +927,17 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getPatientAccetokenByIdcard)
    @ApiOperation(value = "根据居民CODE换取居民请求秘钥")
    public Envelop getPatientAccetokenByIdcard(@ApiParam(name = "patientCode", value = "居民CODE")
                                       @RequestParam(value = "patientCode",required = true) String patientCode)throws Exception{
                                               @RequestParam(value = "patientCode",required = true) String patientCode)throws Exception{
        return success(wlyyBusinessService.wlyyGetPatientAccetokenByIdcard(patientCode));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWlyyPatient)
    @ApiOperation(value = "获取居民信息")
    public Envelop findWlyyPatient(@ApiParam(name = "idcard", value = "idcard")
                                               @RequestParam(value = "idcard",required = true) String idcard)throws Exception{
                                   @RequestParam(value = "idcard",required = true) String idcard)throws Exception{
        return success(wlyyBusinessService.findWlyyPatient(idcard));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientListBySscOrIdCard)
    @ApiOperation(value = "获取居民身份证信息")
    public Envelop findPatientListBySscOrIdCard(@ApiParam(name = "idcard", value = "idcard")
@ -945,11 +952,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
        return failed("身份证或医保卡格式有误");
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.makeBase64Qrcode)
    @ApiOperation(value = "获取医生二维码")
    public ObjEnvelop makeBase64Qrcode(@ApiParam(name = "doctor", value = "医生ID")
                                    @RequestParam(value = "doctor",required = true) String doctor)throws Exception{
                                       @RequestParam(value = "doctor",required = true) String doctor)throws Exception{
        return success("获取医生二维码成功",wlyyBusinessService.makeBase64Qrcode(doctor));
    }
    
@ -963,30 +970,30 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        List<Map<String,Object>>  data = imService.doctorUpcomingList(doctorCode, type);
        if (data != null) {
            for (Map<String,Object> consult : data) {
                Integer consultType =  Integer.parseInt(consult.get("type").toString());
                if("1,15".equals(consultType)){//专家咨询
                if("1,15".equals(type)){//专家咨询
                    Integer consultType =  Integer.parseInt(consult.get("type").toString());
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("doctorCode").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("generalDoctor").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else{}
                }else if("9".equals(consultType)){//图文复诊
                }else if("9".equals(type)){//图文复诊
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientid")!=null?consult.get("outpatientid").toString():null+"_9");
                    consult.put("type",consultType);
                }else if("16".equals(consultType)){//视频复诊
                    consult.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientid")!=null?consult.get("outpatientid").toString():null+"_16");
                    consult.put("type",consultType);
                    consult.put("type",type);
                }else if("12".equals(type)){//协同门诊
                    consult.put("session_id", consult.get("patientId")!=null?consult.get("patientId").toString():null+"_"+consult.get("outpatientid")!=null?consult.get("outpatientid").toString():null+"_12");
                    consult.put("type",consultType);
                    consult.put("type",type);
                }else{}
            
                
                array.add(consult);
            }
        }
        return success(array);
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.setRecord)
    @ApiOperation(value = "his建立档案与互联网医院账户同步")
    public Envelop setRecord(@ApiParam(name = "json", value = "档案实体json")
@ -995,7 +1002,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                             @RequestParam(value = "type",required = true)String type)throws Exception{
        return success(prescriptionService.setRecord(json,type));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientRecord)
    @ApiOperation(value = "获取HIIS居民档案信息")
    public Envelop findPatientRecord(@ApiParam(name = "idcard", value = "居民身份证")
@ -1008,7 +1015,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "ybcard",required = false)String ybcard)throws Exception{
        return success(prescriptionService.findPatientRecord(idcard,patient,admitNum,ybcard));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByName)
    @ApiOperation(value = "获取医生信息")
    public ListEnvelop findDoctorByName(@ApiParam(name = "hospital", value = "医院code")
@ -1019,7 +1026,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                        @RequestParam(value = "chargeType",required = false)String chargeType) {
        return success(prescriptionService.findDoctorByName(hospital,name,chargeType));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptWithDoctorWorkTime)
    @ApiOperation(value = "获取带排班部门")
    public ListEnvelop findDeptWithDoctorWorkTime(@ApiParam(name = "hospital", value = "医院code")
@ -1032,29 +1039,29 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                  @RequestParam(value = "pagesize",required = false)Integer pagesize) {
        return success(prescriptionService.findDeptWithDoctorWorkTime(hospital,keyWord,page,pagesize));
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.findWorkTimeRule)
    @ApiOperation(value = "查询排班规则")
    public ObjEnvelop findWorkTimeRule(@ApiParam(name = "hospital", value = "医院code")
                                       @RequestParam(value = "hospital",required = true)String hospital) {
        return success(workTimeService.findWorkTimeRule(hospital));
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveWorkTimeRule)
    @ApiOperation(value = "保存排班规则")
    public ObjEnvelop saveWorkTimeRule(@ApiParam(name = "workTimeRuleJson", value = "保存排班规则")
                                           @RequestParam(value = "workTimeRuleJson",required = true)String workTimeRuleJson) throws Exception{
                                       @RequestParam(value = "workTimeRuleJson",required = true)String workTimeRuleJson) throws Exception{
        return success(workTimeService.saveWorkTimeRule(workTimeRuleJson));
    }
    
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.checkDoctorWork)
    @ApiOperation(value = "判断医生是否在班")
    public ObjEnvelop checkDoctorWork(@ApiParam(name = "doctor", value = "判断医生是否在班")
                                      @RequestParam(value = "doctor",required = true)String doctor) throws Exception{
        return success(workTimeService.checkDoctorWork(doctor));
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.importDoctorWork)
    @ApiOperation(value = "导入排班信息")
    public ListEnvelop importDoctorWork(@ApiParam(name = "file", value = "文件", required = true)
@ -1067,14 +1074,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        request.setCharacterEncoding("UTF-8");
        DoctorWorkTimeExcelReader reader = new DoctorWorkTimeExcelReader();
        reader.read(file);
        
        if("-1".equals(reader.getCode())) {
            ListEnvelop envelop = new ListEnvelop();
            envelop.setStatus(-1);
            envelop.setMessage("目前仅支持200位医生同时导入!");
            return envelop;
        }
        
        List<DoctorWorkTimeMainExcelDO> errorLs = reader.getErrorLs();
        List<DoctorWorkTimeMainExcelDO> correctLs = reader.getCorrectLs();
        if(errorLs!=null&&errorLs.size()>0){
@ -1084,12 +1091,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            envelop.setDetailModelList(errorLs);
            return envelop;
        }
        
        Map<String,Object> rs = workTimeService.getExcelWorkInfo(correctLs,dateMoth,hospital);
        List<DoctorWorkTimeMainExcelDO> error = (List<DoctorWorkTimeMainExcelDO>)rs.get("error");
        Integer errorTotal = (Integer) rs.get("errorTotal");
        Integer succTotal = (Integer) rs.get("succTotal");
        
        if(error!=null&&error.size()>0){
            ListEnvelop envelop = new ListEnvelop();
            envelop.setStatus(-1);
@ -1097,15 +1104,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            envelop.setDetailModelList(error);
            return envelop;
        }
        
        ListEnvelop envelop = new ListEnvelop();
        envelop.setStatus(200);
        envelop.setMessage("导入成功!"+succTotal+"位医生排班数据!");
        envelop.setDetailModelList(error);
        return envelop;
    }
    
    
    /**
     * 易联众统一支付
     * @param relationCode
@ -1125,8 +1132,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
     * 查询支付状态
     * @param relationCode
@ -1144,8 +1151,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
     * 易联众统一退款
     *
@ -1169,8 +1176,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
     * 易联众统一订单查询
     *
@ -1192,29 +1199,29 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.selectPrescriptionList)
    @ApiOperation(value = "查询处方列表")
    public ListEnvelop findPrescriptionList(@ApiParam(name = "hospital", value = "医院code")
                                                  @RequestParam(value = "hospital",required = false)String hospital,
                                                  @ApiParam(name = "dept", value = "科室code")
                                                  @RequestParam(value = "dept",required = false)String dept,
                                                  @ApiParam(name = "status", value = "状态")
                                                  @RequestParam(value = "status",required = false)String status,
                                                  @ApiParam(name = "startTime", value = "开始时间")
                                                  @RequestParam(value = "startTime",required = false)String startTime,
                                                  @ApiParam(name = "endTime", value = "结束时间")
                                                  @RequestParam(value = "endTime",required = false)String endTime,
                                                  @ApiParam(name = "nameinfo", value = "医生名字/患者名字")
                                                  @RequestParam(value = "nameinfo",required = false)String nameinfo,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page",required = false)Integer page,
                                                  @ApiParam(name = "pagesize", value = "每页大小")
                                                  @RequestParam(value = "pagesize",required = false)Integer pagesize) {
                                            @RequestParam(value = "hospital",required = false)String hospital,
                                            @ApiParam(name = "dept", value = "科室code")
                                            @RequestParam(value = "dept",required = false)String dept,
                                            @ApiParam(name = "status", value = "状态")
                                            @RequestParam(value = "status",required = false)String status,
                                            @ApiParam(name = "startTime", value = "开始时间")
                                            @RequestParam(value = "startTime",required = false)String startTime,
                                            @ApiParam(name = "endTime", value = "结束时间")
                                            @RequestParam(value = "endTime",required = false)String endTime,
                                            @ApiParam(name = "nameinfo", value = "医生名字/患者名字")
                                            @RequestParam(value = "nameinfo",required = false)String nameinfo,
                                            @ApiParam(name = "page", value = "第几页")
                                            @RequestParam(value = "page",required = false)Integer page,
                                            @ApiParam(name = "pagesize", value = "每页大小")
                                            @RequestParam(value = "pagesize",required = false)Integer pagesize) {
        return success(prescriptionService.selectByCondition(hospital,dept,status,startTime,endTime,nameinfo,page,pagesize,wxId));
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.updateStatus)
    @ApiOperation("完成自取")
    public ObjEnvelop updateStatus(
@ -1229,7 +1236,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    /**
     * 更改单号
     * @param id
@ -1251,7 +1258,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    /**
     * 处方-- 审方
     *
@ -1266,37 +1273,109 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.prescriptionCheck)
    @ApiOperation("处方-审方")
    public ObjEnvelop prescriptionCheck(
            @ApiParam(name = "operate", value = "operate", required = true)
            @ApiParam(name = "operate", value = "审核人", required = true)
            @RequestParam(required = true)String operate,
            @ApiParam(name = "operateName", value = "operateName", required = true)
            @ApiParam(name = "operateName", value = "审核人名字", required = true)
            @RequestParam(required = true)String operateName,
            @ApiParam(name = "reason", value = "reason", required = true)
            @ApiParam(name = "reason", value = "审核原因", required = true)
            @RequestParam(required = true)String reason,
            @ApiParam(name = "status", value = "status", required = true)
            @ApiParam(name = "status", value = "0未审核1审核退回2审核通过", required = true)
            @RequestParam(required = true)Integer status,
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            //String operate,String operateName,String reason,Integer status,String prescriptionId
            return ObjEnvelop.getSuccess("ok",prescriptionService.saveCheck(operate,operateName,reason,status,prescriptionId));
            return ObjEnvelop.getSuccess("ok",prescriptionService.saveCheck(operate,operateName,reason,status,prescriptionId,wxId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
     * 医生端-处方处理
     *
     * @param operate
     * @param reason
     * @param status
     * @param prescriptionId
     * @return
     * @throws Exception
     */
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.savePrescriptionCheck)
    @ApiOperation("医生端-处方处理")
    public ObjEnvelop savePrescriptionCheck(
            @ApiParam(name = "operate", value = "操作人code", required = true)
            @RequestParam(required = true)String operate,
            @ApiParam(name = "reason", value = "处理原因", required = true)
            @RequestParam(required = true)String reason,
            @ApiParam(name = "status", value = "3处方修改4执行处方", required = true)
            @RequestParam(required = true)Integer status,
            @ApiParam(name = "prescriptionId", value = "处方id", required = true)
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            //String operate,String operateName,String reason,Integer status,String prescriptionId
            return ObjEnvelop.getSuccess("ok",prescriptionService.savePrescriptionCheck(operate,reason,status,prescriptionId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
     * 查询审核历史记录
     *
     * @param prescriptionId
     * @return
     * @throws Exception
     */
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.prescriptionCheckList)
    @ApiOperation("查询审核历史记录")
    public ObjEnvelop prescriptionCheckList(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            
            return ObjEnvelop.getSuccess("ok",prescriptionService.findPrescriptionCheck(prescriptionId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    /**
     * 查询单条处方记录
     * @param prescriptionId
     * @return
     * @throws Exception
     */
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.selectByPrescriptionId)
    @ApiOperation("查询单条处方记录")
    public ObjEnvelop selectByPrescriptionId(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true)String prescriptionId) throws Exception {
        try {
            
            return ObjEnvelop.getSuccess("ok",prescriptionService.selectByPrescriptionId(prescriptionId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.deleteById)
    @ApiOperation("医生端-逻辑删除业务数据")
    public ObjEnvelop deleteById(
            @ApiParam(name = "flag", value = "1药品2诊断3检查", required = true)
            @RequestParam(required = true)Integer flag,
            @ApiParam(name = "id", value = "业务id", required = true)
            @RequestParam(required = true)String id) throws Exception {
        try {
            prescriptionService.deleteById(flag,id);
            return ObjEnvelop.getSuccess("ok",null);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
}

+ 11 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ylz/YlzNotifyController.java

@ -14,8 +14,12 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.order.BusinessOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.RequestMapping;
@ -38,6 +42,9 @@ import com.ylzinfo.onepay.sdk.utils.StringUtil;
public class YlzNotifyController<T> {
	private static final Logger LOGGER = LoggerFactory.getLogger(YlzNotifyController.class);
	@Autowired
	private BusinessOrderService businessOrderService;
	/**
	 * 商户页面跳转(模拟测试)
	 * @param request
@ -157,6 +164,10 @@ public class YlzNotifyController<T> {
				if (!isVerify) {
					response.getWriter().write("FAILURE");
				} else {
					String param = JSON.toJSONString(decryptRes.getParam());
					JSONObject object = JSONObject.parseObject(param);
					String orderNo = object.getString("outChargeNo");
					businessOrderService.updatePayStatus(orderNo);
					response.getWriter().write("SUCCESS");
				}
			}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -288,7 +288,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        //判断账户是否重复
        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID());
        if (account==null){
        if (account!=null){
            return MixEnvelop.getSuccess("账户已注册",-1);
        }

+ 32 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

@ -58,7 +58,7 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
    @Autowired
    private HttpClientUtil httpClientUtil;
    private final static String jobUrl = "http://localhost:10031/job/reStartById?taskId=data_sim_Balance_remind_job";
    private final static String jobUrl = "http://172.26.0.109:10031/job/reStartById?taskId=data_sim_Balance_remind_job";
    /**
     * 增加SIM卡管理
@ -122,11 +122,15 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(Integer page, Integer size, String status, String sim, String sn){
        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE del=0 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count from iot_device_sim c  WHERE del=0 ");
//        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE del=0 ");
        StringBuffer sql = new StringBuffer("SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim" +
                " LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        StringBuffer sqlCount = new StringBuffer("SELECT  COUNT(c.id) count  FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim " +
                "LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sql.append(" and c.status=").append(status);
            sqlCount.append("and c.status='").append(status).append("' ");
            args.add(status);
        }
@ -140,7 +144,30 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
//        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql.toString());
        ArrayList<IotDeviceSimDO> list = new ArrayList<>();
        mapList.forEach(one->{
            IotDeviceSimDO iotDeviceSimDO = JSONObject.parseObject(JSONObject.toJSONString(one), IotDeviceSimDO.class);
            if (one.get("patient_name")!=null){
                iotDeviceSimDO.setContactsName(one.get("patient_name").toString());
            }
            if (one.get("mobile")!=null){
                iotDeviceSimDO.setContactsMobile(one.get("mobile").toString());
            }
            if (one.get("sn")!=null){
                iotDeviceSimDO.setDeviceSn(one.get("sn").toString());
            }
            if (one.get("name")!=null){
                iotDeviceSimDO.setDeviceName(one.get("name").toString());
            }
            //更新表中数据
            iotDeviceSimDao.save(iotDeviceSimDO);
            list.add(iotDeviceSimDO);
        });
        List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

@ -71,7 +71,7 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> deleteType(String id) {
        IotWorkTypeDO type = iotWorkTypeDao.findOne(id);
        if(type.getDel().equalsIgnoreCase("1")){
            return MixEnvelop.getError("该企业已删除,请勿重复删除");
            return MixEnvelop.getError("该业务类型已删除,请勿重复删除");
        }
        type.setDel("1");
        iotWorkTypeDao.save(type);