Sfoglia il codice sorgente

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

wangzhinan 4 anni fa
parent
commit
b676e5893d

+ 6 - 2
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -9,7 +9,9 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.doctor.DoctorSpecialDiseaseDo;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -23,6 +25,7 @@ import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -54,7 +57,8 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    @Autowired
    private WlyyChargeDictDao wlyyChargeDictDao;
    /**
     * 查询医生信息分页列表.
     * @param city
@ -121,6 +125,7 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
                " a.del AS \"del\", " +
                " b.dept_name AS \"deptName\", " +
                " e.req_fee AS \"money\" " +
                " a.charge_type as \"chargeType\", "+
                " FROM " +
                " base_doctor a " +
                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
@ -152,7 +157,6 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        logger.info("queryList sql:"+sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, pageSize, count);
    }

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

@ -103,6 +103,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.Banner;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -444,7 +445,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.disease_img AS \"diseaseImg\"," +
                " o.consumer as \"consumer\"," +
                " o.consumer_name as \"consumerName\"," +
                " o.consumer_mobile as \"consumerMobile\", ";
                " o.consumer_mobile as \"consumerMobile\", "+
                " o.fee as \"fee\", ";
        if ("xm_ykyy_wx".equals(wechatId)) {
            if (flag){
                sql = sql + "date_format(o.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime,";
@ -506,6 +508,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
        rs.put("operator",outpatientDO.getOperator());
        rs.put("status",outpatientDO.getStatus());
        rs.put("fee",outpatientDO.getFee());
        rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
@ -569,6 +572,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        //电子病历
                        vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
                    }
                } else if (wxId.equalsIgnoreCase("xm_xzzx_wx")) {
                    WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO1 = prescriptionEmrDao.findEmrByPrescriptionId(vo.getId());
                    if (wlyyPrescriptionEmrDO1 != null) {
                        vo.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO1);
                    } else {
                        List<WlyyPrescriptionEmrDO> listEmr = xzzxEntranceService.selectHistoryEmr(hisPatient,"");
                        if (null!=listEmr&&listEmr.size()>0){
                            vo.setWlyyPrescriptionEmrDO(listEmr.get(0));
                        }
                    }
                }
                //支付信息
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
@ -1493,6 +1506,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String id = (String) doctor.get("id");
                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode);
                doctor.put("workTime", times);
                String deptTyepCode = "6";
                List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(id);
                if (null!=depts&&depts.size()>0){
                    BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0);
                    String deptcode =  baseDoctorHospitalDO.getDeptCode();
                    String hosptitalCode = baseDoctorHospitalDO.getOrgCode();
                    List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode);
                    if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){
                        deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode();
                    }
                }
                String chargeTypeList = doctor.get("chargeType").toString();
                if (chargeType.contains(",")){
                    chargeTypeList = chargeType.replace(",","','");
                }
                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                        "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                        " from wlyy_charge_dict where 1=1";
                sqlCharge+=" and charge_type in ( '"+chargeTypeList+"')";
                sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
                List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
                doctor.put("chargeTypeList",chargeDictDOLists);
            }
            if (StringUtils.isNotBlank(doctorCode)) {
                //排序
@ -3366,8 +3402,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("sex",doctorDO.getSex());
            rs.put("popularity",doctorDO.getPopularity());
            rs.put("qrcode",doctorDO.getQrcode());
            //号别
            String deptTyepCode = "6";
            List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor);
            if (null!=depts&&depts.size()>0){
                BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0);
                String deptcode =  baseDoctorHospitalDO.getDeptCode();
                String hosptitalCode = baseDoctorHospitalDO.getOrgCode();
                List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode);
                if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){
                    deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode();
                }
            }
            String chargeType = doctorDO.getChargeType();
            if (chargeType.contains(",")){
                chargeType = chargeType.replace(",","','");
            }
            String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                    "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                    " from wlyy_charge_dict where 1=1";
            sqlCharge+=" and charge_type in ( '"+chargeType+"')";
            sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
            List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            rs.put("chargeTypeList",chargeDictDOLists);
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
            if (hospitalDOs != null && hospitalDOs.size() > 0) {
@ -3601,7 +3659,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("learning",doctorDO.getLearning());
            rs.put("sex",doctorDO.getSex());
            rs.put("qrcode",doctorDO.getQrcode());
            //号别
            String deptTyepCode = "6";
            List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor);
            if (null!=depts&&depts.size()>0){
                BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0);
                String deptcode =  baseDoctorHospitalDO.getDeptCode();
                String hosptitalCode = baseDoctorHospitalDO.getOrgCode();
                List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode);
                if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){
                    deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode();
                }
            }
            String chargeType = doctorDO.getChargeType();
            if (chargeType.contains(",")){
                chargeType = chargeType.replace(",","','");
            }
            String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                    "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                    " from wlyy_charge_dict where 1=1";
            sqlCharge+=" and charge_type in ( '"+chargeType+"')";
            sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
            List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            rs.put("chargeTypeList",chargeDictDOLists);
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
            List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
@ -4865,12 +4946,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
      /*  if(page >=1){
            page --;
        }
        if (pagesize <= 0) {
            pagesize = 10;
        }*/
      wechatId = "12";
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
@ -5030,6 +5110,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        list.stream().sorted(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("workTotal"))).reversed().thenComparing(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("consultStatus")))).reversed());*/
        for (Map<String,Object> map:list){
            String doctor = map.get("id").toString();
            //号别
            String deptTyepCode = "6";
            List<BaseDoctorHospitalDO> depts = baseDoctorHospitalDao.findByDoctorCode(doctor);
            if (null!=depts&&depts.size()>0){
                BaseDoctorHospitalDO baseDoctorHospitalDO = depts.get(0);
                String deptcode =  baseDoctorHospitalDO.getDeptCode();
                String hosptitalCode = baseDoctorHospitalDO.getOrgCode();
                List<DictHospitalDeptDO> dictHospitalDeptDO = dictHospitalDeptDao.findByOrgCodeAndCode(hosptitalCode,deptcode);
                if(null!=dictHospitalDeptDO&&dictHospitalDeptDO.size()>0){
                    deptTyepCode = dictHospitalDeptDO.get(0).getDeptTypeCode();
                }
            }
            String chargeType = map.get("chargeType").toString();
            if (chargeType.contains(",")){
                chargeType = chargeType.replace(",","','");
            }
            String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                    "req_fee  as \"reqFee\",dept_type_code as \"deptTypeCode\" " +
                    " from wlyy_charge_dict where 1=1";
            sqlCharge+=" and charge_type in ( '"+chargeType+"')";
            sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
            List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            map.put("chargeTypeList",chargeDictDOLists);
            //查询医生各项评价平均分
            String sqlscore = "SELECT " +
                    "AVG(a.score) AS \"score\"," +
@ -5575,7 +5679,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public List<Map<String, Object>> getVideoPrescriptionByDoctor(String doctor, String general_doctor, String wxId) {
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
        /*if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            }else {
@ -5584,7 +5688,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
        }
        }*/
        String sql = "SELECT " +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
@ -5594,7 +5698,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "patient.photo AS \"photo\"," +
                "patient.birthday AS \"birthday\"," +
                "patient.mobile AS \"mobile\"," +
                "room.consult_type AS \"consult_type\"," + condition +
                "room.consult_type AS \"consult_type\"," + "room.reservation_time as \"time\", " +
                "room.reservation_type AS \"reservation_type\"," +
                "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
@ -5628,7 +5732,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String idcard = (String) outpatient.get("idcard");
                String patient_id = (String) outpatient.get("patient_id");
                outpatient.put("age", DateUtil.getAgeForIdcard(idcard));
                //转换日期格式
                outpatient.put("time",null==outpatient.get("time")?"":DateUtil.dateToStrLong(DateUtil.strToDateLong(outpatient.get("time").toString())));
                String outpatient_id = (String) outpatient.get("id");
                String isAlert = redisTemplate.opsForValue().get("patient_alert_" + patient_id);
@ -5717,7 +5822,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
            if(flag){
                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
                condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' )  AS \"time\",";
                condition += "date_format(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            }else{
                condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
@ -5725,7 +5830,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        } else {
            condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
                condition += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS \"time\",";
            condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
        }
        String sql = "SELECT " +
@ -8728,4 +8833,123 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
       }
       return envelop;
    }
    //应声开具处方管理
    public MixEnvelop prescriptionManage(String keyWord,String doctorId,String startTime,String endTime,String checkStatus,Integer page,Integer pageSize){
        String sql = " select p.create_time as \"createTime\"," +
                " p.patient_name as \"patientName\"," +
                " p.idcard as \"idcard\"," +
                " o.card_no as \"cardNo\"," +
                " p.check_status as \"checkStatus\"," +
                " p.id as \"id\"," +
                " p.check_reason as \"checkReason\" " +
                " from wlyy_prescription p left join wlyy_outpatient o on p.outpatient_id  = o.id" +
                " where  1=1";
        if (StringUtils.isNotBlank(keyWord)){
            sql+=" and (p.patient_name like '%"+keyWord+"%' or p.idcard = '"+keyWord+"'" +
                    " or o.card_no = '"+keyWord+"')";
        }
        if(StringUtils.isNotBlank(checkStatus)){
            sql+=" and p.check_status ="+checkStatus;
        }
        if(StringUtils.isNotBlank(doctorId)){
            sql+=" and p.doctor = '"+doctorId+"'";
        }
        if(StringUtils.isNotBlank(startTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                    sql+=" and p.create_time > '" + startTime + " 00:00:00'";
                }else {
                    sql+=" and p.create_time > to_date('" + startTime + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') ";
                }
            }else{
                sql+=" and p.create_time > '" + startTime + " 00:00:00' ";
            }
        }
        if(StringUtils.isNotBlank(endTime)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                    sql+="  and p.create_time<'" + endTime + " 23:59:59'";
                }else {
                    sql+=" and p.create_time< to_date('" + endTime + " 23:59:59','yyyy-mm-dd hh24:mi:ss')";
                }
            }else{
                sql+="  and p.create_time<'" + endTime + " 23:59:59'";
            }
        }
        sql+=" order by p.create_time desc";
        String sqlcount = "SELECT COUNT(1) AS \"total\" FROM ("+sql+") q";
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlcount);
        if(total!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        List<Map<String,Object>> resultList = hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:resultList){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            map.put("createTime",null==map.get("createTime")?"":DateUtil.dateToStrLong(DateUtil.strToDateLong(map.get("createTime").toString())));
            String prescriptionId = map.get("id").toString();
            //获取处方信息
            List<WlyyPrescriptionDO> prescriptionDOs = null;
            prescriptionDOs = prescriptionDao.findById(prescriptionId);
            List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
            List<BusinessOrderDO> businessOrders = new ArrayList<>();
            if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
                convertToModels(prescriptionDOs, prescriptionVOs, WlyyPrescriptionVO.class);
                for (WlyyPrescriptionVO vo : prescriptionVOs) {
                    List<WlyyPrescriptionCheckDO> prescriptionCheckDO = prescriptionCheckDao.findByPrescriptionId(vo.getId());
                    //疾病信息
                    vo.setDiagnosisVOs(findDiagnosisById(vo.getId()));
                    if(null!=prescriptionCheckDO&&prescriptionCheckDO.size()>0){
                        vo.setDispUser(prescriptionCheckDO.get(0).getOperate());
                        vo.setDispUserName(prescriptionCheckDO.get(0).getOperateName());
                    }
                    //药品信息
                    List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
                    System.out.println("=====PrescriptionId======"+vo.getId());
                    convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId(), 1), infoVOs, WlyyPrescriptionInfoVO.class);
                    vo.setInfoVOs(infoVOs);
                    //检查检验信息
                    List<WlyyInspectionVO> inspectionVOs = new ArrayList<>();
                    vo.setInspectionVOs(convertToModels(wlyyInspectionDao.findByPrescriptionId(vo.getId(), 1), inspectionVOs, WlyyInspectionVO.class));
                    //支付信息
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(vo.getId());
                    if (null!=businessOrderDO){
                        businessOrders.add(businessOrderDO);
                    }
                }
            }
            map.put("prescriptions",prescriptionVOs);
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setDetailModelList(resultList);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setTotalCount(count.intValue());
        return  mixEnvelop;
    }
    //作废处方
    public String disablePrescription(String prescriptionId) throws  Exception{
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
        if (null!=prescriptionDO){
            String hisId = prescriptionDO.getHisId();
            if("xm_xzzx_wx".equalsIgnoreCase(wechatId)){
                List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
                if (null!=wlyyPrescriptionDiagnosisDOs&&wlyyPrescriptionDiagnosisDOs.size()>0){
                    xzzxEntranceService.deleteCheckInputInfo(hisId,"0",prescriptionDO.getDoctor(),prescriptionDO.getPatientCode(),wlyyPrescriptionDiagnosisDOs);
                }
            }
            prescriptionDO.setStatus(-1);
            prescriptionDO.setCheckStatus(5);
            prescriptionDO.setCheckReason("作废处方");
            prescriptionDao.save(prescriptionDO);
            return "作废成功";
        }else {
            return "作废失败";
        }
    }
}

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

@ -1726,9 +1726,14 @@ public class XzzxEntranceService{
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        wlyyHttpLogDO.setRequest(msgBody);
        wlyyHttpLogDO.setName("保存电子病历");
        wlyyHttpLogDO.setCreateTime(new Date());
        logger.info("returnEmrHtmlByHLW params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
        logger.info("returnEmrHtmlByHLW json:"+xml);
        wlyyHttpLogDO.setResponse(xml);
        return xml;
    }
@ -1772,6 +1777,49 @@ public class XzzxEntranceService{
        logger.info("SelectEmrInfo json:"+json);
        return json;
    }
    /**
     *
     *  获取历史病历
     *
     * @param patientId
     * @param eventNo
     * @return
     * @throws Exception
     */
    public String SelectEmrDispRecord(String templateId,String patientId,String eventNo)throws Exception{
        String api = "SelectEmrDispRecord";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>"+api+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+key+"</certificate> " +
                "</root>";
        String condition ="";
        if (!StringUtils.isEmpty(templateId)&&!"null".equalsIgnoreCase(templateId)){
            condition += "<template_id>"+templateId+"</template_id>";
        }
        if (!StringUtils.isEmpty(patientId)&&!"null".equalsIgnoreCase(templateId)){
            condition += "<patientId>"+patientId+"</patientId>";
        }
        if (StringUtils.isNotBlank(eventNo)&&!"null".equalsIgnoreCase(eventNo)){
            condition += "<eventNo>"+eventNo+"</eventNo>";
        }
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
        Map<String,String> params = new HashedMap();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        logger.info("SelectEmrDispRecord params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getOperateUrl());
       /* XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();*/
        logger.info("SelectEmrDispRecord json:"+xml);
        return xml;
    }
//=====================微信模板消息推送===================================
    public String sendMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String redirectUrl){
@ -3119,7 +3167,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
     * @return
     * @throws Exception
     */
    public JSONObject saveEmrToEntrance(String prescriptionId) throws Exception {
    public String  saveEmrToEntrance(String prescriptionId) throws Exception {
        Map<String,String> params = new HashedMap();
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        JSONObject paramRequest = new JSONObject();
@ -3146,8 +3194,7 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
                paramRequest.put("patientAge",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
                paramRequest.put("patientsex",IdCardUtil.getSexForIdcard(basePatientDO.getIdcard()));
                paramRequest.put("patientName",basePatientDO.getName());
                paramRequest.put("patientClan","0");
            }
                paramRequest.put("patientClan","0"); }
            if (null!=wlyyOutpatientDO){
                paramRequest.put("deptCode",wlyyOutpatientDO.getDept());
                paramRequest.put("outpatientCode","R"+wlyyOutpatientDO.getRegisterNo());
@ -3164,14 +3211,22 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
        JSONObject jsonObject = new JSONObject();
        String response = "";
        String url = entranceUrl+"returnEmrHtmlByHLW";
        logger.info("params"+params.toString());
        response = httpClientUtil.httpPost(url,params);
        JSONObject object = new JSONObject();
        logger.info("保存电子病历"+response);
        JSONObject object = JSONObject.parseObject(response);
        if(object.getInteger("status")==200){
            jsonObject = object.getJSONObject("obj");
        if (response.contains("error:插入失败")){
            logger.info("保存失败:"+response);
            return "faild";
        }else {
            object = JSONObject.parseObject(response);
            if(object.getInteger("status")==200){
                jsonObject = object.getJSONObject("obj");
                logger.info("保存成功:"+jsonObject);
            }
            return "success";
        }
        return jsonObject;
    }
    /**
     * 获取历史病历
@ -3205,6 +3260,25 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
        }
        return wlyyPrescriptionEmrDOList;
    }
    /**
     * 查询历次就诊门诊病历文书
     * @param templateId
     * @param patientId 病人id
     * @param eventNo 病人住院号
     * @return
     */
    public String selectHistoryEmrRecord(String templateId,String patientId,String eventNo) throws Exception {
        String response="";
        String url = entranceUrl+"selectEmrDispRecord?templateId="+templateId+"&patientId="+patientId+"&eventNo="+eventNo;
        response = httpClientUtil.get(url,"GBK");
        JSONObject object = JSONObject.parseObject(response);
        if(object.getInteger("status")==200){
            String obj = object.getString("obj");
            return obj;
        }else {
            return "获取失败";
        }
    }
//=====================hospital应用调用entrance应用============end=================

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

@ -266,7 +266,31 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     * 处方号
     */
    private String realOrder;
    /**
     * 金额
     */
    private Double fee;
    /**
     * 处方号
     */
    private String chargeType;
    @Column(name = "charge_type")
    public String getChargeType() {
        return chargeType;
    }
    public void setChargeType(String chargeType) {
        this.chargeType = chargeType;
    }
    @Column(name = "fee")
    public Double getFee() {
        return fee;
    }
    public void setFee(Double fee) {
        this.fee = fee;
    }
    @Column(name = "remind_count")
    public Integer getRemindCount() {

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

@ -483,8 +483,12 @@ public class BaseHospitalRequestMapping {
        public static final String saveEmrToEntrance="/saveEmrToEntrance";
        //处方管理
        public static final String prescriptionManage="/prescriptionManage";
        public static final String findEmrByPrescriptionId="/findEmrByPrescriptionId";
        //作废处方
        public static final String disablePrescription="/disablePrescription";
        /*
        关注医生信息

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

@ -228,8 +228,26 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    @ApiModelProperty(value = "代接诊人手机号", example = "代接诊人手机号")
    private String consumerMobile;
    @ApiModelProperty(value = "费用", example = "费用")
    private Double fee;
    @ApiModelProperty(value = "号别", example = "号别")
    private String chargeType;
    public Double getFee() {
        return fee;
    }
    public void setFee(Double fee) {
        this.fee = fee;
    }
    public String getChargeType() {
        return chargeType;
    }
    public void setChargeType(String chargeType) {
        this.chargeType = chargeType;
    }
    public String getAdmNo() {
        return admNo;

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

@ -620,6 +620,22 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
                                      @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.SelectEmrInfo(patientId,eventNo));
    }
    /**
     * 查询历次就诊门诊病历文书
     * @param patientId 病人id(必填)
     * @param eventNo 住院号
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/selectEmrDispRecord")
    @ApiOperation(value = "查询历次就诊门诊病历文书", notes = "查询历次就诊门诊病历文书")
    public ObjEnvelop SelectEmrDispRecord (@ApiParam(name = "templateId", value = "模板id", required = false)
                                               @RequestParam(value = "templateId",required = false)String templateId,
                                        @ApiParam(name = "patientId", value = "病人id", required = false)
                                      @RequestParam(value = "patientId",required = false)String patientId,
                                      @ApiParam(name = "eventNo", value = "住院号", required = false)
                                      @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.SelectEmrDispRecord(templateId,patientId,eventNo));
    }
}

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

@ -157,5 +157,22 @@ public class XzyyController extends EnvelopRestEndpoint {
                                      @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectHistoryEmr(patientId,eventNo));
    }
    /**
     * 查询历史就诊病历
     * @param patientId 病人id(必填)
     * @param eventNo 病人住院号
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/findHistoryEmrRecord")
    @ApiOperation(value = "查询历史就诊病历", notes = "查询历史就诊病历")
    public ObjEnvelop findHistoryEmrRecord(@ApiParam(name = "templateId", value = "模板id", required = false)
                                               @RequestParam(value = "templateId",required = false)String templateId,
                                        @ApiParam(name = "patientId", value = "病人id", required = false)
                                     @RequestParam(value = "patientId",required = false)String patientId,
                                     @ApiParam(name = "eventNo", value = "病人住院号", required = false)
                                     @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectHistoryEmrRecord(templateId,patientId,eventNo));
    }
}

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

@ -2221,4 +2221,32 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        objEnvelop.setObj(xzzxEntranceService.saveEmrToEntrance(prescriptionId));
        return objEnvelop;
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.prescriptionManage)
    @ApiOperation(value = "处方管理")
    public MixEnvelop prescriptionManage(
            @ApiParam(name = "keyWord", value = "患者姓名或证件号或就诊卡")
            @RequestParam(value = "keyWord",defaultValue = "",required = false) String keyWord,
            @ApiParam(name = "doctorId", value = "医生id")
            @RequestParam(value = "doctorId",defaultValue = "",required = false) String doctorId,
            @ApiParam(name = "startTime", value = "开始时间")
            @RequestParam(value = "startTime",defaultValue = "",required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间")
            @RequestParam(value = "endTime",defaultValue = "",required = false) String endTime,
            @ApiParam(name = "checkStatus", value = "处方状态")
            @RequestParam(value = "checkStatus",defaultValue = "",required = false) String checkStatus,
            @ApiParam(name = "page", value = "页数")
            @RequestParam(value = "page",defaultValue = "",required = false) Integer page,
            @ApiParam(name = "pageSize",value = "页大小")
            @RequestParam(value = "pageSize",defaultValue = "",required = false) Integer pageSize) throws Exception {
        return prescriptionService.prescriptionManage(keyWord,doctorId,startTime,endTime,checkStatus,page,pageSize);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.disablePrescription)
    @ApiOperation(value = "作废处方")
    public Envelop disablePrescription(
            @ApiParam(name = "prescriptionId", value = "prescriptionId")
            @RequestParam(value = "prescriptionId",defaultValue = "",required = true) String prescriptionId) throws Exception {
        return success(prescriptionService.disablePrescription(prescriptionId));
    }
}