فهرست منبع

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

wangzhinan 5 سال پیش
والد
کامیت
2530d5e3db

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

@ -11,14 +11,28 @@ 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.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import javafx.scene.DepthTest;
import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -63,9 +77,30 @@ public class YkyyEntranceService {
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private BaseEvaluateScoreDao baseEvaluateScoreDao;
    @Autowired
    private BaseEvaluateDao baseEvaluateDao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
        return hibenateUtils.createSQLQuery(sql,params,page,size);
    }
@ -251,26 +286,270 @@ public class YkyyEntranceService {
        return buffer.toString();
    }
//    public String test(){
    public String getCFXX(String brids,String ysdm,String startDate)throws Exception{
        BaseDoctorDO doctor = findByMapingCode(ysdm);
        if(doctor==null){
            return "doctor mapping not exist !";
        }
        BaseDoctorHospitalDO hospitalDO = getDept(doctor.getId());
        if(hospitalDO==null){
            return "hospital not exist!";
        }
        String sql ="SELECT " +
                " c.BRID," +
                " c.CFHM," +
                " c.TSCF," +
                " c.BRXM," +
                " c.YSDM," +
                " c.KSDM," +
                " c.YPMC," +
                " c.YPDJ," +
                " c.YPSL," +
                " c.HJJE," +
                " c.JZXH," +
                " c.FPHM," +
                " c.FYBZ," +
                " c.YPCD," +
                " c.YPXH," +
                " c.YPYF," +
                " d.ICD," +
                " d.JBMC," +
                " x.YPDM," +
                " x.YFGG," +
                " x.YFDW," +
                " x.YFBZ," +
                " x.YPSX," +
                " x.YPJL," +
                " x.JLDW," +
                " x.PYDM," +
                " x.FYFS," +
                " x.GYFF," +
                " x.GYFFMC," +
                " x.YFZF," +
                " x.LSJG," +
                " x.KCSL," +
                " x.ZFPB," +
                " x.JBYWBZ," +
                " x.YDYP," +
                " x.YPMC2," +
                " p.JZKH " +
                "FROM " +
                " V_ZKSG_CFCX c, " +
                " v_hlw_mzbrzd d, " +
                " V_ZKSG_MZ_YPXX x," +
                " V_ZKSG_BRCX p " +
                "WHERE " +
                " c.BRID = d.BRID " +
                " AND c.jzxh = d.jzxh " +
                " AND c.ysdm = '"+ysdm+"' " +
                " AND x.ypxh = c.ypxh  " +
                " AND x.ypcd = c.ypcd " +
                " AND p.BRID = c.BRID " +
                " AND c.BRID in  ("+brids+") order by c.BRID DESC";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
//        HttpResponse response = HttpUtils.doGet(url,params);
//        String content = response.getContent();
//        logger.info("response:"+content);
//        JSONObject rs = JSON.parseObject(content);
//        Integer status = rs.getInteger("status");
//        Map<String,String> map = new HashedMap();
//        if(status!=null&&status == 200){
//            JSONArray array = rs.getJSONArray("detailModelList");
//            logger.info("detailModelList size:"+array.size());
//            if(array!=null&&array.size()>0) {
//                for(int i= 0;i<array.size();i++){
//                    JSONObject cfxx = array.getJSONObject(i);
//                    String brid = cfxx.getString("BRID");
//                    BasePatientDO patientDO = findPatientByMapingCode(brid);
//                    if(patientDO!=null){
//                        if(map.get(brid)==null){
//                            map.put(brid,brid);
//                            logger.info("1.创建门诊记录");
//                            //1.创建门诊记录
//                            WlyyOutpatientDO outpatientDO = saveOutPatient(cfxx,hospitalDO,patientDO,doctor,startDate);
//
//                            logger.info("2.生成处方记录");
//                            //2.生成处方记录
//                            savePrescription(outpatientDO,cfxx,startDate);
//
//        DictHospitalDeptDO deptDO = new DictHospitalDeptDO();
////        deptDO.setId(5);
//        deptDO.setOrgCode("test");
//        deptDO.setCode("test");
//        deptDO.setName("test");
//        deptDO.setConsultDeptFlag("test");
//        deptDO.setCreateTime(new Date());
//        hospitalDeptDao.save(deptDO);
//                            logger.info("3.医生评价");
//                            //3.医生评价
//                            saveDoctorScore(outpatientDO);
//
////        BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
////        hospitalDO.setDeptName("test");
////        hospitalDO.setDeptCode("test");
////        hospitalDO.setOrgCode("test");
////        hospitalDO.setOrgName("test");
////        hospitalDO.setDeptCode("test");
////        hospitalDO.setDeptName("test");
////        hospitalDO.setDel("1");
////        baseDoctorHospitalDao.save(hospitalDO);
//        return "ok";
//    }
//                        }
//                    }else{
//                        logger.info("brid:"+brid+" mapping not exist");
//                    }
//                }
//            }
//        }
        return "ok";
    }
    //生成门诊信息
    public WlyyOutpatientDO saveOutPatient(JSONObject cfxx,BaseDoctorHospitalDO hospitalDO,BasePatientDO patientDO,BaseDoctorDO doctor,String startDate){
        WlyyOutpatientDO outpatientDO = new WlyyOutpatientDO();
        outpatientDO.setRegisterNo(cfxx.getString("JZXH"));
        outpatientDO.setOutpatientType("1");
        outpatientDO.setType("1");
        outpatientDO.setHospital(orgCode);
        outpatientDO.setHospitalName(orgName);
        outpatientDO.setDept(hospitalDO.getDeptCode());
        outpatientDO.setDeptName(hospitalDO.getDeptName());
        outpatientDO.setPatient(patientDO.getId());
        outpatientDO.setPatientName(patientDO.getName());
        outpatientDO.setDoctor(doctor.getId());
        outpatientDO.setDoctorName(doctor.getName());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setMjz("mz");
        outpatientDO.setIcd10(cfxx.getString("ICD"));
        outpatientDO.setIcd10Name(cfxx.getString("JBMC"));
        outpatientDO.setAdvice("注意休息,防止过度疲劳");
        outpatientDO.setStatus("2");
        outpatientDO.setDescription("身体不舒服,焦虑");
        outpatientDO.setCreateTime(DateUtil.strToDate(startDate+" 08:30:00","yyyy-MM-dd HH:mm:ss"));
        outpatientDO.setDiseaseImg("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583567535353&di=6529f7ff05e79c26f37e0176adcb3241&imgtype=0&src=http%3A%2F%2Fimages.669pic.com%2Felement_pic%2F74%2F70%2F44%2F48%2F8997cd56af062ce6e1ca3da37506f3c9.jpg");
        outpatientDO.setConNo(cfxx.getString("JZXH"));
        outpatientDO.setRegisterDate(DateUtil.strToDate(startDate+" 08:30:00","yyyy-MM-dd HH:mm:ss"));
        outpatientDO.setEvaluateStatus("1");
        outpatientDO.setEndTime(DateUtil.strToDate(startDate+" 09:30:00","yyyy-MM-dd HH:mm:ss"));
        outpatientDO.setAdmNo("001");
        return outpatientDao.save(outpatientDO);
    }
    public void savePrescription(WlyyOutpatientDO outpatientDO,JSONObject cfxx,String startDate){
        WlyyPrescriptionDO prescriptionDO = new WlyyPrescriptionDO();
        prescriptionDO.setOutpatientId(outpatientDO.getId());
        prescriptionDO.setRealOrder(cfxx.getString("CFHM"));
        prescriptionDO.setSerialNo(cfxx.getString("JZXH"));
        prescriptionDO.setType(1);
        prescriptionDO.setPatientCode(outpatientDO.getPatient());
        prescriptionDO.setPatientName(outpatientDO.getPatientName());
        prescriptionDO.setIdcard(outpatientDO.getIdcard());
        prescriptionDO.setSsc(outpatientDO.getCardNo());
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        prescriptionDO.setStatus(100);
        prescriptionDO.setCreateTime(DateUtil.strToDate(startDate+" 09:00:00","yyyy-MM-dd HH:mm:ss"));
        prescriptionDO.setDept(outpatientDO.getDept());
        prescriptionDO.setDeptName(outpatientDO.getDeptName());
        prescriptionDO.setHospital(outpatientDO.getHospital());
        prescriptionDO.setHospitalName(outpatientDO.getHospitalName());
        prescriptionDO.setRemark("001");
        prescriptionDO.setDiseaseImg("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1583567535353&di=6529f7ff05e79c26f37e0176adcb3241&imgtype=0&src=http%3A%2F%2Fimages.669pic.com%2Felement_pic%2F74%2F70%2F44%2F48%2F8997cd56af062ce6e1ca3da37506f3c9.jpg");
        prescriptionDO.setDrugFee(cfxx.getDouble("HJJE"));
        prescriptionDO.setInspectFee(0D);
        prescriptionDO.setRegFee(0D);
        WlyyPrescriptionDO temp = prescriptionDao.save(prescriptionDO);
        WlyyPrescriptionInfoDO info = new WlyyPrescriptionInfoDO();
        info.setPrescriptionId(temp.getId());
        info.setDrugNo(cfxx.getString("PYDM"));
        info.setDrugName(cfxx.getString("YPMC"));
        info.setDosage(cfxx.getString("YPJL"));
        info.setQuantity(cfxx.getString("YPSL"));
        //计量单位
        info.setUnitName(cfxx.getString("JLDW"));
        //包装单位
        info.setPackUnitName(cfxx.getString("YFDW"));
        //用法
        info.setSupplyCode(cfxx.getString("GYFF"));
        info.setSupplyName(cfxx.getString("GYFFMC"));
        //规格
        info.setSpecification(cfxx.getString("YFGG"));
        info.setDel(1);
        info.setUsageCode(cfxx.getString("YPYF"));
        info.setUsageName(cfxx.getString("YPYF"));
        //药品单价
        info.setPackRetprice(cfxx.getDouble("YPDJ"));
        info.setComm("001");
        prescriptionInfoDao.save(info);
    }
    public void saveDoctorScore(WlyyOutpatientDO outpatientDO){
        BaseEvaluateScoreDO scoreDO = new BaseEvaluateScoreDO();
        scoreDO.setHospital(orgCode);
        scoreDO.setHospital(orgName);
        scoreDO.setDoctor(outpatientDO.getDoctor());
        scoreDO.setDoctorName(outpatientDO.getDoctorName());
        scoreDO.setPatient(outpatientDO.getPatient());
        scoreDO.setPatientName(outpatientDO.getPatientName());
        scoreDO.setEvaluateType(1);
        scoreDO.setScore(100D);
        scoreDO.setType(1);
        scoreDO.setRelationCode("001");
        BaseEvaluateScoreDO temp = baseEvaluateScoreDao.save(scoreDO);
        BaseEvaluateDO evaluateDO = new BaseEvaluateDO();
        evaluateDO.setRelationCode(temp.getId());
        evaluateDO.setScore(1D);
        evaluateDO.setScoreType("4");
        evaluateDO.setContent("五星好评!");
        baseEvaluateDao.save(evaluateDO);
    }
    /**
     * 获取医生信息
     * @param mappingCode
     * @return
     */
    public BaseDoctorDO findByMapingCode(String mappingCode){
        String sql = "SELECT " +
                " map.doctor AS \"doctor\" " +
                " FROM " +
                " base_doctor_mapping map " +
                " WHERE " +
                " map.org_code ='350211A5004' " +
                " AND map.mapping_code ='"+mappingCode+"' ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        if(list!=null&&list.size()>0){
            BaseDoctorDO doctorDO = baseDoctorDao.findById(list.get(0).get("doctor").toString());
            return doctorDO;
        }
        return null;
    }
    //获取部门
    public BaseDoctorHospitalDO getDept(String doctor){
        List<BaseDoctorHospitalDO> list =  baseDoctorHospitalDao.findByDoctorCode(doctor);
        if(list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    //获取居民信息
    public BasePatientDO findPatientByMapingCode(String mappingCode){
        PatientMappingDO patientMappingDO = patientMappingDao.findByMappingCodeAndSource(mappingCode,"1");
        if(patientMappingDO==null){
            return null;
        }
        BasePatientDO patientDO = basePatientDao.findById(patientMappingDO.getPatient());
        return patientDO;
    }
}

+ 14 - 5
business/base-service/src/main/java/com/yihu/jw/internet/entity/InternetUpLogDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.internet.entity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@ -16,7 +17,7 @@ public class InternetUpLogDO {
    private String id; //上传批次
    private String code;//监管平台任务编码',
    private Date date;//执行日期',
    private Date createDate;//执行日期',
    private Date startDate;//开始时间',
    private Date endDate;//结束时间',
    private Integer suc;//成功条数',
@ -33,6 +34,7 @@ public class InternetUpLogDO {
        this.id = id;
    }
    @Column(name = "code")
    public String getCode() {
        return code;
    }
@ -41,14 +43,16 @@ public class InternetUpLogDO {
        this.code = code;
    }
    public Date getDate() {
        return date;
    @Column(name = "create_date")
    public Date getCreateDate() {
        return createDate;
    }
    public void setDate(Date date) {
        this.date = date;
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    @Column(name = "start_date")
    public Date getStartDate() {
        return startDate;
    }
@ -57,6 +61,7 @@ public class InternetUpLogDO {
        this.startDate = startDate;
    }
    @Column(name = "end_date")
    public Date getEndDate() {
        return endDate;
    }
@ -65,6 +70,7 @@ public class InternetUpLogDO {
        this.endDate = endDate;
    }
    @Column(name = "suc")
    public Integer getSuc() {
        return suc;
    }
@ -73,6 +79,7 @@ public class InternetUpLogDO {
        this.suc = suc;
    }
    @Column(name = "err")
    public Integer getErr() {
        return err;
    }
@ -81,6 +88,7 @@ public class InternetUpLogDO {
        this.err = err;
    }
    @Column(name = "data_err")
    public Integer getDataErr() {
        return dataErr;
    }
@ -89,6 +97,7 @@ public class InternetUpLogDO {
        this.dataErr = dataErr;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetService.java

@ -1634,7 +1634,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        internetUpLogDO.setCode(code);
        internetUpLogDO.setStartDate(startDate);
        internetUpLogDO.setEndDate(endDate);
        internetUpLogDO.setDate(new Date());
        internetUpLogDO.setCreateDate(new Date());
        internetUpLogDO.setSuc(suc);
        internetUpLogDO.setErr(err);
        internetUpLogDO.setDataErr(dataErr);

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 182 - 218
business/base-service/src/main/java/com/yihu/jw/internet/service/ykyy/YkyyInternetService.java


+ 25 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -407,12 +407,36 @@ public class JobController extends BaseController {
                    break; //可选
                case "2.5" :
                    //语句
                    ykyyInternetService.upNsDoctorRecord(null,null,null);
                    ykyyInternetService.upAppointmentOnline(null,null,null);
                    break; //可选
                case "2.7" :
                    //语句
                    ykyyInternetService.upNsDoctorScore(null,null,null);
                    break; //可选upNsDoctorScore
                case "2.8" :
                    //语句
                    ykyyInternetService.upNsOnlineAsk(null,null,null);
                    break; //可选
                case "2.9" :
                    //语句
                    ykyyInternetService.upNsOnlineMed(null,null,null);
                    break; //可选
                case "2.10" :
                    //语句
                    ykyyInternetService.upPrescription(null,null,null);
                    break; //可选
                case "2.11" :
                    //语句
                    ykyyInternetService.upPrescriptionDrug(null,null,null);
                    break; //可选
                case "2.12" :
                    //语句
                    ykyyInternetService.upNsOnlineImg(null,null,null);
                    break; //可选
                case "2.13" :
                    //语句
                    ykyyInternetService.upNsOrganProtocol(null,null,null);
                    break; //可选
                default : //可选
                    //语句
            }

+ 16 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/base/BaseInfoEndpoint.java

@ -190,6 +190,22 @@ public class BaseInfoEndpoint extends EnvelopRestEndpoint {
        return success(ykyyEntranceService.updateYkyyDoctor());
    }
    @GetMapping(value = "/getCFXX")
    @ApiOperation(value = "同步处方信息生成数据", notes = "同步处方信息生成数据")
    public Envelop getCFXX(@ApiParam(name = "brids", value = "病人id")
                           @RequestParam(value = "brids", required = true)String brids,
                           @ApiParam(name = "ysdm", value = "医生id")
                           @RequestParam(value = "ysdm", required = true)String ysdm,
                           @ApiParam(name = "startDate", value = "生成时间")
                           @RequestParam(value = "startDate", required = true)String startDate) throws Exception {
        return success(ykyyEntranceService.getCFXX(brids,ysdm,startDate));
    }
    @GetMapping(value = "/findPatientByMapingCode")
    @ApiOperation(value = "findPatientByMapingCode", notes = "findPatientByMapingCode")
    public Envelop findPatientByMapingCode(String code) throws Exception {
        return success(ykyyEntranceService.findPatientByMapingCode(code));
    }
//    @GetMapping(value = "/test")
//    @ApiOperation(value = "test", notes = "test")
//    public Envelop test() throws Exception {