微信后端代码
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.

105 lines
4.6 KiB

package com.ynxbd.common.action.xk;
import com.alibaba.fastjson.JSONObject;
import com.ynxbd.common.action.base.BaseAction;
import com.ynxbd.common.bean.his.HisTreat;
import com.ynxbd.common.bean.xk.HisRxItem;
import com.ynxbd.common.config.interceptor.AesDecode;
import com.ynxbd.common.dao.his.HisTreatDao;
import com.ynxbd.common.dao.his.HisXKDao;
import com.ynxbd.common.helper.common.JsonHelper;
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");
String rxJson = body.getString("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);
}
List<HisRxItem> hisRxItems = JsonHelper.parseArray(rxJson, HisRxItem.class);
if (hisRxItems.isEmpty()) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
JsonResult resp = new HisXKDao().createHisRx(doctCode, treatNum, rxType, diagnose, weight, note, ybAttrib, bzCode, bzName, hisRxItems);
if (!resp.success()) {
return Result.error(resp.getMessage());
}
return Result.success();
}
@Action("updateHisTreat")
public Result updateHisTreat(@AesDecode String openId, @AesDecode String treatNum, String symptom, String subjComplaint, String disDescription, String treatMeas,
String tcmDdCode, String tcmDdName, String tcmSdCode, String tcmSdName, String mdDisCode, String mdDisName,
String pastHistory, String presentHistory, String alleHist, String disCode1, String disName1, String disCode2, String disName2) {
try {
log.info("[HIS更新就诊记录] treatNum={}, symptom={}, subjComplaint={}, disDescription={}, treatMeas={}, tcmDdCode={}, tcmDdName={}, tcmSdCode={}, tcmSdName={}, mdDisCode={}, mdDisName={}",
treatNum, symptom, subjComplaint, disDescription, treatMeas, tcmDdCode, tcmDdName, tcmSdCode, tcmSdName, mdDisCode, mdDisName);
if (ObjectUtils.isEmpty(openId) || ObjectUtils.isEmpty(treatNum)) {
return Result.error(ResultEnum.PARAM_IS_INVALID);
}
if (ObjectUtils.isEmpty(symptom) || ObjectUtils.isEmpty(subjComplaint) || ObjectUtils.isEmpty(disDescription) || ObjectUtils.isEmpty(treatMeas)
|| ObjectUtils.isEmpty(tcmDdCode) || ObjectUtils.isEmpty(tcmDdName) || ObjectUtils.isEmpty(tcmSdCode) || ObjectUtils.isEmpty(tcmSdName)
|| ObjectUtils.isEmpty(mdDisCode) || ObjectUtils.isEmpty(mdDisName)
) {
return Result.error(ResultEnum.PARAM_IS_DEFECT);
}
HisTreat data = new HisTreatDao().updateHisTreat(treatNum, symptom, subjComplaint, disDescription, treatMeas, tcmDdCode, tcmDdName, tcmSdCode, tcmSdName, mdDisCode, mdDisName, pastHistory, presentHistory, alleHist, disCode1, disName1, disCode2, disName2);
if (data == null) {
return Result.error();
}
return Result.success(data);
} catch (Exception e) {
return Result.error(e);
}
}
}