package com.ynxbd.common.action.xk; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ynxbd.common.action.base.BaseAction; import com.ynxbd.common.dao.his.HisXKDao; import com.ynxbd.common.result.JsonResult; import com.ynxbd.common.result.Result; import com.ynxbd.common.result.ResultEnum; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; import java.util.List; @Slf4j @Namespace("/xk") public class XKAction extends BaseAction { @Action("getRxDict") public Result getRxDict(String callNo, String type) { if (!"xbd2026".equals(callNo)) { return Result.error(ResultEnum.PARAM_IS_INVALID); } log.info("[开方]字典查询 type={}", type); if (type == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } List dataList = new HisXKDao().queryHisRxDict(type); return Result.success(dataList); } @Action("createHisRx") public Result createHisRx() { JSONObject body = getBody(); if (body == null) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } String doctCode = body.getString("doctCode"); String treatNum = body.getString("treatNum"); String rxType = body.getString("rxType"); String diagnose = body.getString("diagnose"); String weight = body.getString("weight"); String note = body.getString("note"); String ybAttrib = body.getString("ybAttrib"); String bzCode = body.getString("bzCode"); String bzName = body.getString("bzName"); JSONArray rxJsonArr = body.getJSONArray("rxJsonArr"); log.info("[开方]doctCode={}, treatNum={}, rxType={}", doctCode, treatNum, rxType); if (ObjectUtils.isEmpty(doctCode) || ObjectUtils.isEmpty(treatNum) || ObjectUtils.isEmpty(rxType)) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } System.out.println(rxJsonArr); if (rxJsonArr.isEmpty()) { return Result.error(ResultEnum.PARAM_IS_DEFECT); } JsonResult resp = new HisXKDao().createHisRx(doctCode, treatNum, rxType, diagnose, weight, note, ybAttrib, bzCode, bzName, rxJsonArr); if (!resp.success()) { return Result.error(resp.getMessage()); } return Result.success(); } }