浏览代码

处方查询新增心脏查询电子病历接口

wangjun 4 年之前
父节点
当前提交
faab2aa1d4

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

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

@ -445,7 +445,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.disease_img AS \"diseaseImg\"," +
                " o.disease_img AS \"diseaseImg\"," +
                " o.consumer as \"consumer\"," +
                " o.consumer as \"consumer\"," +
                " o.consumer_name as \"consumerName\"," +
                " 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 ("xm_ykyy_wx".equals(wechatId)) {
            if (flag){
            if (flag){
                sql = sql + "date_format(o.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime,";
                sql = sql + "date_format(o.create_time ,'%Y-%m-%d %H:%i:%S' ) AS createTime,";
@ -507,6 +508,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
        rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
        rs.put("operator",outpatientDO.getOperator());
        rs.put("operator",outpatientDO.getOperator());
        rs.put("status",outpatientDO.getStatus());
        rs.put("status",outpatientDO.getStatus());
        rs.put("fee",outpatientDO.getFee());
        rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
        rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
        //居民详情
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
@ -1501,6 +1503,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String id = (String) doctor.get("id");
                String id = (String) doctor.get("id");
                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode);
                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode);
                doctor.put("workTime", times);
                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)) {
            if (StringUtils.isNotBlank(doctorCode)) {
                //排序
                //排序
@ -3374,8 +3399,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("sex",doctorDO.getSex());
            rs.put("sex",doctorDO.getSex());
            rs.put("popularity",doctorDO.getPopularity());
            rs.put("popularity",doctorDO.getPopularity());
            rs.put("qrcode",doctorDO.getQrcode());
            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> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
            if (hospitalDOs != null && hospitalDOs.size() > 0) {
            if (hospitalDOs != null && hospitalDOs.size() > 0) {
@ -3609,7 +3656,30 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("learning",doctorDO.getLearning());
            rs.put("learning",doctorDO.getLearning());
            rs.put("sex",doctorDO.getSex());
            rs.put("sex",doctorDO.getSex());
            rs.put("qrcode",doctorDO.getQrcode());
            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> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
            List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
            List<BaseDoctorHospitalDO> hospitalDOList = new ArrayList<>();
@ -4873,12 +4943,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
      /*  if(page >=1){
      /*  if(page >=1){
            page --;
            page --;
        }
        if (pagesize <= 0) {
        if (pagesize <= 0) {
            pagesize = 10;
            pagesize = 10;
        }*/
        }*/
      wechatId = "12";
        String sql = "SELECT " +
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.photo AS \"photo\", " +
@ -5038,6 +5107,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());*/
        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){
        for (Map<String,Object> map:list){
            String doctor = map.get("id").toString();
            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 " +
            String sqlscore = "SELECT " +
                    "AVG(a.score) AS \"score\"," +
                    "AVG(a.score) AS \"score\"," +
@ -5583,7 +5676,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
     */
    public List<Map<String, Object>> getVideoPrescriptionByDoctor(String doctor, String general_doctor, String wxId) {
    public List<Map<String, Object>> getVideoPrescriptionByDoctor(String doctor, String general_doctor, String wxId) {
        String condition = "";
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
        /*if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
            if (flag){
                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
                condition += "date_format(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
            }else {
            }else {
@ -5592,7 +5685,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
        } 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\",";
        }
        }*/
        String sql = "SELECT " +
        String sql = "SELECT " +
                "room.outpatient_id AS \"id\"," +
                "room.outpatient_id AS \"id\"," +
                "room.patient_id AS \"patient_id\"," +
                "room.patient_id AS \"patient_id\"," +
@ -5602,7 +5695,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "patient.photo AS \"photo\"," +
                "patient.photo AS \"photo\"," +
                "patient.birthday AS \"birthday\"," +
                "patient.birthday AS \"birthday\"," +
                "patient.mobile AS \"mobile\"," +
                "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\"," +
                "room.reservation_type AS \"reservation_type\"," +
                "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.disease_img AS \"disease_img\"," +
                "outpatient.description AS \"description\"," +
                "outpatient.description AS \"description\"," +
@ -5636,7 +5729,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                String idcard = (String) outpatient.get("idcard");
                String idcard = (String) outpatient.get("idcard");
                String patient_id = (String) outpatient.get("patient_id");
                String patient_id = (String) outpatient.get("patient_id");
                outpatient.put("age", DateUtil.getAgeForIdcard(idcard));
                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 outpatient_id = (String) outpatient.get("id");
                String isAlert = redisTemplate.opsForValue().get("patient_alert_" + patient_id);
                String isAlert = redisTemplate.opsForValue().get("patient_alert_" + patient_id);
@ -5725,7 +5819,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String condition = "";
        String condition = "";
        if ("xm_ykyy_wx".equals(wxId)) {
        if ("xm_ykyy_wx".equals(wxId)) {
            if(flag){
            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\",";
                condition += "date_format(room.reservation_time,'YYYY-MM-DD')  AS \"group_date\",";
            }else{
            }else{
                condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
                condition += "to_char(room.reservation_time,'YYYY-MM-DD hh24:mi:ss')  AS \"time\",";
@ -5733,7 +5827,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
            }
        } else {
        } 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\",";
            condition += "date_format(room.reservation_time ,'%Y-%m-%d' ) AS \"group_date\",";
        }
        }
        String sql = "SELECT " +
        String sql = "SELECT " +
@ -8737,12 +8831,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
       return envelop;
       return envelop;
    }
    }
    //应声开具处方管理
    //应声开具处方管理
    public MixEnvelop prescriptionManage(String keyWord,String startTime,String endTime,String checkStatus,Integer page,Integer pageSize){
    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\"," +
        String sql = " select p.create_time as \"createTime\"," +
                " p.patient_name as \"patientName\"," +
                " p.patient_name as \"patientName\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " o.card_no as \"cardNo\"," +
                " o.card_no as \"cardNo\"," +
                " p.check_status as \"checkStatus\"," +
                " p.check_status as \"checkStatus\"," +
                " p.id as \"id\"," +
                " p.check_reason as \"checkReason\" " +
                " p.check_reason as \"checkReason\" " +
                " from wlyy_prescription p left join wlyy_outpatient o on p.outpatient_id  = o.id" +
                " from wlyy_prescription p left join wlyy_outpatient o on p.outpatient_id  = o.id" +
                " where  1=1";
                " where  1=1";
@ -8753,6 +8848,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(StringUtils.isNotBlank(checkStatus)){
        if(StringUtils.isNotBlank(checkStatus)){
            sql+=" and p.check_status ="+checkStatus;
            sql+=" and p.check_status ="+checkStatus;
        }
        }
        if(StringUtils.isNotBlank(doctorId)){
            sql+=" and p.doctor = '"+doctorId+"'";
        }
        if(StringUtils.isNotBlank(startTime)){
        if(StringUtils.isNotBlank(startTime)){
            if("xm_ykyy_wx".equals(wechatId)){
            if("xm_ykyy_wx".equals(wechatId)){
                if (flag){
                if (flag){
@ -8787,6 +8885,43 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        for (Map<String,Object> map:resultList){
        for (Map<String,Object> map:resultList){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            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())));
            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<>();
            BusinessOrderDO businessOrder = new BusinessOrderDO();
            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 mixEnvelop = new MixEnvelop();
        mixEnvelop.setDetailModelList(resultList);
        mixEnvelop.setDetailModelList(resultList);
@ -8795,4 +8930,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        mixEnvelop.setTotalCount(count.intValue());
        mixEnvelop.setTotalCount(count.intValue());
        return  mixEnvelop;
        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 "作废失败";
        }
    }
}
}

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

@ -1777,6 +1777,49 @@ public class XzzxEntranceService{
        logger.info("SelectEmrInfo json:"+json);
        logger.info("SelectEmrInfo json:"+json);
        return 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){
    public String sendMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String redirectUrl){
@ -3217,6 +3260,25 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
        }
        }
        return wlyyPrescriptionEmrDOList;
        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=================
//=====================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 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")
    @Column(name = "remind_count")
    public Integer getRemindCount() {
    public Integer getRemindCount() {

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

@ -487,6 +487,8 @@ public class BaseHospitalRequestMapping {
        public static final String prescriptionManage="/prescriptionManage";
        public static final String prescriptionManage="/prescriptionManage";
        public static final String findEmrByPrescriptionId="/findEmrByPrescriptionId";
        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 = "代接诊人手机号")
    @ApiModelProperty(value = "代接诊人手机号", example = "代接诊人手机号")
    private String consumerMobile;
    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() {
    public String getAdmNo() {
        return admNo;
        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{
                                      @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.SelectEmrInfo(patientId,eventNo));
        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{
                                      @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectHistoryEmr(patientId,eventNo));
        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));
    }
}
}

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

@ -2224,6 +2224,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public MixEnvelop prescriptionManage(
    public MixEnvelop prescriptionManage(
            @ApiParam(name = "keyWord", value = "患者姓名或证件号或就诊卡")
            @ApiParam(name = "keyWord", value = "患者姓名或证件号或就诊卡")
            @RequestParam(value = "keyWord",defaultValue = "",required = false) String keyWord,
            @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 = "开始时间")
            @ApiParam(name = "startTime", value = "开始时间")
            @RequestParam(value = "startTime",defaultValue = "",required = false) String startTime,
            @RequestParam(value = "startTime",defaultValue = "",required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间")
            @ApiParam(name = "endTime", value = "结束时间")
@ -2235,6 +2237,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "pageSize",value = "页大小")
            @ApiParam(name = "pageSize",value = "页大小")
            @RequestParam(value = "pageSize",defaultValue = "",required = false) Integer pageSize) throws Exception {
            @RequestParam(value = "pageSize",defaultValue = "",required = false) Integer pageSize) throws Exception {
        return prescriptionService.prescriptionManage(keyWord,startTime,endTime,checkStatus,page,pageSize);
        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));
    }
    }
}
}