瀏覽代碼

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

wangzhinan 4 年之前
父節點
當前提交
dfb0743bed

+ 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 (" +

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

@ -770,7 +770,7 @@ public class YkyyEntranceService {
                "\td.GUID as \"guid\",\n" +
                "\td.JZKH as \"jzkh\"\n" +
                "FROM\n" +
                "\tV_MS_DD01 d\n" +
                "\tV_MS_CF01 d\n" +
                "WHERE\n" +
                "\td.JZXH = '"+admNo+"'";
@ -846,7 +846,7 @@ public class YkyyEntranceService {
                        "\td.YYTS as \"yyts\",\n" +
                        "\td.YFGG as \"yfgg\"\n" +
                        "FROM\n" +
                        "\tV_MS_DD02 d  \n" +
                        "\tV_MS_CF02 d  \n" +
                        "WHERE\n" +
                        "\td.cfsb = '"+wlyyPrescriptionVO.getRealOrder()+"'";

+ 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);

+ 7 - 2
common/common-util/src/main/java/com/yihu/jw/util/common/FileUtil.java

@ -11,6 +11,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Logger;
/**
 * 文件处理工具类
@ -80,16 +81,20 @@ public class FileUtil {
	 * @throws Exception
	 */
	public String copyTempImage(String files,String tempPath) throws Exception {
		System.out.println("files====="+files);
		System.out.println("tempPath====="+tempPath);
		// 文件保存的临时路径
		String[] fileArray = files.split(",");
		String fileUrls = "";
		for (String file : fileArray) {
			File f = new File(tempPath + file);
			File fs = new File(tempPath + file + "_small");
			System.out.println("file+++"+file);
			File f = new File(tempPath + "/"+file);
			File fs = new File(tempPath +"/"+ file + "_small");
			if (f.exists()) {
				String fileName = f.getName();
				InputStream in = new FileInputStream(f);
				ObjectNode result = fastDFSHelper.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
				System.out.println(result.toString());
				in.close();
				if (result != null) {
					//1.3.7去掉前缀

+ 5 - 5
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -340,7 +340,7 @@ public class PrescriptionStatusUpdateService {
                }
            }
            outpatientDao.save(outpatientDOs);
            //退费
            /*//退费
            for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                long currentTime = new Date().getTime();
                Date temp = new Date();
@ -356,17 +356,17 @@ public class PrescriptionStatusUpdateService {
                        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                        if (businessOrderDO!=null){
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                                //businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
    /*
    *//*
                        businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
    */
    *//*
                            }
                        } } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
            }*/
            logger.info("setOutPatientOver count :"+outpatientDOs.size());
        }else {
            logger.info("setOutPatientOver count :"+0);

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

@ -205,6 +205,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private FileUtil fileUtil;
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Value("${FileTempPath.upload_temp_path}")
    private String upload_temp_path;
    @Autowired
    private ConsultTeamDao consultTeamDao;
@ -1670,12 +1672,14 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                        imgeUrl = fileUploadService.uploadWxImage(imagepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
                    }else{
                        imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
                        imgeUrl = fileUtil.copyTempImage(imagepath,upload_temp_path);
                    }
                    logger.info("imgeUrl"+imgeUrl);
                    object.put("path",imgeUrl);
                }
            }else{}
        }
        logger.info("object"+object.toString());
        return success(object);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.testJpush)

+ 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);
        }