Commit 62011b83 authored by 黎聪聪's avatar 黎聪聪

咨询单管理

parent d62d8733
<!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:consultSheet:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/consultSheet/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/consultSheet/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/consultSheet/form')";
},
cancel: function () {
location.href = "#springUrl('/a/consultSheet/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/consultSheet/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/consultSheet/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
...@@ -10,5 +10,13 @@ ...@@ -10,5 +10,13 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>consult-module</artifactId> <artifactId>consult-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>sys-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project> </project>
\ No newline at end of file
package com.cftech.consultsheet.dao;
import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.core.generic.GenericDao;
/**
* 咨询单Mapper
*
* @author Licc
* @date: 2020-09-22 12:06
*/
public interface ConsultSheetMapper extends GenericDao<ConsultSheet> {
}
\ No newline at end of file
package com.cftech.consultsheet.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 咨询单
*
* @author Licc
* @date: 2020-09-22 12:06
*/
@Data
public class ConsultSheet implements Serializable {
/* 主键id */
private Long id;
/* 咨询单编码 */
@ExportConfig(value = "咨询单编码", width = 100, showLevel = 1)
private Long consultId;
/* 用药人name */
@ExportConfig(value = "用药人name", width = 100, showLevel = 1)
private String userName;
/* 身份证号 */
@ExportConfig(value = "身份证号", width = 100, showLevel = 1)
private String numberId;
/* 出生年月 */
@ExportConfig(value = "出生年月", width = 100, showLevel = 1)
private Date benebitId;
/* 性别 */
@ExportConfig(value = "性别", width = 100, showLevel = 1)
private Long sex;
/* 手机号 */
@ExportConfig(value = "手机号", width = 100, showLevel = 1)
private String iPhone;
/* 疾病史 */
@ExportConfig(value = "疾病史", width = 100, showLevel = 1)
private String pastRecords;
/* 处方单 */
@ExportConfig(value = "处方单", width = 100, showLevel = 1)
private String Prescription;
/* 药师id */
@ExportConfig(value = "药师id", width = 100, showLevel = 1)
private Long doctorId;
/* 客服id */
@ExportConfig(value = "客服id", width = 100, showLevel = 1)
private Long customerId;
/* 病情描述 */
@ExportConfig(value = "病情描述", width = 100, showLevel = 1)
private Long illness;
/* 所属的账号 */
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 ConsultSheet() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.consultsheet.service;
import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.core.generic.GenericService;
/**
* 咨询单Service
*
* @author Licc
* @date: 2020-09-22 12:06
*/
public interface ConsultSheetService extends GenericService<ConsultSheet> {
}
package com.cftech.consultsheet.service.impl;
import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.consultsheet.service.ConsultSheetService;
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 Licc
* @date: 2020-09-22 12:06
*/
@Service("consultSheetService")
public class ConsultSheetServiceImpl<ConsultSheetMapper> extends GenericServiceImpl<ConsultSheet> implements ConsultSheetService {
@Autowired
@Qualifier("consultSheetMapper")
private ConsultSheetMapper consultSheetMapper;
@Override
public GenericDao<ConsultSheet> getGenericMapper() {
return (GenericDao<ConsultSheet>) consultSheetMapper;
}
}
\ No newline at end of file
package com.cftech.consultsheet.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.consultsheet.service.ConsultSheetService;
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.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
*
* 权限字符串说明:
* 查看:public static final String CONSULTSHEET_VIEW = "qy:consultSheet:view"
* 查看:public static final String CONSULTSHEET_EDIT = "qy:consultSheet:edit"
*
* @author Strive
* @date: 2020-09-22 12:06
*/
@Slf4j
@Controller
@RequestMapping("/a/consultSheet")
public class ConsultSheetController {
public static final String CONSULTSHEET_VIEW = "qy:consultSheet:view";
public static final String CONSULTSHEET_EDIT = "qy:consultSheet:edit";
@Autowired
private ConsultSheetService consultSheetService;
//列表页面
@RequiresPermissions(value = CONSULTSHEET_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "consultSheet/consultSheetlist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = CONSULTSHEET_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
ConsultSheet consultSheet = consultSheetService.fetchById(id);
model.addAttribute("data", consultSheet);
}
return "consultSheet/consultSheetform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = CONSULTSHEET_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(ConsultSheet consultSheet, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (consultSheet != null && consultSheet.getId() != null) {
consultSheet.setUpdateBy(UserUtils.getUser().getId());
consultSheetService.update(consultSheet);
rtnJson.put("errorNo", 0);
} else {
consultSheet.setAccountsId(accountsId);
consultSheet.setDelFlag(false);
consultSheet.setAccountsId(UserUtils.getmpaccounts(request));
consultSheet.setCreateBy(UserUtils.getUser().getId());
consultSheet.setUpdateBy(UserUtils.getUser().getId());
consultSheetService.save(consultSheet);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = CONSULTSHEET_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ConsultSheet consultSheet, 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<ConsultSheet> list = consultSheetService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = consultSheetService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = CONSULTSHEET_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
consultSheetService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = CONSULTSHEET_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<ConsultSheet> list = consultSheetService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(ConsultSheet.class, response).toExcel(list, "咨询单信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = CONSULTSHEET_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(ConsultSheet.class, response).toExcel(null, "咨询单信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = CONSULTSHEET_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))) {
ConsultSheet consultSheet = new ConsultSheet();
consultSheet.setAccountsId(accountId);
consultSheetService.save(consultSheet);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
<?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.cos.config.cosconfig.dao.CosconfigMapper">
<resultMap id="resultMap" type="com.cftech.cos.config.cosconfig.model.Cosconfig">
<id column="id" property="id"/>
<result column="app_id" property="appId"/>
<result column="cos_type" property="cosType"/>
<result column="key_id" property="keyId"/>
<result column="key_secret" property="keySecret"/>
<result column="bucket" property="bucket"/>
<result column="endpoint" property="endpoint"/>
<result column="region" property="region"/>
<result column="url" property="url"/>
<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,
app_id,
cos_type,
key_id,
key_secret,
bucket,
endpoint,
region,
url,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.cos.config.cosconfig.model.Cosconfig" useGeneratedKeys="true"
keyProperty="id">
insert into t_cos_config
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{appId, jdbcType=BIGINT},
#{cosType, jdbcType=VARCHAR},
#{keyId, jdbcType=VARCHAR},
#{keySecret, jdbcType=VARCHAR},
#{bucket, jdbcType=VARCHAR},
#{endpoint, jdbcType=VARCHAR},
#{region, jdbcType=VARCHAR},
#{url, jdbcType=VARCHAR},
#{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_cos_config t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_cos_config
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_cos_config
<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.cos.config.cosconfig.model.Cosconfig">
update t_cos_config
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="appId != null">
app_id = #{appId, jdbcType=BIGINT},
</if>
<if test="cosType != null">
cos_type = #{cosType, jdbcType=VARCHAR},
</if>
<if test="keyId != null">
key_id = #{keyId, jdbcType=VARCHAR},
</if>
<if test="keySecret != null">
key_secret = #{keySecret, jdbcType=VARCHAR},
</if>
<if test="bucket != null">
bucket = #{bucket, jdbcType=VARCHAR},
</if>
<if test="endpoint != null">
endpoint = #{endpoint, jdbcType=VARCHAR},
</if>
<if test="region != null">
region = #{region, jdbcType=VARCHAR},
</if>
<if test="url != null">
url = #{url, jdbcType=VARCHAR},
</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_cos_config set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
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