Explorar o código

检查检验修改

wangjun %!s(int64=4) %!d(string=hai) anos
pai
achega
264d196e96

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

@ -1,26 +1,32 @@
package com.yihu.jw.hospital.prescription.service;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionPartsDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.InspectionPartsDictDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.WlyyInspectionDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/9/26.
 */
@Service
@Transactional
public class InspectionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
public class InspectionService extends BaseJpaService<WlyyInspectionDO, WlyyInspectionDao> {
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -30,6 +36,8 @@ public class InspectionService extends BaseJpaService<WlyyPrescriptionDO, Prescr
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private HibenateUtils hibenateUtils;
    public List<WlyyInspectionPartsDictDO> findByPartsCode(String parentCode) {
        return inspectionPartsDictDao.findByParentCode(parentCode);
@ -38,5 +46,38 @@ public class InspectionService extends BaseJpaService<WlyyPrescriptionDO, Prescr
    public List<WlyyHospitalSysDictDO> findDictByName(String hospital, String name) {
        return hospitalSysDictDao.findByHospitalAndDictNameOrderBySortAsc(hospital, name);
    }
    public MixEnvelop findInspectionByPatient(String patient,Integer page ,Integer pageSize){
        String sql = " select t.id as \"id\"," +
                " b.patient_name as \"patientName\"," +
                " b.consumer as \"consumer\"," +
                " b.consumer_name as \"consumerName\"," +
                " b.idcard as \"idcard\"," +
                " b.mobile as \"mobile\"," +
                " t.create_time as \"createTime\"," +
                " t.charge_amount as \"chargeAmount\"," +
                " t.quantity as \"quantity\"," +
                " t.code as \"code\"," +
                " t.name as \"name\"," +
                " t.dept as \"dept\"," +
                " t.dept_name as \"deptName\"," +
                " t.org_code as \"orgCode\"," +
                " t.org_name as \"orgName\"" +
                " from wlyy_inspection t " +
                " left join wlyy_outpatient b on t.outpatient_id = b.id" +
                " where t.del = 1 ";
        if (StringUtils.isNoneBlank(patient)){
            sql+= " and t.consumer '"+patient+"'";
        }else {
            sql+=" and t.consumer is null";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        List<Map<String,Object>> listCount = hibenateUtils.createSQLQuery(sql);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(listCount==null?0:listCount.size());
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        return mixEnvelop;
    }
}

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

@ -8539,22 +8539,26 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyPrescriptionDO.setId(prescriptionId);
            wlyyPrescriptionDO.setCheckStatus(status);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(11);
            /*if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                wlyyPrescriptionDO.setStatus(10);
            }else{
                wlyyPrescriptionDO.setStatus(11);
            }*/
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                wlyyPrescriptionDO.setStatus(10);
                List<WlyyPrescriptionInfoDO> list = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(wlyyPrescriptionDO.getId(),1);
                if (list!=null&&list.size()>0){
                }else {
                    if(inspectionDOS!=null&&inspectionDOS.size()>0){
                        wlyyPrescriptionDO.setStatus(20);
                        wlyyPrescriptionDO.setStatus(9);
                        wlyyPrescriptionDO.setCheckReason("只开检查检验,不开药品无需审方");
                        wlyyPrescriptionDO.setCheckStatus(2);
                    }
                }
            }else{*/
          /*  }*/
            }else{
                wlyyPrescriptionDO.setStatus(11);
            }
        }
        prescriptionDao.save(wlyyPrescriptionDO);
@ -9321,24 +9325,53 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param size
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient) {
    public PageEnvelop findPatientAllPrescription(String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug) {
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO==null){
            return PageEnvelop.getError("找不到该患者",-1);
        }
        StringBuffer sql = new StringBuffer(" SELECT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer countSql = new StringBuffer("select COUNT(b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer countSql = new StringBuffer("select COUNT(DISTINCT b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        sql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        countSql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        if (StringUtils.isNoneBlank(isSelectDrug)){
            if("0".equalsIgnoreCase(isSelectDrug)){
                sql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
                countSql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
            }
            if ("1".equalsIgnoreCase(isSelectDrug)){
                sql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
                countSql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
            }
        }
        if (StringUtils.isNotEmpty(status)) {
            status = status.substring(1, status.length() - 1);
            sql.append(" where b.status IN(").append(status).append(")");
            countSql.append(" where b.status IN(").append(status).append(")");
            if (StringUtils.isNoneBlank(isSelectDrug)){
                if("0".equalsIgnoreCase(isSelectDrug)){
                    sql.append(" where b.status IN( 9,").append(status).append(")");
                    countSql.append(" where b.status IN( 9,").append(status).append(")");
                }else {
                    sql.append(" where b.status IN(").append(status).append(")");
                    countSql.append(" where b.status IN(").append(status).append(")");
                }
            }else{
                sql.append(" where b.status IN(").append(status).append(")");
                countSql.append(" where b.status IN(").append(status).append(")");
            }
        } else {
            sql.append("  where b.status IN(20,21,30,31,32,100,101)");
            countSql.append(" where b.status IN(20,21,30,31,32,100,101) ");
        }
        if (StringUtils.isNoneBlank(isSelectDrug)){
            if("0".equalsIgnoreCase(isSelectDrug)){
                sql.append(" and m.del =1 ");
                countSql.append(" and m.del =1 ");
            }
            if ("1".equalsIgnoreCase(isSelectDrug)){
                sql.append(" and m.del =1");
                countSql.append(" and m.del =1");
            }
        }
        if (StringUtils.isNotEmpty(keyName)) {
            sql.append(" and (" +

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

@ -109,7 +109,7 @@ public class YkyySMSService {
                    content = smsTemplateDO.getContent().replace("{{病人姓名}}",wlyyOutpatientDO.getPatientName()).replace("{{时间}}", DateUtil.dateToStrLong(wlyyPrescriptionDO.getCreateTime()))
                            .replace("{{性别}}",sex);
                    if (StringUtils.isNoneBlank(wlyyPrescriptionDO.getRealOrder())){
                        content.replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                        content = content.replace("{{处方编号}}",wlyyPrescriptionDO.getRealOrder());
                    }
                    if (wxPushLogDO==null&&"1".equalsIgnoreCase(sendMesControl)){
                        ykyySendSMS(mobile,smsTemplateDO.getHeader()+content);

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

@ -2094,13 +2094,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                  @RequestParam(value = "keyName", required = false)String keyName,
                                                  @ApiParam(name = "status[]", value = "状态")
                                                  @RequestParam(value = "status[]", required = false)String status,
                                                  @ApiParam(name = "isSelectDrug", value = "1查询处方药品1是0查询检查")
                                                      @RequestParam(value = "isSelectDrug", required = false)String isSelectDrug,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page",required = false,defaultValue = "1") Integer page,
                                                  @ApiParam(name = "size", value = "页面大小")
                                                  @RequestParam(value = "size",required = false,defaultValue = "10") Integer size)throws Exception {
        try {
            String patient = getUID();
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size,patient);
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size,patient,isSelectDrug);
        } catch (Exception e) {
            return PageEnvelop.getError(e.getMessage(),-1);
        }