Преглед изворни кода

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

wangjun пре 4 година
родитељ
комит
4a47f0290a
14 измењених фајлова са 308 додато и 129 уклоњено
  1. 10 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  2. 9 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  3. 23 16
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  4. 49 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 4 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  6. 5 20
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  7. 8 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  8. 13 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  9. 2 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 17 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  11. 71 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  12. 48 34
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  13. 1 10
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java
  14. 48 42
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

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

@ -2,8 +2,10 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
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 org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@ -16,6 +18,9 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.status in(0,1)")
    List<WlyyOutpatientDO> findByPatientList(String patient);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.his_status=1")
    List<WlyyOutpatientDO> findByPatientListNoStatus(String patient);
    List<WlyyOutpatientDO> findByDoctorAndStatus(String doctor,String status);
    @Query("from WlyyOutpatientDO a where a.doctor = ?1 and a.status in(2,3)")
@ -47,4 +52,9 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    /*@Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = 1")
    List<WlyyOutpatientDO> findOutpatientByPatientAndStatus(String patient);*/
    @Transactional
    @Modifying
    @Query("update WlyyOutpatientDO p set p.hisStatus=?2 where p.id=?1")
    void updateHisStatusById(String id,Integer hisStatus);
}

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

@ -22,6 +22,12 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("update WlyyPrescriptionDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,Integer status);
    @Transactional
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.status=?2,p.payTime=?3  where p.realOrder=?1")
    void updateStatusByRealOrder(String realOrder,Integer status,Date payTime);
    @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);
@ -49,6 +55,9 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.admNo = ?1 and a.realOrder =?2 ")
    List<WlyyPrescriptionDO> findByAdmNoAndRealOrderList(String adnmo,String realOrder);
    @Query("select a from WlyyPrescriptionDO a where a.outpatientId = ?1 and a.status>=20 and a.status<30 ")
    List<WlyyPrescriptionDO> findByOutPatientIdList(String outpatientId);
    List<WlyyPrescriptionDO> findByDoctorAndCreateTimeAndRemark(String doctor,Date createTime,String remark);
}

+ 23 - 16
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java

@ -1,30 +1,38 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.http.HttpClientUtil;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
@Service
public class PayInfoNoticeService {
    @Value("${hospital.url}")
    private String serverUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private BasePatientDao patientDao;
    public String pushPrescriptionPay(String patient,String doctorName,String orderNo,String outpatientId,String prescriptionId,String total){
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){
            String userName = patientDO.getName();
            String idcard = patientDO.getIdcard();
            String phone = patientDO.getMobile();
            String title="您在厦门大学附属中山医院有一笔诊察/处方费用以支付完成!";
            String url = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+prescriptionId;
            String remark = "结算方式:微信结算" +
                    "点击查看取药\n物流信息";
            return paySuccessNotice(userName,idcard,phone,title,url,doctorName,total,"0",total,orderNo,remark);
        }
        return null;
    }
    /**
     * 支付成功提醒
@ -44,20 +52,19 @@ public class PayInfoNoticeService {
     */
    public String paySuccessNotice(String userName,String idCard,String phone,String title,String url,
                                   String doctorName,String total,String miPay,String selfPay,String orderNo,String remark) {
        url = "https://172.16.1.34";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("userName", userName);
        jsonObject.put("idCard", idCard);
        jsonObject.put("phone", phone);
        jsonObject.put("title", title);
        jsonObject.put("url", serverUrl);
        jsonObject.put("url", url);
        jsonObject.put("doctorName", doctorName);
        jsonObject.put("total", total);
        jsonObject.put("miPay", miPay);
        jsonObject.put("selfPay", selfPay);
        jsonObject.put("orderNo", orderNo);
        jsonObject.put("remark", remark);
        String responseMsg = httpClientUtil.sendPost(url + "/interface/paySuccessNoticePush.htm", jsonObject.toJSONString());
        String responseMsg = httpClientUtil.sendPost(serverUrl + "/interface/paySuccessNoticePush.htm", jsonObject.toJSONString());
        JSONObject result = new JSONObject();
        String respCode = "";
        if (responseMsg != null) {

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

@ -1747,6 +1747,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return res;
    }
    public net.sf.json.JSONObject refundRegisterNo(String outpatientId) throws Exception {
        net.sf.json.JSONObject res = new net.sf.json.JSONObject();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if(outpatientDO!=null){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
            if (StringUtils.isNoneBlank(outpatientDO.getRegisterNo())){
                net.sf.json.JSONObject rs = entranceService.BS10138(outpatientDO.getCardNo(), doctorMappingDO.getMappingCode(), outpatientDO.getDept(), outpatientDO.getRegisterNo(), outpatientDO.getWinNo(), demoFlag);
                res= rs.getJSONObject("resquest");
                logger.info("挂号结果 res: " + res.toString());
                String rsCode = res.getString("@RESULT");
                //保存日志
                WlyyHttpLogDO log = new WlyyHttpLogDO();
                log.setCode("refundregisterOutPatient");
                log.setName("退号");
                log.setPatient(outpatientDO.getPatient());
                log.setDoctor(outpatientDO.getDoctor());
                log.setResponse(rs.toString());
                log.setRequest("outPatientId=" + outpatientId + "&doctor=" + outpatientDO.getDoctor());
                log.setStatus(rsCode);
                log.setCreateTime(new Date());
                wlyyHttpLogDao.save(log);
            }
        }
        return  res;
    }
    public String registDianziBingli(WlyyOutpatientDO outpatientDO, BasePatientDO basePatientDO, Integer manageType, String RegisterSN, String registerCon) throws Exception {
        //调用电子病历接口注册居民信息
@ -2650,13 +2677,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql = sql + "date_format(p.pay_time,'YYYY-MM-DD hh24:mi:ss')  AS \"payTime\",";
            }else {
                sql = sql + "to_char(p.pay_time,'YYYY-MM-DD hh24:mi:ss')  AS \"payTime\",";
            }
        } else {
            sql = sql + "date_format(p.pay_time,'%Y-%m-%d %H:%i:%S' )  AS \"payTime\",";
        }
        sql = sql + " e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " p.status as \"status\", " +
                " p.id AS \"prescriptionId\" ," +
                " e.id AS \"expressageId\"" +
                " e.id AS \"expressageId\""+
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
@ -7197,7 +7234,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
                        String patientCode = prescriptionDO.getPatientCode();
                        String realerOrder = prescriptionDO.getRealOrder();
                        String free = prescriptionDO.getDrugFee() + "";
                        String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(), "yyyyMMddHHmmss");
                        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(prescriptionDO.getDoctor());
                        String applyDepaName = null;
@ -7223,6 +7260,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            cardNo = outpatientDO.getCardNo();
                        }
                        logger.info("cardNo:" + cardNo);
                        Double total = 0.0;
                        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutpatientId(prescriptionDO.getOutpatientId());
                        for (WlyyPrescriptionDO wlyyPrescriptionDO1:wlyyPrescriptionDOS){
                            total +=wlyyPrescriptionDO1.getDrugFee();
                        }
                        String free = total + "";
                        List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByPatientListNoStatus(patientCode);
                        if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
                            free=(Double.parseDouble(free)+15)+"";
                        }
                        ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
                    }
                    //sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);

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

@ -75,6 +75,8 @@ public class EntranceService {
    private static String BS10110 = "BS10110";
    //线上挂号接口
    private static String BS10111 = "BS10111";
    //线上退号接口
    private static String BS10138= "BS10138";
    //线上处方接口
    private static String BS10112 = "BS10112";
    //医生挂号权限查询接口
@ -856,8 +858,8 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public net.sf.json.JSONObject BS10112(String card_no, String doctor, String dept, String serial_no, String win_no, boolean demoFlag) throws Exception {
        String fid = BS10111;
    public net.sf.json.JSONObject BS10138(String card_no, String doctor, String dept, String serial_no, String win_no, boolean demoFlag) throws Exception {
        String fid = BS10138;
        logger.info("EntranceService " + fid + " card_no :" + card_no + " doctor:" + doctor + " dept:" + dept + " serial_no:" + serial_no + " win_no:" + win_no);
        String resp = "";

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

@ -2,7 +2,6 @@ package com.yihu.jw.order.pay.ylz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
@ -269,13 +268,7 @@ public class YlzPayService {
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        JSONObject jsonObject = new JSONObject();
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("EXAMFREE");
        Double free = 0.0;
        if (hospitalSysDictDO!=null){
            free = Double.parseDouble(fee)+Integer.parseInt(hospitalSysDictDO.getDictValue());
        }else {
            free = Double.parseDouble(fee);
        }
        Double free = Double.parseDouble(fee);
        try {
            jsonObject.put("cardType",cardType);//卡类型01 社保卡 06 临时卡
            jsonObject.put("cardNo",cardNo);//卡号
@ -584,7 +577,7 @@ public class YlzPayService {
        String error = null;
        RequestParams requestParams = new RequestParams();
        try {
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_balance_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
@ -598,27 +591,19 @@ public class YlzPayService {
        requestParams.setSignType(signType);
        requestParams.setEncryptType(encryptType);
        requestParams.setTimestamp(DateUtil.getCurrentDateTime());
        //分页参数
        if(StringUtils.isNotBlank(queryType)&&"online".equalsIgnoreCase(queryType)){
        if (StringUtils.isNoneBlank(pageNo)&&StringUtils.isNoneBlank(pageSize)){
            JSONObject pageParam = new JSONObject();
            pageParam.put("pageNo",pageNo);
            pageParam.put("pageSize",pageSize);
            requestParams.setPageParam(pageParam);
        }
        JSONObject params = new JSONObject();
        if (StringUtils.isBlank(cardNo)||StringUtils.isBlank(queryType)){
            return "cardNo或者queryType不能为空";
        }
        if (queryType.equalsIgnoreCase("onlineRecordDetail")){
            if(StringUtils.isBlank(billSn)||StringUtils.isBlank(traceNo)){
                return "billSn和traceNo不能为空";
            }
        }
        params.put("cardNo",cardNo);
        params.put("queryType",queryType);
        if (StringUtils.isNotBlank(beginDate)){
            params.put("beginDate",beginDate);
        }if (StringUtils.isNotBlank(endDate)){
        }
        if (StringUtils.isNotBlank(endDate)){
            params.put("endDate",endDate);
        }
        if (StringUtils.isNotBlank(billSn)){

+ 8 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
@ -157,6 +159,8 @@ public class ImService {
	private SystemMessageService systemMessageService;
	@Autowired
	private BaseUserMessageDao userMessageDao;
	@Autowired
	private BaseDoctorHospitalDao doctorHospitalDao;
	
	@Value("${wechat.id}")
	private String wxId;
@ -2254,6 +2258,10 @@ public class ImService {
			if (map.get("doctor")!=null){
				String doctorId = map.get("doctor").toString();
				BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					map.put("deptName",doctorHospitalDOS.get(0).getDeptName());
				}
				if (baseDoctorDO!=null){
					map.put("doctorName",baseDoctorDO.getName());
				}

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

@ -238,6 +238,10 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    *提醒次数
     */
    private Integer remindCount;
    /**
     * 0未结算1已结算
     */
    private Integer hisStatus;
    @Column(name = "remind_count")
    public Integer getRemindCount() {
        return remindCount;
@ -621,4 +625,13 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setSource(String source) {
        this.source = source;
    }
    @Column(name = "his_status")
    public Integer getHisStatus() {
        return hisStatus;
    }
    public void setHisStatus(Integer hisStatus) {
        this.hisStatus = hisStatus;
    }
}

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

@ -913,6 +913,8 @@ public class BaseHospitalRequestMapping {
        //添加(复诊咨询,协同门诊)
        public static final String addPrescriptionConsult ="/addPrescriptionConsult";
        public static final String refundRegisterNo = "/refundRegisterNo";
        public static final String addConsult= "addConsult";
    
        //全科医生发起求助专科医生的专家咨询

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

@ -4,7 +4,6 @@ package com.yihu.jw.entrance.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.RegisterService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
@ -156,6 +155,23 @@ public class MqSdkController extends EnvelopRestEndpoint {
        return ObjEnvelop.getSuccess("获取成功",obj);
    }
    @PostMapping(value = "/BS10138")
    @ApiOperation(value = "  线上挂号接口")
    public ObjEnvelop BS10138(
            @ApiParam(name = "cardNo", value = "卡号")
            @RequestParam(value = "cardNo", required = false) String cardNo,
            @ApiParam(name = "doctor", value = "医生工号")
            @RequestParam(value = "doctor", required = false) String doctor,
            @ApiParam(name = "dept", value = "科室编码")
            @RequestParam(value = "dept", required = false) String dept,
            @ApiParam(name = "serial_no", value = "挂号号")
            @RequestParam(value = "serial_no", required = false) String serial_no,
            @ApiParam(name = "winNo", value = "分部号")
            @RequestParam(value = "winNo", required = false) String winNo) throws Exception {
        JSONObject obj = entranceService.BS10138(cardNo, doctor, dept, serial_no, winNo,demoFlag);
        return ObjEnvelop.getSuccess("获取成功",obj);
    }
    //多个前端使用json传参
    @PostMapping(value = "/BS10112")
    @ApiOperation(value = "线上处方接口")

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

@ -9,9 +9,11 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
@ -19,6 +21,7 @@ import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -96,6 +99,10 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	private ConsultDao consultDao;
	@Autowired
	private YkyyEntranceService ykyyEntranceService;
	@Autowired
	private YlzPayService ylzPayService;
	@Autowired
	private PatientMappingDao patientMappingDao;
	
	@Value("${wechat.id}")
	private String wxId;
@ -234,6 +241,43 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			return success("操作成功",result);
	}
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.refundRegisterNo)
	@ApiOperation(value = "退号", notes = "退号")
	public Envelop refundRegisterNo(@ApiParam(name = "outpatientCode", value = "就诊记录code", defaultValue = "1")
										  @RequestParam(value = "outpatientCode", required = true) String outpatientCode)throws Exception{
		JSONObject result = new JSONObject();
		synchronized (outpatientCode.intern()){
			if(!"xm_ykyy_wx".equals(wxId)){//中山医院-心脏中心需要挂号
				//1.调用退号接口
				logger.info("调用挂号接口====START");
				String rsCode = "";
				String mes = "";
				if("xm_xzzx_wx".equals(wxId)){ //心脏中心挂号
				}else {
					if (demoFlag.equalsIgnoreCase("true")){
						rsCode="0";
						mes="已退号";
					}else {
						net.sf.json.JSONObject res = prescriptionService.refundRegisterNo(outpatientCode);
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
					}
				}
				if("-1".equals(rsCode)){
					return failed(mes);
				}
				logger.info("调用退号接口====END");
			}else {
			}
		}
		return success("操作成功",result);
	}
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.addConsult)
	@ApiOperation(value = "添加(复诊咨询,协同门诊)", notes = "添加(复诊咨询,协同门诊)")
@ -369,9 +413,34 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		JSONObject msgObj = new JSONObject();
		msgObj.put("msg",baseDoctorDO.getName()+"结束了咨询");
		msgObj.put("consultcode",consult);
		
		String jsonStr = "";
		
		ConsultDo cons = consultDao.findOne(consult);
		if (StringUtils.isNoneBlank(cons.getRelationCode())){
			List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByPatientListNoStatus(cons.getPatient());
			//发送诊断消息
			if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
				WlyyOutpatientDO outpatientDO = wlyyOutpatientDOList.get(0);
				BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
				String userName = null;
				String idcard = null;
				if (patientDO != null) {
					userName = patientDO.getName();
					idcard = patientDO.getIdcard();
				}
				PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
				String userNo = null;
				if (patientMappingDO != null) {
					userNo = patientMappingDO.getMappingCode();
				}
				String cardNo = null;
				if (StringUtils.isNoneBlank(outpatientDO.getCardNo())) {
					cardNo = outpatientDO.getCardNo();
				}
				String date=DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyyMMddHHmmss");
				ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, null, outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, "15", "1");
			}
		}
		if(1 == resutl){
			jsonStr = "{\"id\":\""+ UUID.randomUUID().toString()+"\",\"sender_id\":\""+doctorCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
		}

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

@ -21,6 +21,7 @@ import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PayInfoNoticeService;
@ -45,7 +46,6 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.WechatDao;
@ -149,6 +149,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private EntranceService entranceService;
    @Autowired
    private PayInfoNoticeService payInfoNoticeService;
    @Autowired
    private OutpatientDao outpatientDao;
    private String successxml = "SUCCESS";
@ -503,12 +505,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                        }
                    }
                    businessOrderService.updatePayStatus(traceNo);
                    response.getWriter().write("SUCCESS");
                    return "SUCCESS";
                }
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            e.printStackTrace();
        }
        return appId;
@ -562,7 +563,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        } catch (Exception e1) {
            logger.error("解密回调报文错误");
            response.getWriter().write("ERROR:" + e1.getMessage());
            return e1.getMessage();
        }
        OnepayClient payService = new OnepayClient("", appId, appSecret, res.getSignType(), res.getEncryptType());
@ -604,14 +605,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                        businessOrderService.updatePayStatus(outChargeNo);
                    }
                }
                response.getWriter().write("SUCCESS");
                return "SUCCESS";
            } else {
                response.getWriter().write("FAIL");
                return "FAIL";
            }
        } catch (Exception e) {
            error = e.getMessage();
            response.getWriter().write(e.getMessage());
            e.printStackTrace();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.verifyResponseSign", "支付回调", "POST", null,JSON.toJSONString(responseParams), jsonObject, error,logService.shoppatType);
        return appId;
@ -813,7 +813,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
        logger.info("回调参数:{}", params);
        if (StringUtil.isEmpty(params)) {
            response.getWriter().write("empty");
            return appId;
        }
        // 参数转换
@ -823,45 +822,60 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            logger.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
            JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
                boolean isVerify = true;
                logger.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
                    JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
                    JSONObject param = jsonObject.getJSONObject("param");
                    logger.info("param"+params);
                    String cardNo = param.getString("cardNo");
                    String traceNo = param.getString("traceNo");
                    String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
                    JSONObject jsonObjectTotal = JSON.parseObject(result);
                    if (jsonObjectTotal.get("respCode").toString().equalsIgnoreCase("000000")){
                       JSONObject listParam =  JSON.parseObject(jsonObjectTotal.get("param").toString());
                       String bills = listParam.getString("bills");
                       String len = listParam.getString("len");
                       JSONObject billParam = JSON.parseObject(bills);
                       String drugState = billParam.getString("drugState");
                       String messageRemind = "您在中山医院医院内科就诊费用已支付成功!";
                       WaitPayDetailVO waitPayDetailVO = new WaitPayDetailVO();
                       if ("1".equalsIgnoreCase(drugState)){
                           messageRemind += "自取患者请于周一至周五上午8点到12点、下午2:30到5:30,到门诊药房9号或10号窗口凭相应的就诊卡或电子健康卡取药。";
                        }else {
                           messageRemind += "";
                       }
                        List<WaitPayDetailVO> listWPD = JSONObject.parseArray(billParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
                    if (param!=null){
                        JSONObject object = param.getJSONObject("externalMap");
                        String cardNo = object.getString("cardNo");
                        String traceNo = object.getString("traceNo");
                        String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
                        JSONObject jsonObjectTotal = JSONObject.parseObject(result);
                        logger.info("查询在线结算处方信息"+jsonObjectTotal);
                        if (jsonObjectTotal.getString("respCode").equalsIgnoreCase("000000")){
                            JSONObject listParam =  JSONObject.parseObject(jsonObjectTotal.getString("param"));
                            List<WaitPayDetailVO> listWPD = JSONObject.parseArray(listParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
                            if (listWPD!=null&&listWPD.size()!=0){
                                WaitPayDetailVO waitPayDetailVO = listWPD.get(0);
                                String voucherNo = waitPayDetailVO.getVoucherNo();
                                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
                                    String patient = prescriptionDO.getPatientCode();
                                    if (prescriptionDO.getStatus()!=30){
                                        String pushPayLog = payInfoNoticeService.pushPrescriptionPay(prescriptionDO.getPatientCode(),prescriptionDO.getDoctorName(),voucherNo,prescriptionDO.getOutpatientId(),prescriptionDO.getId(),prescriptionDO.getDrugFee().toString());
                                        logger.info("处方结算成功"+pushPayLog+"====="+waitPayDetailVO.getRecipeNo());
                                    }
                                }
                            }
                            for (WaitPayDetailVO waitPayDetailVO:listWPD){
                                if (waitPayDetailVO.getItemName().equalsIgnoreCase("互联网医院复诊诊查费")){
                                   List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                   if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                                       WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                                       outpatientDao.updateHisStatusById(wlyyPrescriptionDO.getOutpatientId(),1);
                                       logger.info("更新门诊结算状态");
                                   }
                                }
                                prescriptionDao.updateStatusByRealOrder(waitPayDetailVO.getRecipeNo(),30,new Date());
                            }
                            logger.info("更新系统处方支付状态");
                        }
                    }
                    response.getWriter().write("SUCCESS");
                    return "SUCCESS";
                }
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            e.printStackTrace();
        }
        return appId;
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findHisPatientInfo)

+ 1 - 10
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java

@ -93,7 +93,7 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.rehabilitation.findTemplateDetailByTemplateId)
    @ApiOperation(value = "获取康复服务套餐模板明细")
    public ListEnvelop findTemplateDetailByTemplateId(@ApiParam(name = "templateId", value = "模板id")
                                                                                      @RequestParam(value = "templateId", required = true)String templateId){
                                                      @RequestParam(value = "templateId", required = true)String templateId){
        try {
            return rehabilitationPlanService.findTemplateDetailByTemplateId(templateId);
        }catch (Exception e){
@ -138,15 +138,9 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
                                                                       @RequestParam(value = "rehabilitationPlan", required = true)String rehabilitationPlan){
        try {
            JSONObject json = new JSONObject(rehabilitationPlan);
            if(json.has("totalExpense")) {
                json.put("totalExpense", (DataUtils.doubleToInt(json.getDouble("totalExpense"))));
            }
            JSONArray array = new JSONArray();
            for(Object planDetail : json.getJSONArray("detail")) {
                JSONObject j = (JSONObject)planDetail;
                if(j.has("expense")){
                    j.put("expense", (DataUtils.doubleToInt(j.getDouble("expense"))));
                }
                if(j.has("executeTime")) {
                    String executeTime = j.get("executeTime").toString();
                    String[] result = null;
@ -382,9 +376,6 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            JSONArray array = new JSONArray();
            for(Object planDetail : json.getJSONArray("detail")) {
                JSONObject j = (JSONObject)planDetail;
                if(j.has("expense")){
                    j.put("expense", (DataUtils.doubleToInt(j.getDouble("expense"))));
                }
                if(j.has("executeTime")) {
                    String executeTime = j.get("executeTime").toString();
                    String[] result = null;

+ 48 - 42
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -378,57 +378,63 @@ public class RehabilitationManageService {
                m = map.get(executeTime);
                Map<String,Integer> family = null;
                Map<String,Integer> specialist = null;
                if((Integer)one.get("type")==1){//家庭医生
                    if(m.containsKey("family")){
                        family = (Map<String,Integer>)m.get("family");
                    }else{
                        family = new HashMap<>();
                        family.put("all",0);
                        family.put("finish",0);
                    }
                    if((Integer)one.get("status")==1){
                        family.put("finish",family.get("finish")+1);
                    }
                    family.put("all",family.get("all")+1);
                    m.put("family",family);
                }else if((Integer)one.get("type")==2){//专科医生
                if(one.get("type")!=null){
                    if((Integer)one.get("type")==1){//家庭医生
                        if(m.containsKey("family")){
                            family = (Map<String,Integer>)m.get("family");
                        }else{
                            family = new HashMap<>();
                            family.put("all",0);
                            family.put("finish",0);
                        }
                        if((Integer)one.get("status")==1){
                            family.put("finish",family.get("finish")+1);
                        }
                        family.put("all",family.get("all")+1);
                        m.put("family",family);
                    }else if((Integer)one.get("type")==2){//专科医生
                    if(m.containsKey("specialist")){
                        if(m.containsKey("specialist")){
                        specialist = (Map<String,Integer>)m.get("specialist");
                    }else{
                        specialist = new HashMap<>();
                        specialist.put("all",0);
                        specialist.put("finish",0);
                    }
                    if((Integer)one.get("status")==1){
                        specialist.put("finish",(specialist.get("finish"))+1);
                            specialist = (Map<String,Integer>)m.get("specialist");
                        }else{
                            specialist = new HashMap<>();
                            specialist.put("all",0);
                            specialist.put("finish",0);
                        }
                        if((Integer)one.get("status")==1){
                            specialist.put("finish",(specialist.get("finish"))+1);
                        }
                        specialist.put("all",(specialist.get("all"))+1);
                        m.put("specialist",specialist);
                    }
                    specialist.put("all",(specialist.get("all"))+1);
                    m.put("specialist",specialist);
                }
            }else{
                m = new HashMap<>();
//                m.put("specialist",new HashMap<String,Object>());
                if((Integer)one.get("type")==1){//家庭医生
                    Map<String,Integer> family = new HashMap<>();
                    family.put("all",0);
                    family.put("finish",0);
                    if((Integer)one.get("status")==1){
                        family.put("finish",family.get("finish")+1);
                    }
                    family.put("all",family.get("all")+1);
                    m.put("family",family);
                }else if((Integer)one.get("type")==2){//专科医生
                    Map<String,Integer> specialist = new HashMap<>();
                    specialist.put("all",0);
                    specialist.put("finish",0);
                    if((Integer)one.get("status")==1){
                        specialist.put("finish",specialist.get("finish")+1);
                if(one.get("type")!=null){
                    if((Integer)one.get("type")==1){//家庭医生
                        Map<String,Integer> family = new HashMap<>();
                        family.put("all",0);
                        family.put("finish",0);
                        if((Integer)one.get("status")==1){
                            family.put("finish",family.get("finish")+1);
                        }
                        family.put("all",family.get("all")+1);
                        m.put("family",family);
                    }else if((Integer)one.get("type")==2){//专科医生
                        Map<String,Integer> specialist = new HashMap<>();
                        specialist.put("all",0);
                        specialist.put("finish",0);
                        if((Integer)one.get("status")==1){
                            specialist.put("finish",specialist.get("finish")+1);
                        }
                        specialist.put("all",specialist.get("all")+1);
                        m.put("specialist",specialist);
                    }
                    specialist.put("all",specialist.get("all")+1);
                    m.put("specialist",specialist);
                }
            }
            //myTaskFlag,1:有自己任务,0:没有自己任务
            if(StringUtils.isNotEmpty(doctorCode)){