You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					
					
						
							204 lines
						
					
					
						
							7.9 KiB
						
					
					
				
			
		
		
	
	
							204 lines
						
					
					
						
							7.9 KiB
						
					
					
				package com.ynxbd.common.action;
 | 
						|
 | 
						|
import com.ynxbd.common.action.base.BaseAction;
 | 
						|
import com.ynxbd.common.bean.HisRecipe;
 | 
						|
import com.ynxbd.common.bean.NatRecord;
 | 
						|
import com.ynxbd.common.bean.Patient;
 | 
						|
import com.ynxbd.common.dao.NatRecordDao;
 | 
						|
import com.ynxbd.common.dao.PatientDao;
 | 
						|
import com.ynxbd.common.dao.his.HisRecipeDao;
 | 
						|
import com.ynxbd.common.helper.common.DateHelper;
 | 
						|
import com.ynxbd.common.result.Result;
 | 
						|
import com.ynxbd.common.result.ResultEnum;
 | 
						|
import com.ynxbd.common.service.RecipeService;
 | 
						|
import lombok.extern.slf4j.Slf4j;
 | 
						|
import org.apache.struts2.convention.annotation.Action;
 | 
						|
import org.apache.struts2.convention.annotation.Namespace;
 | 
						|
 | 
						|
import java.util.ArrayList;
 | 
						|
import java.util.List;
 | 
						|
 | 
						|
/**
 | 
						|
 * 处方
 | 
						|
 *
 | 
						|
 * @Author wsq
 | 
						|
 * @Date 2020/11/6 9:45
 | 
						|
 * @Copyright @ 2020 云南新八达科技有限公司 All rights reserved.
 | 
						|
 */
 | 
						|
@Slf4j
 | 
						|
@Namespace("/recipe")
 | 
						|
public class RecipeAction extends BaseAction {
 | 
						|
 | 
						|
    /**
 | 
						|
     * 获取已缴费项目
 | 
						|
     */
 | 
						|
    @Action("getPayedList")
 | 
						|
    public Result getPayedList(String patientId, String begDate, String endDate) {
 | 
						|
        log.info("[处方]已缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate);
 | 
						|
        if (patientId == null || begDate == null || endDate == null) {
 | 
						|
            return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | 
						|
        }
 | 
						|
 | 
						|
        List<HisRecipe> recipeList = new HisRecipeDao().getPaidRecipeList(patientId, begDate, endDate);
 | 
						|
        return Result.success(recipeList);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * 获取未缴费项目
 | 
						|
     */
 | 
						|
    @Action("getUnPayList")
 | 
						|
    public Result getUnPayList(String patientId,  String begDate, String endDate ) {
 | 
						|
        log.info("[处方]未缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate);
 | 
						|
        if (patientId == null || begDate == null || endDate == null) {
 | 
						|
            return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | 
						|
        }
 | 
						|
 | 
						|
        int days = DateHelper.intervalDays(begDate, endDate, true);
 | 
						|
        List<HisRecipe> hisRecipes = new HisRecipeDao().getUnPayRecipe(patientId, days);
 | 
						|
 | 
						|
        List<HisRecipe> resultList = new ArrayList<>();
 | 
						|
        for (HisRecipe hisRecipe : hisRecipes) {
 | 
						|
            if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) {
 | 
						|
                resultList.add(hisRecipe);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        return Result.success(resultList);
 | 
						|
    }
 | 
						|
 | 
						|
//    /**
 | 
						|
//     * 获取未缴费项目
 | 
						|
//     */
 | 
						|
//    @Action("getDevUnPayList")
 | 
						|
//    public Result getDevUnPayList(String patientId,  String begDate, String endDate ) {
 | 
						|
//        log.info("[处方]未缴费项目查询 patientId={}, begDate={}, endDate={}", patientId, begDate, endDate);
 | 
						|
//        if (patientId == null || begDate == null || endDate == null) {
 | 
						|
//            return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | 
						|
//        }
 | 
						|
//
 | 
						|
//        int days = DateHelper.intervalDays(begDate, endDate, true);
 | 
						|
//        List<HisRecipe> hisRecipes = new DevHisRecipeDao().getDevUnPayRecipe(patientId, days);
 | 
						|
//
 | 
						|
//        List<HisRecipe> resultList = new ArrayList<>();
 | 
						|
//        for (HisRecipe hisRecipe : hisRecipes) {
 | 
						|
//            if (hisRecipe.getDate() != null && DateHelper.inDateRange(begDate, endDate, hisRecipe.getDate(), DateHelper.DateEnum.yyyy_MM_dd)) {
 | 
						|
//                resultList.add(hisRecipe);
 | 
						|
//            }
 | 
						|
//        }
 | 
						|
//        return Result.success(resultList);
 | 
						|
//    }
 | 
						|
 | 
						|
 | 
						|
    /**
 | 
						|
     * 标准物价查询
 | 
						|
     *
 | 
						|
     * @param pageNum   页码
 | 
						|
     * @param pageSize  每页数量
 | 
						|
     * @param pyCode    拼音码
 | 
						|
     * @param type      类型 {1:检查治疗; 2:药品材料; 99:全部}
 | 
						|
     * @param groupFlag 组套标识 { 0:不含组套; 1:包含组套 }
 | 
						|
     * @return 结果
 | 
						|
     */
 | 
						|
    @Action("getStandardPrice")
 | 
						|
    public Result getStandardPrice(Integer pageNum, Integer pageSize, String pyCode, String type, String groupFlag) {
 | 
						|
        return new RecipeService().getStandardPrice(pageNum, pageSize, pyCode, type, groupFlag);
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
    /**
 | 
						|
     * 添加核酸检测记录(德宏)
 | 
						|
     */
 | 
						|
    @Action("addNatRecord")
 | 
						|
    public Result addNatRecord() {
 | 
						|
        String openid = getString("openid");
 | 
						|
        String patientId = getString("patientId");
 | 
						|
        if (patientId == null || openid == null) {
 | 
						|
            return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | 
						|
        }
 | 
						|
 | 
						|
        Boolean isRepeat = getBoolean("isRepeat"); // 开启重复填写检查
 | 
						|
        if (isRepeat == null) isRepeat = false;
 | 
						|
 | 
						|
        NatRecordDao natRecordDao = new NatRecordDao();
 | 
						|
        if (isRepeat && natRecordDao.hasRecord(patientId, DateHelper.getCurDate())) {
 | 
						|
            return Result.success();
 | 
						|
        }
 | 
						|
 | 
						|
        String temperature = getString("temperature"); // 体温
 | 
						|
        String country = getString("country");         // 国籍
 | 
						|
        String greenCode = getString("greenCode");     // 绿码情况
 | 
						|
        String tripCode = getString("tripCode");       // 行程码情况
 | 
						|
        String symptom = getString("symptom");         // 症状
 | 
						|
        String info = getString("info");
 | 
						|
        log.info("[核酸检测]记录 country={}, temperature={}, greenCode={}, tripCode={}, symptom={}", country, temperature, greenCode, tripCode, symptom);
 | 
						|
        if (temperature == null || greenCode == null || tripCode == null) {
 | 
						|
            return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | 
						|
        }
 | 
						|
 | 
						|
        Patient patient = new PatientDao().selectByOpenidAndPatientId(openid, patientId);
 | 
						|
        if (patient == null) {
 | 
						|
            return Result.error(ResultEnum.PATIENT_NOT_FOUND);
 | 
						|
        }
 | 
						|
 | 
						|
        NatRecord natRecord = new NatRecord();
 | 
						|
        natRecord.setOperateUser("蓝旗");
 | 
						|
        natRecord.setPatientId(patientId);
 | 
						|
        natRecord.setIdCardNo(patient.getIdCardNo());
 | 
						|
        natRecord.setName(patient.getName());
 | 
						|
        natRecord.setTel(patient.getTel());
 | 
						|
        natRecord.setSex(patient.getSex());
 | 
						|
        //
 | 
						|
        natRecord.setCountry(country);
 | 
						|
        natRecord.setTemperature(temperature);
 | 
						|
        natRecord.setGreenCode(greenCode);
 | 
						|
        natRecord.setTripCode(tripCode);
 | 
						|
        natRecord.setSymptom(symptom);
 | 
						|
        //
 | 
						|
        natRecord.setInfo(info);
 | 
						|
        boolean isInsert = natRecordDao.insert(natRecord);
 | 
						|
        if (!isInsert) {
 | 
						|
            log.info("[核酸检测] 记录信息失败 patientId={}, openid={}", patientId, openid);
 | 
						|
            return Result.error();
 | 
						|
        }
 | 
						|
        return Result.success();
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
//    /**
 | 
						|
//     * 核酸检测支付
 | 
						|
//     */
 | 
						|
//    @Action("payNat")
 | 
						|
//    public Result payNat() {
 | 
						|
//        String patientId = getString("patientId");
 | 
						|
//        Boolean isDoubleCollect = getBoolean("isDoubleCollect"); // 是否双采
 | 
						|
//        if (StringUtils.isEmpty(patientId)) {
 | 
						|
//            return Result.error(ResultEnum.PARAM_IS_DEFECT);
 | 
						|
//        }
 | 
						|
//
 | 
						|
//        // 开申请单
 | 
						|
//        JsonResult JsonResult = new HisRecipeDao().payNat(patientId, isDoubleCollect);
 | 
						|
//        if (JsonResult.isTimeout()) { // 请求超时
 | 
						|
//            return Result.error(JsonResult.getMessage());
 | 
						|
//        }
 | 
						|
//
 | 
						|
//        String mzNum = JsonResult.getDataMapString("MZNum");
 | 
						|
//        String recipeId = JsonResult.getDataMapString("RecipeId");
 | 
						|
//        if (ObjectUtils.isEmpty(recipeId) || ObjectUtils.isEmpty(mzNum)) {
 | 
						|
//            return Result.error(JsonResult.getMessage());
 | 
						|
//        }
 | 
						|
//
 | 
						|
//        if (!JsonResult.success()) {
 | 
						|
//            return Result.error(ResultEnum.RECIPE_REPEAT_BILL, null, JsonResult.getMessage());
 | 
						|
//        }
 | 
						|
//
 | 
						|
//        try {
 | 
						|
//            Map<String, Object> resultData = new HashMap<>();
 | 
						|
//            resultData.put("recipeId", Long.toString(Long.parseLong(recipeId) + 1000000000L));
 | 
						|
//            resultData.put("treatNum", mzNum);
 | 
						|
//            return Result.success(resultData);
 | 
						|
//        } catch (Exception e) {
 | 
						|
//            ErrorHelper.println(e);
 | 
						|
//        }
 | 
						|
//        return Result.error();
 | 
						|
//    }
 | 
						|
 | 
						|
}
 | 
						|
 |