Bladeren bron

Merge branch 'baseCopy1' of wangjun/wlyy2.0 into dev

wangzhinan 3 jaren geleden
bovenliggende
commit
fbe34c4542

+ 5 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseNatAppointmentDao.java

@ -13,10 +13,14 @@ public interface BaseNatAppointmentDao extends PagingAndSortingRepository<BaseNa
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 ")
    List<BaseNatAppointmentDO> findByPayStatus();
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 and t.isSuccess=1 and t.patientId=?1")
    @Query("from BaseNatAppointmentDO t where  t.payStatus = 0 and t.isSuccess=1 and t.patientId=?1")
    List<BaseNatAppointmentDO> findPayStatusByPatientId(String patientId);
    @Query("from BaseNatAppointmentDO t where t.payStatus = 1 or t.payStatus = 0 and t.isSuccess=1 and t.patientId=?1")
    List<BaseNatAppointmentDO> findPayStatusByPatientIdTASY(String patientId);
    @Query("select a from BaseNatAppointmentDO a where  a.realOrder =?1 ")
    List<BaseNatAppointmentDO> findByRealOrderList(String realOrder);
}

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

@ -11727,7 +11727,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            format2 = new SimpleDateFormat("yyyy-MM-dd").parse(natTime);
            String shortDate = new SimpleDateFormat("yyyyMMdd").format(format2);
            System.out.println("yyyy-MM-dd转yyyyMMdd:"+shortDate);
            String regRes=tasyNatService.saveRegOrder(regDept,shortDate,pm,preNo,cardNo,mobile,name,"3");
           /* String regRes=tasyNatService.saveRegOrder(regDept,shortDate,pm,preNo,cardNo,mobile,name,"3");
            com.alibaba.fastjson.JSONObject regObj = com.alibaba.fastjson.JSONObject.parseObject(regRes);
            String HisSeqNo="";
            String orderNum="";
@ -11741,11 +11741,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    returnMap.put("status","-1");
                    return  returnMap;
                }
            }
            }*/
            //先进行核算检测预约
            String realOrder="";
            String addressNow=provinceName+cityName+townName+streetName+address;
            String result = tasyNatService.initNatParams(HisSeqNo,name,mediaCard,addressNow,firstJobCode,secondJobCode);
            String result = tasyNatService.initNatParams("",name,mediaCard,addressNow,firstJobCode,secondJobCode);
            Boolean flag = false;
            if (StringUtils.isNoneBlank(result)){
                com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
@ -11756,7 +11756,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    if ("0".equalsIgnoreCase(returnCode)){
                        returnMap.put("msg",object.getString("data"));
                        returnMap.put("status","-1");
                        tasyNatService.cancleOrder(cardNo,HisSeqNo,orderNum);
                        //tasyNatService.cancleOrder(cardNo,HisSeqNo,orderNum);
                        return  returnMap;
                    }else {
                        flag = true;
@ -11772,13 +11772,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
                baseNatAppointmentDO.setChargeAmount(itemPrice);
                baseNatAppointmentDO.setMedicare(mediaCard);
                baseNatAppointmentDO.setRegisterNo(HisSeqNo);
                //baseNatAppointmentDO.setRegisterNo(HisSeqNo);
                baseNatAppointmentDO.setName(name);
                baseNatAppointmentDO.setCardNo(cardNo);
                baseNatAppointmentDO.setCardType(cardType);
                baseNatAppointmentDO.setAddress(address);
                baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDateLong(natTime));
                baseNatAppointmentDO.setOderNum(orderNum);
                //baseNatAppointmentDO.setOderNum(orderNum);
                baseNatAppointmentDO.setCityName(cityName);
                baseNatAppointmentDO.setFirstJobCode(firstJobCode);
                baseNatAppointmentDO.setFirstJobName(firstJobName);
@ -11836,9 +11836,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                orderObj.put("openId",openId);
                orderObj.put("name",name);
                orderObj.put("idNo",cardNo);
                String hisPatientId=tasyNatService.getPatientHisId(cardNo,mediaCard);
                orderObj.put("hisPatientId",hisPatientId);
                orderObj.put("mediaCard",mediaCard);
                Map mapHis=tasyNatService.getPatientHisId(cardNo,mediaCard);
                orderObj.put("patientId",mapHis.get("Patientid").toString());
                orderObj.put("mobile",mapHis.get("MobilePhone").toString());
                //orderObj.put("socialCard","");
                orderObj.put("icCard",mediaCard);
                BigDecimal b = new BigDecimal(itemPrice);
                b=b.setScale(2, BigDecimal.ROUND_DOWN);
                System.out.println("amount"+b);
@ -12267,13 +12269,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if (StringUtils.isNoneBlank(baseNatAppointmentDO.getRealOrder())){
                            logger.info("同步his订单状态"+baseNatAppointmentDO.getRealOrder());
                            //取消号源
                            String registerCancel =tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                            com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(registerCancel);
                            String isSuccess=jsonObject.getString("success");
                            //String registerCancel =tasyNatService.cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                            /*com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(registerCancel);
                            String isSuccess=jsonObject.getString("success");*/
                            String natCancel=tasyNatService.cancelNat(baseNatAppointmentDO.getRealOrder(),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName());
                            com.alibaba.fastjson.JSONObject jsonObject1 = JSON.parseObject(natCancel);
                            String returnCode=jsonObject1.getString("ReturnCode");
                            if ("1".equalsIgnoreCase(returnCode)&&"true".equalsIgnoreCase(isSuccess)){
                            if ("1".equalsIgnoreCase(returnCode)){
                                System.out.println("11111");
                                baseNatAppointmentDO.setIsSuccess("-1");
                                baseNatAppointmentDO.setCancelReson("患者本人取消");

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

@ -33,6 +33,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -380,7 +382,7 @@ public class TasyNatService {
            }
        }
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("preNo",preNo);
        //jsonObject.put("preNo",preNo);
        jsonObject.put("icCardNo",icCardNo);
        jsonObject.put("patientName",patientName);
        jsonObject.put("deptCode",deptCode);
@ -538,11 +540,11 @@ public class TasyNatService {
            first.put("color",wxTemplateConfigDO1.getKeyword6());
            key1.put("value",baseNatAppointmentD0.getDoctorName());
            key1.put("color",wxTemplateConfigDO1.getKeyword6());
            key2.put("value",baseNatAppointmentD0.getChargeAmount());
            key2.put("value",baseNatAppointmentD0.getChargeAmount()+".00元");
            key2.put("color",wxTemplateConfigDO1.getKeyword6());
            key3.put("value",wxTemplateConfigDO1.getKeyword3());
            key3.put("color",wxTemplateConfigDO1.getKeyword6());
            key4.put("value",baseNatAppointmentD0.getChargeAmount());
            key4.put("value",baseNatAppointmentD0.getChargeAmount()+".00元");
            key4.put("color",wxTemplateConfigDO1.getKeyword6());
            key5.put("value",baseNatAppointmentD0.getVoucherNo());
            key5.put("color",wxTemplateConfigDO1.getKeyword6());
@ -582,7 +584,7 @@ public class TasyNatService {
            key3.put("color",wxTemplateConfigDO1.getKeyword6());
            key4.put("value",baseNatAppointmentD0.getDoctorName());
            key4.put("color",wxTemplateConfigDO1.getKeyword6());
            key5.put("value", DateUtil.formatDate(baseNatAppointmentD0.getCreateTime(),"yyyy-MM-dd hh:mm:ss"));
            key5.put("value", DateUtil.formatDate(baseNatAppointmentD0.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
            key5.put("color",wxTemplateConfigDO1.getKeyword6());
            remark.put("value",wxTemplateConfigDO1.getRemark());
            remark.put("color",wxTemplateConfigDO1.getKeyword6());
@ -616,7 +618,7 @@ public class TasyNatService {
            key1.put("color",wxTemplateConfigDO1.getKeyword6());
            key2.put("value",baseNatAppointmentD0.getInspectionName());
            key2.put("color",wxTemplateConfigDO1.getKeyword6());
            key3.put("value",DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"));
            key3.put("value",DateUtil.formatDate(baseNatAppointmentD0.getAppointmentTime(),"yyyy-MM-dd HH:mm:ss"));
            key3.put("color",wxTemplateConfigDO1.getKeyword6());
            key4.put("value",wxTemplateConfigDO1.getKeyword4());
            key4.put("color",wxTemplateConfigDO1.getKeyword6());
@ -802,7 +804,7 @@ public class TasyNatService {
    }
    public void savePayStatusByHis(String patientId) throws Exception {
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientId(patientId);
        List<BaseNatAppointmentDO> baseNatAppointmentDOList = baseNatAppointmentDao.findPayStatusByPatientIdTASY(patientId);
        for (BaseNatAppointmentDO baseNatAppointmentDO:baseNatAppointmentDOList){
                String res = QueryApplyInfo(baseNatAppointmentDO.getRealOrder());
                JSONObject jsonObject = JSON.parseObject(res);
@ -817,6 +819,20 @@ public class TasyNatService {
                                businessOrderDO.setStatus(1);
                                businessOrderDao.save(businessOrderDO);
                            }
                        }else if ("已退费".equalsIgnoreCase(jsonObject.getString("Status"))){
                            logger.info("进入退费订单同步");
                            baseNatAppointmentDO.setPayStatus("-1");
                            baseNatAppointmentDO.setIsSuccess("-1");
                            baseNatAppointmentDO.setCancelReson("患者本人线下取消");
                            baseNatAppointmentDO.setCancelTime(new Date());
                            baseNatAppointmentDO.setCancelBy(patientId);
                            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(baseNatAppointmentDO.getId().toString());
                            if (businessOrderDO!=null){
                                businessOrderDO.setStatus(-1);
                                businessOrderDao.save(businessOrderDO);
                            }
                            //取消号源
                            //cancleOrder(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getRegisterNo(),baseNatAppointmentDO.getOderNum());
                        }
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                    }
@ -850,6 +866,11 @@ public class TasyNatService {
            orderObj.put("openId",openId);
            orderObj.put("name",baseNatAppointmentDO.getName());
            orderObj.put("idNo",baseNatAppointmentDO.getCardNo());
            Map mapHis=getPatientHisId(baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMedicare());
            orderObj.put("patientId",mapHis.get("Patientid").toString());
            orderObj.put("mobile",mapHis.get("MobilePhone").toString());
            //orderObj.put("socialCard","");
            orderObj.put("icCard",baseNatAppointmentDO.getMedicare());
            BigDecimal b = new BigDecimal(baseNatAppointmentDO.getChargeAmount());
            b=b.setScale(2, BigDecimal.ROUND_DOWN);
            System.out.println("amount"+b);
@ -926,13 +947,16 @@ public class TasyNatService {
        params.put("msg",msgBody);
        logger.info("hdrQueryDataWS params:"+params.toString());
        String xml = getTaszWebServiceInfo("hdrQueryDataWS",params,gethsQueryDataWS());
        xml=xml.substring(xml.indexOf("<ArrayList>"),xml.lastIndexOf("]]"));
        if (xml.contains("<ArrayList>")){
            xml=xml.substring(xml.indexOf("<ArrayList>"),xml.lastIndexOf("]]"));
        }else {
            xml=xml.substring(xml.indexOf("<?xml"),xml.lastIndexOf("]]"));
        }
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("hdrQueryDataWS json:"+json);
        return json;
    }
    public  Map checkBalance(String relationCode) throws  Exception{
        BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(Integer.parseInt(relationCode));
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("MzBalance");
@ -1002,7 +1026,8 @@ public class TasyNatService {
        result.put("msg","验证通过");
        return  result;
    }
    public String getPatientHisId(String idcard,String mediacard) throws Exception{
    public Map getPatientHisId(String idcard,String mediacard) throws Exception{
        Map map = new HashMap();
        String res = findHisPatientCard(idcard);
        JSONObject jsonObject = JSON.parseObject(res);
        if ("1".equalsIgnoreCase(jsonObject.getString("ReturnCode"))) {
@ -1014,7 +1039,10 @@ public class TasyNatService {
                        JSONObject child = jsonArray.getJSONObject(i);
                        if (mediacard.equalsIgnoreCase(child.getString("CardNo"))) {
                            String Patientid = child.getString("Patientid");
                            return Patientid;
                            String MobilePhone = child.getString("MobilePhone");
                            map.put("Patientid",Patientid);
                            map.put("MobilePhone",MobilePhone);
                            return map;
                        }
                    }
@ -1024,7 +1052,10 @@ public class TasyNatService {
                    JSONObject jsonObject1 = JSONObject.parseObject(patients);
                    if (mediacard.equalsIgnoreCase(jsonObject1.getString("CardNo"))) {
                        String Patientid = jsonObject1.getString("Patientid");
                        return Patientid;
                        String MobilePhone = jsonObject1.getString("MobilePhone");
                        map.put("Patientid",Patientid);
                        map.put("MobilePhone",MobilePhone);
                        return map;
                    }
                } catch (Exception e) {
                   e.printStackTrace();
@ -1032,6 +1063,6 @@ public class TasyNatService {
            }
        }
        return "";
        return map;
    }
}

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

@ -2298,6 +2298,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                System.out.println("111");
                return success("操作成功",tasyNatService.hdrQueryDataWS(jsonObject.getString("idcard"),jsonObject.getString("wsCode"),jsonObject.getString("oid"),jsonObject.getString("time")));
            }
            if ("GetDoctorWorkDate".equalsIgnoreCase(api)){
                System.out.println("111");
                return success("操作成功",tasyNatService.GetDoctorWorkDate("3",jsonObject.getString("dept")));
            }
            return success("");
        } catch (Exception e){
            return  failedException(e);

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

@ -17,9 +17,11 @@ import com.yihu.jw.entity.base.area.BaseProvinceDO;
import com.yihu.jw.entity.base.area.BaseTownDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.service.BaseOperateLogService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
@ -136,6 +138,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private BaseOperateLogService baseOperateLogService;
    @Autowired
    private TasyNatService tasyNatService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${qywx.id}")
    private String qywxId;
@ -2888,17 +2892,27 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        }else if ("xm_tasy_wx".equalsIgnoreCase(wxId)){
            String res=tasyNatService.departMent(deptCode);
            String dept="";
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("tasyNatDept");
            if (wlyyHospitalSysDictDO!=null){
                dept=wlyyHospitalSysDictDO.getDictValue();
            }
            JSONObject deptres = JSON.parseObject(res);
            if (deptres!=null){
                if (deptres.getString("success").equalsIgnoreCase("true")){
                    JSONObject data = JSON.parseObject(deptres.getString("data"));
                    dept=data.getString("Dept");
                    JSONArray jsonArray1 = JSON.parseArray(dept);
                    /*JSONObject data = JSON.parseObject(deptres.getString("data"));
                    String depts=data.getString("Dept");
                    JSONArray jsonArray1 = JSON.parseArray(depts);
                    if (jsonArray1!=null&&jsonArray1.size()>0){
                        JSONObject jsonObject = jsonArray1.getJSONObject(0);
                        dept=jsonObject.getString("Id");
                        System.out.println(dept);
                    }
                        for (int i=0;i<jsonArray1.size();i++){
                            JSONObject jsonObject = jsonArray1.getJSONObject(i);
                            if (dept.equalsIgnoreCase(jsonObject.getString("Id"))){
                                dept=jsonObject.getString("Id");
                                System.out.println(dept);
                                break;
                            }
                        }
                    }*/
                    String json=tasyNatService.GetDoctorWorkDate("3",dept);
                    JSONObject jsonObject = JSON.parseObject(json);
                    jsonObject.put("dept",dept);