Commit d86fb068 authored by 谢希宇's avatar 谢希宇

create entity

parent 971eb382
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
处方单药品列表管理
<small>处方单药品列表</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">处方单药品列表</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:preDrugs:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/preDrugs/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/preDrugs/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/preDrugs/form')";
},
cancel: function () {
location.href = "#springUrl('/a/preDrugs/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/preDrugs/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/preDrugs/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
处方单列表管理
<small>处方单列表</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">处方单列表</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:prescription:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/prescription/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/prescription/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/prescription/form')";
},
cancel: function () {
location.href = "#springUrl('/a/prescription/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/prescription/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/prescription/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
package com.cftech.predrugs.dao;
import com.cftech.core.generic.GenericDao;
import com.cftech.predrugs.model.PreDrugs;
/**
* 处方单药品列表Mapper
*
* @author Strive
* @date: 2021-08-18 19:41
*/
public interface PreDrugsMapper extends GenericDao<PreDrugs> {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cftech.predrugs.dao.PreDrugsMapper">
<resultMap id="resultMap" type="com.cftech.predrugs.model.PreDrugs">
<id column="id" property="id"/>
<result column="drug_erp_no" property="drugErpNo"/>
<result column="otc" property="otc"/>
<result column="drug_unit" property="drugUnit"/>
<result column="dosage" property="dosage"/>
<result column="spec" property="spec"/>
<result column="appr_number" property="apprNumber"/>
<result column="drug_num" property="drugNum"/>
<result column="drug_compay" property="drugCompay"/>
<result column="name" property="name"/>
<result column="drug_id" property="drugId"/>
<result column="parent_id" property="parentId"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
id
,
drug_erp_no,
otc,
drug_unit,
dosage,
spec,
appr_number,
drug_num,
drug_compay,
name,
drug_id,
parent_id,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.predrugs.model.PreDrugs" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_pre_drugs
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{drugErpNo, jdbcType=VARCHAR},
#{otc, jdbcType=VARCHAR},
#{drugUnit, jdbcType=VARCHAR},
#{dosage, jdbcType=VARCHAR},
#{spec, jdbcType=VARCHAR},
#{apprNumber, jdbcType=VARCHAR},
#{drugNum, jdbcType=BIGINT},
#{drugCompay, jdbcType=VARCHAR},
#{name, jdbcType=VARCHAR},
#{drugId, jdbcType=VARCHAR},
#{parentId, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_pre_drugs t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_pre_drugs
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_pre_drugs
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.predrugs.model.PreDrugs">
update t_aidea_pre_drugs
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="drugErpNo != null">
drug_erp_no = #{drugErpNo, jdbcType=VARCHAR},
</if>
<if test="otc != null">
otc = #{otc, jdbcType=VARCHAR},
</if>
<if test="drugUnit != null">
drug_unit = #{drugUnit, jdbcType=VARCHAR},
</if>
<if test="dosage != null">
dosage = #{dosage, jdbcType=VARCHAR},
</if>
<if test="spec != null">
spec = #{spec, jdbcType=VARCHAR},
</if>
<if test="apprNumber != null">
appr_number = #{apprNumber, jdbcType=VARCHAR},
</if>
<if test="drugNum != null">
drug_num = #{drugNum, jdbcType=BIGINT},
</if>
<if test="drugCompay != null">
drug_compay = #{drugCompay, jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name, jdbcType=VARCHAR},
</if>
<if test="drugId != null">
drug_id = #{drugId, jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId, jdbcType=BIGINT},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_aidea_pre_drugs
set del_flag=1
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.predrugs.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 处方单药品列表
*
* @author Strive
* @date: 2021-08-18 19:41
*/
@Data
public class PreDrugs implements Serializable {
/* 主键id */
private Long id;
/* 药品的ERP编号 */
@ExportConfig(value = "药品的ERP编号", width = 100, showLevel = 1)
private String drugErpNo;
/* 是否是OTC(0:否,1:是) */
@ExportConfig(value = "是否是OTC(0:否,1:是)", width = 100, showLevel = 1)
private String otc;
/* 单位 */
@ExportConfig(value = "单位", width = 100, showLevel = 1)
private String drugUnit;
/* 用法用量 */
@ExportConfig(value = "用法用量", width = 100, showLevel = 1)
private String dosage;
/* 规格 */
@ExportConfig(value = "规格", width = 100, showLevel = 1)
private String spec;
/* 国药准字 */
@ExportConfig(value = "国药准字", width = 100, showLevel = 1)
private String apprNumber;
/* 数量 */
@ExportConfig(value = "数量", width = 100, showLevel = 1)
private Long drugNum;
/* 药品生产厂家 */
@ExportConfig(value = "药品生产厂家", width = 100, showLevel = 1)
private String drugCompay;
/* 药品名称 */
@ExportConfig(value = "药品名称", width = 100, showLevel = 1)
private String name;
/* 药品编号 */
@ExportConfig(value = "药品编号", width = 100, showLevel = 1)
private String drugId;
/* 所属处方单id */
@ExportConfig(value = "所属处方单id", width = 100, showLevel = 1)
private Long parentId;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public PreDrugs() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.predrugs.service;
import com.cftech.core.generic.GenericService;
import com.cftech.predrugs.model.PreDrugs;
/**
* 处方单药品列表Service
*
* @author Strive
* @date: 2021-08-18 19:41
*/
public interface PreDrugsService extends GenericService<PreDrugs> {
}
package com.cftech.predrugs.service.impl;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.predrugs.dao.PreDrugsMapper;
import com.cftech.predrugs.model.PreDrugs;
import com.cftech.predrugs.service.PreDrugsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 处方单药品列表ServiceImpl
*
* @author Strive
* @date: 2021-08-18 19:41
*/
@Service("preDrugsService")
public class PreDrugsServiceImpl extends GenericServiceImpl<PreDrugs> implements PreDrugsService {
@Autowired
@Qualifier("preDrugsMapper")
private PreDrugsMapper preDrugsMapper;
@Override
public GenericDao<PreDrugs> getGenericMapper() {
return preDrugsMapper;
}
}
\ No newline at end of file
package com.cftech.predrugs.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.predrugs.model.PreDrugs;
import com.cftech.predrugs.service.PreDrugsService;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 处方单药品列表Controller
* <p>
* 权限字符串说明:
* 查看:public static final String PREDRUGS_VIEW = "qy:preDrugs:view"
* 查看:public static final String PREDRUGS_EDIT = "qy:preDrugs:edit"
*
* @author Strive
* @date: 2021-08-18 19:41
*/
@Slf4j
@Controller
@RequestMapping("/a/preDrugs")
public class PreDrugsController {
public static final String PREDRUGS_VIEW = "qy:preDrugs:view";
public static final String PREDRUGS_EDIT = "qy:preDrugs:edit";
@Autowired
private PreDrugsService preDrugsService;
//列表页面
@RequiresPermissions(value = PREDRUGS_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "preDrugs/preDrugslist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = PREDRUGS_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
PreDrugs preDrugs = preDrugsService.fetchById(id);
model.addAttribute("data", preDrugs);
}
return "preDrugs/preDrugsform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = PREDRUGS_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(PreDrugs preDrugs, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (preDrugs != null && preDrugs.getId() != null) {
preDrugs.setUpdateBy(UserUtils.getUser().getId());
preDrugsService.update(preDrugs);
rtnJson.put("errorNo", 0);
} else {
preDrugs.setAccountsId(accountsId);
preDrugs.setDelFlag(false);
preDrugs.setAccountsId(UserUtils.getmpaccounts(request));
preDrugs.setCreateBy(UserUtils.getUser().getId());
preDrugs.setUpdateBy(UserUtils.getUser().getId());
preDrugsService.save(preDrugs);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = PREDRUGS_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, PreDrugs preDrugs, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId);
Sort sort = new Sort("create_time", OrderType.DESC);
List<PreDrugs> list = preDrugsService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = preDrugsService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = PREDRUGS_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
preDrugsService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = PREDRUGS_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
List<PreDrugs> list = preDrugsService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(PreDrugs.class, response).toExcel(list, "处方单药品列表信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = PREDRUGS_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(PreDrugs.class, response).toExcel(null, "处方单药品列表信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = PREDRUGS_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
PreDrugs preDrugs = new PreDrugs();
preDrugs.setAccountsId(accountId);
preDrugsService.save(preDrugs);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
package com.cftech.prescription.dao;
import com.cftech.prescription.model.Prescription;
import com.cftech.core.generic.GenericDao;
/**
* 处方单列表Mapper
*
* @author Strive
* @date: 2021-08-18 19:32
*/
public interface PrescriptionMapper extends GenericDao<Prescription> {
}
\ No newline at end of file
package com.cftech.prescription.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 处方单列表
*
* @author Strive
* @date: 2021-08-18 19:32
*/
@Data
public class Prescription implements Serializable {
/* 主键id */
private Long id;
/* 编码 */
@ExportConfig(value = "编码", width = 100, showLevel = 1)
private String number;
/* 小程序编码 */
@ExportConfig(value = "小程序编码", width = 100, showLevel = 1)
private String minProgramNo;
/* 药店编码 */
@ExportConfig(value = "药店编码", width = 100, showLevel = 1)
private String storeId;
/* 医院名称 */
@ExportConfig(value = "医院名称", width = 100, showLevel = 1)
private String hospitalName;
/* 药店名称 */
@ExportConfig(value = "药店名称", width = 100, showLevel = 1)
private String storeName;
/* 用户姓名 */
@ExportConfig(value = "用户姓名", width = 100, showLevel = 1)
private String custName;
/* 用户体重 */
@ExportConfig(value = "用户体重", width = 100, showLevel = 1)
private String weight;
/* 患者性别 */
@ExportConfig(value = "患者性别", width = 100, showLevel = 1)
private String custSex;
/* 用户电话 */
@ExportConfig(value = "用户电话", width = 100, showLevel = 1)
private String custPhone;
/* 病人状况描述 */
@ExportConfig(value = "病人状况描述", width = 100, showLevel = 1)
private String symptom;
/* 多个初步诊断之间使用|隔开 */
@ExportConfig(value = "多个初步诊断之间使用|隔开", width = 100, showLevel = 1)
private String syptmFlag;
/* 开方的医生 */
@ExportConfig(value = "开方的医生", width = 100, showLevel = 1)
private String doctorName;
/* 医生科室 */
@ExportConfig(value = "医生科室", width = 100, showLevel = 1)
private String doctorDpmtName;
/* 医生开方状态 0 通过 1未审核 2 未通过 */
@ExportConfig(value = "医生开方状态 0 通过 1未审核 2 未通过", width = 100, showLevel = 1)
private String docStatus;
/* 医生审核不通过理由 */
@ExportConfig(value = "医生审核不通过理由", width = 100, showLevel = 1)
private String docResult;
/* 此处方被审核后审方药师名 */
@ExportConfig(value = "此处方被审核后审方药师名", width = 100, showLevel = 1)
private String pharmName;
/* 本次审核结果,若不通过则此处为不通过的理 */
@ExportConfig(value = "本次审核结果,若不通过则此处为不通过的理", width = 100, showLevel = 1)
private String result;
/* 过敏史 */
@ExportConfig(value = "过敏史", width = 100, showLevel = 1)
private String guoms;
/* 用户年龄 */
@ExportConfig(value = "用户年龄", width = 100, showLevel = 1)
private String age;
/* 处方图片 */
@ExportConfig(value = "处方图片", width = 100, showLevel = 1)
private String presUrl;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public Prescription() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.prescription.service;
import com.cftech.prescription.model.Prescription;
import com.cftech.core.generic.GenericService;
/**
* 处方单列表Service
*
* @author Strive
* @date: 2021-08-18 19:32
*/
public interface PrescriptionService extends GenericService<Prescription> {
}
package com.cftech.prescription.service.impl;
import com.cftech.prescription.model.Prescription;
import com.cftech.prescription.dao.PrescriptionMapper;
import com.cftech.prescription.service.PrescriptionService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 处方单列表ServiceImpl
*
* @author Strive
* @date: 2021-08-18 19:32
*/
@Service("prescriptionService")
public class PrescriptionServiceImpl extends GenericServiceImpl<Prescription> implements PrescriptionService {
@Autowired
@Qualifier("prescriptionMapper")
private PrescriptionMapper prescriptionMapper;
@Override
public GenericDao<Prescription> getGenericMapper() {
return prescriptionMapper;
}
}
\ No newline at end of file
package com.cftech.prescription.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.prescription.model.Prescription;
import com.cftech.prescription.service.PrescriptionService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 处方单列表Controller
* <p>
* 权限字符串说明:
* 查看:public static final String PRESCRIPTION_VIEW = "qy:prescription:view"
* 查看:public static final String PRESCRIPTION_EDIT = "qy:prescription:edit"
*
* @author Strive
* @date: 2021-08-18 19:32
*/
@Slf4j
@Controller
@RequestMapping("/a/prescription")
public class PrescriptionController {
public static final String PRESCRIPTION_VIEW = "qy:prescription:view";
public static final String PRESCRIPTION_EDIT = "qy:prescription:edit";
@Autowired
private PrescriptionService prescriptionService;
//列表页面
@RequiresPermissions(value = PRESCRIPTION_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "prescription/prescriptionlist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = PRESCRIPTION_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
Prescription prescription = prescriptionService.fetchById(id);
model.addAttribute("data", prescription);
}
return "prescription/prescriptionform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = PRESCRIPTION_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(Prescription prescription, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (prescription != null && prescription.getId() != null) {
prescription.setUpdateBy(UserUtils.getUser().getId());
prescriptionService.update(prescription);
rtnJson.put("errorNo", 0);
} else {
prescription.setAccountsId(accountsId);
prescription.setDelFlag(false);
prescription.setAccountsId(UserUtils.getmpaccounts(request));
prescription.setCreateBy(UserUtils.getUser().getId());
prescription.setUpdateBy(UserUtils.getUser().getId());
prescriptionService.save(prescription);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = PRESCRIPTION_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, Prescription prescription, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId);
Sort sort = new Sort("create_time", OrderType.DESC);
List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = prescriptionService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = PRESCRIPTION_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
prescriptionService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = PRESCRIPTION_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
List<Prescription> list = prescriptionService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(Prescription.class, response).toExcel(list, "处方单列表信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = PRESCRIPTION_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(Prescription.class, response).toExcel(null, "处方单列表信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = PRESCRIPTION_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
Prescription prescription = new Prescription();
prescription.setAccountsId(accountId);
prescriptionService.save(prescription);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment