瀏覽代碼

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

liubing 3 年之前
父節點
當前提交
b9b76e8311
共有 47 個文件被更改,包括 4503 次插入506 次删除
  1. 4 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorDao.java
  2. 11 0
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  3. 1 1
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
  4. 237 118
      business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java
  5. 48 0
      business/base-service/src/main/java/com/yihu/jw/healthUpload/dao/BaseDoctorHealthUploadDao.java
  6. 37 0
      business/base-service/src/main/java/com/yihu/jw/healthUpload/dao/BaseDoctorMemberDao.java
  7. 971 0
      business/base-service/src/main/java/com/yihu/jw/healthUpload/service/BaseDoctorHealthUploadService.java
  8. 8 2
      business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationDao.java
  9. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  10. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  11. 17 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  12. 1 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  13. 425 92
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  14. 343 51
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  15. 7 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  16. 93 12
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  17. 217 2
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  18. 0 1
      business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java
  19. 20 9
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  20. 15 3
      business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java
  21. 4 0
      business/base-service/src/mqConfig/esbmq-config.xml
  22. 2 2
      business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java
  23. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  24. 31 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  25. 448 0
      common/common-entity/src/main/java/com/yihu/jw/entity/healthUpload/BaseDoctorHealthUploadDO.java
  26. 95 0
      common/common-entity/src/main/java/com/yihu/jw/entity/healthUpload/BaseDoctorMemberDO.java
  27. 245 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java
  28. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  29. 2 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  30. 528 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisSettleVO.java
  31. 45 1
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  32. 1 1
      gateway/ag-basic/pom.xml
  33. 1 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  34. 6 2
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  35. 8 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  36. 4 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java
  37. 121 140
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  38. 8 7
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/HcyyService.java
  39. 12 12
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/RSAEncrypt.java
  40. 4 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java
  41. 21 21
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/healthCare/HealthCareEndPoint.java
  42. 1 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java
  43. 17 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/config/DoctorServiceEndPoint.java
  44. 9 15
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthCare/HealthCareEndPoint.java
  45. 307 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthUpload/HealthUploadPoint.java
  46. 32 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  47. 89 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

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

@ -38,6 +38,10 @@ public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO,
    @Query("update BaseDoctorDO p set p.del = ?2 where p.id = ?1")
    void updateStatus(String doctorId,String status);
    @Modifying
    @Query("update BaseDoctorDO p set p.sort = ?2 where p.id = ?1")
    void updateSort(String doctorId,Integer sort);
    List<BaseDoctorDO> findByIdcard(String idcard);
    @Query("from BaseDoctorDO d where d.name = ?1 AND d.del ='1'")

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -137,6 +137,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                " e.req_fee AS \"money\", " +
                " a.charge_type as \"chargeType\", "+
                " c.mapping_code as \"mappingCode\", "+
                " a.sort AS \"sort\", " +
                "\tm.req_fee as \"twfzFee\",\n" +
                "\tn.req_fee as \"spfzFee\",\n" +
                "\tp.req_fee as \"spzxFee\",\n" +
@ -182,6 +183,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        if(StringUtils.isNotBlank(dept)){
            sql += " AND b.dept_code =:dept";
        }
        sql +=" order by a.sort asc ";
        logger.info("queryList sql:"+sql);
@ -418,6 +420,15 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
    public void updateStatus(String doctorId,String status)throws Exception{
        baseDoctorDao.updateStatus(doctorId,status);
    }
    /**
     * 修改医生排名
     * @param doctorId
     * @param sort
     */
    public void updateSort(String doctorId,Integer sort)throws Exception{
        baseDoctorDao.updateSort(doctorId,sort);
    }
    /**修改眼科通密码信息
     *
     * @param doctorId

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -678,7 +678,7 @@ public class FileUploadService {
            type = type.substring(type.lastIndexOf("."),type.length()-1);
        }
        logger.info(type);
        List img = new ArrayList(Arrays.asList("jpeg","bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp","xls","xlsx","text/plain","mp4","m4v","avi","ogm","wmv","mpg","webm","ogv","mov","asx","mpeg","image/png"));
        List img = new ArrayList(Arrays.asList("jpeg","bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp","xls","xlsx","text/plain","mp4","m4v","avi","ogm","wmv","mpg","webm","ogv","mov","asx","mpeg","image/png","amr"));
        if (!img.contains(type)) {
            return false;
        }

+ 237 - 118
business/base-service/src/main/java/com/yihu/jw/healthCare/service/HealthCareService.java

@ -30,6 +30,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.ylzinfo.ehc.common.utils.DateUtils;
import net.sf.json.util.JSONTokener;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -637,69 +638,90 @@ public class HealthCareService {
        if (outpatientDO == null){
            throw new Exception("门诊信息不存在");
        }
        JSONObject data = new JSONObject();
        data.put("order_code","");//订单号
        data.put("order_time",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));//订单时间
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(outpatientId);
        if(wlyyPrescriptionDOS.size()==0){
            throw new Exception("处方信息不存在");
        }
        data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
        data.put("channel","1");//1、微信公众号,2、app,3、web
//        data.put("insurance_ticket_no","");//医保收费单据号	String	N	订单结算后的收费单据号
        data.put("order_state","");//订单状态    --1待发货、2配送中、3已签收、4已取消	String	Y
        List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(outpatientId);
        if(expressageDOList.size()==0){
            throw new Exception("收获信息不存在");
        }
        BasePatientDO patientDO = patientDao.findById(outpatientDO.getPatient());
        if(patientDO==null){
            throw new Exception("居民信息不存在");
        }
        WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
        data.put("order_addr_detail",expressageDO.getAddress());//订单详细地址
        data.put("order_owner",expressageDO.getName());
        data.put("order_owner_idcard",patientDO.getIdcard());
        data.put("order_owner_phone",patientDO.getMobile());
        Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getAddress());
        data.put("addr_lat",map.get("lat"));//收货地址纬度
        data.put("addr_lng",map.get("lng"));//收货地址经度
        if(expressageDO.getOneselfPickupFlg()==1){
            //自取
            data.put("delivery_way","2");//1.网订配送,2.网订自取
            data.put("qrcode_check_time","");//扫码校验时间
            data.put("receiving_time","");//药品签收时间
        }else {
            //非自取
            data.put("delivery_way","1");//配送方式 1.网订配送,2.网订自取
            data.put("delivery_number",expressageDO.getMailno());//配送单号
            data.put("delivery_org","");//配送单位
            data.put("delivery_take_time","");//配送接单时间
            data.put("delivery_name","");//配送人姓名
            data.put("delivery_id_card","");//配送人身份证
        logger.info("电子处方订单接收:1");
        List<YlzMedicalRelationDO> ylzMedicalRelationDOList = ylzMedicailRelationDao.findByOutpatientStatus(outpatientId);
        for (YlzMedicalRelationDO ylzMedicalRelationDO:ylzMedicalRelationDOList){
            logger.info("电子处方订单接收:2");
            JSONObject data = new JSONObject();
            data.put("order_time",DateUtil.dateToStrLong(expressageDO.getCreateTime()));//订单时间
            List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderList(ylzMedicalRelationDO.getLogNo());
            if(wlyyPrescriptionDOS.size()==0){
                throw new Exception("处方信息不存在");
            }
            data.put("order_code",ylzMedicalRelationDO.getLogNo());//订单号
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
            data.put("channel","1");//1、微信公众号,2、app,3、web
            data.put("insurance_ticket_no",ylzMedicalRelationDO.getBillSerial());//医保收费单据号	String	N	订单结算后的收费单据号
            String order_state = "";
            if (wlyyPrescriptionDO.getStatus()==30){
                order_state = "1";
            }else if (wlyyPrescriptionDO.getStatus()==31){
                order_state = "2";
            }else if (wlyyPrescriptionDO.getStatus()==100){
                order_state = "3";
            }
            logger.info("电子处方订单接收:3"+order_state);
            data.put("order_state",order_state);//订单状态    --1待发货、2配送中、3已签收、4已取消	String	Y
            data.put("order_addr_detail",expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());//订单详细地址
            data.put("order_owner",expressageDO.getName());
            data.put("order_owner_idcard",patientDO.getIdcard());
            data.put("order_owner_phone",patientDO.getMobile());
            Map<String,String> map = LatitudeUtils.getGeocoderLatitude(expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress());
            data.put("addr_lat",map.get("lat"));//收货地址纬度
            data.put("addr_lng",map.get("lng"));//收货地址经度
            if(expressageDO.getOneselfPickupFlg()==1){
                //自取
                data.put("delivery_way","2");//1.网订配送,2.网订自取
                data.put("qrcode_check_time","");//扫码校验时间
                data.put("receiving_time","");//药品签收时间
            }else {
                //非自取
                data.put("delivery_way","1");//配送方式 1.网订配送,2.网订自取
                data.put("delivery_number",expressageDO.getMailno());//配送单号
                data.put("delivery_org","顺丰");//配送单位
                data.put("delivery_take_time",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPayTime()));//配送接单时间
                data.put("delivery_name","顺丰");//配送人姓名
                data.put("delivery_id_card","顺丰");//配送人身份证
//            data.put("delivery_phone","");//配送人联系电话 N
            data.put("getmedical_time","");//骑手取药记录
            data.put("delivery_money","");//配送费
                data.put("getmedical_time",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPayTime()));//骑手取药记录
                data.put("delivery_money","");//配送费
        }
            }
//        apothecary_name	药师姓名	String	N
//        apothecary_id_card	药师身份证	String	N
//        apothecary_audit	药师审核时间	String	N
        data.put("money","");//商品金额
        data.put("settlement_time","");//结算时间
        data.put("data_source","");//数据来源
        data.put("delivery_time","");//发单时间
            data.put("money",ylzMedicalRelationDO.getTotalAmount());//商品金额
            data.put("settlement_time",DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));//结算时间
            data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
            data.put("delivery_time",DateUtil.dateToStrLong(wlyyPrescriptionDO.getPayTime()));//发单时间
        data.put("elec_prescription_code",wlyyPrescriptionDOS.get(0).getId());//平台处方编号
        data.put("prescription_code",wlyyPrescriptionDOS.get(0).getRealOrder());//医院处方编号
            data.put("elec_prescription_code",wlyyPrescriptionDO.getId());//平台处方编号
            data.put("prescription_code",wlyyPrescriptionDO.getRealOrder());//医院处方编号
//        data.put("insurance_serial",outpatientDO.getInsuranceSerial());//医保门诊流水号
        data.put("his_serial","");//门诊业务流水号
            data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//门诊业务流水号
            JSONArray array = new JSONArray();
            List<YlzMedicalMxDO> ylzMedicalMxDOS = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
            for (YlzMedicalMxDO ylzMedicalMxDO:ylzMedicalMxDOS){
                JSONObject object = new JSONObject();
                object.put("order_id",ylzMedicalRelationDO.getLogNo());
                object.put("settlement_no",ylzMedicalRelationDO.getHisBillSerial());
                object.put("item_name",ylzMedicalMxDO.getItemName());
                object.put("item_code",ylzMedicalMxDO.getItemCode());
                array.add(object);
            }
            data.put("MXLIST",array);
//        mxlist	药品明细	MXLIST	N
//        MXLIST
//        order_id	订单号	String	Y
@ -708,17 +730,18 @@ public class HealthCareService {
//        item_code	医保项目编码	String	Y
//        supervision_code	药品电子监管码	String	N	非必填
        String result = requestYlz(data,"N20.17.05.02","电子处方订单接收");
        if(result == null){
            throw new Exception("医保请求失败");
        }
        logger.info("电子处方订单接收:"+result);
        JSONObject object = JSONObject.parseObject(result);
        if (object.getString("flag").equalsIgnoreCase("1")){
            JSONObject encryptData = object.getJSONObject("encrypt_data");
            return encryptData.toJSONString();
            String result = requestYlz(data,"N20.17.05.02","电子处方订单接收");
            if(result == null){
                throw new Exception("医保请求失败");
            }
            logger.info("电子处方订单接收:"+result);
            JSONObject object = JSONObject.parseObject(result);
            if (object.getString("flag").equalsIgnoreCase("1")){
                JSONObject encryptData = object.getJSONObject("encrypt_data");
                logger.info("encryptData=="+encryptData);
            }
        }
        return result;
        return "上传成功";
    }
    /**
@ -1144,13 +1167,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 系统id
     * @return
     * @throws Exception
     */
    public String register(String registerNo) throws Exception{
    public String register(String outpatientId) throws Exception{
        String funid = "N20.17.04.01";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("上传医保挂号失败:结算信息为空!");
        }
@ -1166,7 +1189,7 @@ public class HealthCareService {
        data.put("his_dept_name",ylzMedicalRelationDO.getHisDeptName());//his内部科室名称
        data.put("emergency_sign",ylzMedicalRelationDO.getEmergencySign());//急诊标志0 否,1 是
        data.put("trauma_sign",ylzMedicalRelationDO.getTraumaSign());//外伤标志0 否,1 是
        data.put("date", DateUtil.dateToStrLong(ylzMedicalRelationDO.getDate()));//实际门诊/入院日期 若为空,默认取系统时间
        data.put("date", DateUtil.dateToStrFormatLong(ylzMedicalRelationDO.getDate()));//实际门诊/入院日期 若为空,默认取系统时间
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        String result = requestYlz(data,funid,"医保挂号");
        if (result==null){
@ -1177,6 +1200,8 @@ public class HealthCareService {
            JSONObject encryptData = object.getJSONObject("encrypt_data");
            String insuranceSerial = encryptData.getString("insurance_serial");
            ylzMedicalRelationDO.setInsuranceSerial(insuranceSerial);
            ylzMedicalRelationDO.setInsuranceType(encryptData.getString("insurance_type"));
            ylzMedicalRelationDO.setInsuranceTypeName(encryptData.getString("insurance_type_name"));
            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            logger.info("医保挂号流水号保存成功");
        }
@ -1188,14 +1213,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 门诊id
     * @return
     * @throws Exception
     */
    public String registerToEntrance(String registerNo) throws Exception{
    public String registerToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"register?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"register?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1210,13 +1235,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String registerBack(String registerNo) throws Exception{
    public String registerBack(String outpatientId) throws Exception{
        String funid = "N20.17.04.02";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保挂号冲销失败:结算信息为空!");
        }
@ -1249,14 +1274,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String registerBackToEntrance(String registerNo) throws Exception{
    public String registerBackToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"registerBack?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"registerBack?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1269,13 +1294,13 @@ public class HealthCareService {
    /**
     * 2.5.3医保费用明细上传(N20.17.04.03)
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String feeDetailUpload(String registerNo) throws Exception{
    public String feeDetailUpload(String outpatientId) throws Exception{
        String funid = "N20.17.04.03";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1345,7 +1370,7 @@ public class HealthCareService {
            String detailSerial = encryptData.getString("detail_serial");
            ylzMedicalRelationDO.setDetailSerial(detailSerial);
            ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            logger.info("医保费用明细上传失败保存成功");
            logger.info("医保费用明细上传保存成功");
        }
        return result;
    }
@ -1353,14 +1378,14 @@ public class HealthCareService {
    /**
     * 2.5.3医保费用明细上传(N20.17.04.03)
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String feeDetailUploadToEntrance(String registerNo) throws Exception{
    public String feeDetailUploadToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"feeDetailUpload?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"feeDetailUpload?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1375,13 +1400,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String feeDetailRefund(String registerNo,String remark) throws Exception{
    public String feeDetailRefund(String outpatientId,String remark) throws Exception{
        String funid = "N20.17.04.04";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1413,14 +1438,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 门诊id
     * @return
     * @throws Exception
     */
    public String feeDetailRefundToEntrance(String registerNo,String remark) throws Exception{
    public String feeDetailRefundToEntrance(String outpatientId,String remark) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"feeDetailRefund?registerNo="+registerNo+"&remark="+remark;
        String url = entranceHealthCareUrl+"feeDetailRefund?outpatientId="+outpatientId+"&remark="+remark;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1435,13 +1460,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public YlzMedicalRelationDO preSettlement(String registerNo) throws Exception{
    public YlzMedicalRelationDO preSettlement(String outpatientId) throws Exception{
        String funid = "N20.17.04.05";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1455,7 +1480,7 @@ public class HealthCareService {
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
        data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
        data.put("settlement_sign",0);//结算标识
        data.put("date",DateUtil.dateToStrLong(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("date",DateUtil.dateToStrFormatShort(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("leave_method","09");//离院方式
        data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
        data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
@ -1465,12 +1490,78 @@ public class HealthCareService {
        data.put("trt_fee_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
        data.put("dept_code",ylzMedicalRelationDO.getDeptCode());//科室编码
        data.put("charge_qty",1);//本次收费次数
        JSONArray array = new JSONArray();
        JSONObject object = new JSONObject();
        object.put("detail_serial",ylzMedicalRelationDO.getDetailSerial());
        array.add(object);
        data.put("cflist",array);
        String result = requestYlz(data,funid,"医保预结算服务");
        if (result==null){
            throw new Exception("医保预结算服务失败!");
        }
        }else {
            JSONObject resObj = JSONObject.parseObject(result);
            if (resObj.getString("flag").equalsIgnoreCase("1")){
                JSONObject jsonObject = resObj.getJSONObject("encrypt_data");
                ylzMedicalRelationDO.setAccountBalance(jsonObject.getString("account_balance"));
                ylzMedicalRelationDO.setBillSerial(jsonObject.getString("bill_serial"));
                ylzMedicalRelationDO.setPersonalCode(jsonObject.getString("personal_code"));
                ylzMedicalRelationDO.setSex(jsonObject.getString("sex"));
                ylzMedicalRelationDO.setSexMc(jsonObject.getString("sex_mc"));
                ylzMedicalRelationDO.setPersonCash(jsonObject.getString("person_cash"));
                ylzMedicalRelationDO.setPersonAccount(jsonObject.getString("person_account"));
                ylzMedicalRelationDO.setFundPrice(jsonObject.getString("fund_price"));
                ylzMedicalRelationDO.setJkzhPay(jsonObject.getString("own_jkzh_pay"));
                ylzMedicalRelationDO.setOwnPay(jsonObject.getString("own_pay"));
                ylzMedicalRelationDO.setCardNo(jsonObject.getString("card_no"));
                ylzMedicalRelationDO.setHospitalizationQty(jsonObject.getString("hospitalization_times"));
                ylzMedicalRelationDO.setPayDate(DateUtil.strToDate(jsonObject.getString("pay_date")+jsonObject.getString("pay_time")));
                ylzMedicalRelationDO.setInvoiceJj(jsonObject.getString("invoice_jj"));
                ylzMedicalRelationDO.setInvoiceXj(jsonObject.getString("invoice_xj"));
                ylzMedicalRelationDO.setInvoiceZh(jsonObject.getString("invoice_zh"));
                ylzMedicalRelationDO.setDiseaseCode(jsonObject.getString("disease_code"));
                ylzMedicalRelationDO.setTreatmentType(jsonObject.getString("treatment_type"));
                ylzMedicalRelationDO.setTreatmentTypeName(jsonObject.getString("treatment_type_name"));
                ylzMedicalRelationDO.setAllopatryType(jsonObject.getString("allopatry_type"));
                ylzMedicalRelationDO.setAllopatryTypeName(jsonObject.getString("allopatry_type_name"));
                ylzMedicalRelationDO.setAdministrativeArea(jsonObject.getString("administrative_area"));
                ylzMedicalRelationDO.setPayStandard(jsonObject.getString("pay_standard"));
                ylzMedicalRelationDO.setTcjjPay(jsonObject.getString("tcjj_pay"));
                ylzMedicalRelationDO.setSbjjPay(jsonObject.getString("sbjj_pay"));
                ylzMedicalRelationDO.setGwyPay(jsonObject.getString("gwy_pay"));
                ylzMedicalRelationDO.setJzfpPay(jsonObject.getString("jzfp_pay"));
                ylzMedicalRelationDO.setYljzPay(jsonObject.getString("yljz_pay"));
                ylzMedicalRelationDO.setOtherPay(jsonObject.getString("other_pay"));
                ylzMedicalRelationDO.setEnterpriseSupplement(jsonObject.getString("enterprise_supplement"));
                ylzMedicalRelationDO.setJtgjPay(jsonObject.getString("jtgj_pay"));
                ylzMedicalRelationDO.setCollector(jsonObject.getString("collector"));
                Double price= Double.parseDouble(ylzMedicalRelationDO.getTcjjPay())+Double.parseDouble(ylzMedicalRelationDO.getSbjjPay())+
                        Double.parseDouble(ylzMedicalRelationDO.getJzfpPay())+Double.parseDouble(ylzMedicalRelationDO.getYljzPay())+
                        Double.parseDouble(ylzMedicalRelationDO.getOtherPay())+Double.parseDouble(ylzMedicalRelationDO.getEnterpriseSupplement());
                ylzMedicalRelationDO.setMedicalPrice(price+"");
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                JSONArray jsonArray = jsonObject.getJSONArray("fplist");
                for (int i=0;i<jsonArray.size();i++){
                    JSONObject jsonObject1 = jsonArray.getJSONObject(i);
                    YlzMedicalBillDO ylzMb = new YlzMedicalBillDO();
                    ylzMb.setMedicalId(ylzMedicalRelationDO.getId());
                    ylzMb.setInvoicePay(jsonObject1.getString("invoice_pay"));
                    ylzMb.setInvoiceType(jsonObject1.getString("invoice_type"));
                    ylzMb.setInvoiceTypeName(jsonObject1.getString("invoice_type_name"));
                    ylzMb.setProjectPay(jsonObject1.getString("project_pay"));
                    ylzMb.setOwnPay(jsonObject1.getString("own_pay"));
                    ylzMb.setSpecialPay(jsonObject1.getString("special_pay"));
                    ylzMb.setUninsurancePay(jsonObject1.getString("uninsurance_pay"));
                    ylzMb.setCreateTime(new Date());
                    ylzMedicailBillDao.save(ylzMb);
                }
            }
        }
        List<YlzMedicalIcdDO> icdDOList = ylzMedicailIcdDao.findByMedicalId(ylzMedicalRelationDO.getId());
        List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
        ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOList);
        ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
        return ylzMedicalRelationDO;
    }
@ -1479,12 +1570,12 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 门诊id
     * @return
     * @throws Exception
     */
    public YlzMedicalRelationDO preSettlementToEntrance(String registerNo) throws Exception{
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
    public YlzMedicalRelationDO preSettlementToEntrance(String outpatientId) throws Exception{
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保费用明细上传:结算信息为空!");
        }
@ -1498,7 +1589,7 @@ public class HealthCareService {
        }
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"preSettlement?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"preSettlement?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1552,14 +1643,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String preSettlementRefundToEntrance(String registerNo) throws Exception{
    public String preSettlementRefundToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"feeDetailRefund?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"feeDetailRefund?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1574,13 +1665,13 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String preSettlementRefund(String registerNo) throws Exception{
    public String preSettlementRefund(String outpatientId) throws Exception{
        String funid = "N20.17.04.06";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("医保结算冲销上传:结算信息为空!");
        }
@ -1591,7 +1682,7 @@ public class HealthCareService {
        data.put("cert_type",ylzMedicalRelationDO.getCertType());//证件类型
        data.put("medical_mode",ylzMedicalRelationDO.getMedicalMode());//医疗就诊方式
        data.put("bill_serial",ylzMedicalRelationDO.getBillSerial());//医保收费流水号
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisSerial());//his收费单据流水号
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisSettleNo());//his收费单据流水号
        data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//医保流水号
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("refund_serial",ylzMedicalRelationDO.getHisSerial());//医院退费操作流水号
@ -1612,14 +1703,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrl(String registerNo) throws Exception{
    public String getSettlementResultUrl(String outpatientId) throws Exception{
        String funid = "N20.17.04.07";
        JSONObject data = new JSONObject();
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("获取医保结算页面地址:结算信息为空!");
        }
@ -1635,20 +1726,35 @@ public class HealthCareService {
        data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
        data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
        data.put("date",ylzMedicalRelationDO.getDate());//实际就诊日期
        data.put("date",DateUtil.dateToStrFormatShort(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("leave_method","09");//离院方式
        data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
        data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
        data.put("person_cash",ylzMedicalRelationDO.getPersonCash());//个人现金支付金额(实付现金)
        data.put("person_account",ylzMedicalRelationDO.getPersonAccount());//个人账户支付金额
        data.put("fund_price",ylzMedicalRelationDO.getFundPrice());//基金支付总额
        data.put("fund_price",ylzMedicalRelationDO.getMedicalPrice());//基金支付总额
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
        data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
        data.put("redirect_url",wlyyHospitalSysDictDO.getDictValue());//回调地址
        String result = requestYlz(data,funid,"获取医保结算结果");
        JSONArray array = new JSONArray();
        JSONObject object = new JSONObject();
        object.put("detail_serial",ylzMedicalRelationDO.getDetailSerial());
        array.add(object);
        data.put("cflist",array);
        String result = requestYlz(data,funid,"获取医保结算页面地址");
        if (result==null){
            throw new Exception("获取医保结算结果失败!");
            throw new Exception("获取医保结算页面地址失败!");
        }else {
            JSONObject resObj = JSONObject.parseObject(result);
            if (resObj.getString("flag").equalsIgnoreCase("1")){
                JSONObject jsonObject = resObj.getJSONObject("encrypt_data");
                String link_url = jsonObject.getString("link_url");
                String str1=link_url.substring(0, link_url.indexOf("="));
                String str2=link_url.substring(str1.length()+1, link_url.length());
                ylzMedicalRelationDO.setPageCode(str2);
                ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            }
        }
        return result;
    }
@ -1659,14 +1765,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrlToEntrance(String registerNo) throws Exception{
    public String getSettlementResultUrlToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"getSettlementResultUrl?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"getSettlementResultUrl?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1683,14 +1789,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrlBase64(String registerNo) throws Exception{
    public String getSettlementResultUrlBase64(String outpatientId) throws Exception{
        String funid = "N20.17.04.08";
        JSONObject data = new JSONObject();
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(registerNo);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO==null){
            throw new Exception("获取医保结算页面地址:结算信息为空!");
        }
@ -1706,20 +1812,20 @@ public class HealthCareService {
        data.put("medical_type",ylzMedicalRelationDO.getMedicalType());//医疗类别
        data.put("insurance_serial",ylzMedicalRelationDO.getInsuranceSerial());//
        data.put("his_bill_serial",ylzMedicalRelationDO.getHisBillSerial());//his收费单据流水号
        data.put("date",ylzMedicalRelationDO.getDate());//实际就诊日期
        data.put("date",DateUtil.dateToStrFormatShort(ylzMedicalRelationDO.getDate()));//实际就诊日期
        data.put("leave_method","09");//离院方式
        data.put("pre_count",ylzMedicalRelationDO.getPreCount());//处方项目数
        data.put("total_amount",ylzMedicalRelationDO.getTotalAmount());//医疗费总金额
        data.put("person_cash",ylzMedicalRelationDO.getPersonCash());//个人现金支付金额(实付现金)
        data.put("person_account",ylzMedicalRelationDO.getPersonAccount());//个人账户支付金额
        data.put("fund_price",ylzMedicalRelationDO.getFundPrice());//基金支付总额
        data.put("fund_price",ylzMedicalRelationDO.getMedicalPrice());//基金支付总额
        data.put("data_source",ylzMedicalRelationDO.getDataSource());//数据来源
        data.put("his_serial",ylzMedicalRelationDO.getHisSerial());//his流水号
        data.put("doctor_level",ylzMedicalRelationDO.getDoctorLevel());//医师诊查费等级
        data.put("redirect_url",wlyyHospitalSysDictDO.getDictValue());//回调地址
        String result = requestYlz(data,funid,"获取医保结算结果");
        String result = requestYlz(data,funid,"获取医保结算页面地址");
        if (result==null){
            throw new Exception("获取医保结算结果失败!");
            throw new Exception("获取医保结算页面地址失败!");
        }
        return result;
    }
@ -1730,14 +1836,14 @@ public class HealthCareService {
     *
     * 返回值
     *
     * @param registerNo 挂号号
     * @param outpatientId 挂号号
     * @return
     * @throws Exception
     */
    public String getSettlementResultUrlBase64ToEntrance(String registerNo) throws Exception{
    public String getSettlementResultUrlBase64ToEntrance(String outpatientId) throws Exception{
        String result = "";
        String response="";
        String url = entranceHealthCareUrl+"getSettlementResultUrlBase64?registerNo="+registerNo;
        String url = entranceHealthCareUrl+"getSettlementResultUrlBase64?outpatientId="+outpatientId;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
@ -1767,6 +1873,19 @@ public class HealthCareService {
        if (result==null){
            throw new Exception("获取医保结算结果失败!");
        }
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
        if (object.getString("flag").equalsIgnoreCase("1")){
            JSONObject jsonObject = object.getJSONObject("encrypt_data");
            String insuranceSerial = jsonObject.getString("insurance_serial");
            String billSerial = jsonObject.getString("bill_serial");
            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByInsuranceSerial(insuranceSerial);
            if (ylzMedicalRelationDO!=null){
                ylzMedicalRelationDO.setStatus(1);
                ylzMedicalRelationDO.setBillSerial(billSerial);
                ylzMedicalRelationDO.setPayDate(DateUtil.strToDate(jsonObject.getString("pay_date")+jsonObject.getString("pay_time")));
                ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            }
        }
        return result;
    }

+ 48 - 0
business/base-service/src/main/java/com/yihu/jw/healthUpload/dao/BaseDoctorHealthUploadDao.java

@ -0,0 +1,48 @@
package com.yihu.jw.healthUpload.dao;
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
import com.yihu.jw.entity.patient.Message;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
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;
/**
 *
 * 医生成员表
 *
 * @version
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
@Transactional
public interface BaseDoctorHealthUploadDao extends PagingAndSortingRepository<BaseDoctorHealthUploadDO, String>, JpaSpecificationExecutor<BaseDoctorHealthUploadDO>  {
    @Query("from BaseDoctorHealthUploadDO d where d.id = ?1 ")
    BaseDoctorHealthUploadDO findById(String id);
    @Query("from BaseDoctorHealthUploadDO d where d.doctorId = ?1 ")
    List<BaseDoctorHealthUploadDO> findByDoctorId(String doctorId);
    @Query("from BaseDoctorHealthUploadDO d where d.doctorId = ?1 and d.consumer= ?2 order by d.createTime desc")
    List<BaseDoctorHealthUploadDO> findByDoctorIdAndConsumer(String doctorId,String consumer);
    @Query("select a from BaseDoctorHealthUploadDO a where a.doctorId=?1 order by a.createTime desc")
    List<BaseDoctorHealthUploadDO> selectHealthUploadInfoByDoctorId(String doctorId, Pageable pageRequest);
    @Query("select a from BaseDoctorHealthUploadDO a where a.doctorId=?1 and a.createTime>=?2 and a.createTime<=?3 order by a.createTime desc")
    List<BaseDoctorHealthUploadDO> selectHealthUploadInfoByDoctorIdAndDate(String doctorId, Date startDate,Date endDate,Pageable pageRequest);
}

+ 37 - 0
business/base-service/src/main/java/com/yihu/jw/healthUpload/dao/BaseDoctorMemberDao.java

@ -0,0 +1,37 @@
package com.yihu.jw.healthUpload.dao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 *
 * 医生成员表
 *
 * @version
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
@Transactional
public interface BaseDoctorMemberDao extends PagingAndSortingRepository<BaseDoctorMemberDO, String>, JpaSpecificationExecutor<BaseDoctorMemberDO>  {
    @Query("from BaseDoctorMemberDO d where d.id = ?1 AND d.del ='1'")
    BaseDoctorMemberDO findById(String id);
    @Query("from BaseDoctorMemberDO d where  d.del ='1' and d.doctorId=?1")
    List<BaseDoctorMemberDO> findByDoctorIdAndDel(String doctorId);
    @Query("from BaseDoctorMemberDO d where  d.del ='1' and d.doctorId=?1 and d.memberId=?2 ")
    BaseDoctorMemberDO findByDoctorIdAndMemberIdAndDel(String doctorId,String memberId);
}

+ 971 - 0
business/base-service/src/main/java/com/yihu/jw/healthUpload/service/BaseDoctorHealthUploadService.java

@ -0,0 +1,971 @@
package com.yihu.jw.healthUpload.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
import com.yihu.jw.entity.hospital.DmHospitalDO;
import com.yihu.jw.healthUpload.dao.BaseDoctorHealthUploadDao;
import com.yihu.jw.healthUpload.dao.BaseDoctorMemberDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.common.PwdUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.mysql.query.BaseJpaService;
import jxl.format.*;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.io.IOException;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class BaseDoctorHealthUploadService extends BaseJpaService<BaseDoctorHealthUploadDO, BaseDoctorHealthUploadDao> {
    private static Logger logger = LoggerFactory.getLogger(BaseDoctorHealthUploadService.class);
    @Autowired
    private BaseDoctorMemberDao doctorMemberDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BaseDoctorHealthUploadDao baseDoctorHealthUploadDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    /**
     * 新增医生成员关系
     * @param doctorId
     * @param ids 逗号隔开
     * @return
     */
    public List<BaseDoctorMemberDO> saveAndCreateMember(String doctorId,String ids){
        String str[] =ids.split(",");
        List<BaseDoctorMemberDO> baseDoctorMemberDOList = new ArrayList<>();
        for (int i=0;i<str.length;i++){
            String memberId = str[i];
            BaseDoctorMemberDO memberDO = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId,memberId);
            if (memberDO==null){
                BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
                baseDoctorMemberDO.setDel(1);
                baseDoctorMemberDO.setDoctorId(doctorId);
                baseDoctorMemberDO.setMemberId(memberId);
                baseDoctorMemberDO.setCreateTime(new Date());
                baseDoctorMemberDO.setUpdateTime(new Date());
                baseDoctorMemberDO= doctorMemberDao.save(baseDoctorMemberDO);
                baseDoctorMemberDOList.add(baseDoctorMemberDO);
            }
        }
        return baseDoctorMemberDOList;
    }
    /**
     * 查询医生的成员列表
     * @param doctorId
     * @return
     */
    public List<BaseDoctorMemberDO> selectByDoctorId(String doctorId){
       List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
        BaseDoctorMemberDO memberDO1 = doctorMemberDao.findByDoctorIdAndMemberIdAndDel(doctorId,doctorId);
        //添加本人
        if (memberDO1==null){
            BaseDoctorMemberDO baseDoctorMemberDO = new BaseDoctorMemberDO();
            baseDoctorMemberDO.setDel(1);
            baseDoctorMemberDO.setDoctorId(doctorId);
            baseDoctorMemberDO.setMemberId(doctorId);
            baseDoctorMemberDO.setCreateTime(new Date());
            baseDoctorMemberDO.setUpdateTime(new Date());
            baseDoctorMemberDO= doctorMemberDao.save(baseDoctorMemberDO);
        }
       for (BaseDoctorMemberDO memberDO:baseDoctorMemberDOList){
           BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
           if (baseDoctorDO!=null){
               memberDO.setBaseDoctorDO(baseDoctorDO);
           }
       }
       return baseDoctorMemberDOList;
    }
    /**
     * 查询医生的成员列表带有已上报次数
     * @param doctorId
     * @return
     */
    public List<BaseDoctorMemberDO> selectCountByDoctorId(String doctorId){
        List<BaseDoctorMemberDO> baseDoctorMemberDOList = doctorMemberDao.findByDoctorIdAndDel(doctorId);
        for (BaseDoctorMemberDO memberDO:baseDoctorMemberDOList){
            BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(memberDO.getMemberId());
            if (baseDoctorDO!=null){
                memberDO.setBaseDoctorDO(baseDoctorDO);
            }
            List<BaseDoctorHealthUploadDO> baseDoctorHealthUploadDOList = baseDoctorHealthUploadDao.findByDoctorIdAndConsumer(memberDO.getMemberId(),doctorId);
            memberDO.setCount(baseDoctorHealthUploadDOList.size()+"");
        }
        return baseDoctorMemberDOList;
    }
    /**
     * 查询某一个成员id
     * @param id 成员id
     * @return
     */
    public BaseDoctorMemberDO selectById(String id){
        BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(baseDoctorMemberDO.getMemberId());
        if (baseDoctorDO!=null){
            baseDoctorMemberDO.setBaseDoctorDO(baseDoctorDO);
        }
        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorMemberDO.getMemberId());
        baseDoctorMemberDO.setDoctorHospitalDOS(doctorHospitalDOS);
        return baseDoctorMemberDO;
    }
    /**
     * 删除某个成员
     * @param id 成员id
     * @return
     */
    public BaseDoctorMemberDO delDoctorMember(String id){
        BaseDoctorMemberDO baseDoctorMemberDO = doctorMemberDao.findById(id);
        baseDoctorMemberDO.setDel(0);
        baseDoctorMemberDO = doctorMemberDao.save(baseDoctorMemberDO);
        return baseDoctorMemberDO;
    }
    /**
     * 提交健康信息
     * @param baseDoctorHealthUploadDO 健康信息实体类
     * @return
     */
    public BaseDoctorHealthUploadDO createHealthUploadInfo(BaseDoctorHealthUploadDO baseDoctorHealthUploadDO){
        baseDoctorHealthUploadDO.setCreateTime(new Date());
        return baseDoctorHealthUploadDao.save(baseDoctorHealthUploadDO);
    }
    /**
     * 查询成员的健康上报记录
     *
     * @param doctorId 医生id
     * @return
     */
    public MixEnvelop selectHealthUploadInfoByDoctorId(String doctorId,String startDate,String endDate,Integer page,Integer pageSize){
        PageRequest pageRequest = new PageRequest(page-1,pageSize);
        MixEnvelop mixEnvelop = new MixEnvelop();
        List<BaseDoctorHealthUploadDO> list = new ArrayList<>();
        if (StringUtils.isNoneBlank(startDate)) {
            Date startTime = DateUtil.strToDateLong(startDate);
            Date endTime = DateUtil.strToDateLong(endDate);
            list = baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorIdAndDate(doctorId,startTime,endTime,pageRequest);
        }else {
            list =baseDoctorHealthUploadDao.selectHealthUploadInfoByDoctorId(doctorId,pageRequest);
        }
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setTotalCount(list==null?0:list.size());
        return mixEnvelop;
    }
    public BaseDoctorHealthUploadDO selectHealthInfoById(String id){
        BaseDoctorHealthUploadDO baseDoctorHealthUploadDO = baseDoctorHealthUploadDao.findById(id);
        return baseDoctorHealthUploadDO;
    }
    /**
     * 新增加医生信息
     * @param photo
     * @param name
     * @param idcard
     * @param sex
     * @param mobile
     * @param dept
     * @param deptName
     * @param idCardType
     * @param idType
     * @return
     */
    public BaseDoctorDO  saveDoctorInfo(String id,String photo,String name,String idcard,String sex,String mobile,String dept,String deptName,String idCardType,String idType) throws Exception {
        BaseDoctorDO baseDoctorDO = new BaseDoctorDO();
        if (StringUtils.isNoneBlank(id)) {
            baseDoctorDO = baseDoctorDao.findById(id);
            baseDoctorDO.setIdCardType(idCardType);
            baseDoctorDO.setIdType(idType);
            baseDoctorDO.setPhoto(photo);
            baseDoctorDO.setName(name);
            baseDoctorDO.setIdcard(idcard);
            baseDoctorDO.setSex(Integer.parseInt(sex));
            baseDoctorDO.setMobile(mobile);
            String deptCode = dept;
            baseDoctorDO.setChargeType("1");
            baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
            List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorDO.getId());
            if (null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0) {
                baseDoctorHospitalDao.delete(baseDoctorHospitalDOS);
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
                baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorHospitalDO.setDeptCode(deptCode);
                baseDoctorHospitalDO.setDeptName(deptName);
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
            }else {
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
                baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorHospitalDO.setDeptCode(deptCode);
                baseDoctorHospitalDO.setDeptName(deptName);
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
            }
        } else {
            baseDoctorDO.setIdcard(idcard);
            baseDoctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
            baseDoctorDO.setSex(Integer.parseInt(sex));
            baseDoctorDO.setLocked(0);
            baseDoctorDO.setEnabled(1);
            String disableFlag = "0";
            //互联网医院:1停用,0使用  转 i健康:1正常,0作废
            baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
            baseDoctorDO.setMobile("0");
            baseDoctorDO.setName(name);
            baseDoctorDO.setIsFamous(0);
            baseDoctorDO.setCreateTime(new Date());
            baseDoctorDO.setUpdateTime(new Date());
            baseDoctorDO.setIdCardType(idCardType);
            baseDoctorDO.setIdType(idType);
            baseDoctorDO.setPhoto(photo);
            baseDoctorDO.setMobile(mobile);
            baseDoctorDO.setChargeType("1");
            if (StringUtils.isNotBlank(mobile)) {
                baseDoctorDO.setSalt(PwdUtil.randomString(5));
                try {
                    baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getMobile().substring(baseDoctorDO.getMobile().length() - 6) + "{" + baseDoctorDO.getSalt() + "}"));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } else {
                baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456" + "{" + baseDoctorDO.getSalt() + "}"));
            }
            // 用医生和机构id、部门判断数据是否存在,若不存在则保存医生机构关联关系
            String deptCode = dept;
            baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
            List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(baseDoctorDO.getId());
            if (null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0) {
                baseDoctorHospitalDao.delete(baseDoctorHospitalDOS);
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
                baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorHospitalDO.setDeptCode(deptCode);
                baseDoctorHospitalDO.setDeptName(deptName);
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
            }else {
                BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                baseDoctorHospitalDO.setOrgCode("350211A1002");
                baseDoctorHospitalDO.setOrgName("马銮湾医院");
                baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                baseDoctorHospitalDO.setDeptCode(deptCode);
                baseDoctorHospitalDO.setDeptName(deptName);
                baseDoctorHospitalDO.setDel("1");
                baseDoctorHospitalDao.save(baseDoctorHospitalDO);
            }
        }
        return baseDoctorDO;
    }
    /**
     *
     * @param dept
     * @param level 1院级管理员,2科室管理员
     * @param doctorId
     * @return
     */
    public JSONObject selectHealthByRole(String dept,int level,String doctorId){
        String nowDate = DateUtil.getStringDateShort();
        //今日本人提交
        String benrenSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and consumer in(doctor_id) and  create_time >='"+nowDate+" 00:00:00' and create_time<='"+nowDate+" 23:59:59'";
        //今日提交
        String personSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and  create_time >='"+nowDate+" 00:00:00' and create_time<='"+nowDate+" 23:59:59'";
        //代上报
        String daishangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and consumer not in(doctor_id)";
        //本人上报
        String benrenshangbaoSql = "select count(1) as total from base_doctor_health_upload where consumer='"+doctorId+"' and consumer in(doctor_id)";
        String doctorSql ="";
        String sql = "";
        if (level==1){
            //总人次
            doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
            //今日上报人次
            sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and d.create_time >='"+nowDate+" 00:00:00' and d.create_time<='"+nowDate+" 23:59:59'";
        }else if (level==2){
            //总人次
           doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 and id IN (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 )";
            //今日上报人次
            sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 and doctor_id in (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 ) and d.create_time >='"+nowDate+" 00:00:00' and d.create_time<='"+nowDate+" 23:59:59'";
        }
        //今日提交
        int personTotal = 0;
        //代上报
        int daishangbaoTotal = 0;
        //本人上报
        int benrenshangbaoTotal = 0;
        //总人次
        int doctorTotal = 0;
        //今日上报人次
        int sqlTotal = 0;
        //今日未上报人次
        int notUploadTotal = 0;
        Map<String,Object> personMap = jdbcTemplate.queryForMap(personSql);
        if (personMap!=null){
            if (personMap.get("total")!=null){
                personTotal = Integer.parseInt(personMap.get("total").toString());
            }
        }
        Map<String,Object> daishangbaoMap = jdbcTemplate.queryForMap(daishangbaoSql);
        if (daishangbaoMap!=null){
            if (daishangbaoMap.get("total")!=null){
                daishangbaoTotal = Integer.parseInt(daishangbaoMap.get("total").toString());
            }
        }
        Map<String,Object> benrenshangbaoMap = jdbcTemplate.queryForMap(benrenshangbaoSql);
        if (benrenshangbaoMap!=null){
            if (benrenshangbaoMap.get("total")!=null){
                benrenshangbaoTotal = Integer.parseInt(benrenshangbaoMap.get("total").toString());
            }
        }
        Map<String,Object> doctorMap = jdbcTemplate.queryForMap(doctorSql);
        if (doctorMap!=null){
            if (doctorMap.get("total")!=null){
                doctorTotal = Integer.parseInt(doctorMap.get("total").toString());
            }
        }
        Map<String,Object> sqlMap = jdbcTemplate.queryForMap(sql);
        if (sqlMap!=null){
            if (sqlMap.get("total")!=null){
                sqlTotal = Integer.parseInt(sqlMap.get("total").toString());
            }
        }
        int benrenTotal=0;
        Map<String,Object> benrenMap = jdbcTemplate.queryForMap(benrenSql);
        if (benrenMap!=null){
            if (benrenMap.get("total")!=null){
                benrenTotal = Integer.parseInt(benrenMap.get("total").toString());
            }
        }
        JSONObject object = new JSONObject();
        object.put("personTotal",personTotal);//今日上报人数
        object.put("daishangbaoTotal",daishangbaoTotal);//代上报
        object.put("benrenshangbaoTotal",benrenshangbaoTotal);//已上报
        object.put("doctorTotal",doctorTotal);//总人次
        object.put("sqlTotal",sqlTotal);//今日上报人数
        object.put("notUploadTotal",doctorTotal-sqlTotal);//今日未上报人数
        object.put("benrenTotal",benrenTotal);//今日本人提交
        return object;
    }
    /**
     * 首页统计
     *
     * @param dept
     * @param idType
     * @param status 上报状态
     * @param state 健康状态
     * @param startDate
     * @param endDate
     * @return
     */
    public JSONObject selectHeaderTotal(String dept,String idType,String status,String state,String startDate,String endDate,String name){
        JSONObject object =new JSONObject();
        String day = DateUtil.getTwoDay(endDate,startDate);
        String doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
        Integer total = 0;//总人次
        String sql = "select COUNT(DISTINCT d.doctor_id) as \"total\" from base_doctor_health_upload d where 1=1 ";
        String deptCondition = "";
        if (StringUtils.isNoneBlank(dept)){
            deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 )";
        }
        String idTypeCondition = " ";
        if (StringUtils.isNoneBlank(idType)){
            idTypeCondition +="  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '"+idType+"')";
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            doctorSql+=" and d.id IN "+deptCondition;
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            doctorSql+=" and d.id IN "+idTypeCondition ;
        }
        if (StringUtils.isNoneBlank(name)){
            doctorSql+=" and d.name like '%"+name+"%' " ;
        }
        Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
        String doctorTotal = "";
        if (map!=null){
             doctorTotal = map.get("total").toString();
        }
        if (StringUtils.isNoneBlank(doctorTotal)){
            //总人次
            if (!day.equalsIgnoreCase("0")){
                total = Integer.parseInt(doctorTotal)*Integer.parseInt(day);
            }else {
                total= Integer.parseInt(doctorTotal);
            }
        }
        Integer yishangbaoTotal = 0;
        Integer weishangbaoTotal =0;
        Integer zhengchangTotal = 0;
        Integer yichangTotal = 0;
        if (StringUtils.isNoneBlank(startDate)){
            sql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        }
        if (StringUtils.isNoneBlank(state)){
            if (state.equalsIgnoreCase("1")){
                sql +=" and (d.health_code not in(2,3) and CAST(d.temperature as DECIMAL)<37.3 and  d.is_symptoms=2 and d.is_epidemic=2) ";
            }else if (state.equalsIgnoreCase("2")){
                sql +=" and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1) ";
            }
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            sql+=" and d.doctor_id IN "+deptCondition;
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            sql+=" and d.doctor_id IN "+idTypeCondition ;
        }
        if (StringUtils.isNoneBlank(name)){
            sql+=" and d.doctor_name like '%"+name+"%'" ;
        }
        //已上传
        Map<String,Object> yishangchaungMap = jdbcTemplate.queryForMap(sql);
        if (yishangchaungMap!=null){
            if (yishangchaungMap.get("total")!=null){
                yishangbaoTotal = Integer.parseInt(yishangchaungMap.get("total").toString());
            }
        }
        //未上报
        weishangbaoTotal=total-yishangbaoTotal;
        //上传总次数
        Integer shangchuanTotal= 0;
        String shangchuanTotalSql = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1  ";
        if (StringUtils.isNoneBlank(startDate)){
            shangchuanTotalSql +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            shangchuanTotalSql +=" and d.doctor_id IN "+deptCondition;
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            shangchuanTotalSql +=" and d.doctor_id IN "+idTypeCondition ;
        }
        if (StringUtils.isNoneBlank(name)){
            shangchuanTotalSql+=" and d.doctor_name like '%"+name+"%'" ;
        }
        Map<String,Object> shangchuanMap = jdbcTemplate.queryForMap(shangchuanTotalSql);
        if (shangchuanMap!=null){
            if (shangchuanMap.get("total")!=null){
                shangchuanTotal = Integer.parseInt(shangchuanMap.get("total").toString());
            }
        }
        //正常、异常
        String sqlZhengchang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code not in(2,3) AND CAST(d.temperature as DECIMAL)<37.3 AND  d.is_symptoms=2 and  d.is_epidemic=2) ";
        if (StringUtils.isNoneBlank(startDate)){
            sqlZhengchang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            sqlZhengchang +=" and d.doctor_id IN "+deptCondition;
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            sqlZhengchang +=" and d.doctor_id IN "+idTypeCondition ;
        }
        if (StringUtils.isNoneBlank(name)){
            sqlZhengchang+=" and d.doctor_name like '%"+name+"%'" ;
        }
        //正常
        Map<String,Object> zhengchangMap = jdbcTemplate.queryForMap(sqlZhengchang);
        if (zhengchangMap!=null){
            if (zhengchangMap.get("total")!=null){
                zhengchangTotal = Integer.parseInt(zhengchangMap.get("total").toString());
            }
        }
        String sqlYichang = "select COUNT(1) as \"total\" from base_doctor_health_upload d where 1=1 and (d.health_code in(2,3) OR CAST(d.temperature as DECIMAL)>=37.3 OR  d.is_symptoms=1 OR d.is_epidemic=1)  ";
        if (StringUtils.isNoneBlank(startDate)){
            sqlYichang +=" and d.create_time >='"+startDate+" 00:00:00' and d.create_time<='"+endDate+" 23:59:59' ";
        }
        if (StringUtils.isNoneBlank(deptCondition)){
            sqlYichang +=" and d.doctor_id IN "+deptCondition;
        }
        if (StringUtils.isNoneBlank(idTypeCondition)){
            sqlYichang +=" and d.doctor_id IN "+idTypeCondition ;
        }
        if (StringUtils.isNoneBlank(name)){
            sqlYichang+=" and d.doctor_name like '%"+name+"%'" ;
        }
        //正常
        Map<String,Object> yichangMap = jdbcTemplate.queryForMap(sqlYichang);
        if (yichangMap!=null){
            if (yichangMap.get("total")!=null){
                yichangTotal = Integer.parseInt(yichangMap.get("total").toString());
            }
        }
        object.put("total",total);//总人次
        object.put("yishangbaoTotal",yishangbaoTotal);//已上报
        object.put("weishangbaoTotal",weishangbaoTotal);//未上报
        object.put("zhengchangTotal",zhengchangTotal);//上报正常
        object.put("yichangTotal",yichangTotal);//上报异常
        object.put("shangchuanTotal",shangchuanTotal);//上传总次数
        return object;
    }
    /**
     * 具体每一个统计时间列表
     *
     * @param dept
     * @param idType
     * @param status
     * @param state
     * @param startDate
     * @param endDate
     * @return
     */
    public JSONArray selectListByTotal(String dept,String idType,String status,String state,String startDate,String endDate,String name){
        long days = DateUtil.getDays(endDate,startDate);
        List<String> list = new ArrayList<>();
        Date startTime = DateUtil.strToDateShort(startDate);
        for (int i=0;i<=days;i++){
            Date date = DateUtil.getPreDays(startTime,i);
            String str = DateUtil.dateToStrShort(date);
            list.add(str);
        }
        JSONArray array = new JSONArray();
        for (int i=0;i<list.size();i++){
            String date = list.get(i);
            String doctorSql =" select COUNT(1) as \"total\" from base_doctor d where d.del=1 ";
            String deptCondition = "";
            if (StringUtils.isNoneBlank(dept)){
                deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 )";
            }
            String idTypeCondition = " ";
            if (StringUtils.isNoneBlank(idType)){
                idTypeCondition +="  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '"+idType+"')";
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                doctorSql+=" and d.id IN "+deptCondition;
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                doctorSql+=" and d.id IN "+idTypeCondition ;
            }
            if (StringUtils.isNoneBlank(status)){
                if (status.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' )";
                }else if (status.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id not in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' )";
                }
            }
            if (StringUtils.isNoneBlank(state)){
                if (state.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2))  ";
                }else if (state.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1)) ";
                }
            }
            if (StringUtils.isNoneBlank(name)){
                doctorSql +=" and d.name LIKE  '%"+name+"%' ";
            }
            Map<String,Object> map = jdbcTemplate.queryForMap(doctorSql);
            Integer total = 0;
            if (map!=null){
                if (map.get("total")!=null){
                    total = Integer.parseInt(map.get("total").toString());
                }
            }
            JSONObject object = new JSONObject();
            object.put("time",date);
            object.put("total",total);
            array.add(object);
        }
        return array;
    }
    /**
     * 具体每一个统计时间的详情
     *
     * @param dept
     * @param idType
     * @param status
     * @param state
     * @param startDate
     * @param endDate
     * @param name total
     * @return
     */
    public JSONArray selectListInfoByTotal(String dept,String idType,String status,String state,String startDate,String endDate,String name){
        long days = DateUtil.getDays(endDate,startDate);
        List<String> list = new ArrayList<>();
        Date startTime = DateUtil.strToDateShort(startDate);
        for (int i=0;i<=days;i++){
            Date date = DateUtil.getPreDays(startTime,i);
            String str = DateUtil.dateToStrShort(date);
            list.add(str);
        }
        JSONArray array = new JSONArray();
        for (int i=0;i<list.size();i++){
            String date = list.get(i);
            String doctorSql =" select d.name,d.id,d.job_title_name as jobTitleName,d.photo from base_doctor d where d.del=1 ";
            String deptCondition = "";
            if (StringUtils.isNoneBlank(dept)){
                deptCondition +=" (select dh.doctor_code from base_doctor_hospital dh where dh.dept_code = '"+dept+"' and dh.del=1 )";
            }
            String idTypeCondition = " ";
            if (StringUtils.isNoneBlank(idType)){
                idTypeCondition +="  (select d1.id from base_doctor d1 where 1=1 and d1.id_type = '"+idType+"')";
            }
            if (StringUtils.isNoneBlank(deptCondition)){
                doctorSql+=" and d.id IN "+deptCondition;
            }
            if (StringUtils.isNoneBlank(idTypeCondition)){
                doctorSql+=" and d.id IN "+idTypeCondition ;
            }
            if (StringUtils.isNoneBlank(status)){
                if (status.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in (select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59')";
                }else if (status.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id not in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59')";
                }
            }
            if (StringUtils.isNoneBlank(state)){
                if (state.equalsIgnoreCase("1")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2) )  ";
                }else if (state.equalsIgnoreCase("2")){
                    doctorSql +=" and d.id in(select d1.doctor_id from base_doctor_health_upload d1 where 1=1 and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1)) ";
                }
            }
            if (StringUtils.isNoneBlank(name)){
                doctorSql +=" and d.NAME  LIKE '%"+name+"%'";
            }
            List<Map<String,Object>> mapList = jdbcTemplate.queryForList(doctorSql);
            for (Map<String,Object> map:mapList){
                String id = map.get("id").toString();
                List<BaseDoctorHospitalDO> hospitalDOList = baseDoctorHospitalDao.findByDoctorCode(id);
                map.put("deptInfo",hospitalDOList);
                String stateCondition = "";
                if (StringUtils.isNoneBlank(state)){
                    if (state.equalsIgnoreCase("1")){
                        stateCondition +=" and (d1.health_code not in(2,3) and CAST(d1.temperature as DECIMAL)<37.3 and  d1.is_symptoms=2 and d1.is_epidemic=2)  ";
                    }else if (state.equalsIgnoreCase("2")){
                        stateCondition +=" and (d1.health_code in(2,3) OR CAST(d1.temperature as DECIMAL)>=37.3 OR  d1.is_symptoms=1 OR d1.is_epidemic=1) ";
                    }
                }
                String sql = "select d1.health_code,d1.temperature,d1.is_symptoms as isSymptoms,d1.is_epidemic as isEpidemic,d1.id,d1.consumer,d1.consumer_name as consumerName,date_format(d1.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime from base_doctor_health_upload d1 where 1=1 "+stateCondition+" and d1.create_time >='"+date+" 00:00:00' and d1.create_time<='"+date+" 23:59:59' and d1.doctor_id = '"+id+"' order by d1.create_time desc ";
                List<Map<String,Object>> mapList1 = jdbcTemplate.queryForList(sql);
                if (mapList1!=null&&mapList1.size()!=0){
                    for (Map<String,Object> map1:mapList1){
                        String healthCode = map1.get("health_code").toString();
                        Double temperature = Double.parseDouble(map1.get("temperature").toString());
                        String isSymptoms = map1.get("isSymptoms").toString();
                        String isEpidemic = map1.get("isEpidemic").toString();
                        if (healthCode.equalsIgnoreCase("2")||healthCode.equalsIgnoreCase("3")||
                                temperature>=37.3||isSymptoms.equalsIgnoreCase("1")||isEpidemic.equalsIgnoreCase("1")){
                            map1.put("healthState","异常");
                        }else {
                            map1.put("healthState","正常");
                        }
                        map.put("uploadState","已上报");
                        map.put("uploadId",map1.get("id").toString());
                    }
                    map.put("recordList",mapList1);
                }else {
                    map.put("healthState","未知");
                    map.put("uploadState","未上报");
                    map.put("uploadId","");
                    map.put("consumer","");
                    map.put("consumerName","");
                    map.put("createTime","");
                    map.put("recordList",mapList1);
                }
            }
            JSONObject object = new JSONObject();
            object.put("time",date);
            object.put("list",mapList);
            array.add(object);
        }
        return array;
    }
    /**
     * 报表导出
     *
     * @param startDate
     * @param endDate
     * @return
     */
    public JSONArray selectListInfoExcelByTotal(OutputStream os,String startDate,String endDate) throws Exception {
        long days = DateUtil.getDays(endDate,startDate);
        List<String> list = new ArrayList<>();
        Date startTime = DateUtil.strToDateShort(startDate);
        for (int i=0;i<=days;i++){
            Date date = DateUtil.getPreDays(startTime,i);
            String str = DateUtil.dateToStrShort(date);
            list.add(str);
        }
        JSONArray array = new JSONArray();
        for (int i=0;i<list.size();i++){
            String date = list.get(i);
            String doctorSql ="SELECT\n" +
                    "\td.idcard as idcard,\n" +
                    "\td.name as name,\n" +
                    "\td.mobile as mobile,\n" +
                    "\td.id_type as idType,\n" +
                    "\td.id as id,\n" +
                    "\tdhu.province_name as provinceName,\n" +
                    "\tdhu.city_name as cityName,\n" +
                    "\tdhu.town_name as townName,\n" +
                    "\tdhu.street_name as streetName,\n" +
                    "\tdhu.address as address,\n" +
                    "\tdhu.temperature as temperature,\n" +
                    "\tdhu.health_code as healthCode,\n" +
                    "\tdhu.tour_code as tourCode,\n" +
                    "\tdhu.is_symptoms as isSymtoms,\n" +
                    "\tdhu.is_epidemic as isEpidemic,\n" +
                    "\tdhu.is_outside as isOutside,\n" +
                    "\tdhu.is_nucleate as isNucleate,\n" +
                    "\tdhu.is_outside_high as isOutsideHigh, \n" +
                    "date_format(dhu.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime "+
                    " FROM\n" +
                    "\tbase_doctor d\n" +
                    "LEFT JOIN /* (SELECT * FROM base_doctor_health_upload dhu1*/ base_doctor_health_upload dhu ON dhu.doctor_id = d.id WHERE dhu.create_time >= '"+date+" 00:00:00' AND dhu.create_time <= '"+date+" 23:59:59'   ";
            List<Map<String,Object>> mapList = jdbcTemplate.queryForList(doctorSql);
            for (Map<String,Object> map:mapList){
                String id = map.get("id").toString();
                List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(id);
                if (baseDoctorHospitalDOS!=null&&baseDoctorHospitalDOS.size()!=0){
                    map.put("deptName",baseDoctorHospitalDOS.get(0).getDeptName());
                }
            }
            JSONObject object = new JSONObject();
            object.put("time",date);
            object.put("list",mapList);
            array.add(object);
        }
        pushListWritePriceTotal(os,array,startDate,endDate);
        return array;
    }
    /**
     *
     * mergeCells(a,b,c,d)
     * a 单元格的列号
     b 单元格的行号
     c 从单元格[a,b]起,向左合并到c列
     d 从单元格[a,b]起,向下合并到d行
     * 收入日报导出
     * @param os
     * @param ls
     * @param startTime
     * @param endTime
     * @throws Exception
     */
    public void pushListWritePriceTotal(OutputStream os,JSONArray ls,String startTime, String endTime) throws Exception {
        WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
        try {
        for (int i=0;i<ls.size();i++){
            JSONObject jsonObject = ls.getJSONObject(i);
            String time = jsonObject.getString("time");
            WritableSheet ws;
            ws = wwb.createSheet(time, i+1);
            String[] header = {"互联网综合服务平台健康上报情况","","","","","","","","","","","","","",""};//
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
                k++;
            }
            String[] header2 = {"科室","姓名","电话","身份类别","上报状态","所在地","体温","健康码","行程码","异常症状","涉疫人员","14天内从外地返","核酸检测","14天内有同往人从中高风险返厦","健康状态","上报时间"};//
            int k2 = 0;
            for (String h : header2) {
                addCell(ws, 1, k2, h);//表名,行,列,header
                k2++;
            }
            int j= 1;
            JSONArray array = jsonObject.getJSONArray("list");
            for (int z=0;z<array.size();z++){
                j=j+1;
                JSONObject object = array.getJSONObject(z);
                addCell(ws, j, 0, object.getString("deptName"));//表名,行,列,header
                addCell(ws, j, 1, object.getString("name"));//表名,行,列,header
                addCell(ws, j, 2, object.getString("mobile"));//表名,行,列,header
                if (StringUtils.isNoneBlank(object.getString("idType"))){
                    addCell(ws, j, 3, object.getString("idType"));//表名,行,列,header
                }else {
                    addCell(ws, j, 3, "");//表名,行,列,header
                }
                if (StringUtils.isNoneBlank(object.getString("temperature"))){
                    String address = "";
                    if ( StringUtils.isNoneBlank(object.getString("provinceName"))){
                        address +=object.getString("provinceName");
                    }
                    if ( StringUtils.isNoneBlank(object.getString("cityName"))){
                        address +=object.getString("cityName");
                    }
                    if ( StringUtils.isNoneBlank(object.getString("townName"))){
                        address +=object.getString("townName");
                    }
                    addCell(ws, j, 4, "已上报");//表名,行,列,header
                    addCell(ws, j, 5,address);//表名,行,列,header
                    addCell(ws, j, 6, object.getString("temperature"));//表名,行,列,header
                    String healthCodeName="";
                    String healthStateName= "";
                    if (object.getString("healthCode").equalsIgnoreCase("1")){
                        healthCodeName="绿码";
                    }else if (object.getString("healthCode").equalsIgnoreCase("2")){
                        healthCodeName="红码";
                    }else if (object.getString("healthCode").equalsIgnoreCase("3")){
                        healthCodeName="黄码";
                    }
                    if (object.getString("healthCode").equalsIgnoreCase("2")||object.getString("healthCode").equalsIgnoreCase("3")||
                            object.getDouble("temperature")>=37.3||object.getString("isSymtoms").equalsIgnoreCase("1")||object.getString("isEpidemic").equalsIgnoreCase("1")){
                        healthStateName="异常";
                    }else {
                        healthStateName="正常";
                    }
                    String tourCodeName = "";
                    if (object.getString("tourCode").equalsIgnoreCase("1")){
                        tourCodeName="带星";
                    }else if (object.getString("tourCode").equalsIgnoreCase("2")){
                        tourCodeName="不带星";
                    }
                    String isSymtomsName="";
                    if (object.getString("isSymtoms").equalsIgnoreCase("1")){
                        isSymtomsName="是";
                    }else if (object.getString("isSymtoms").equalsIgnoreCase("2")){
                        isSymtomsName="否";
                    }
                    String isEpidemicName="";
                    if (object.getString("isEpidemic").equalsIgnoreCase("1")){
                        isEpidemicName="是";
                    }else if (object.getString("isEpidemic").equalsIgnoreCase("2")){
                        isEpidemicName="否";
                    }
                    String isOutsideName="";
                    if (object.getString("isOutside").equalsIgnoreCase("1")){
                        isOutsideName="是";
                    }else if (object.getString("isOutside").equalsIgnoreCase("2")){
                        isOutsideName="否";
                    }
                    String isNucleateName="";
                    if (object.getString("isNucleate").equalsIgnoreCase("1")){
                        isNucleateName="未做";
                    }else if (object.getString("isNucleate").equalsIgnoreCase("2")){
                        isNucleateName="已做(院内)";
                    }else if (object.getString("isNucleate").equalsIgnoreCase("3")){
                        isNucleateName="已做(院外)";
                    }
                    String isOutsideHighName="";
                    if (object.getString("isOutsideHigh").equalsIgnoreCase("1")){
                        isOutsideHighName="是";
                    }else if (object.getString("isOutsideHigh").equalsIgnoreCase("2")){
                        isOutsideHighName="否";
                    }
                    String createTime= "";
                    if (object.get("createTime")!=null){
                        createTime = object.getString("createTime");
                    }
                    addCell(ws, j, 7, healthCodeName);//表名,行,列,header
                    addCell(ws, j, 8, tourCodeName);//表名,行,列,header
                    addCell(ws, j, 9, isSymtomsName);//表名,行,列,header
                    addCell(ws, j, 10, isEpidemicName);//表名,行,列,header
                    addCell(ws, j, 11, isOutsideName);//表名,行,列,header
                    addCell(ws, j, 12, isNucleateName);//表名,行,列,header
                    addCell(ws, j, 13, isOutsideHighName);//表名,行,列,header
                    addCell(ws, j, 14, healthStateName);//表名,行,列,header
                    addCell(ws, j, 15, createTime);//表名,行,列,header
                }else {
                    addCell(ws, j, 4, "未上报");//表名,行,列,header
                    addCell(ws, j, 5, "");//表名,行,列,header
                    addCell(ws, j, 6, "");//表名,行,列,header
                    addCell(ws, j, 7, "");//表名,行,列,header
                    addCell(ws, j, 8, "");//表名,行,列,header
                    addCell(ws, j, 9, "");//表名,行,列,header
                    addCell(ws, j, 10, "");//表名,行,列,header
                    addCell(ws, j, 11, "");//表名,行,列,header
                    addCell(ws, j, 12, "");//表名,行,列,header
                    addCell(ws, j, 13, "");//表名,行,列,header
                    addCell(ws, j, 14, "");//表名,行,列,header
                    addCell(ws, j, 15, "");//表名,行,列,header
                }
            }
            ws.mergeCells(0,0,15,0);
        }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
        Label label = new Label(column, row, data);
        WritableCellFormat cellFormat = new WritableCellFormat();
        cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
        cellFormat.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        label.setCellFormat(cellFormat);
        ws.addCell(label);
    }
    /**
     * 查下最新一次记录
     * @param doctorId
     * @param consumer
     * @return
     */
    public BaseDoctorHealthUploadDO selectRecordByDoctorIdAndConsumer(String doctorId,String consumer){
        BaseDoctorHealthUploadDO baseDoctorHealthUploadDO = null;
        List<BaseDoctorHealthUploadDO> doctorHealthUploadDOList = baseDoctorHealthUploadDao.findByDoctorIdAndConsumer(doctorId,consumer);
        if (doctorHealthUploadDOList!=null&&doctorHealthUploadDOList.size()!=0){
            baseDoctorHealthUploadDO = doctorHealthUploadDOList.get(0);
        }
        return baseDoctorHealthUploadDO;
    }
}

+ 8 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationDao.java

@ -15,9 +15,15 @@ import java.util.List;
 */
public interface YlzMedicailRelationDao extends PagingAndSortingRepository<YlzMedicalRelationDO, String>, JpaSpecificationExecutor<YlzMedicalRelationDO> {
    @Query("from YlzMedicalRelationDO a where a.relationCode = ?1 ")
    YlzMedicalRelationDO findByOutpatient(String relationCode);
    @Query("from YlzMedicalRelationDO a where   a.relationCode = ?1 and a.state=0 ")
    YlzMedicalRelationDO findByOutpatient(String outpatientId);
    @Query("from YlzMedicalRelationDO a where   a.relationCode = ?1 and a.state=1 ")
    List<YlzMedicalRelationDO> findByOutpatientStatus(String outpatientId);
    @Query("from YlzMedicalRelationDO a where a.logNo = ?1 ")
    YlzMedicalRelationDO findByLog_no(String logNo);
    @Query("from YlzMedicalRelationDO a where a.insuranceSerial = ?1 ")
    YlzMedicalRelationDO findByInsuranceSerial(String insuranceSerial);
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -86,7 +86,7 @@ public class PatientMappingService {
            return patient;
        }
        logger.info("patientDO:"+patientDO.toString());
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1");
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        if(patientMappingDO!=null){
            return patientMappingDO.getMappingCode();

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

@ -60,6 +60,8 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.outpatientId = ?1 and a.status>=20 and a.status<30 ")
    List<WlyyPrescriptionDO> findByOutPatientIdList(String outpatientId);
    @Query("select a from WlyyPrescriptionDO a where a.realOrder = ?1 and a.status>=20 and a.status<30 ")
    List<WlyyPrescriptionDO> findByRealOrderAndStatusList(String realOrder);
    List<WlyyPrescriptionDO> findByDoctorAndCreateTimeAndRemark(String doctor,Date createTime,String remark);
    @Query("select a from WlyyPrescriptionDO a where a.createTime>?1 and  a.createTime <?2 and a.status <30 and a.status>=0")

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

@ -53,6 +53,23 @@ public class PayInfoNoticeService {
        return null;
    }
    public String pushPrescriptionPayMedicare(String patient,String doctorName,String orderNo,String outpatientId,String prescriptionId,String total,String mipay,String selfPay,String title,String url){
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){
            String userName = patientDO.getName();
            String idcard = patientDO.getIdcard();
            String phone = patientDO.getMobile();
            if (!StringUtils.isNotBlank(url)){
                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,mipay,selfPay,orderNo,remark);
        }
        return null;
    }
    public String pushPrescriptionPayAndHsjc(String patient,String doctorName,String orderNo,String id,String total,String title,String url,String realOrder){
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){

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

@ -599,6 +599,7 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            if(isContainEndRoutInfo){
                //修改处方状态为完成
                prescriptionDao.updateStatusByOutPatientId( 100,new Date(),sfexpress.getOutpatientId());
                prescriptionService.electronicPrescriptionReceiving(sfexpress.getOutpatientId());
                /*List<WlyyPrescriptionDO> wlyyPrescriptionDOs = prescriptionDao.findByOutpatientId(sfexpress.getOutpatientId());
                if (wlyyPrescriptionDOs.size()>0){
                    WlyyPrescriptionDO wlyyPrescriptionDO=wlyyPrescriptionDOs.get(0);

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

@ -41,6 +41,8 @@ import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
@ -61,6 +63,8 @@ import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.family.dao.WlyyNatPatientFamilyMemberDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.BaseOperateLogService;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
@ -326,8 +330,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private HcyyPrescriptionService hcyyPrescriptionService;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    private YlzMedicailMxDao ylzMedicailMxDao;
    @Autowired
    private WlyyNatPatientFamilyMemberDao natPatientFamilyMemberDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
    public static String entranceHealthCareUrl = "http://127.0.0.1:10023/healthCare/";
@ -706,6 +715,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("doctorCancelType", outpatientDO.getDoctorCancelType());
        rs.put("doctorCancelValue", outpatientDO.getDoctorCancelValue());
        rs.put("doctorCancelRemark", outpatientDO.getDoctorCancelRemark());
        rs.put("medicalState",outpatientDO.getMedicalState());
        rs.put("payStatus", outpatientDO.getPayStatus());
        rs.put("patientCancelType", outpatientDO.getPatientCancelType());
        rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
@ -1584,7 +1594,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " h.dept_name AS \"deptName\","+
                " h.org_code AS \"orgCode\","+
                " h.org_name AS \"orgName\","+
                " t.photo AS \"hosptialphoto\""+
                " t.photo AS \"hosptialphoto\","+
                " d.id_type AS \"idType\","+
                " d.id_card_type AS \"idCardType\" "+
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
@ -3537,7 +3549,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " e.id AS \"expressageId\" ,"+
                " p.real_order AS \"realOrder\" ,"+
                " p.origin_real_order AS \"originRealOrder\"," +
                " o.patient_name as \"patientName\" "+
                " o.patient_name as \"patientName\", "+
                " p.check_status as \"checkStatus\", "+
                " p.check_reason as \"checkReason\"  "+
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
@ -3783,7 +3797,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            WritableSheet ws;
            ws = wwb.createSheet("sheet", 1);
            String[] header = {"序号","充值时间","商户订单号","医院订单号","患者姓名","证件号码","就诊卡号","手机号码","金额","状态","业务类型","咨询方式"};
            String[] header = {"序号","充值时间","商户订单号","医院订单号","患者姓名","证件号码","就诊卡号","手机号码","金额","状态","业务类型","咨询方式","代问诊人","问诊医生"};
            int k = 0;
            for (String h : header) {
                addCell(ws, 0, k, h);//表名,行,列,header
@ -3873,12 +3887,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }else {
                    time = m.get("payTime").toString();
                }
                String consumerName = "";
                if (m.get("consumerName") == null){
                    consumerName = null;
                }else {
                    consumerName= m.get("consumerName").toString();
                }
                String doctorName ="";
                if (m.get("doctorName") == null){
                    doctorName = null;
                }else {
                    doctorName= m.get("doctorName").toString();
                }
                addCell(ws, i, 0, m.get("id")!=null?m.get("id").toString():n);
                addCell(ws, i, 1, time!=null?time:n);
                addCell(ws, i, 2, (String) m.get("orderNo")!=null?(String) m.get("orderNo"):n);
                addCell(ws, i, 3, (String) m.get("ykOrderNo")!=null?(String) m.get("ykOrderNo"):n);
                addCell(ws, i, 4, (String) m.get("patientName")!=null?(String) m.get("patientName"):n);
                addCell(ws, i, 4, consumerName!=null?consumerName:n);
                addCell(ws, i, 5, (String) m.get("idcard")!=null?(String) m.get("idcard"):n);
                addCell(ws, i, 6, (String) m.get("medicard")!=null?(String) m.get("medicard"):n);
                addCell(ws, i, 7, (String) m.get("mobile")!=null?(String) m.get("mobile"):n);
@ -3886,6 +3914,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                addCell(ws, i, 9, status!=null?status:n);
                addCell(ws, i, 10, odry!=null?odry:n);
                addCell(ws, i, 11, odte!=null?odte:n);
                addCell(ws, i, 12, (String) m.get("patientName")!=null?(String) m.get("patientName"):n);
                addCell(ws, i, 13, doctorName!=null?doctorName:n);
                i++;
            }
            wwb.write();
@ -4359,6 +4389,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("popularity",doctorDO.getPopularity());
            rs.put("qrcode",doctorDO.getQrcode());
            rs.put("appletQrcode",doctorDO.getAppletQrCode());
            rs.put("idType",doctorDO.getIdType());
            rs.put("idCard",doctorDO.getIdcard());
            rs.put("idCardType",doctorDO.getIdCardType());
            List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            String sqlCharge = "SELECT\n" +
                    "\tm.req_fee as \"twfzFee\",\n" +
@ -4431,7 +4464,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " base_doctor_role r " +
                    " JOIN base_doctor_role_dict t ON t.code = r.role_code " +
                    " WHERE " +
                    " r.doctor_code = '" + doctor + "'";
                    " r.doctor_code = '" + doctorDO.getId() + "'";
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
            if (list != null && list.size() > 0) {
@ -4440,14 +4474,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                rs.put("roles", null);
            }
            //医生预约量
            List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctor(doctor);
            List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctor(doctorDO.getId());
            if (registerTimeDOs != null && registerTimeDOs.size() > 0) {
                rs.put("registerCount", registerTimeDOs.size());
            } else {
                rs.put("registerCount", 0);
            }
            //医生问诊量
            List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctor);
            List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctorList(doctorDO.getId());
            if (wlyyOutpatientDOs != null && wlyyOutpatientDOs.size() > 0) {
                rs.put("outpatientCount", wlyyOutpatientDOs.size());
            } else {
@ -4459,7 +4493,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//            rs.put("coordinationCout",coordinationCout);
            //医生关注
            if(StringUtils.isNotBlank(patient)){
                List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctor,patient);
                List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctorAndPatient(doctorDO.getId(),patient);
                if (doctorPatientFollowDOS != null && doctorPatientFollowDOS.size() > 0) {
                    rs.put("attention", "1");
                } else {
@ -4480,7 +4514,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //专家咨询
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='" + doctor + "' AND (type=1 OR type=15)";
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='" + doctorDO.getId() + "' AND (type=1 OR type=15)";
            List<Map<String, Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
            if (zjList != null && zjList.size() > 0) {
                rs.put("zjCount", zjList.size());
@ -4495,7 +4529,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "FROM base_evaluate a,base_evaluate_score b " +
                    "WHERE " +
                    "a.relation_code=b.id " +
                    "AND b.doctor='" + doctor + "' " +
                    "AND b.doctor='" + doctorDO.getId() + "' " +
                    "GROUP BY a.score_type ORDER BY  a.score_type ASC ";
            List<Map<String, Object>> listscore = jdbcTemplate.queryForList(sqlscore);
@ -4514,7 +4548,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            } else {
                rs.put("scoreDoctor", null);
            }
            int count = baseBannerDoctorDao.getTotalBannerCount(doctor);
            int count = baseBannerDoctorDao.getTotalBannerCount(doctorDO.getId());
            rs.put("bannerCount",count);
            //查询评价明细
@ -4532,8 +4566,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    "FROM " +
                    "base_evaluate a " +
                    "LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctor + "' " +
                    "WHERE a.relation_code=b.id AND b.doctor='" + doctor + "' order by b.create_time DESC ";
                    "LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code AND c.doctor='" + doctorDO.getId() + "' " +
                    "WHERE a.relation_code=b.id AND b.doctor='" + doctorDO.getId() + "' order by b.create_time DESC ";
            List<Map<String, Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
            if (scoreList != null && scoreList.size() > 0) {
//                Set<String> datelist = new HashSet<>();
@ -6837,17 +6871,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            params.put("consultStatus", consultStatus);
        }
        if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (flag){
                sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+",dw.workTotal DESC";
            }else{
                sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
                sql+=" NULLS LAST,\n" +
                        "\tD.id DESC,dw.workTotal DESC NULLS LAST";
            }
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("isSort");//isSort:1按照后台顺序,0按照系统排序
        if (hospitalSysDictDO!=null&&hospitalSysDictDO.getDictValue().equalsIgnoreCase("1")){
            sql +=" and d.del='1' order by d.sort asc  ";
        }else {
            sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+"";
            if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                if (flag){
                    sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+",dw.workTotal DESC";
                }else{
                    sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
                    sql+=" NULLS LAST,\n" +
                            "\tD.id DESC,dw.workTotal DESC NULLS LAST";
                }
            }else {
                sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort+"";
            }
        }
        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
        /*list.stream().forEach(e->{
@ -7318,19 +7358,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Boolean flag = healthCareService.isHospitalFlag();
        if (flag){
            try{
                String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                if (object.getString("flag").equalsIgnoreCase("1")){
                    com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
                    String state = encryptData.getString("state");
                    String auth_date = encryptData.getString("auth_date");
                    basePatientDO.setMedicalState(state);
                    basePatientDO = basePatientDao.save(basePatientDO);
                if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                    String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                    if (object.getString("flag").equalsIgnoreCase("1")){
                        com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
                        String state = encryptData.getString("state");
                        String auth_date = encryptData.getString("auth_date");
                        basePatientDO.setMedicalState(state);
                        basePatientDO = basePatientDao.save(basePatientDO);
                    }
                }else {
                    String result = healthCareService.authorized(basePatientDO.getId());
                    com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
                    if (object.getString("flag").equalsIgnoreCase("1")){
                        com.alibaba.fastjson.JSONObject encryptData = object.getJSONObject("encrypt_data");
                        String state = encryptData.getString("state");
                        String auth_date = encryptData.getString("auth_date");
                        basePatientDO.setMedicalState(state);
                        basePatientDO = basePatientDao.save(basePatientDO);
                    }
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patient, "1");
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
@ -8649,6 +8700,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                room.setDeptName(outpatientDO.getDeptName());
                room.setDoctor(outpatientDO.getDoctor());
                room.setDoctorName(outpatientDO.getDoctorName());
                room.setReservationTime(outpatientDO.getRegisterDate());
                room.setConsultType(Integer.parseInt(outpatientDO.getType()));
                room.setChargeType(chargeType);
            }
@ -11416,6 +11468,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
                WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByOutPatientIdList(prescriptionDO.getOutpatientId());
                DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
@ -11456,8 +11509,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wlyyHttpLogDO.setCreateTime(new Date());
                wlyyHttpLogDO.setCode(outpatientDO.getId());
                wlyyHttpLogDao.save(wlyyHttpLogDO);
                for (WlyyPrescriptionDO wlyyPrescriptionDO:prescriptionDOList){
                    wlyyPrescriptionDO.setStatus(-4);
                    wlyyPrescriptionDO.setDisableTime(new Date());
                    wlyyPrescriptionDO.setCheckStatus(5);
                    wlyyPrescriptionDO.setCheckReason("已作废");
                    prescriptionDao.save(wlyyPrescriptionDO);
                }
            }
            prescriptionDO.setStatus(-4);
            prescriptionDO.setDisableTime(new Date());
            prescriptionDO.setCheckStatus(5);
@ -13981,36 +14040,35 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception {
    public com.alibaba.fastjson.JSONObject getSettlementInfo(String outpatientId,Integer flag) throws Exception {
        logger.info("获取患者待结算信息开始!");
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if(outpatientDO==null){
            throw new Exception("门诊信息为空");
        }
        String registerNo = outpatientDO.getRegisterNo();
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("ylzConfigOrgCode");
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());
            xzzxEntranceService.getSettleInfHospital(outpatientDO.getCardNo(),outpatientId,sysDictDO.getDictValue());
            logger.info("获取患者待结算信息结束!");
            logger.info("医保挂号开始!");
            String register = healthCareService.registerToEntrance(registerNo);
            String register = healthCareService.registerToEntrance(outpatientId);
            logger.info("医保挂号结束!");
            logger.info("医保费用明细上传开始!");
            String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(registerNo);
            String feeDetailUpload= healthCareService.feeDetailUploadToEntrance(outpatientId);
            logger.info("医保费用明细上传结束!");
            logger.info("医保预结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(registerNo);
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlementToEntrance(outpatientId);
            logger.info("医保预结算信息结束!");
            JSONObject object = new JSONObject();
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            if (flag==1){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(registerNo);
                String getSettlementResultUrl = healthCareService.getSettlementResultUrlToEntrance(outpatientId);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrl",getSettlementResultUrl);
            }else if (flag==2){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(registerNo);
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64ToEntrance(outpatientId);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
            }
@ -14022,47 +14080,118 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            object.put("deptName",outpatientDO.getPatientName());
            return object;
        }else {
            /*entranceService.BS10108()*/
            /*entrance(outpatientDO.getCardNo(),registerNo,sysDictDO.getDictValue());*/
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            logger.info("获取患者待结算信息开始!");
            entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
            ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
                //医保已结算直接返回数据
                List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
                ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                Double totalPirce=b1.add(b2).add(b3).doubleValue();
                logger.info("总费用:"+totalPirce);
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }
            try {
                ylzMedicalRelationDO = entranceService.getSettleInfo(outpatientDO.getCardNo(),outpatientDO.getIdcard(),outpatientDO.getId());
            }catch (Exception e){
                throw new Exception(e.getMessage());
            }
            if (ylzMedicalRelationDO==null){
                throw new Exception("无待结算信息");
            }
            logger.info("获取患者待结算信息结束!");
            logger.info("医保挂号开始!");
            String register = healthCareService.register(registerNo);
            logger.info("医保挂号结束!");
            logger.info("医保费用明细上传开始!");
            String feeDetailUpload= healthCareService.feeDetailUpload(registerNo);
            logger.info("医保费用明细上传结束!");
            if(outpatientDO!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
                logger.info("医保挂号开始!");
                String register = healthCareService.register(outpatientId);
                logger.info("医保挂号结束!");
                logger.info("医保费用明细上传开始!");
                String feeDetailUpload= healthCareService.feeDetailUpload(outpatientId);
                logger.info("医保费用明细上传结束!");
                logger.info("医保预结算信息开始!");
                ylzMedicalRelationDO =  healthCareService.preSettlement(outpatientId);
                logger.info("医保预结算信息结束!");
                if (flag==1){
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrl = healthCareService.getSettlementResultUrl(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrl",getSettlementResultUrl);
                }else if (flag==2){
                    logger.info("获取医保结算页面地址开始!");
                    String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(outpatientId);
                    logger.info("获取医保结算页面地址结束!");
                    object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
                }
                if (ylzMedicalRelationDO.getPersonCash()!=null){
                    BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                    BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                    BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                    Double totalPirce=b1.add(b2).add(b3).doubleValue();
                    logger.info("总费用:"+totalPirce);
                    if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                        object.put("code","403");
                        object.put("message","金额不对无法结算!");
                    }else {
                        object.put("code","200");
                        object.put("message","核对金额无误!");
                    }
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }else {
                BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
                BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
                BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
                Double totalPirce=b1.add(b2).add(b3).doubleValue();
                logger.info("总费用:"+totalPirce);
                if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                    object.put("code","403");
                    object.put("message","金额不对无法结算!");
                }else {
                    object.put("code","200");
                    object.put("message","核对金额无误!");
                }
                object.put("getSettleInfo",ylzMedicalRelationDO);
                return object;
            }
        }
    }
            logger.info("医保预结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO =  healthCareService.preSettlement(registerNo);
            logger.info("医保预结算信息结束!");
            JSONObject object = new JSONObject();
            if (flag==1){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrl = healthCareService.getSettlementResultUrl(registerNo);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrl",getSettlementResultUrl);
            }else if (flag==2){
                logger.info("获取医保结算页面地址开始!");
                String getSettlementResultUrlBase64 = healthCareService.getSettlementResultUrlBase64(registerNo);
                logger.info("获取医保结算页面地址结束!");
                object.put("getSettlementResultUrlBase64",getSettlementResultUrlBase64);
    public YlzMedicalRelationDO selectByOutpatientId(String outpatientId){
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        return ylzMedicalRelationDO;
    }
    public String electronicPrescriptionReceiving(String outpatientId) {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO.getMedicalState()!=null&&outpatientDO.getMedicalState().equalsIgnoreCase("1")){
            try {
                healthCareService.electronicPrescriptionReceiving(outpatientId);
                return "上传成功";
            }catch (Exception e){
                e.printStackTrace();
            }
            object.put("register",register);
            object.put("feeDetailUpload",feeDetailUpload);
            object.put("preSettlement",ylzMedicalRelationDO);
            object.put("cardNo",outpatientDO.getCardNo());
            object.put("deptName",outpatientDO.getPatientName());
            return object;
        }
        return null;
    }
    /**
     * 医保结算页面
     * 医保结算结果
     * @param outpatientId
     * @return
     * @throws Exception
@ -14079,15 +14208,210 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            result = healthCareService.getSettlementResult(code);
            logger.info("医保结算结果获取end!");
        }else{
        }/*else{
            logger.info("医保结算页面start!");
            String registerNo = outpatientDO.getRegisterNo();
            result = healthCareService.getSettlementResultUrl(registerNo);
            logger.info("医保结算页面end!");
        }
        }*/
        return result;
    }
    /**
     * 医保结算后确认his结算
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String confirmSettlementService(String outpatientId) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO==null){
            throw new Exception("未找到待结算记录");
        }
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        if (ylzMedicalRelationDO.getState()!=null&&ylzMedicalRelationDO.getState()==1){
            return "已结算";
        }
        //用医保结算直接调用确认结算
        confirmSettlement(outpatientId);
        return "结算成功";
    }
    /**
     * 费用结算
     *
     * @param outpatientId
     * @return
     * @throws Exception
     */
    public String confirmSettlement(String outpatientId) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if (outpatientDO==null){
            throw new Exception("未找到待结算记录");
        }
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
        String depositType = "";
        String depositAmount = "";
        String outChargeNo = "";
        if (businessOrderDO!=null){
            depositType = businessOrderDO.getDepositType();
            depositAmount = businessOrderDO.getPayPrice()+"";
            outChargeNo = businessOrderDO.getTraceNo();
        }
        JSONArray jsonArray = new JSONArray();
        if (ylzMedicalRelationDO.getMedicalState()==null||(ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0)){
            WlyyHisSettleVO wlyyHisSettleVO = new WlyyHisSettleVO();
            wlyyHisSettleVO.setCardNo(ylzMedicalRelationDO.getCardNo());
            wlyyHisSettleVO.setXtgzh0(ylzMedicalRelationDO.getHisSettleNo());
            wlyyHisSettleVO.setDepositType(depositType);
            wlyyHisSettleVO.setDepositAmount(depositAmount);
            wlyyHisSettleVO.setOutChargeNo(outChargeNo);
            wlyyHisSettleVO.setOrgCode("6");
            wlyyHisSettleVO.setXyzf00("0");
            wlyyHisSettleVO.setChannelType("09");
            wlyyHisSettleVO.setDjlsh0("");
            wlyyHisSettleVO.setMzlsh0("");
            wlyyHisSettleVO.setZhzfe0("");
            wlyyHisSettleVO.setGrzfe0("");
            wlyyHisSettleVO.setJjzfe0("");
            wlyyHisSettleVO.setGwybz0("");
            wlyyHisSettleVO.setFybfy0("");
            wlyyHisSettleVO.setCfdxje("");
            wlyyHisSettleVO.setBjjjzf("");
            wlyyHisSettleVO.setSybxzf("");
            wlyyHisSettleVO.setBcbxf0("");
            wlyyHisSettleVO.setSfrq00("");
            wlyyHisSettleVO.setSfsj00("");
            wlyyHisSettleVO.setSfrxm0("");
            wlyyHisSettleVO.setBzjjzf("");
            wlyyHisSettleVO.setGrzhye("");
            wlyyHisSettleVO.setYlzfje("");
            wlyyHisSettleVO.setJkzhye("");
            wlyyHisSettleVO.setJkzhye("");
            wlyyHisSettleVO.setGrzhye("");
            wlyyHisSettleVO.setYbmxls("");
            wlyyHisSettleVO.setBdgjzf("");
            wlyyHisSettleVO.setYdgjzf("");
            wlyyHisSettleVO.setBckbcs("");
            jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
        }
        if (ylzMedicalRelationDO!=null&&ylzMedicalRelationDO.getStatus()==1){
            WlyyHisSettleVO wlyyHisSettleVO = new WlyyHisSettleVO();
            wlyyHisSettleVO.setCardNo(ylzMedicalRelationDO.getCardNo());
            wlyyHisSettleVO.setXtgzh0(ylzMedicalRelationDO.getHisSettleNo());
            wlyyHisSettleVO.setDepositType(depositType);
            wlyyHisSettleVO.setDepositAmount(depositAmount);
            wlyyHisSettleVO.setOutChargeNo(outChargeNo);
            wlyyHisSettleVO.setOrgCode("6");
            wlyyHisSettleVO.setXyzf00("0");
            wlyyHisSettleVO.setChannelType("09");
            wlyyHisSettleVO.setDjlsh0(ylzMedicalRelationDO.getBillSerial());
            wlyyHisSettleVO.setMzlsh0(ylzMedicalRelationDO.getInsuranceSerial());
            wlyyHisSettleVO.setZhzfe0(ylzMedicalRelationDO.getPersonAccount());
            wlyyHisSettleVO.setGrzfe0(ylzMedicalRelationDO.getPersonCash());
            wlyyHisSettleVO.setJjzfe0(ylzMedicalRelationDO.getMedicalPrice());
            wlyyHisSettleVO.setGwybz0(ylzMedicalRelationDO.getGwyPay());
            wlyyHisSettleVO.setFybfy0(ylzMedicalRelationDO.getPersonCash());
            wlyyHisSettleVO.setCfdxje("0");
            wlyyHisSettleVO.setBjjjzf("0");
            wlyyHisSettleVO.setSybxzf(ylzMedicalRelationDO.getSbjjPay());
            wlyyHisSettleVO.setBcbxf0(ylzMedicalRelationDO.getTotalAmount());
            wlyyHisSettleVO.setSfrq00(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
            wlyyHisSettleVO.setSfsj00("");
            wlyyHisSettleVO.setSfrxm0("");
            wlyyHisSettleVO.setBzjjzf(ylzMedicalRelationDO.getYljzPay());
            wlyyHisSettleVO.setGrzhye(ylzMedicalRelationDO.getAccountBalance());
            wlyyHisSettleVO.setYlzfje(ylzMedicalRelationDO.getOwnPay());
            wlyyHisSettleVO.setJkzhye(ylzMedicalRelationDO.getJkzhPay());
            wlyyHisSettleVO.setYbmxls(ylzMedicalRelationDO.getDetailSerial());
            wlyyHisSettleVO.setBdgjzf(ylzMedicalRelationDO.getJtgjPay());
            wlyyHisSettleVO.setYdgjzf(ylzMedicalRelationDO.getJtgjPay());
            wlyyHisSettleVO.setBckbcs(ylzMedicalRelationDO.getHospitalizationQty());
            wlyyHisSettleVO.setPsnNo(ylzMedicalRelationDO.getPersonalCode());
            wlyyHisSettleVO.setAab301(ylzMedicalRelationDO.getAdministrativeArea());
            wlyyHisSettleVO.setInsutype(ylzMedicalRelationDO.getInsuranceType());
            wlyyHisSettleVO.setSetlTime(DateUtil.dateToStrLong(ylzMedicalRelationDO.getPayDate()));
            jsonArray = entranceService.BS15039(wlyyHisSettleVO,false);
        }
        if (jsonArray!=null&&jsonArray.size()!=0){
            net.sf.json.JSONObject object = jsonArray.getJSONObject(0);
            net.sf.json.JSONObject jsonObject = object.getJSONObject("retInfo");
            net.sf.json.JSONObject msgInfoJson = object.getJSONObject("msgInfo");
            if (jsonObject.getString("retCode").equalsIgnoreCase("00")){
                ylzMedicalRelationDO.setState(1);
                ylzMedicalRelationDO.setHisBillSerial(msgInfoJson.getString("callSn"));
                ylzMedicalRelationDO.setHisDesc(msgInfoJson.getString("jsxxts"));
                ylzMedicalRelationDO.setSettleDate(new Date());
                ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                List<YlzMedicalMxDO> mxDOList = ylzMedicailMxDao.findByMedicalId(ylzMedicalRelationDO.getId());
                boolean hisState = false;
                for (YlzMedicalMxDO mxDO:mxDOList){
                    if (mxDO.getItemName().contains("互联网医院复诊诊查费")){
                        hisState = true;
                    }
                }
                logger.info("变更医保结算状态成功");
                String realOrder = msgInfoJson.getString("xtgzh0");
                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderAndStatusList(realOrder);
                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    String title = "";
                    if (wlyyOutpatientDO.getHisStatus()==null){
                        title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!结算费用包含本次在线问诊的复诊诊查费:"+wlyyOutpatientDO.getFee()+"元。";
                    }else {
                        title="您在厦门大学附属中山医院有一笔诊察/处方费用已支付完成!";
                    }
                    if (hisState){
                        wlyyOutpatientDO.setHisStatus(1);
                        outpatientDao.save(wlyyOutpatientDO);
                    }
                    WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                    prescriptionLogDO.setCreateTime(new Date());
                    prescriptionLogDO.setStatus(30);
                    prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
                    prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
                    prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
                    prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
                    prescriptionLogDO.setUserType(1);
                    prescriptionLogDO.setDatajson("处方结算");
                    prescriptionLogDao.save(prescriptionLogDO);
                    prescriptionDO.setStatus(30);
                    prescriptionDO.setPayTime(new Date());
                    prescriptionDao.save(prescriptionDO);
                    logger.info("变更处方结算状态成功");
                    String fee = ylzMedicalRelationDO.getTotalAmount();
                    String pushPayLog =  payInfoNoticeService.pushPrescriptionPayMedicare(wlyyOutpatientDO.getConsumer(),prescriptionDO.getDoctorName(),prescriptionDO.getVoucherNo(),prescriptionDO.getOutpatientId(),prescriptionDO.getId(),fee,ylzMedicalRelationDO.getMedicalPrice(),ylzMedicalRelationDO.getPersonCash(),title,null);
                    logger.info("处方结算成功"+pushPayLog+"====="+realOrder);
                    //2.6.1	电子处方订单接收
                    logger.info("医保电子处方订单");
                    if (ylzMedicalRelationDO.getMedicalState()!=null&&ylzMedicalRelationDO.getMedicalState()==0){
                        List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageDao.findByOutpatientId(ylzMedicalRelationDO.getRelationCode());
                        if (expressageDOList!=null&&expressageDOList.size()!=0){
                            WlyyPrescriptionExpressageDO expressageDO = expressageDOList.get(0);
                            if (expressageDO.getOneselfPickupFlg()==1){
                                healthCareService.electronicPrescriptionReceiving(ylzMedicalRelationDO.getRelationCode());
                            }
                        }
                    }
                }
                logger.info("电子发票开具开始");
                /*try {
                    entranceService.dzpjServer(patientMappingDO.getMappingCode(),realOrder);
                }catch (Exception e){
                    e.printStackTrace();
                }*/
                logger.info("电子发票开具结束");
            }
        }
        return jsonArray.toString();
    }
    /**
     *
@ -14514,6 +14838,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            com.alibaba.fastjson.JSONObject objectString = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.toJSON(prescriptionDO);
            List<WlyyPrescriptionInfoDO> infoDOList = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(),1);
            objectString.put("info",infoDOList);
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
            if (outpatientDO!=null){
                objectString.put("consumerName",outpatientDO.getConsumerName());
            }else {
                objectString.put("consumerName","");
            }
            Map<String,Object> map = new HashedMap();
            map.put("prescription",objectString);
            mapList.add(map);
@ -14524,7 +14854,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 药品明细表导出
     * @param os
     * @param osmergeCells(a,b,c,d)
     * @param ls
     * @param startTime
     * @param endTime
@ -14548,7 +14878,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                addCell(ws, 1, k1, h);//表名,行,列,header
                k1++;
            }
            String[] header2 = {"患者名称","订单药品","规格","总量","单位","进价","零售价","进货金额","零售金额","发药时间","审方时间","开方时间","开方医生"};//
            String[] header2 = {"患者名称","代问诊人","订单药品","规格","总量","单位","进价","零售价","进货金额","零售金额","发药时间","审方时间","开方时间","开方医生"};//
            int k2 = 0;
            for (String h : header2) {
                addCell(ws, 2, k2, h);//表名,行,列,header
@ -14563,31 +14893,34 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                com.alibaba.fastjson.JSONArray array = jsonObject.getJSONArray("info");
                int j = i;
                addCell(ws, i, 0,jsonObject.get("patientName")!=null?jsonObject.get("patientName").toString():n);
                addCell(ws, i, 1,jsonObject.get("consumerName")!=null?jsonObject.get("consumerName").toString():n);
                DecimalFormat df = new DecimalFormat("#.00");
                if(array!=null&&array.size()!=0){
                    for (int z=0;z<array.size();z++){
                        com.alibaba.fastjson.JSONObject object = array.getJSONObject(z);
                        addCell(ws, i, 1, object.get("drugName")!=null?object.get("drugName").toString():n);
                        addCell(ws, i, 2, object.get("specification")!=null?object.get("specification").toString():n);
                        addCell(ws, i, 3, object.get("quantity")!=null?object.get("quantity").toString():n);
                        addCell(ws, i, 4, object.get("packUnitName")!=null?object.get("packUnitName").toString():n);
                        addCell(ws, i, 5, "无");
                        addCell(ws, i, 6, object.get("packRetprice")!=null?object.get("packRetprice").toString():n);
                        addCell(ws, i, 7, "无");
                        addCell(ws, i, 2, object.get("drugName")!=null?object.get("drugName").toString():n);
                        addCell(ws, i, 3, object.get("specification")!=null?object.get("specification").toString():n);
                        addCell(ws, i, 4, object.get("quantity")!=null?object.get("quantity").toString():n);
                        addCell(ws, i, 5, object.get("packUnitName")!=null?object.get("packUnitName").toString():n);
                        addCell(ws, i, 6, "无");
                        addCell(ws, i, 7, object.get("packRetprice")!=null?object.get("packRetprice").toString():n);
                        addCell(ws, i, 8, "无");
                        if (object.get("quantity")!=null){
                            Double quantity = Double.parseDouble(object.get("quantity").toString());
                            Double packRetprice = Double.parseDouble(object.get("packRetprice").toString());
                            addCell(ws, i, 8,df.format(packRetprice*quantity));
                            addCell(ws, i, 9,df.format(packRetprice*quantity));
                        }else {
                            addCell(ws, i, 8,"");
                            addCell(ws, i, 9,"");
                        }
                        addCell(ws, i, 9,jsonObject.get("dispDate")!=null?DateUtil.stampToString(jsonObject.get("dispDate").toString()):n);
                        addCell(ws, i, 10,jsonObject.get("checkTime")!=null?DateUtil.stampToString(jsonObject.get("checkTime").toString()):n);
                        addCell(ws, i, 11,jsonObject.get("createTime")!=null?DateUtil.stampToString(jsonObject.get("createTime").toString()):n);
                        addCell(ws, i, 12,jsonObject.get("doctorName")!=null?jsonObject.get("doctorName").toString():n);
                        addCell(ws, i, 10,jsonObject.get("dispDate")!=null?DateUtil.stampToString(jsonObject.get("dispDate").toString()):n);
                        addCell(ws, i, 11,jsonObject.get("checkTime")!=null?DateUtil.stampToString(jsonObject.get("checkTime").toString()):n);
                        addCell(ws, i, 12,jsonObject.get("createTime")!=null?DateUtil.stampToString(jsonObject.get("createTime").toString()):n);
                        addCell(ws, i, 13,jsonObject.get("doctorName")!=null?jsonObject.get("doctorName").toString():n);
                        i++;
                    }
                    ws.mergeCells(0,j,0,i-1);
                    ws.mergeCells(1,j,1,i-1);
                }else {
                    i++;
                }
@ -14595,8 +14928,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            ws.mergeCells(0,0,12,0);
            ws.mergeCells(0,1,12,1);
            ws.mergeCells(0,0,13,0);
            ws.mergeCells(0,1,13,1);
            wwb.write();
            wwb.close();
        } catch (IOException e) {

文件差異過大導致無法顯示
+ 343 - 51
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


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

@ -2444,7 +2444,7 @@ public class XzzxEntranceService{
     * @return
     * @throws Exception
     */
    public String confirmSettle(String his_serial,String icCardNo,String org_code)throws Exception{
    public String confirmSettle(String his_serial,String icCardNo,String org_code,String outpatientId)throws Exception{
        String api = "confirmSettle";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
@ -2453,7 +2453,7 @@ public class XzzxEntranceService{
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(his_serial);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
        String condition ="";
        JSONObject jsonObject = new JSONObject();
@ -2485,8 +2485,8 @@ public class XzzxEntranceService{
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getPersonAccount())){
                jsonObject.put("person_account",ylzMedicalRelationDO.getPersonAccount());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getFundPrice())){
                jsonObject.put("fund_amount",ylzMedicalRelationDO.getFundPrice());
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getMedicalPrice())){
                jsonObject.put("fund_amount",ylzMedicalRelationDO.getMedicalPrice());
            }
            if (!StringUtils.isEmpty(ylzMedicalRelationDO.getJkzhPay())){
                jsonObject.put("jkzh_pay",ylzMedicalRelationDO.getJkzhPay());
@ -2749,8 +2749,10 @@ public class XzzxEntranceService{
     * @param org_code 医院编码
     * @return
     */
    public JSONObject getSettleInfHospital(String icCardNo,String his_serial,String org_code){
    public JSONObject getSettleInfHospital(String icCardNo,String outpatientId,String org_code){
        JSONObject jsonObject= new JSONObject();
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(outpatientId);
        String his_serial = wlyyOutpatientDO.getRegisterNo();
        String response="";
        String url = entranceUrl+"getSettleInfo?icCardNo="+icCardNo+"&his_serial="+his_serial+"&org_code="+org_code;
        response = httpClientUtil.get(url,"GBK");

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

@ -59,6 +59,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.CriteriaBuilder;
import java.io.InputStream;
import java.math.BigDecimal;
import java.rmi.server.ExportException;
import java.util.*;
/**
@ -1760,7 +1761,7 @@ public class YkyyEntranceService {
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\t(x.jzkh = '"+ssc+"' or x.MZHM='"+ssc+"') and x.sfzh ='"+idcard+"'";
                "\t(UPPER(x.jzkh) = UPPER('"+ssc+"') or UPPER(x.MZHM)=UPPER('"+ssc+"')) ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -1787,9 +1788,67 @@ public class YkyyEntranceService {
            Integer status = rs.getInteger("status");
            if (status==200){
                array = rs.getJSONArray("detailModelList");
                if (array==null||array.size()==0){
                    String sqlSfzh = "SELECT\n" +
                            "\tx.brid AS \"brid\",\n" +
                            "\tx.mzhm AS \"mzhm\",\n" +
                            "\tx.brxm AS \"brxm\",\n" +
                            "\tx.sfzh AS \"sfzh\",\n" +
                            "\tx.brxz AS \"brxz\",\n" +
                            "\tx.brxb AS \"brxb\",\n" +
                            "\tx.csny as \"csny\",\n" +
                            "\tx.jzkh AS \"jzkh\",\n" +
                            "\tx.jdsj AS \"jdsj\",\n" +
                            "\tx.sjhm AS \"sjhm\",\n" +
                            "\tx.fzxmc AS \"fzxmc\",\n" +
                            "\tx.gzztmc AS \"gzztmc\",\n" +
                            "\tx.lxdz AS \"lxdz\"\n" +
                            "FROM\n" +
                            "\tV_ZKSG_BRCX x\n" +
                            "WHERE\n" +
                            " UPPER(x.sfzh) =UPPER('"+idcard+"')";
                    Map<String,Object> paramsSfzh = new HashedMap();
                    paramsSfzh.put("sql",sqlSfzh);
                    HttpResponse response1 = HttpUtils.doGet(url,paramsSfzh);
                    String content1 = response1.getContent();
                    logger.info("response1:"+content1);
                    JSONObject rs1 = JSON.parseObject(content1);
                    Integer status1 = rs1.getInteger("status");
                    if (status1==200){
                        array = rs1.getJSONArray("detailModelList");
                    }
                }else if (array!=null&&array.size()>1){
                    String sqlSfzh = "SELECT\n" +
                            "\tx.brid AS \"brid\",\n" +
                            "\tx.mzhm AS \"mzhm\",\n" +
                            "\tx.brxm AS \"brxm\",\n" +
                            "\tx.sfzh AS \"sfzh\",\n" +
                            "\tx.brxz AS \"brxz\",\n" +
                            "\tx.brxb AS \"brxb\",\n" +
                            "\tx.csny as \"csny\",\n" +
                            "\tx.jzkh AS \"jzkh\",\n" +
                            "\tx.jdsj AS \"jdsj\",\n" +
                            "\tx.sjhm AS \"sjhm\",\n" +
                            "\tx.fzxmc AS \"fzxmc\",\n" +
                            "\tx.gzztmc AS \"gzztmc\",\n" +
                            "\tx.lxdz AS \"lxdz\"\n" +
                            "FROM\n" +
                            "\tV_ZKSG_BRCX x\n" +
                            "WHERE\n" +
                            " UPPER(x.sfzh) =UPPER('"+idcard+"') and (UPPER(x.jzkh) = UPPER('"+ssc+"') or UPPER(x.MZHM)=UPPER('"+ssc+"')) ";
                    Map<String,Object> paramsSfzh = new HashedMap();
                    paramsSfzh.put("sql",sqlSfzh);
                    HttpResponse response1 = HttpUtils.doGet(url,paramsSfzh);
                    String content1 = response1.getContent();
                    logger.info("response1:"+content1);
                    JSONObject rs1 = JSON.parseObject(content1);
                    Integer status1 = rs1.getInteger("status");
                    if (status1==200){
                        array = rs1.getJSONArray("detailModelList");
                    }
                }
            }
        }
        return array;
    }
@ -1817,7 +1876,7 @@ public class YkyyEntranceService {
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tx.sfzh = '"+idcard+"' ";
                "\tUPPER(x.sfzh) = UPPER('"+idcard+"') ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -1874,11 +1933,11 @@ public class YkyyEntranceService {
                "\tV_ZKSG_BRCX x\n" +
                "WHERE 1=1" ;
        if (StringUtils.isNotBlank(medicare)&&StringUtils.isNotBlank(mzhm)){
            sql+=" and (x.jzkh = '"+medicare+"' or x.mzhm = '"+mzhm+"')";
            sql+=" and (UPPER(x.jzkh) = UPPER('"+medicare+"') or UPPER(x.mzhm) = UPPER('"+mzhm+"'))";
        }else if (StringUtils.isNotBlank(medicare)&&!StringUtils.isNotBlank(mzhm)){
            sql+=" and x.jzkh = '"+medicare+"' ";
            sql+=" and UPPER(x.jzkh) = UPPER('"+medicare+"') ";
        }else if (!StringUtils.isNotBlank(medicare)&&StringUtils.isNotBlank(mzhm)){
            sql+=" and x.mzhm = '"+mzhm+"' ";
            sql+=" and UPPER(x.mzhm) = UPPER('"+mzhm+"') ";
        }else {
            sql+=" and x.brid is null";
        }
@ -2520,12 +2579,31 @@ public class YkyyEntranceService {
        String doctor = wlyyPrescriptionVO.getDoctor();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        BasePatientDO patientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        if (patientMedicareCardDO==null){
            patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_02",patient,"1");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO==null){
            JSONArray jsonArray = findHisPatientBySscAndIdcard(patientMedicareCardDO.getCode(),patientDO.getIdcard(),demoFlag);
            if(jsonArray!=null&&jsonArray.size()>0){
                //获取居民信息
                JSONObject json = jsonArray.getJSONObject(0);
                String brid = json.getString("brid");
                patientMappingDO = new PatientMappingDO();
                patientMappingDO.setCreateTime(new Date());
                patientMappingDO.setIdcard(patientDO.getIdcard());
                patientMappingDO.setMappingCode(brid);
                patientMappingDO.setPatient(patient);
                patientMappingDO.setPatientName(patientDO.getName());
                patientMappingDO.setSource("1");
                patientMappingDao.save(patientMappingDO);
            }else {
                throw new Exception("该名患者,在院信息有误,请告知患者核对(身份证号、社保卡号)!");
            }
        }
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
@ -2761,6 +2839,9 @@ public class YkyyEntranceService {
                hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
                String patient = wlyyPrescriptionVO.getPatientCode();
                PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
                if (patientMappingDO==null){
                    throw new Exception("该名患者,在院信息有误,请告知患者核对(身份证号、社保卡号)!");
                }
                hlwCf01DO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
                hlwCf01DO.setBRXM(wlyyPrescriptionVO.getPatientName());
                hlwCf01DO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
@ -3543,7 +3624,7 @@ public class YkyyEntranceService {
        res.put("status", 200);
        Float brid = null;
        //根据身份证查询是否建档
        String sfzhSql = "SELECT jzkh \"jzkh\" ,brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where sfzh = '" + idcard + "' order by JDSJ ";
        String sfzhSql = "SELECT jzkh \"jzkh\" ,brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where UPPER(sfzh) = UPPER('" + idcard + "') order by JDSJ ";
        //根据社保卡查询是否建档
        String jzkhSql = "SELECT brid \"brid\",sfzh \"sfzh\" from portal_his.V_ZKSG_BRCX@xec_link where UPPER(jzkh) = UPPER('" + medicare + "')  order by JDSJ ";
        JSONArray sfzhArray = getSqlResult(sfzhSql);
@ -3575,11 +3656,11 @@ public class YkyyEntranceService {
                }
            }
        } else*/ if (size > 1) {//如果存在多条数据,查看是否有跟当前社保卡号一致的,如果有则跳过,如果社保卡都为空则取其中一条更新,否则就提示与预留卡号不一致
            String sql = "SELECT brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where sfzh = '" + idcard + "' and  UPPER(jzkh) = UPPER('" + medicare + "') ";
            String sql = "SELECT brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where UPPER(sfzh) = UPPER('" + idcard + "') and  UPPER(jzkh) = UPPER('" + medicare + "') ";
            JSONArray array = getSqlResult(sql);
            logger.info("查询身份证和社保卡:" + array.toString());
            String sql1 = "SELECT brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where sfzh = '" + idcard + "' and  mzhm = '" + clinicId + "' ";
            String sql1 = "SELECT brid \"brid\" from portal_his.V_ZKSG_BRCX@xec_link where UPPER(sfzh) = UPPER('" + idcard + "') and  mzhm = '" + clinicId + "' ";
            JSONArray array1 = getSqlResult(sql1);
            logger.info("查询身份证和门诊号:" + array1.toString());
            /*if (array==null||array.size()==0){
@ -3640,9 +3721,9 @@ public class YkyyEntranceService {
            params1.put("csny", IdCardUtil.getBirthdayForIdcardStr(idcard));
            params1.put("brxb", IdCardUtil.getSexForIdcard_new(idcard));
            params1.put("czgh", "1996");
            params1.put("sfzh", idcard);
            params1.put("sfzh", idcard.toUpperCase());
            params1.put("sjhm", phoneNum);
            params1.put("ybkh", medicare);
            params1.put("ybkh", medicare.toUpperCase());
            params1.put("lxdz", 0);
            params1.put("zy", 0);
            HttpResponse response1 = HttpUtils.doGet(saveJdxxUrl, params1);

+ 217 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -12,6 +12,7 @@ import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
@ -19,6 +20,7 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
@ -37,6 +39,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
import com.yihu.jw.util.common.BeanUtils;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
@ -146,6 +149,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private HibenateUtils hibenateUtils;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    /**
@ -186,7 +191,9 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
                businessOrderDO.setPatient(outpatientDO.getConsumer());
                businessOrderDO.setPatientName(outpatientDO.getConsumerName());
                BigDecimal b = new BigDecimal(String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:wlyyPrescriptionDO.getDrugFee()));
                String a = String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:String.format("%.2f",wlyyPrescriptionDO.getDrugFee()));
                logger.info("");
                BigDecimal b = new BigDecimal(a);
                BigDecimal c = new BigDecimal(String.valueOf(100));
                BigDecimal bc = b.multiply(c);
                BigDecimal dc = new BigDecimal(0);
@ -257,7 +264,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    }
                }
            }else {
                BigDecimal b = new BigDecimal(String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:wlyyPrescriptionDO.getDrugFee()));
                String a = String.valueOf(wlyyPrescriptionDO.getDrugFee()==null?0:String.format("%.2f",wlyyPrescriptionDO.getDrugFee()));
                BigDecimal b = new BigDecimal(a);
                BigDecimal c = new BigDecimal(String.valueOf(100));
                BigDecimal bc = b.multiply(c);
                BigDecimal dc = new BigDecimal(0);
@ -1592,6 +1600,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(1);
        businessOrderDO.setPayTime(new Date());
        businessOrderDao.save(businessOrderDO);
        return businessOrderDO;
@ -1907,6 +1916,180 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    }
    /**
     * 预交金处方支付
     * @param code
     * @param depositType
     * @param wechatId
     * @return
     * @throws Exception
     */
    public String ylzRechargePre(String code,String depositType,String wechatId,String cardType,String cardNo,boolean demoFlag) throws Exception {
        String response = null;
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO =hospitalSysDictDao.findById("YLZ_NOTIFY_URL");
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(code);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(code);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
        BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getTotalAmount());//总金额
        BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
        BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
        Double fee = b1.subtract(b2).subtract(b3).doubleValue();
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            logger.info("开始1"+idcard);
            String openId = "";
            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
            Double cardFee = object1.getDouble("ZHYE");
            BigDecimal b = new BigDecimal(String.valueOf(cardFee));
            BigDecimal c = new BigDecimal(String.valueOf(fee));
            if (b.compareTo(c) == 1){
                return "无需线上支付";
            }
            BigDecimal balance = c.subtract(b);
            businessOrderDO.setPayPrice(balance.doubleValue());
            businessOrderDO.setPayType(4);
            businessOrderDO.setHistoryOrder(businessOrderDO.getOrderNo());
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setDepositType(depositType);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
                openId = patientWechatDo.getOpenid();
            }
            String price = businessOrderDO.getPayPrice().toString();
            String notifyUrl = hospitalSysDictDO.getDictCode();
            String operatorId =null;
            String operatorName = null;
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                operatorId = "123456";
                operatorName =businessOrderDO.getPatientName();
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            if (depositType.equalsIgnoreCase("WX_QR")){
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        InputStream qrcode = QrcodeUtil.createQrcode(jsonObject.getString("qrcode"),300,"jpg");
                        ByteToInputStream byteToInputStream = new ByteToInputStream();
                        String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                        jsonObject.put("qrcodeUrl","data:image/png;base64,"+ QRCodeImg);
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                    response = object.toJSONString();
                }
            }else {
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }else {
            businessOrderDO = new BusinessOrderDO();
            BasePatientDO patientDO = patientDao.findById(wlyyOutpatientDO.getPatient());
            String idcard = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            logger.info("开始1"+idcard);
            String openId = "";
            net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(cardNo, demoFlag);
            Double cardFee = object1.getDouble("ZHYE");
            BigDecimal b = new BigDecimal(String.valueOf(cardFee));
            BigDecimal c = new BigDecimal(String.valueOf(fee));
            BigDecimal balance = c.subtract(b);
            businessOrderDO.setPayPrice(balance.doubleValue());
            businessOrderDO.setPayType(4);
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setDepositType(depositType);
            businessOrderDO.setRelationCode(ylzMedicalRelationDO.getId());
            businessOrderDO.setRelationName("费用结算");
            businessOrderDO.setPatientName(patientDO.getName());
            businessOrderDO.setPatient(patientDO.getId());
            businessOrderDO.setDoctor(wlyyOutpatientDO.getDoctor());
            businessOrderDO.setOrderCategory("6");
            businessOrderDO.setOrderType(6);
            businessOrderDO.setStatus(0);
            businessOrderDO.setDescription("费用结算");
            businessOrderDO.setCreateTime(new Date());
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
                openId = patientWechatDo.getOpenid();
            }
            String price = businessOrderDO.getPayPrice().toString();
            String notifyUrl = hospitalSysDictDO.getDictCode();
            String operatorId =null;
            String operatorName = null;
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                operatorId = "123456";
                operatorName =businessOrderDO.getPatientName();
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            if (depositType.equalsIgnoreCase("WX_QR")){
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        InputStream qrcode = QrcodeUtil.createQrcode(jsonObject.getString("qrcode"),300,"jpg");
                        ByteToInputStream byteToInputStream = new ByteToInputStream();
                        String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                        jsonObject.put("qrcodeUrl","data:image/png;base64,"+ QRCodeImg);
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                    response = object.toJSONString();
                }
            }else {
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }
        return response;
    }
    /**
     * 咨询退费
     * @param consult
@ -2042,11 +2225,21 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        for (Map<String,Object> map:list){
            if (map.get("orderCategory")!=null){
                String orderCategoryFlag = map.get("orderCategory").toString();
                String relationCode =map.get("relationCode").toString();
                if (!orderCategoryFlag.equalsIgnoreCase("5")){
                    Double price = Double.parseDouble(map.get("payPrice").toString());
                    Double prie = price/100;
                    logger.info("price"+prie);
                    map.put("payPrice",prie);
                }if (orderCategoryFlag.equalsIgnoreCase("1")||orderCategoryFlag.equalsIgnoreCase("2")||orderCategoryFlag.equalsIgnoreCase("3")){
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(relationCode);
                    map.put("doctorName",outpatientDO.getDoctorName());
                    map.put("consumerName",outpatientDO.getConsumerName());
                }else if (orderCategoryFlag.equalsIgnoreCase("4")){
                    WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(relationCode);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    map.put("doctorName",outpatientDO.getDoctorName());
                    map.put("consumerName",outpatientDO.getConsumerName());
                }
            }
        }
@ -2152,12 +2345,34 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        for (Map<String,Object> map:mapList){
            if (map.get("orderCategory")!=null){
                String orderCategoryFlag = map.get("orderCategory").toString();
                String relationCode =map.get("relationCode").toString();
                if (!orderCategoryFlag.equalsIgnoreCase("5")){
                    Double price = Double.parseDouble(map.get("payPrice").toString());
                    Double prie = price/100;
                    logger.info("price"+prie);
                    map.put("payPrice",prie);
                }
                if (orderCategoryFlag.equalsIgnoreCase("1")||orderCategoryFlag.equalsIgnoreCase("2")||orderCategoryFlag.equalsIgnoreCase("3")){
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(relationCode);
                    if (outpatientDO!=null){
                        map.put("doctorName",outpatientDO.getDoctorName());
                        map.put("consumerName",outpatientDO.getPatientName());
                    }else {
                        map.put("doctorName","");
                        map.put("consumerName","");
                    }
                }else if (orderCategoryFlag.equalsIgnoreCase("4")){
                    WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(relationCode);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                    if (outpatientDO!=null){
                        map.put("doctorName",outpatientDO.getDoctorName());
                        map.put("consumerName",outpatientDO.getPatientName());
                    }else {
                        map.put("doctorName","");
                        map.put("consumerName","");
                    }
                }
            }
        }
        return MixEnvelop.getSuccessListWithPage2(BaseHospitalRequestMapping.Prescription.api_success, mapList);

+ 0 - 1
business/base-service/src/main/java/com/yihu/jw/order/dao/BusinessOrderDao.java

@ -22,7 +22,6 @@ public interface BusinessOrderDao extends PagingAndSortingRepository<BusinessOrd
    @Query("from BusinessOrderDO w where w.relationCode = ?1 ")
    BusinessOrderDO selectByRelationCode(String relationCode);
    @Query("from BusinessOrderDO w where w.relationCode = ?1 order by createTime desc ")
    List<BusinessOrderDO> selectListByRelationCode(String relationCode);

+ 20 - 9
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -404,16 +404,27 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        }
        Boolean flag = healthCareService.isHospitalFlag();
        if (flag){
            String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
            JSONObject object = JSONObject.parseObject(result);
            if (object.getString("flag").equalsIgnoreCase("1")){
                JSONObject encryptData = object.getJSONObject("encrypt_data");
                String state = encryptData.getString("state");
                String auth_date = encryptData.getString("auth_date");
                basePatientDO.setMedicalState(state);
                basePatientDO = basePatientDao.save(basePatientDO);
            if(wxId.equalsIgnoreCase("xm_xzzx_wx")){
                String result = healthCareService.authorizedToEntrace(basePatientDO.getId());
                JSONObject object = JSONObject.parseObject(result);
                if (object.getString("flag").equalsIgnoreCase("1")){
                    JSONObject encryptData = object.getJSONObject("encrypt_data");
                    String state = encryptData.getString("state");
                    String auth_date = encryptData.getString("auth_date");
                    basePatientDO.setMedicalState(state);
                    basePatientDO = basePatientDao.save(basePatientDO);
                }
            }else {
                String result = healthCareService.authorized(basePatientDO.getId());
                JSONObject object = JSONObject.parseObject(result);
                if (object.getString("flag").equalsIgnoreCase("1")){
                    JSONObject encryptData = object.getJSONObject("encrypt_data");
                    String state = encryptData.getString("state");
                    String auth_date = encryptData.getString("auth_date");
                    basePatientDO.setMedicalState(state);
                    basePatientDO = basePatientDao.save(basePatientDO);
                }
            }
        }
        return basePatientDO;
    }

+ 15 - 3
business/base-service/src/main/java/com/yihu/jw/utils/YkyySMSService.java

@ -7,10 +7,12 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.wx.WxPushLogDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.WlyyInspectionDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.sms.dao.BaseSmsTemplateDao;
@ -38,9 +40,9 @@ import java.util.Map;
@Service
public class YkyySMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyySMSService.class);
    private final String usrCode ="300643";
    private final String usrCode ="301312";
    private final String pw ="T9IHN69DDF";
    private final String pw ="3PRCADHD2M";
    private final String urlSms ="https://smsapp.wlwx.com";
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
@ -54,6 +56,8 @@ public class YkyySMSService {
    private WxPushLogDao wxPushLogDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    /**
     * 发送短信验证码
@ -63,7 +67,15 @@ public class YkyySMSService {
     */
    public ResultMsg ykyySendSMS(String mobile, String content){
        SmsClient smsClient = new SmsClient();
        return smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",urlSms,pw);
        WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
        ResultMsg resultMsg= smsClient.sendSms("ykyy",usrCode, content,mobile,"yes","","8",urlSms,pw);
        httpLogDO.setCode("sendSms");
        httpLogDO.setRequest(mobile+content);
        httpLogDO.setResponse(resultMsg.getMsg()+resultMsg.getCode()+resultMsg.getData());
        httpLogDO.setCreateTime(new Date());
        httpLogDO.setName("短信发送");
        wlyyHttpLogDao.save(httpLogDO);
        return resultMsg;
    }
    public void sendSmsByTempcode(String temlateCode, WlyyOutpatientDO wlyyOutpatientDO, WlyyPrescriptionDO wlyyPrescriptionDO,String doctorMobile){
        SmsTemplateDO smsTemplateDO =  null;

+ 4 - 0
business/base-service/src/mqConfig/esbmq-config.xml

@ -97,6 +97,10 @@
				<BS15051_0>EwellQ.S60.BS15051.PUT</BS15051_0>
				<BS15051_1>EwellQ.S60.BS15051.GET</BS15051_1>
				<!--his确认结算接口-->
				<BS15039_0>EwellQ.S60.BS15039.PUT</BS15039_0>
				<BS15039_1>EwellQ.S60.BS15039.GET</BS15039_1>
				<!--检查检验start-->
				<BS20030_0>EwellQ.S60.BS20030.PUT</BS20030_0>
				<BS20030_1>EwellQ.S60.BS20030.GET</BS20030_1>

+ 2 - 2
business/sms-service/src/main/java/com/yihu/jw/sms/service/YkyyINSMSService.java

@ -14,9 +14,9 @@ import org.springframework.stereotype.Service;
@Service
public class YkyyINSMSService {
    private static final Logger logger = LoggerFactory.getLogger(YkyyINSMSService.class);
    private final String usrCode ="300643";
    private final String usrCode ="301312";
    private final String pw ="T9IHN69DDF";
    private final String pw ="3PRCADHD2M";
    private final String urlSms ="https://smsapp.wlwx.com";
    @Autowired

+ 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;

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

@ -298,6 +298,37 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    private String appletQrCode;
    private Integer sort;//排序
    private String idCardType;//证件类别
    private String idType;//身份类别
    public String getIdCardType() {
        return idCardType;
    }
    public void setIdCardType(String idCardType) {
        this.idCardType = idCardType;
    }
    public String getIdType() {
        return idType;
    }
    public void setIdType(String idType) {
        this.idType = idType;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Column(name = "applet_qr_code")
    public String getAppletQrCode() {
        return appletQrCode;

+ 448 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/healthUpload/BaseDoctorHealthUploadDO.java

@ -0,0 +1,448 @@
package com.yihu.jw.entity.healthUpload;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 医生成员表
 *
 * @author Administrator on  2018年09月05日
 *
 */
@Entity
@Table(name = "base_doctor_health_upload")
public class BaseDoctorHealthUploadDO extends UuidIdentityEntityWithOperator {
    public String provinceName;
    public String cityName;
    public String townName;
    public String streetName;
    public String address;
    public String temperature;
    public Integer healthCode;
    public String healthCodeUrl;
    public Integer tourCode;
    public String tourCodeUrl;
    public Integer isSymptoms;
    public String abnormalSymptoms;
    public Integer isEpidemic;
    public String epidemicPerson;
    public Integer  isOutside;
    public String outsideProvinceCode;
    public String outsideProvinceName;
    public String outsideCityCode;
    public String outsideCityName;
    public String outsideTownCode;
    public String outsideTownName;
    public String outsideStreetName;
    public String outsideStreetCode;
    public String outsideAddress;
    public Date outsideDate;
    public Integer isNucleate;
    public String nucleateCodeUrl;
    public Integer  isOutsideHigh;
    public String outsideHighProvinceCode;
    public String outsideHighProvinceName;
    public String outsideHighCityCode;
    public String outsideHighCityName;
    public String outsideHighTownCode;
    public String outsideHighTownName;
    public String outsideHighStreetName;
    public String outsideHighStreetCode;
    public String outsideHighAddress;
    public Date outsideHighDate;
    public String doctorId;
    public String doctorName;
    public String idCard;
    public String mobile;
    public String consumer;
    public String consumerName;
    public String healthCodeDesc;
    public Integer outsideHighNucleate;
    public String abnormalSymptomsOther;
    public String getAbnormalSymptomsOther() {
        return abnormalSymptomsOther;
    }
    public void setAbnormalSymptomsOther(String abnormalSymptomsOther) {
        this.abnormalSymptomsOther = abnormalSymptomsOther;
    }
    public Integer getOutsideHighNucleate() {
        return outsideHighNucleate;
    }
    public void setOutsideHighNucleate(Integer outsideHighNucleate) {
        this.outsideHighNucleate = outsideHighNucleate;
    }
    public String getHealthCodeDesc() {
        return healthCodeDesc;
    }
    public void setHealthCodeDesc(String healthCodeDesc) {
        this.healthCodeDesc = healthCodeDesc;
    }
    public String getNucleateCodeUrl() {
        return nucleateCodeUrl;
    }
    public void setNucleateCodeUrl(String nucleateCodeUrl) {
        this.nucleateCodeUrl = nucleateCodeUrl;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getTemperature() {
        return temperature;
    }
    public void setTemperature(String temperature) {
        this.temperature = temperature;
    }
    public Integer getHealthCode() {
        return healthCode;
    }
    public void setHealthCode(Integer healthCode) {
        this.healthCode = healthCode;
    }
    public String getHealthCodeUrl() {
        return healthCodeUrl;
    }
    public void setHealthCodeUrl(String healthCodeUrl) {
        this.healthCodeUrl = healthCodeUrl;
    }
    public Integer getTourCode() {
        return tourCode;
    }
    public void setTourCode(Integer tourCode) {
        this.tourCode = tourCode;
    }
    public String getTourCodeUrl() {
        return tourCodeUrl;
    }
    public void setTourCodeUrl(String tourCodeUrl) {
        this.tourCodeUrl = tourCodeUrl;
    }
    public Integer getIsSymptoms() {
        return isSymptoms;
    }
    public void setIsSymptoms(Integer isSymptoms) {
        this.isSymptoms = isSymptoms;
    }
    public String getAbnormalSymptoms() {
        return abnormalSymptoms;
    }
    public void setAbnormalSymptoms(String abnormalSymptoms) {
        this.abnormalSymptoms = abnormalSymptoms;
    }
    public Integer getIsEpidemic() {
        return isEpidemic;
    }
    public void setIsEpidemic(Integer isEpidemic) {
        this.isEpidemic = isEpidemic;
    }
    public String getEpidemicPerson() {
        return epidemicPerson;
    }
    public void setEpidemicPerson(String epidemicPerson) {
        this.epidemicPerson = epidemicPerson;
    }
    public Integer getIsOutside() {
        return isOutside;
    }
    public void setIsOutside(Integer isOutside) {
        this.isOutside = isOutside;
    }
    public String getOutsideProvinceCode() {
        return outsideProvinceCode;
    }
    public void setOutsideProvinceCode(String outsideProvinceCode) {
        this.outsideProvinceCode = outsideProvinceCode;
    }
    public String getOutsideProvinceName() {
        return outsideProvinceName;
    }
    public void setOutsideProvinceName(String outsideProvinceName) {
        this.outsideProvinceName = outsideProvinceName;
    }
    public String getOutsideCityCode() {
        return outsideCityCode;
    }
    public void setOutsideCityCode(String outsideCityCode) {
        this.outsideCityCode = outsideCityCode;
    }
    public String getOutsideCityName() {
        return outsideCityName;
    }
    public void setOutsideCityName(String outsideCityName) {
        this.outsideCityName = outsideCityName;
    }
    public String getOutsideTownCode() {
        return outsideTownCode;
    }
    public void setOutsideTownCode(String outsideTownCode) {
        this.outsideTownCode = outsideTownCode;
    }
    public String getOutsideTownName() {
        return outsideTownName;
    }
    public void setOutsideTownName(String outsideTownName) {
        this.outsideTownName = outsideTownName;
    }
    public String getOutsideStreetName() {
        return outsideStreetName;
    }
    public void setOutsideStreetName(String outsideStreetName) {
        this.outsideStreetName = outsideStreetName;
    }
    public String getOutsideStreetCode() {
        return outsideStreetCode;
    }
    public void setOutsideStreetCode(String outsideStreetCode) {
        this.outsideStreetCode = outsideStreetCode;
    }
    public String getOutsideAddress() {
        return outsideAddress;
    }
    public void setOutsideAddress(String outsideAddress) {
        this.outsideAddress = outsideAddress;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "outside_date", nullable = false, length = 0,updatable = false)
    public Date getOutsideDate() {
        return outsideDate;
    }
    public void setOutsideDate(Date outsideDate) {
        this.outsideDate = outsideDate;
    }
    public Integer getIsNucleate() {
        return isNucleate;
    }
    public void setIsNucleate(Integer isNucleate) {
        this.isNucleate = isNucleate;
    }
    public Integer getIsOutsideHigh() {
        return isOutsideHigh;
    }
    public void setIsOutsideHigh(Integer isOutsideHigh) {
        this.isOutsideHigh = isOutsideHigh;
    }
    public String getOutsideHighProvinceCode() {
        return outsideHighProvinceCode;
    }
    public void setOutsideHighProvinceCode(String outsideHighProvinceCode) {
        this.outsideHighProvinceCode = outsideHighProvinceCode;
    }
    public String getOutsideHighProvinceName() {
        return outsideHighProvinceName;
    }
    public void setOutsideHighProvinceName(String outsideHighProvinceName) {
        this.outsideHighProvinceName = outsideHighProvinceName;
    }
    public String getOutsideHighCityCode() {
        return outsideHighCityCode;
    }
    public void setOutsideHighCityCode(String outsideHighCityCode) {
        this.outsideHighCityCode = outsideHighCityCode;
    }
    public String getOutsideHighCityName() {
        return outsideHighCityName;
    }
    public void setOutsideHighCityName(String outsideHighCityName) {
        this.outsideHighCityName = outsideHighCityName;
    }
    public String getOutsideHighTownCode() {
        return outsideHighTownCode;
    }
    public void setOutsideHighTownCode(String outsideHighTownCode) {
        this.outsideHighTownCode = outsideHighTownCode;
    }
    public String getOutsideHighTownName() {
        return outsideHighTownName;
    }
    public void setOutsideHighTownName(String outsideHighTownName) {
        this.outsideHighTownName = outsideHighTownName;
    }
    public String getOutsideHighStreetName() {
        return outsideHighStreetName;
    }
    public void setOutsideHighStreetName(String outsideHighStreetName) {
        this.outsideHighStreetName = outsideHighStreetName;
    }
    public String getOutsideHighStreetCode() {
        return outsideHighStreetCode;
    }
    public void setOutsideHighStreetCode(String outsideHighStreetCode) {
        this.outsideHighStreetCode = outsideHighStreetCode;
    }
    public String getOutsideHighAddress() {
        return outsideHighAddress;
    }
    public void setOutsideHighAddress(String outsideHighAddress) {
        this.outsideHighAddress = outsideHighAddress;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "outside_high_date", nullable = false, length = 0,updatable = false)
    public Date getOutsideHighDate() {
        return outsideHighDate;
    }
    public void setOutsideHighDate(Date outsideHighDate) {
        this.outsideHighDate = outsideHighDate;
    }
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getConsumer() {
        return consumer;
    }
    public void setConsumer(String consumer) {
        this.consumer = consumer;
    }
    public String getConsumerName() {
        return consumerName;
    }
    public void setConsumerName(String consumerName) {
        this.consumerName = consumerName;
    }
}

+ 95 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/healthUpload/BaseDoctorMemberDO.java

@ -0,0 +1,95 @@
package com.yihu.jw.entity.healthUpload;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * 医生成员表
 *
 * @author Administrator on  2018年09月05日
 *
 */
@Entity
@Table(name = "base_doctor_member")
public class BaseDoctorMemberDO extends UuidIdentityEntityWithOperator {
    private String doctorId;//医生id
    private String memberId;//成员id
    private Integer del;//删除标志(1正常,0删除)
    private Integer memberRelation;//成员关系
    private BaseDoctorDO baseDoctorDO;
    private String count;
    private List<BaseDoctorHospitalDO> doctorHospitalDOS;
    @Transient
    public List<BaseDoctorHospitalDO> getDoctorHospitalDOS() {
        return doctorHospitalDOS;
    }
    public void setDoctorHospitalDOS(List<BaseDoctorHospitalDO> doctorHospitalDOS) {
        this.doctorHospitalDOS = doctorHospitalDOS;
    }
    @Transient
    public String getCount() {
        return count;
    }
    public void setCount(String count) {
        this.count = count;
    }
    @Transient
    public BaseDoctorDO getBaseDoctorDO() {
        return baseDoctorDO;
    }
    public void setBaseDoctorDO(BaseDoctorDO baseDoctorDO) {
        this.baseDoctorDO = baseDoctorDO;
    }
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
    public String getMemberId() {
        return memberId;
    }
    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public Integer getMemberRelation() {
        return memberRelation;
    }
    public void setMemberRelation(Integer memberRelation) {
        this.memberRelation = memberRelation;
    }
}

+ 245 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/healthCare/YlzMedicalRelationDO.java

@ -65,6 +65,107 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    private Date createTime;//创建时间',
    private String detailSerial;//医保明细流水号
    private Integer status;//结算状态
    private String diseaseCode;//病种编码
    private String treatmentType;//人员待遇类别
    private String treatmentTypeName;//人员待遇类别名称
    private String treatmentStatus;//医疗待遇状态
    private String treatmentStatusName;//医疗待遇状态名称
    private String allopatryType;//异地就医类型
    private String allopatryTypeName;//异地就医类型名称
    private String administrativeArea;//参保地行政区划
    private String payStandard;//统筹支付医保费用起付标准
    private String tcjjPay;//其中:统筹基金支付
    private String sbjjPay;//其中:商保基金支付(大额补充)
    private String gwyPay;//其中:公务员医疗补助
    private String jzfpPay;//其中:精准扶贫医疗叠加
    private String yljzPay;//其中:医疗救助基金
    private String otherPay;//其中:其他基金支付
    private String enterpriseSupplement;//其中:企业补充
    private String jtgjPay;//家庭共济账户支付
    private String collector;//收费人
    private String pageCode;//结算code
    private String insuranceType;//险种类型(医保类型)
    private String insuranceTypeName;//险种类型名称
    private Integer state;//his结算状态(1结算0未结算)
    private Integer medicalState;//0自费1医保
    private String hisDesc;//his结算描述
    private String balance;//预交金余额
    private String medicalPrice;//医保基金总额
    private Date settleDate;//his结算时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="settle_date")
    public Date getSettleDate() {
        return settleDate;
    }
    public void setSettleDate(Date settleDate) {
        this.settleDate = settleDate;
    }
    public String getMedicalPrice() {
        return medicalPrice;
    }
    public void setMedicalPrice(String medicalPrice) {
        this.medicalPrice = medicalPrice;
    }
    public String getBalance() {
        return balance;
    }
    public void setBalance(String balance) {
        this.balance = balance;
    }
    public String getHisDesc() {
        return hisDesc;
    }
    public void setHisDesc(String hisDesc) {
        this.hisDesc = hisDesc;
    }
    public Integer getMedicalState() {
        return medicalState;
    }
    public void setMedicalState(Integer medicalState) {
        this.medicalState = medicalState;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public String getInsuranceType() {
        return insuranceType;
    }
    public void setInsuranceType(String insuranceType) {
        this.insuranceType = insuranceType;
    }
    public String getInsuranceTypeName() {
        return insuranceTypeName;
    }
    public void setInsuranceTypeName(String insuranceTypeName) {
        this.insuranceTypeName = insuranceTypeName;
    }
    public String getPageCode() {
        return pageCode;
    }
    public void setPageCode(String pageCode) {
        this.pageCode = pageCode;
    }
    public Integer getStatus() {
        return status;
@ -485,4 +586,148 @@ public class YlzMedicalRelationDO extends UuidIdentityEntity {
    public void setDoctorLevel(String doctorLevel) {
        this.doctorLevel = doctorLevel;
    }
    public String getDiseaseCode() {
        return diseaseCode;
    }
    public void setDiseaseCode(String diseaseCode) {
        this.diseaseCode = diseaseCode;
    }
    public String getTreatmentType() {
        return treatmentType;
    }
    public void setTreatmentType(String treatmentType) {
        this.treatmentType = treatmentType;
    }
    public String getTreatmentTypeName() {
        return treatmentTypeName;
    }
    public void setTreatmentTypeName(String treatmentTypeName) {
        this.treatmentTypeName = treatmentTypeName;
    }
    public String getTreatmentStatus() {
        return treatmentStatus;
    }
    public void setTreatmentStatus(String treatmentStatus) {
        this.treatmentStatus = treatmentStatus;
    }
    public String getTreatmentStatusName() {
        return treatmentStatusName;
    }
    public void setTreatmentStatusName(String treatmentStatusName) {
        this.treatmentStatusName = treatmentStatusName;
    }
    public String getAllopatryType() {
        return allopatryType;
    }
    public void setAllopatryType(String allopatryType) {
        this.allopatryType = allopatryType;
    }
    public String getAllopatryTypeName() {
        return allopatryTypeName;
    }
    public void setAllopatryTypeName(String allopatryTypeName) {
        this.allopatryTypeName = allopatryTypeName;
    }
    public String getAdministrativeArea() {
        return administrativeArea;
    }
    public void setAdministrativeArea(String administrativeArea) {
        this.administrativeArea = administrativeArea;
    }
    public String getPayStandard() {
        return payStandard;
    }
    public void setPayStandard(String payStandard) {
        this.payStandard = payStandard;
    }
    public String getTcjjPay() {
        return tcjjPay;
    }
    public void setTcjjPay(String tcjjPay) {
        this.tcjjPay = tcjjPay;
    }
    public String getSbjjPay() {
        return sbjjPay;
    }
    public void setSbjjPay(String sbjjPay) {
        this.sbjjPay = sbjjPay;
    }
    public String getGwyPay() {
        return gwyPay;
    }
    public void setGwyPay(String gwyPay) {
        this.gwyPay = gwyPay;
    }
    public String getJzfpPay() {
        return jzfpPay;
    }
    public void setJzfpPay(String jzfpPay) {
        this.jzfpPay = jzfpPay;
    }
    public String getYljzPay() {
        return yljzPay;
    }
    public void setYljzPay(String yljzPay) {
        this.yljzPay = yljzPay;
    }
    public String getOtherPay() {
        return otherPay;
    }
    public void setOtherPay(String otherPay) {
        this.otherPay = otherPay;
    }
    public String getEnterpriseSupplement() {
        return enterpriseSupplement;
    }
    public void setEnterpriseSupplement(String enterpriseSupplement) {
        this.enterpriseSupplement = enterpriseSupplement;
    }
    public String getJtgjPay() {
        return jtgjPay;
    }
    public void setJtgjPay(String jtgjPay) {
        this.jtgjPay = jtgjPay;
    }
    public String getCollector() {
        return collector;
    }
    public void setCollector(String collector) {
        this.collector = collector;
    }
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -57,6 +57,7 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private String historyOrder;
    private String depositType; //原充值类型
    @Column(name = "history_order")
    public String getHistoryOrder() {
        return historyOrder;

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

@ -496,6 +496,7 @@ public class BaseHospitalRequestMapping {
        public static final String selectOrderByRelationCode = "/selectOrderByRelationCode";
        public static final String ylzRechargeJson="ylzRechargeJson";
        public static final String ylzRechargePre="ylzRechargePre";
        public static final String yktMedicalCardTopUp="/yktMedicalCardTopUp";
@ -1474,6 +1475,7 @@ public class BaseHospitalRequestMapping {
        public static final String update  = "/update";
        public static final String updateList  = "/updateList";
        public static final String updateStatus  = "/updateStatus";
        public static final String updateSort  = "/updateSort";
        public static final String updateDoctorPw  = "/updateDoctorPw";
    }

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

@ -0,0 +1,528 @@
package com.yihu.jw.restmodel.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
 * 
 * 在线结算确认实体VO
 *
 *
 *
 */
@ApiModel(value = "WlyyHisSettleVO", description = "在线结算确认")
public class WlyyHisSettleVO extends UuidIdentityVOWithOperator {
    /**
     * 患者卡号
     */
    @ApiModelProperty(value = "患者卡号", example = "患者卡号")
    private String cardNo;
    /**
     * HIS 系统跟踪号
     */
    @ApiModelProperty(value = "HIS 系统跟踪号",example = "HIS 系统跟踪号")
    private String xtgzh0;
    /**
     * 机构编号(医院编号)
     */
    @ApiModelProperty(value = "机构编号(医院编号)",example = "机构编号(医院编号)")
    private String orgCode;
    /**
     * 充值方式(自费金额支付方式)
     */
    @ApiModelProperty(value = "充值方式(自费金额支付方式)",example = "充值方式(自费金额支付方式)")
    private String depositType;
    /**
     * 充值金额
     */
    @ApiModelProperty(value = "充值金额",example = "充值金额")
    private String depositAmount;
    /**
     * 信用支付 0-否 1-是
     */
    @ApiModelProperty(value = "信用支付 0-否 1-是",example = "信用支付 0-否 1-是")
    private String xyzf00;
    /**
     * 渠道类型
     */
    @ApiModelProperty(value = "渠道类型",example = "渠道类型")
    private String channelType;
    /**
     * 平台结算流水号
     */
    @ApiModelProperty(value = "平台结算流水号",example = "平台结算流水号")
    private String outChargeNo;
    /**
     * 单据流水号(医保收费流水号)
     */
    @ApiModelProperty(value = "单据流水号(医保收费流水号)",example = "单据流水号(医保收费流水号)")
    private String djlsh0;
    /**
     * 门诊流水号(医保挂号流水号)
     */
    @ApiModelProperty(value = "门诊流水号(医保挂号流水号)",example = "门诊流水号(医保挂号流水号)")
    private String mzlsh0;
    /**
     * 帐户支付额
     */
    @ApiModelProperty(value = "帐户支付额",example = "帐户支付额")
    private String zhzfe0;
    /**
     * 个人支付额
     */
    @ApiModelProperty(value = "个人支付额",example = "个人支付额")
    private String grzfe0;
    /**
     * 基金支付额
     */
    @ApiModelProperty(value = "基金支付额",example = "基金支付额")
    private String jjzfe0;
    /**
     * 公务员补助
     */
    @ApiModelProperty(value = "公务员补助",example = "公务员补助")
    private String gwybz0;
    /**
     * 非医保费用
     */
    @ApiModelProperty(value = "非医保费用",example = "非医保费用")
    private String fybfy0;
    /**
     * 超封顶线金额
     */
    @ApiModelProperty(value = "超封顶线金额",example = "超封顶线金额")
    private String cfdxje;
    /**
     * 保健基金支付
     */
    @ApiModelProperty(value = "保健基金支付",example = "保健基金支付")
    private String bjjjzf;
    /**
     * 本次报销总额
     */
    @ApiModelProperty(value = "本次报销总额",example = "本次报销总额")
    private String bcbxf0;
    /**
     * 收费日期
     */
    @ApiModelProperty(value = "收费日期",example = "收费日期")
    private String sfrq00;
    /**
     * 收费时间
     */
    @ApiModelProperty(value = "收费时间",example = "收费时间")
    private String sfsj00;
    /**
     * 收费人姓名
     */
    @ApiModelProperty(value = "收费人姓名",example = "收费人姓名")
    private String sfrxm0;
    /**
     * 医保帐户余额
     */
    @ApiModelProperty(value = "医保帐户余额",example = "医保帐户余额")
    private String grzhye;
    /**
     * 乙类支付额
     */
    @ApiModelProperty(value = "乙类支付额",example = "乙类支付额")
    private String ylzfje;
    /**
     * 健康账户支付
     */
    @ApiModelProperty(value = "健康账户支付",example = "健康账户支付")
    private String jkzhzf;
    /**
     * 健康账户余额
     */
    @ApiModelProperty(value = "健康账户余额",example = "健康账户余额")
    private String jkzhye;
    /**
     * 医保明细上传流水号
     */
    @ApiModelProperty(value = "医保明细上传流水号",example = "医保明细上传流水号")
    private String ybmxls;
    /**
     * 对账数据分类
     */
    @ApiModelProperty(value = "对账数据分类",example = "对账数据分类")
    private String dzsjfl;
    /**
     * 商业保险支付
     */
    @ApiModelProperty(value = "商业保险支付",example = "商业保险支付")
    private String sybxzf;
    /**
     * 本地共计账户支付
     */
    @ApiModelProperty(value = "本地共计账户支付",example = "本地共计账户支付")
    private String bdgjzf;
    /**
     * 异地共计账户支付
     */
    @ApiModelProperty(value = "异地共计账户支付",example = "异地共计账户支付")
    private String ydgjzf;
    /**
     * 本次看病次数
     */
    @ApiModelProperty(value = "本次看病次数",example = "本次看病次数")
    private String bckbcs;
    /**
     * 补助基金支付
     */
    @ApiModelProperty(value = "补助基金支付",example = "补助基金支付")
    private String bzjjzf;
    /**
     * 人员编号
     */
    @ApiModelProperty(value = "人员编号",example = "人员编号")
    private String psnNo;
    /**
     * 参保地行政区号
     */
    @ApiModelProperty(value = "参保地行政区号",example = "参保地行政区号")
    private String aab301;
    /**
     * 险种
     */
    @ApiModelProperty(value = "险种",example = "险种")
    private String insutype;
    /**
     * 医保结算时间
     */
    @ApiModelProperty(value = "医保结算时间",example = "医保结算时间")
    private String setlTime;
    public String getSetlTime() {
        return setlTime;
    }
    public void setSetlTime(String setlTime) {
        this.setlTime = setlTime;
    }
    public String getPsnNo() {
        return psnNo;
    }
    public void setPsnNo(String psnNo) {
        this.psnNo = psnNo;
    }
    public String getAab301() {
        return aab301;
    }
    public void setAab301(String aab301) {
        this.aab301 = aab301;
    }
    public String getInsutype() {
        return insutype;
    }
    public void setInsutype(String insutype) {
        this.insutype = insutype;
    }
    public String getBzjjzf() {
        return bzjjzf;
    }
    public void setBzjjzf(String bzjjzf) {
        this.bzjjzf = bzjjzf;
    }
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    public String getXtgzh0() {
        return xtgzh0;
    }
    public void setXtgzh0(String xtgzh0) {
        this.xtgzh0 = xtgzh0;
    }
    public String getOrgCode() {
        return orgCode;
    }
    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }
    public String getDepositType() {
        return depositType;
    }
    public void setDepositType(String depositType) {
        this.depositType = depositType;
    }
    public String getDepositAmount() {
        return depositAmount;
    }
    public void setDepositAmount(String depositAmount) {
        this.depositAmount = depositAmount;
    }
    public String getXyzf00() {
        return xyzf00;
    }
    public void setXyzf00(String xyzf00) {
        this.xyzf00 = xyzf00;
    }
    public String getChannelType() {
        return channelType;
    }
    public void setChannelType(String channelType) {
        this.channelType = channelType;
    }
    public String getOutChargeNo() {
        return outChargeNo;
    }
    public void setOutChargeNo(String outChargeNo) {
        this.outChargeNo = outChargeNo;
    }
    public String getDjlsh0() {
        return djlsh0;
    }
    public void setDjlsh0(String djlsh0) {
        this.djlsh0 = djlsh0;
    }
    public String getMzlsh0() {
        return mzlsh0;
    }
    public void setMzlsh0(String mzlsh0) {
        this.mzlsh0 = mzlsh0;
    }
    public String getZhzfe0() {
        return zhzfe0;
    }
    public void setZhzfe0(String zhzfe0) {
        this.zhzfe0 = zhzfe0;
    }
    public String getGrzfe0() {
        return grzfe0;
    }
    public void setGrzfe0(String grzfe0) {
        this.grzfe0 = grzfe0;
    }
    public String getJjzfe0() {
        return jjzfe0;
    }
    public void setJjzfe0(String jjzfe0) {
        this.jjzfe0 = jjzfe0;
    }
    public String getGwybz0() {
        return gwybz0;
    }
    public void setGwybz0(String gwybz0) {
        this.gwybz0 = gwybz0;
    }
    public String getFybfy0() {
        return fybfy0;
    }
    public void setFybfy0(String fybfy0) {
        this.fybfy0 = fybfy0;
    }
    public String getCfdxje() {
        return cfdxje;
    }
    public void setCfdxje(String cfdxje) {
        this.cfdxje = cfdxje;
    }
    public String getBjjjzf() {
        return bjjjzf;
    }
    public void setBjjjzf(String bjjjzf) {
        this.bjjjzf = bjjjzf;
    }
    public String getSybxzf() {
        return sybxzf;
    }
    public void setSybxzf(String sybxzf) {
        this.sybxzf = sybxzf;
    }
    public String getBdgjzf() {
        return bdgjzf;
    }
    public void setBdgjzf(String bdgjzf) {
        this.bdgjzf = bdgjzf;
    }
    public String getYdgjzf() {
        return ydgjzf;
    }
    public void setYdgjzf(String ydgjzf) {
        this.ydgjzf = ydgjzf;
    }
    public String getBckbcs() {
        return bckbcs;
    }
    public void setBckbcs(String bckbcs) {
        this.bckbcs = bckbcs;
    }
    public String getBcbxf0() {
        return bcbxf0;
    }
    public void setBcbxf0(String bcbxf0) {
        this.bcbxf0 = bcbxf0;
    }
    public String getSfrq00() {
        return sfrq00;
    }
    public void setSfrq00(String sfrq00) {
        this.sfrq00 = sfrq00;
    }
    public String getSfsj00() {
        return sfsj00;
    }
    public void setSfsj00(String sfsj00) {
        this.sfsj00 = sfsj00;
    }
    public String getSfrxm0() {
        return sfrxm0;
    }
    public void setSfrxm0(String sfrxm0) {
        this.sfrxm0 = sfrxm0;
    }
    public String getGrzhye() {
        return grzhye;
    }
    public void setGrzhye(String grzhye) {
        this.grzhye = grzhye;
    }
    public String getYlzfje() {
        return ylzfje;
    }
    public void setYlzfje(String ylzfje) {
        this.ylzfje = ylzfje;
    }
    public String getJkzhzf() {
        return jkzhzf;
    }
    public void setJkzhzf(String jkzhzf) {
        this.jkzhzf = jkzhzf;
    }
    public String getJkzhye() {
        return jkzhye;
    }
    public void setJkzhye(String jkzhye) {
        this.jkzhye = jkzhye;
    }
    public String getYbmxls() {
        return ybmxls;
    }
    public void setYbmxls(String ybmxls) {
        this.ybmxls = ybmxls;
    }
    public String getDzsjfl() {
        return dzsjfl;
    }
    public void setDzsjfl(String dzsjfl) {
        this.dzsjfl = dzsjfl;
    }
}

+ 45 - 1
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -34,6 +34,7 @@ public class DateUtil {
    public static final String YYYY_MM_DD_HH_MM_SS_ = "yyyy/MM/dd HH:mm:ss";
    public static final String YYYYMMddHHmmssSSS  = "yyyyMMddHHmmssSSS";
    public static final String YYYY_MM ="yyyy-MM";
    public static final String YYYYMMDD_HH_MM_SS = "yyyyMMdd HH:mm:ss";
    public static Date dateTimeParse(String date) throws ParseException {
        return new SimpleDateFormat(yyyy_MM_dd_HH_mm_ss).parse(date);
@ -257,6 +258,21 @@ public class DateUtil {
        return formatter.parse(strDate, pos);
    }
    /**
     * 将长时间格式字符串转换为时间 yyyyMMdd HH:mm:ss
     *
     * @param strDate
     * @return
     */
    public static Date strToYmdDateLong(String strDate) {
        if (StringUtils.isEmpty(strDate)) {
            return null;
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYYMMDD_HH_MM_SS);
        ParsePosition pos = new ParsePosition(0);
        return formatter.parse(strDate, pos);
    }
    public static Date strToDateShort(String strDate) {
        if (StringUtils.isEmpty(strDate)) {
            return null;
@ -279,6 +295,20 @@ public class DateUtil {
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        return formatter.format(dateDate);
    }
    /**
     * 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
     *
     * @param dateDate
     * @return
     */
    public static String dateToStrFormatLong(java.util.Date dateDate) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYYMMDDHHMMSS);
        return formatter.format(dateDate);
    }
    public static String dateToStrNoSecond(java.util.Date dateDate) {
        if (dateDate == null) {
            return "";
@ -287,7 +317,21 @@ public class DateUtil {
        return formatter.format(dateDate);
    }
    /**
     * 将长时间格式时间转换为字符串 yyyy-MM-dd
     * 将长时间格式时间转换为字符串 YYYYMMDD
     *
     * @param dateDate
     * @return
     */
    public static String dateToStrFormatShort(java.util.Date dateDate) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYYMMDD);
        return formatter.format(dateDate);
    }
    /**
     * 将长时间格式时间转换为字符串 yyyyMMdd
     *
     * @param dateDate
     * @return

+ 1 - 1
gateway/ag-basic/pom.xml

@ -12,7 +12,7 @@
    <artifactId>ag-basic</artifactId>
    <version>${parent.version}</version>
    <packaging>jar</packaging>
    <packaging>war</packaging>
    <dependencies>
        <!-- 支持Tomcat启动 -->

+ 1 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -112,6 +112,7 @@ public class BasicZuulFilter extends ZuulFilter {
                url.contains("/prescription/pushListWrite")||
                url.contains("/prescription/pushListDrug")||
                url.contains("/open/noLogin/pushYkCardCharge")||
                url.contains("/open/noLogin/pushListWriteHealthInfo")||
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/Funds/deviceInfoExcel"))){

+ 6 - 2
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java

@ -63,6 +63,7 @@ public class PostFilter extends ZuulFilter {
        if (url.contains("/excelControl")||url.contains("/prescription/pushListWrite")||
                url.contains("/prescription/pushListDrug")||
                url.contains("/open/noLogin/pushYkCardCharge")||
                url.contains("/open/noLogin/pushListWriteHealthInfo")||
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/Funds/deviceInfoExcel")){
@ -79,6 +80,7 @@ public class PostFilter extends ZuulFilter {
            bytes = StreamUtils.copyToByteArray(stream);
        }
        String body = new String(bytes,"UTF8");
        /*String serviceId="";
        String responseCode="";
        String exceptionType="";
@ -126,7 +128,7 @@ public class PostFilter extends ZuulFilter {
        }catch (Exception e){
            e.printStackTrace();
        }*/
        logger.info("body",body);
        logger.info("body",body+"=====status====="+ctx.getResponseStatusCode());
        JSONObject object = new JSONObject();
        object.put("status","200");
        object.put("data", AesEncryptUtils.encrypt(body));
@ -141,6 +143,7 @@ public class PostFilter extends ZuulFilter {
                url.contains("/prescription/pushListWrite")||
                url.contains("/prescription/pushListDrug")||
                url.contains("/open/noLogin/pushYkCardCharge")||
                url.contains("/open/noLogin/pushListWriteHealthInfo")||
                url.contains("/prescription/searchRecordWrite")||
                url.contains("/Funds/reconciliationExcel")||
                url.contains("/Funds/deviceInfoExcel")||url.contains("/open/noEntry"))){
@ -148,7 +151,8 @@ public class PostFilter extends ZuulFilter {
        }else {
            RequestContext.getCurrentContext().setResponseBody(body);
        }
        logger.info(ctx.getResponseBody()+"");
        logger.info("请求返回参数:"+ctx.getResponseBody()+"");
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 8 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -1022,6 +1022,14 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    patient1.setUpdateTime(new Date());
                    patient1.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                    patient1 = patientDao.save(patient1);
                    List<BasePatientWechatDo> patientWechatDoList = basePatientWechatDao.findByWechatIdAndPatientId("xm_hcyy_wx",patient1.getId());
                    basePatientWechatDao.delete(patientWechatDoList);
                    BasePatientWechatDo patientWechatDo = new BasePatientWechatDo();
                    patientWechatDo.setOpenid(openid);
                    patientWechatDo.setPatientId(patient1.getId());
                    patientWechatDo.setWechatId("xm_hcyy_wx");
                    patientWechatDo.setCreateTime(new Date());
                    basePatientWechatDao.save(patientWechatDo);
                    logger.info("结束同步患者数据");
                }
            }

+ 4 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/WlyyTokenGranter.java

@ -1,5 +1,6 @@
package com.yihu.jw.security.oauth2.provider;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
@ -428,7 +429,9 @@ public class WlyyTokenGranter implements TokenGranter {
            Authentication userAuth = new UsernamePasswordAuthenticationToken(username,userDetails.getPassword(),  this.authoritiesMapper.mapAuthorities(userDetails.getAuthorities()));
            ((AbstractAuthenticationToken) userAuth).setDetails(parameters);
            OAuth2Request storedOAuth2Request = getRequestFactory().createOAuth2Request(client, tokenRequest);
            return new OAuth2Authentication(storedOAuth2Request, userAuth);
            OAuth2Authentication oAuth2Authentication = new OAuth2Authentication(storedOAuth2Request, userAuth);
            logger.info("username===oAuth2Authentication==="+ JSONObject.toJSONString(oAuth2Authentication));
            return oAuth2Authentication;
        }
    }

+ 121 - 140
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -262,164 +262,144 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
     */
    @RequestMapping(value = "/oauth/login", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> login(@RequestParam Map<String, String> parameters, HttpSession httpSession) throws Exception {
            logger.info("login:登录进入1");
            //图形验证码验证
            String key = parameters.get("key");
            String text = parameters.get("text");
        logger.info("login:登录进入1");
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
            if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
                if(!verifyCaptcha(key,text)){
                    throw new ImgCaptchaException("验证码错误!");
                }
            }
        }
        logger.info("login:登录进入2");
            logger.info("login:登录进入2");
        String flag = parameters.get("flag");
            String flag = parameters.get("flag");
        String username = parameters.get("username");
        logger.info(username);
            String username = parameters.get("username");
            logger.info(username);
        if (StringUtils.isEmpty(username)&&StringUtils.isEmpty(flag)) {
            throw new InvalidRequestException("username");
        }
        String client_id = parameters.get("client_id");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if("alipay".equals(flag)||"family".equals(flag)){
            //支付宝登录||家人登录
            parameters.put("grant_type", flag);
            String encdata = parameters.get("encdata");
            if("alipay".equals(flag)){
                encdata = AES.decrypt(encdata);
            }else{
                encdata = AesEncryptUtils.agDecrypt(encdata);
            }
            String data[] = encdata.split(":");
            username = data[1];
            parameters.put("username", username);
        }else if("dingTalk".equals(flag)){
            //钉钉免登录
            parameters.put("grant_type", "dingTalk");
            String authCode = parameters.get("authCode");
            if(org.apache.commons.lang3.StringUtils.isBlank(authCode)){
                throw new InvalidRequestException("请求参数错误");
            }
            String registerRes= httpClientUtil.get("http://127.0.0.1:10301/doctor/dingtalk_app_user?authCode="+authCode,"UTF-8");
            JSONObject jsonObject= JSONObject.parseObject(registerRes);
            if (jsonObject.getInteger("status") == 200){
                parameters.put("username", jsonObject.getString("message"));
            }else{
                HttpHeaders headers = new HttpHeaders();
                headers.set("Cache-Control", "no-store");
                headers.set("Pragma", "no-cache");
                Oauth2Envelop<WlyyUserSimple> oauth2Envelop = new Oauth2Envelop<>(jsonObject.getString("message"), -1, null);
                return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
            }
        }else if (StringUtils.isEmpty(parameters.get("captcha"))) {
            parameters.put("grant_type", "password");
            //解密密码
            if (parameters.get("password") != null) {
                KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
                String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
                parameters.put("password", password);
            } else {
                //第三方同步账号模式登录
                parameters.put("grant_type", "ihealthCode");
            if (StringUtils.isEmpty(username)&&StringUtils.isEmpty(flag)) {
                throw new InvalidRequestException("username");
            }
        } else {
            parameters.put("grant_type", "captcha");
        }
        logger.info("login:登录进入3");
        ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
        if (null == authenticatedClient) {
            throw new InvalidRequestException("client_id");
        }
        logger.info("login:登录进入4"+authenticatedClient.getClientId());
            String client_id = parameters.get("client_id");
            if (StringUtils.isEmpty(client_id)) {
                throw new InvalidRequestException("client_id");
            }
            if("alipay".equals(flag)||"family".equals(flag)){
                //支付宝登录||家人登录
                parameters.put("grant_type", flag);
                String encdata = parameters.get("encdata");
                if("alipay".equals(flag)){
                    encdata = AES.decrypt(encdata);
                }else{
                    encdata = AesEncryptUtils.agDecrypt(encdata);
                }
        TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
        oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
    /*如果是移动端登陆则移除之前的token,
    在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
    实现同一账号只能在一处登陆*/
        if("1".equals(kickEachOther)){
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
                if (tokenStore.readAccessToken(token.getValue())!=null){
                    tokenStore.removeAccessToken(token.getValue());
                    tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
                    token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
                String data[] = encdata.split(":");
                username = data[1];
                parameters.put("username", username);
            }else if (StringUtils.isEmpty(parameters.get("captcha"))) {
                parameters.put("grant_type", "password");
                //解密密码
                if (parameters.get("password") != null) {
                    KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
                    String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
                    parameters.put("password", password);
                } else {
                    //第三方同步账号模式登录
                    parameters.put("grant_type", "ihealthCode");
                }
            } else {
                parameters.put("grant_type", "captcha");
            }
            logger.info("login:登录进入3");
            ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
            if (null == authenticatedClient) {
                throw new InvalidRequestException("client_id");
            }
            logger.info("login:登录进入4"+authenticatedClient.getClientId());
            TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
            oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
            OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
            if (token == null) {
                throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
            }
        }
        /*如果是移动端登陆则移除之前的token,
        在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
        实现同一账号只能在一处登陆*/
            if("1".equals(kickEachOther)){
                HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
                if (request.getHeader("login-device") != null && (request.getHeader("login-device").equalsIgnoreCase("mobile")||request.getHeader("login-device").equalsIgnoreCase("pc"))) {
                    if (tokenStore.readAccessToken(token.getValue())!=null){
                        tokenStore.removeAccessToken(token.getValue());
                        tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
                        token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
                    }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        if ("pad".equals(parameters.get("clientType"))&&!("1".equals(wlyyUserSimple.getArchiveType())) ){//医养平板端登录限制
            throw new InvalidGrantException("不允许登录该平台");
        }
        logger.info("wlyyUserSimple::"+wlyyUserSimple);
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());
        wlyyUserSimple.setExpiresIn(token.getExpiresIn());
        wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
        wlyyUserSimple.setUser(parameters.get("username"));
        wlyyUserSimple.setState(parameters.get("state"));
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        String wechatId = parameters.get("wechatId");
        logger.info("login:登录进入7");
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        logger.info("gengxin开始");
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && ("3".equals(loginType)||"4".equalsIgnoreCase(loginType))) {
            baseLoginLogDO.setOpenid(openid);
            logger.info("gengxin进入"+openid);
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                logger.info("gengxin进入"+wechatId);
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
                }
                if (token == null) {
                    throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
                }
            }
        }
        if (parameters.get("password") != null) {
            //使用密码登录成功后, 更新失败次数为 0
            userDetailsService.addFailureCount(username, 0);
        }
        logger.info("login:登录进入8");
        userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        logger.info("login:登录进入9");
        String clientType = parameters.get("clientType");
        baseLoginLogDO.setUserId(wlyyUserSimple.getId());
        baseLoginLogDO.setCreateTime(new Date());
        String userAgent = JSONObject.toJSONString(wlyyUserSimple);
        baseLoginLogDO.setUserAgent(userAgent);
        baseLoginLogDO.setLoginType(loginType);
        baseLoginLogDO.setName(wlyyUserSimple.getName());
        baseLoginLogDO.setClientType(clientType);
        baseLoginLogDO.setToken(token.getValue());
        baseLoginLogService.save(baseLoginLogDO);
        logger.info("login:登录进入10");
            WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
            if ("pad".equals(parameters.get("clientType"))&&!("1".equals(wlyyUserSimple.getArchiveType())) ){//医养平板端登录限制
                throw new InvalidGrantException("不允许登录该平台");
            }
            logger.info("wlyyUserSimple::"+wlyyUserSimple);
            wlyyUserSimple.setAccessToken(token.getValue());
            wlyyUserSimple.setTokenType(token.getTokenType());
            wlyyUserSimple.setExpiresIn(token.getExpiresIn());
            wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
            wlyyUserSimple.setUser(parameters.get("username"));
            wlyyUserSimple.setState(parameters.get("state"));
            String loginType = parameters.get("login_type");
            String openid = parameters.get("openid");
            String wechatId = parameters.get("wechatId");
            logger.info("login:登录进入7");
            //更新患者openId
            BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
            logger.info("gengxin开始");
            if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && ("3".equals(loginType)||"4".equalsIgnoreCase(loginType))) {
                baseLoginLogDO.setOpenid(openid);
                logger.info("gengxin进入"+openid);
                userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
                if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                    logger.info("gengxin进入"+wechatId);
                    userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
                }
            }
            if (parameters.get("password") != null) {
                //使用密码登录成功后, 更新失败次数为 0
                userDetailsService.addFailureCount(username, 0);
            }
            logger.info("login:登录进入8");
        //个推 clientId
        String clientId = parameters.get("getuiClientId");
        String getuiClientType = parameters.get("getuiClientType");
        String padImei = parameters.get("padImei");
        //客户端类型 app,wx,pad,pc
        userDetailsService.updateInfo(clientId,getuiClientType,padImei,loginType,wlyyUserSimple.getId(),baseLoginLogDO);
            userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        return getResponse(wlyyUserSimple);
            logger.info("login:登录进入9");
            String clientType = parameters.get("clientType");
            baseLoginLogDO.setUserId(wlyyUserSimple.getId());
            baseLoginLogDO.setCreateTime(new Date());
            String userAgent = JSONObject.toJSONString(wlyyUserSimple);
            baseLoginLogDO.setUserAgent(userAgent);
            baseLoginLogDO.setLoginType(loginType);
            baseLoginLogDO.setName(wlyyUserSimple.getName());
            baseLoginLogDO.setClientType(clientType);
            baseLoginLogDO.setToken(token.getValue());
            baseLoginLogService.save(baseLoginLogDO);
            logger.info("login:登录进入10");
            //个推 clientId
            String clientId = parameters.get("getuiClientId");
            String getuiClientType = parameters.get("getuiClientType");
            String padImei = parameters.get("padImei");
            //客户端类型 app,wx,pad,pc
            userDetailsService.updateInfo(clientId,getuiClientType,padImei,loginType,wlyyUserSimple.getId(),baseLoginLogDO);
            return getResponse(wlyyUserSimple);
    }
@ -2057,6 +2037,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                basePatientDO.setDel("1");
                basePatientDO.setEnabled(1);
                basePatientDO.setLocked(0);
                basePatientDO.setName(name);
                basePatientDO.setCreateTime(new Date());
                basePatientDO.setUpdateTime(new Date());

+ 8 - 7
server/svr-authentication/src/main/java/com/yihu/jw/security/service/HcyyService.java

@ -17,6 +17,7 @@ import com.yihu.jw.security.utils.WebserviceUtil;
import com.yihu.utils.security.MD5;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -51,7 +52,7 @@ public class HcyyService {
    @Autowired
    private OauthRsaKeyDao rsaKeyDao;
    private static String caKey ="";
    private static String caKey ="bvvsf3JA0mUXMU+mVnMaOQ==";
    static {
        System.setProperty("kasite.appId", APP_ID);
        System.setProperty("kasite.appSecret", APP_SECRET);
@ -84,7 +85,7 @@ public class HcyyService {
        logger.info("url"+url);
        List<WlyyHospitalSysDictDO> xzzxNamespaces =  wlyyHospitalSysDictDao.findByDictName("hcyyCaNamespace");
        List<WlyyHospitalSysDictDO> xzzxNamespaces =  wlyyHospitalSysDictDao.findByDictName("hcyyNamespace");
        String xzzxNamespace = xzzxNamespaces.get(0).getDictCode();
@ -120,7 +121,7 @@ public class HcyyService {
                "   <callOperator></callOperator> " +
                "   <certificate>"+caKey+"</certificate> " +
                "</root>";
        String condition ="{\"apiName\":\""+apiCode+"\",\"version\":\"v1\",\"jsonData\":\""+jsonData+"\"}";
        String condition ="{\"apiName\":\""+apiCode+"\",\"version\":\"v1\",\"jsonData\":\""+ StringEscapeUtils.escapeJson(jsonData)+"\"}";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
@ -147,7 +148,7 @@ public class HcyyService {
     * @throws Exception
     */
    public String token() throws Exception {
        String businessSystemId = "";
        String businessSystemId = "1518527107887804418";
        Long timestamp = new Date().getTime();
        List<OauthRsaKeyDO> oauthRsaKeyDOs = rsaKeyDao.findByCodeAndAppId("hcyyCa","hcyyCa");
        if (oauthRsaKeyDOs==null||oauthRsaKeyDOs.size()==0){
@ -155,11 +156,11 @@ public class HcyyService {
        }
        OauthRsaKeyDO oauthRsaKeyDO = oauthRsaKeyDOs.get(0);
        String res = "businessSystemId="+businessSystemId+"&timestamp="+timestamp;
        String signature = RSAEncrypt.encrypt(res,oauthRsaKeyDO.getPrivateKey());
        String signature = RSAEncrypt.encrypt(res,oauthRsaKeyDO.getPublicKey());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("businessSystemId",businessSystemId);
        jsonObject.put("timestamp",timestamp);
        jsonObject.put("signature",signature);
        jsonObject.put("timestamp",timestamp+"");
        jsonObject.put("signature","");
        String result = XMCA_DCS_UnifiedInterface("获取访问令牌接口","authorize/token",jsonObject.toJSONString());
        if (StringUtils.isNoneBlank(result)){
            JSONObject object = JSONObject.parseObject(result);

+ 12 - 12
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/RSAEncrypt.java

@ -85,17 +85,17 @@ public class RSAEncrypt {
    }
//    public static void main(String[] args) throws Exception {
//        //生成公钥和私钥
//        Map<Integer, String> keyMap = genKeyPair();
//        //加密字符串
//        String message = "test";
//        System.out.println("随机生成的公钥为:" + keyMap.get(0));
//        System.out.println("随机生成的私钥为:" + keyMap.get(1));
//        String messageEn = encrypt(message,keyMap.get(0));
//        System.out.println(message + "\t加密后的字符串为:" + messageEn);
//        String messageDe = decrypt(messageEn,keyMap.get(1));
//        System.out.println("还原后的字符串为:" + messageDe);
//    }
    public static void main(String[] args) throws Exception {
        //生成公钥和私钥
        Map<Integer, String> keyMap = genKeyPair();
        //加密字符串
        String message = "test";
        System.out.println("随机生成的公钥为:" + keyMap.get(0));
        System.out.println("随机生成的私钥为:" + keyMap.get(1));
        String messageEn = encrypt(message,keyMap.get(0));
        System.out.println(message + "\t加密后的字符串为:" + messageEn);
        String messageDe = decrypt(messageEn,keyMap.get(1));
        System.out.println("还原后的字符串为:" + messageDe);
    }
}

+ 4 - 2
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/XzzxCotroller.java

@ -738,9 +738,11 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
                                    @ApiParam(name = "his_serial", value = "HIS挂号号", required = false)
                                    @RequestParam(value = "his_serial",required = false) String his_serial,
                                    @ApiParam(name = "org_code", value = "医院编码", required = false)
                                    @RequestParam(value = "org_code",required = false) String org_code)throws Exception{
                                    @RequestParam(value = "org_code",required = false) String org_code,
                                    @ApiParam(name = "outpatientId", value = "patientId", required = false)
                                        @RequestParam(value = "outpatientId",required = false) String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.confirmSettle(his_serial,icCardNo,org_code));
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.confirmSettle(his_serial,icCardNo,org_code,outpatientId));
    }
    /**

+ 21 - 21
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/healthCare/HealthCareEndPoint.java

@ -152,32 +152,32 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = "/register")
    @ApiOperation(value = "2.5.1医保挂号(N20.17.04.01)", notes = "2.5.1医保挂号(N20.17.04.01)")
    public ObjEnvelop register(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                               @RequestParam(value = "registerNo", required = true)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.register(registerNo));
    public ObjEnvelop register(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                               @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.register(outpatientId));
    }
    @GetMapping(value = "/registerBack")
    @ApiOperation(value = " 2.5.2医保挂号冲销(N20.17.04.02)", notes = " 2.5.2医保挂号冲销(N20.17.04.02)")
    public ObjEnvelop registerBack(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                                   @RequestParam(value = "registerNo", required = true)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.registerBack(registerNo));
    public ObjEnvelop registerBack(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                   @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.registerBack(outpatientId));
    }
    @GetMapping(value = "/feeDetailUpload")
    @ApiOperation(value = " 2.5.3医保费用明细上传(N20.17.04.03)", notes = " 2.5.3医保费用明细上传(N20.17.04.03)")
    public ObjEnvelop feeDetailUpload(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                                      @RequestParam(value = "registerNo", required = true)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailUpload(registerNo));
    public ObjEnvelop feeDetailUpload(@ApiParam(name = "outpatientId", value = "挂号号", required = true)
                                      @RequestParam(value = "outpatientId", required = true)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailUpload(outpatientId));
    }
    @GetMapping(value = "/feeDetailRefund")
    @ApiOperation(value = " 2.5.4医保费用明细上传冲销(N20.17.04.04)", notes = " 2.5.4医保费用明细上传冲销(N20.17.04.04)")
    public ObjEnvelop feeDetailRefund(@ApiParam(name = "registerNo", value = "挂号号", required = true)
                                      @RequestParam(value = "registerNo", required = false)String registerNo,
    public ObjEnvelop feeDetailRefund(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                      @RequestParam(value = "outpatientId", required = false)String outpatientId,
                                      @ApiParam(name = "remark", value = "作废原因", required = false)
                                      @RequestParam(value = "remark", required = true)String remark)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailRefund(registerNo,remark));
        return ObjEnvelop.getSuccess("ok",healthCareService.feeDetailRefund(outpatientId,remark));
    }
    @GetMapping(value = "/preSettlement")
@ -189,23 +189,23 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = "/preSettlementRefund")
    @ApiOperation(value = " 2.5.6医保结算冲销服务(N20.17.04.06)", notes = " 2.5.6医保结算冲销服务(N20.17.04.06)")
    public ObjEnvelop preSettlementRefund(@ApiParam(name = "registerNo", value = "门诊id", required = true)
                                          @RequestParam(value = "registerNo", required = false)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.preSettlementRefund(registerNo));
    public ObjEnvelop preSettlementRefund(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                          @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.preSettlementRefund(outpatientId));
    }
    @GetMapping(value = "/getSettlementResultUrl")
    @ApiOperation(value = " 2.5.7获取医保结算页面地址(N20.17.04.07)", notes = " 2.5.7获取医保结算页面地址(N20.17.04.07)")
    public ObjEnvelop getSettlementResultUrl(@ApiParam(name = "registerNo", value = "门诊id", required = true)
                                             @RequestParam(value = "registerNo", required = false)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrl(registerNo));
    public ObjEnvelop getSettlementResultUrl(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                             @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrl(outpatientId));
    }
    @GetMapping(value = "/getSettlementResultUrlBase64")
    @ApiOperation(value = " 2.5.7获取医保结算页面地址(N20.17.04.08)", notes = " 2.5.7获取医保结算页面地址(N20.17.04.08)")
    public ObjEnvelop getSettlementResultUrlBase64(@ApiParam(name = "registerNo", value = "门诊id", required = true)
                                             @RequestParam(value = "registerNo", required = false)String registerNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrlBase64(registerNo));
    public ObjEnvelop getSettlementResultUrlBase64(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                             @RequestParam(value = "outpatientId", required = false)String outpatientId)throws Exception{
        return ObjEnvelop.getSuccess("ok",healthCareService.getSettlementResultUrlBase64(outpatientId));
    }
    @GetMapping(value = "/getSettlementResult")

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java

@ -283,7 +283,7 @@ public class UnSettledHISPrescriptionService {
                                wxPushLogDao.save(wxPushLogDO);
                                WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
                                wlyyPrescriptionDO.setPrescribeTime(new Date());
                                wlyyPrescriptionDO.setCheckStatus(0);
                                wlyyPrescriptionDO.setCheckStatus(2);
                                wlyyPrescriptionDO.setCheckReason("审核通过");
                                prescriptionDao.save(wlyyPrescriptionDO);
                                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);

+ 17 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/config/DoctorServiceEndPoint.java

@ -130,6 +130,23 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateSort)
    @ApiOperation(value = "修改医生排名")
    public Envelop updateSort(
            @ApiParam(name = "doctorId", value = "状态")
            @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "sort", value = "排名")
            @RequestParam(value = "sort", required = true) Integer sort)throws Exception{
        try {
            baseDoctorService.updateSort(doctorId,sort);
            return success("修改成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateDoctorPw)
    @ApiOperation(value = "修改医生账号密码")
    public Envelop updateDoctorPw(@ApiParam(name = "id", value = "医生ID")

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

@ -204,23 +204,17 @@ public class HealthCareEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "电子处方订单接收", notes = "电子处方订单接收")
    public ObjEnvelop electronicPrescriptionReceiving(@ApiParam(name = "outpatientId", value = "门诊id", required = true)
                                                     @RequestParam(value = "outpatientId",required = true) String outpatientId)throws Exception{
        try {
            if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                String url = entranceHealthCareUrl + "electronicPrescriptionReceiving?outpatientId="+outpatientId;
                String infoResponse = httpClientUtil.get(url,"GBK");
                JSONObject jsonObject = JSONObject.parseObject(infoResponse);
                if(jsonObject.getInteger("status")==200){
                    return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
                }else {
                    return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
                }
        if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
            String url = entranceHealthCareUrl + "electronicPrescriptionReceiving?outpatientId="+outpatientId;
            String infoResponse = httpClientUtil.get(url,"GBK");
            JSONObject jsonObject = JSONObject.parseObject(infoResponse);
            if(jsonObject.getInteger("status")==200){
                return ObjEnvelop.getSuccess("ok",jsonObject.get("obj"));
            }else {
                return ObjEnvelop.getSuccess("ok",healthCareService.electronicPrescriptionReceiving(outpatientId));
                return ObjEnvelop.getError("调用内网接口失败:"+jsonObject.getString("message"));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }else {
            return ObjEnvelop.getSuccess("ok",healthCareService.electronicPrescriptionReceiving(outpatientId));
        }
    }

+ 307 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/healthUpload/HealthUploadPoint.java

@ -0,0 +1,307 @@
package com.yihu.jw.hospital.endpoint.healthUpload;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorHealthUploadDO;
import com.yihu.jw.entity.healthUpload.BaseDoctorMemberDO;
import com.yihu.jw.entity.hospital.prescription.BaseNationalDrugDictDO;
import com.yihu.jw.healthUpload.service.BaseDoctorHealthUploadService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
 *
 * Created at 20211003
 */
@RestController
@RequestMapping(value = "healthUpload")
@Api(value = "马銮湾医院健康上报功能", description = "马銮湾医院健康上报功能")
public class HealthUploadPoint extends EnvelopRestEndpoint {
    private static final Logger logger = LoggerFactory.getLogger(HealthUploadPoint.class);
    @Autowired
    private BaseDoctorHealthUploadService baseDoctorHealthUploadService;
    @PostMapping(value = "saveAndCreateMember")
    @ApiOperation(value = "新增医生成员关系")
    public ListEnvelop saveAndCreateMember(@ApiParam(name = "doctorId", value = "医生id")
                                              @RequestParam(value = "doctorId", required = true) String doctorId,
                                           @ApiParam(name = "ids", value = "成员id,逗号隔开")
                                          @RequestParam(value = "ids", required = true) String ids) {
        try {
            List<BaseDoctorMemberDO> doctorHealthUploadDOS = baseDoctorHealthUploadService.saveAndCreateMember(doctorId,ids);
            return success(doctorHealthUploadDOS);
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "selectByDoctorId")
    @ApiOperation(value = "查询医生的成员列表")
    public ListEnvelop selectByDoctorId(@ApiParam(name = "doctorId", value = "医生id")
                                           @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            List<BaseDoctorMemberDO> memberDOList = baseDoctorHealthUploadService.selectByDoctorId(doctorId);
            return success(memberDOList);
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "selectCountByDoctorId")
    @ApiOperation(value = "查询医生的成员列表带有已上报次数")
    public ListEnvelop selectCountByDoctorId(@ApiParam(name = "doctorId", value = "医生id")
                                        @RequestParam(value = "doctorId", required = true) String doctorId) {
        try {
            List<BaseDoctorMemberDO> memberDOList = baseDoctorHealthUploadService.selectCountByDoctorId(doctorId);
            return success(memberDOList);
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "selectById")
    @ApiOperation(value = "查询某一个成员信息")
    public ObjEnvelop selectById(@ApiParam(name = "id", value = "成员列表id")
                                             @RequestParam(value = "id", required = true) String id) {
        try {
            BaseDoctorMemberDO memberDO = baseDoctorHealthUploadService.selectById(id);
            return success(memberDO);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = "delDoctorMember")
    @ApiOperation(value = "删除某个成员")
    public ObjEnvelop delDoctorMember(@ApiParam(name = "id", value = "成员列表id")
                                 @RequestParam(value = "id", required = true) String id) {
        try {
            BaseDoctorMemberDO memberDO = baseDoctorHealthUploadService.delDoctorMember(id);
            return success(memberDO);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = "createHealthUploadInfo")
    @ApiOperation(value = "提交健康信息")
    public ObjEnvelop createHealthUploadInfo(@ApiParam(name = "jsonData", value = "健康信息实体")
                                      @RequestParam(value = "jsonData", required = true) String jsonData) {
        try {
            BaseDoctorHealthUploadDO healthUploadDO = objectMapper.readValue(jsonData, BaseDoctorHealthUploadDO.class);
            healthUploadDO = baseDoctorHealthUploadService.createHealthUploadInfo(healthUploadDO);
            return success(healthUploadDO);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "selectHealthUploadInfoByDoctorId")
    @ApiOperation(value = "查询成员的健康上报记录")
    public MixEnvelop selectHealthUploadInfoByDoctorId(@ApiParam(name = "doctorId", value = "医生id")
                                                        @RequestParam(value = "doctorId", required = true) String doctorId,
                                                       @ApiParam(name = "startDate", value = "开始时间")
                                                       @RequestParam(value = "startDate", required = false) String startDate,
                                                       @ApiParam(name = "endDate", value = "结束时间")
                                                           @RequestParam(value = "endDate", required = false) String endDate,
                                                       @ApiParam(name = "page", value = "页码")
                                                           @RequestParam(value = "page", required = false) Integer page,
                                                       @ApiParam(name = "pageSize", value = "大小")
                                                           @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            MixEnvelop mixEnvelop = baseDoctorHealthUploadService.selectHealthUploadInfoByDoctorId(doctorId,startDate,endDate,page,pageSize);
            return mixEnvelop;
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectHealthInfoById")
    @ApiOperation(value = "根据id查询健康上报情况")
    public ObjEnvelop selectHealthUploadInfoByDoctorId(@ApiParam(name = "id", value = "医生id")
                                                       @RequestParam(value = "id", required = true) String id) {
        try {
            BaseDoctorHealthUploadDO healthUploadDO = baseDoctorHealthUploadService.selectHealthInfoById(id);
            return success(healthUploadDO);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "saveDoctorInfo")
    @ApiOperation(value = "新增加医生信息")
    public ObjEnvelop saveDoctorInfo(@ApiParam(name = "photo", value = "医生头像")
                                                       @RequestParam(value = "photo", required = false) String photo,
                                                       @ApiParam(name = "name", value = "姓名")
                                                       @RequestParam(value = "name", required = false) String name,
                                                       @ApiParam(name = "idcard", value = "证件号码")
                                                       @RequestParam(value = "idcard", required = false) String idcard,
                                                       @ApiParam(name = "sex", value = "性别")
                                                       @RequestParam(value = "sex", required = false) String sex,
                                                       @ApiParam(name = "mobile", value = "手机号")
                                                       @RequestParam(value = "mobile", required = false) String mobile,
                                                        @ApiParam(name = "dept", value = "科室编码")
                                                         @RequestParam(value = "dept", required = false) String dept,
                                                         @ApiParam(name = "deptName", value = "科室名称")
                                                             @RequestParam(value = "deptName", required = false) String deptName,
                                                         @ApiParam(name = "idCardType", value = "证件类别")
                                                             @RequestParam(value = "idCardType", required = false) String idCardType,
                                                         @ApiParam(name = "idType", value = "身份类别")
                                                             @RequestParam(value = "idType", required = false) String idType,
                                     @ApiParam(name = "id", value = "医生id")
                                         @RequestParam(value = "id", required = false) String id) {
        try {
             BaseDoctorDO baseDoctorDO = baseDoctorHealthUploadService.saveDoctorInfo(id,photo,name,idcard,sex,mobile,dept,deptName,idCardType,idType);
            return success(baseDoctorDO);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    /**
     *
     * @param dept
     * @param level
     * @param doctorId
     * @return
     */
    @GetMapping(value = "selectHealthByRole")
    @ApiOperation(value = "医生首页")
    public ObjEnvelop selectHeaderTotal(@ApiParam(name = "dept", value = "院级管理员无需传科室code")
                                        @RequestParam(value = "dept", required = false) String dept,
                                        @ApiParam(name = "level", value = "1院级管理员,2科室管理员")
                                        @RequestParam(value = "level", required = false) Integer level,
                                        @ApiParam(name = "doctorId", value = "上报状态")
                                        @RequestParam(value = "doctorId", required = false) String doctorId) {
        try {
            JSONObject jsonObject = baseDoctorHealthUploadService.selectHealthByRole(dept,level,doctorId);
            return success(jsonObject);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "selectHeaderTotal")
    @ApiOperation(value = "首页统计")
    public ObjEnvelop selectHeaderTotal(@ApiParam(name = "dept", value = "科室code")
                                                       @RequestParam(value = "dept", required = true) String dept,
                                                       @ApiParam(name = "idType", value = "身份类别")
                                                       @RequestParam(value = "idType", required = false) String idType,
                                                       @ApiParam(name = "status", value = "上报状态")
                                                       @RequestParam(value = "status", required = false) String status,
                                                       @ApiParam(name = "state", value = "健康状态")
                                                       @RequestParam(value = "state", required = false) String state,
                                                       @ApiParam(name = "startDate", value = "开始时间")
                                                       @RequestParam(value = "startDate", required = false) String startDate,
                                        @ApiParam(name = "endDate", value = "结束时间")
                                            @RequestParam(value = "endDate", required = false) String endDate,
                                        @ApiParam(name = "name", value = "姓名")
                                            @RequestParam(value = "name", required = false) String name) {
        try {
            JSONObject jsonObject = baseDoctorHealthUploadService.selectHeaderTotal(dept,idType,status,state,startDate,endDate,name);
            return success(jsonObject);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "selectListByTotal")
    @ApiOperation(value = "获取列表的时间及数量")
    public ListEnvelop selectListByTotal(@ApiParam(name = "dept", value = "科室code")
                                        @RequestParam(value = "dept", required = false) String dept,
                                        @ApiParam(name = "idType", value = "身份类别")
                                        @RequestParam(value = "idType", required = false) String idType,
                                        @ApiParam(name = "status", value = "上报状态")
                                        @RequestParam(value = "status", required = false) String status,
                                        @ApiParam(name = "state", value = "健康状态")
                                        @RequestParam(value = "state", required = false) String state,
                                        @ApiParam(name = "startDate", value = "开始时间")
                                        @RequestParam(value = "startDate", required = false) String startDate,
                                         @ApiParam(name = "endDate", value = "结束时间")
                                             @RequestParam(value = "endDate", required = false) String endDate,
                                         @ApiParam(name = "name", value = "名字搜索")
                                             @RequestParam(value = "name", required = false) String name) {
        try {
            JSONArray jsonArray = baseDoctorHealthUploadService.selectListByTotal(dept,idType,status,state,startDate,endDate,name);
            return success(jsonArray);
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "selectListInfoByTotal")
    @ApiOperation(value = "获取列表的具体人员信息")
    public ListEnvelop selectListInfoByTotal(@ApiParam(name = "dept", value = "科室code")
                                         @RequestParam(value = "dept", required = false) String dept,
                                         @ApiParam(name = "idType", value = "身份类别")
                                         @RequestParam(value = "idType", required = false) String idType,
                                         @ApiParam(name = "status", value = "上报状态")
                                         @RequestParam(value = "status", required = false) String status,
                                         @ApiParam(name = "state", value = "健康状态")
                                         @RequestParam(value = "state", required = false) String state,
                                         @ApiParam(name = "startDate", value = "开始时间")
                                         @RequestParam(value = "startDate", required = false) String startDate,
                                         @ApiParam(name = "endDate", value = "结束时间")
                                         @RequestParam(value = "endDate", required = false) String endDate,
                                             @ApiParam(name = "name", value = "具体医生姓名")
                                                 @RequestParam(value = "name", required = false) String name) {
        try {
            JSONArray jsonArray = baseDoctorHealthUploadService.selectListInfoByTotal(dept,idType,status,state,startDate,endDate,name);
            return success(jsonArray);
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = "pushListWriteHealthInfo")
    @ApiOperation(value = "健康上报数据导出", notes = "健康上报数据导出")
    public Envelop pushListWrite(@ApiParam(name = "startDate", value = "开始时间")
                                 @RequestParam(value = "startDate", required = false) String startDate,
                                 @ApiParam(name = "endDate", value = "结束时间")
                                 @RequestParam(value = "endDate", required = false) String endDate,
                                 HttpServletResponse response) throws Exception {
        try{
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("健康上报报表")+".xls"));
            OutputStream os = response.getOutputStream();
            return success(baseDoctorHealthUploadService.selectListInfoExcelByTotal(os, startDate,endDate));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = "selectRecordByDoctorIdAndConsumer")
    @ApiOperation(value = "查下上报最新一次记录", notes = "查下上报最新一次记录")
    public Envelop selectRecordByDoctorIdAndConsumer(@ApiParam(name = "doctdorId", value = "医生id")
                                 @RequestParam(value = "doctorId", required = false) String doctdorId,
                                 @ApiParam(name = "consumer", value = "代上报人")
                                 @RequestParam(value = "consumer", required = false) String consumer) throws Exception {
        try{
            return success(baseDoctorHealthUploadService.selectRecordByDoctorIdAndConsumer(doctdorId,consumer));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
}

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

@ -20,6 +20,7 @@ import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
@ -29,8 +30,10 @@ import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.es.service.StatisticsEsService;
import com.yihu.jw.es.service.yqfk.YqfkService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.healthUpload.service.BaseDoctorHealthUploadService;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.httplog.service.WlyyHttpLogService;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
@ -94,6 +97,7 @@ import org.apache.poi.util.IOUtils;
import org.apache.tomcat.util.http.fileupload.FileItem;
import org.apache.tomcat.util.http.fileupload.FileItemFactory;
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
import org.hibernate.validator.constraints.SafeHtml;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -246,6 +250,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private String remote_inner_url;
    @Autowired
    private WechatInfoService wechatInfoService;
    @Autowired
    private YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    private BaseDoctorHealthUploadService baseDoctorHealthUploadService;
@ -729,6 +737,9 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                            systemMessageDO.setSender(businessOrderDO.getPatient());
                            //发送IM消息
                            hospitalSystemMessageService.sendImMessage(systemMessageDO);
                        }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("6")){
                            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findOne(businessOrderDO.getRelationCode());
                            prescriptionService.confirmSettlementService(ylzMedicalRelationDO.getRelationCode());
                        }
                    }
                    businessOrderService.updatePayStatus(traceNo);
@ -1158,7 +1169,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                //判断处方
                                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
                                    if (prescriptionDO.getStatus()!=30){
                                    if (prescriptionDO.getStatus()!=30&&prescriptionDO.getStatus()>=20){
                                        String fee=null;
                                        String title = null;
                                        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
@ -1190,6 +1201,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                        prescriptionLogDO.setUserType(1);
                                        prescriptionLogDO.setDatajson("处方结算");
                                        prescriptionLogDao.save(prescriptionLogDO);
                                        /*prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());*/
                                        BusinessOrderDO orderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getId());
                                        orderDO.setStatus(1);
                                        businessOrderDao.save(orderDO);
@ -1289,6 +1301,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                logger.info("更新门诊结算状态");
                                            }
                                        }
                                        /*prescriptionService.electronicPrescriptionReceiving(wlyyOutpatientDO.getId());*/
                                    }else {
                                        WlyyOutpatientDO wlyyOutpatientDO1 = outpatientDao.findByRealOrder(waitPayDetailVO.getRecipeNo());
                                        if (wlyyOutpatientDO1!=null){
@ -1299,6 +1312,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                    }
                                }
                                prescriptionDao.updateStatusByRealOrder(waitPayDetailVO.getRecipeNo(),30,new Date());
                            }
                            logger.info("更新系统处方支付状态");
                        }
@ -2163,6 +2177,23 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "pushListWriteHealthInfo")
    @ApiOperation(value = "健康上报数据导出", notes = "健康上报数据导出")
    public Envelop pushListWrite(@ApiParam(name = "startDate", value = "开始时间")
                                 @RequestParam(value = "startDate", required = false) String startDate,
                                 @ApiParam(name = "endDate", value = "结束时间")
                                 @RequestParam(value = "endDate", required = false) String endDate,
                                 HttpServletResponse response) throws Exception {
        try{
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename=" + new String(URLEncoder.encode("健康上报报表")+".xls"));
            OutputStream os = response.getOutputStream();
            return success(baseDoctorHealthUploadService.selectListInfoExcelByTotal(os, startDate,endDate));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    /**
     * 咨询列表
     * @param startDate

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

@ -2131,6 +2131,31 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    /**
     * 结算预交金充值
     *
     * @param relationCode
     * @return
     * @throws Exception
     */
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.ylzRechargePre)
    @ApiOperation("统一支付--预交金支付")
    public ObjEnvelop ylzRechargePre(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true) String relationCode,
            @ApiParam(name = "depositType", value = "depositType", required = true)
            @RequestParam(required = true) String depositType,
            @ApiParam(name = "cardType", value = "cardType", required = true)
            @RequestParam(required = true) String cardType,
            @ApiParam(name = "cardNo", value = "cardNo", required = true)
            @RequestParam(required = true) String cardNo) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePre(relationCode, depositType, wxId, cardType, cardNo, demoFlag));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 充值卡一支付
@ -3618,5 +3643,69 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/confirmSettlement")
    @ApiOperation(value = "确认费用结算", notes = "确认费用结算")
    public Envelop confirmSettlement(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId) throws Exception {
        try {
            return success("操作成功", prescriptionService.confirmSettlement(outpatientId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/confirmSettlementService")
    @ApiOperation(value = "确认费用结算", notes = "确认费用结算")
    public Envelop confirmSettlementService(
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId) throws Exception {
        try {
            return success("操作成功", prescriptionService.confirmSettlementService(outpatientId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/selectMedicareStatus")
    @ApiOperation(value = "查询是否有医保已结算", notes = "查询是否有医保已结算")
    public Envelop selectMedicareStatus(
            @ApiParam(name = "outpateintId", value = "outpateintId")
            @RequestParam(value = "outpateintId", required = false) String outpateintId) {
        try {
            return success("操作成功", prescriptionService.selectByOutpatientId(outpateintId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/testDzpj")
    @ApiOperation(value = "测试电子票据", notes = "测试电子票据")
    public Envelop testDzpj(
            @ApiParam(name = "pateintId", value = "pateintId")
            @RequestParam(value = "pateintId", required = false) String pateintId,
            @ApiParam(name = "realNo", value = "realNo")
            @RequestParam(value = "realNo", required = false) String realNo) {
        try {
            return success("操作成功", entranceService.dzpjServer(pateintId,realNo));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping("/testElectronicPrescriptionReceiving")
    @ApiOperation(value = "测试医保物流信息上传", notes = "测试医保物流信息上传")
    public Envelop electronicPrescriptionReceiving(
            @ApiParam(name = "outpateintId", value = "outpateintId")
            @RequestParam(value = "outpateintId", required = false) String outpateintId) {
        try {
            return success("操作成功", prescriptionService.electronicPrescriptionReceiving(outpateintId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
}