博主介绍:
✌我是阿龙,一名专注于Java技术领域的程序员,全网拥有10W+粉丝。作为CSDN特邀作者、博客专家、新星计划导师,我在计算机毕业设计开发方面积累了丰富的经验。同时,我也是掘金、华为云、阿里云、InfoQ等平台的优质作者。通过长期分享和实战指导,我致力于帮助更多学生完成毕业项目和技术提升。技术范围:
我熟悉的技术领域涵盖SpringBoot、Vue、SSM、HLMT、Jsp、PHP、Nodejs、Python、爬虫、数据可视化、小程序、安卓app、大数据、物联网、机器学习等方面的设计与开发。如果你有任何技术难题,我都乐意与你分享解决方案。主要内容:
我的服务内容包括:免费功能设计、开题报告、任务书、中期检查PPT、系统功能实现、代码编写、论文撰写与辅导、论文降重、长期答辩答疑辅导。此外,我还提供腾讯会议一对一的专业讲解和模拟答辩演练,帮助你全面掌握答辩技巧与代码逻辑。🍅获取源码请在文末联系我🍅
如果你对我的内容感兴趣,记得先收藏!对于毕设选题、项目开发或论文撰写等相关问题,随时欢迎留言咨询,我会尽力帮助更多同学顺利完成学业。
最主要的是免费咨询相关问题!!
文档学习资料:
客户协商的功能:
功能开发:
1.系统管理员功能:个人中心 - 管理自己的登录凭证和个人资料。
用户管理 - 管理系统用户账户,包括权限分配和账户维护。
科普知识管理 - 发布和更新职业病预防知识和健康信息。
体检预约管理 - 安排和管理员工的健康体检预约。
健康档案管理 - 创建和维护员工的健康档案记录。
鉴定申请管理 - 处理员工的职业病鉴定申请。
治疗安排管理 - 安排和记录员工的治疗过程。
财务管理 - 管理系统的财务情况,如体检费用和治疗费用
数据分析与报告 - 生成关于体检、疾病鉴定和治疗的统计报告(数据分析图)
2.企业管理员功能:
登录注册 - 管理自己的登录凭证和账户信息。
个人信息管理 - 更新和维护个人资料。
员工信息管理 - 管理旗下员工的个人信息和健康记录。
体检预约管理 - 为员工安排体检预约。
健康档案管理 - 维护和查看员工的健康档案。
鉴定申请管理 - 协助员工提交职业病鉴定申请。
治疗安排管理 - 根据鉴定结果安排员工的治疗计划。
3.员工功能:
登录注册 - 创建个人账户以使用系统服务。
个人信息管理 - 更新个人资料和健康信息。
体检预约管理 - 自行预约职业病体检。
鉴定申请管理 - 提交职业病鉴定的申请。
系统详细介绍:
代码实现:
<?php
session_start();
class YuangongController extends CommonController {
public function __construct()
{
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE");
header('Access-Control-Allow-Headers:Origin,Content-Type,Accept,token,X-Requested-With,device');
}
public $columData = [
'id','addtime'
,'gonghao'
,'mima'
,'xingming'
,'xingbie'
,'touxiang'
,'lianxifangshi'
,'shenfenzhenghao'
,'qiyemingcheng'
,'zhiyebingfenlei'
];
/**
* 登录接口
* POST
* */
public function login(){
$username = isset($_REQUEST['username'])?$_REQUEST['username']:"";
$password = isset($_REQUEST['password'])?$_REQUEST['password']:"";
$sql = "select * from `yuangong` where `gonghao` = '".$username."' and `mima` = '".$password."'";
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$token_array = [
"iat" => time(), //签发时间
"exp" => time()+7200, //token 过期时间
'tablename'=> 'yuangong',//表名
'columData' => $this->columData,
'id' => $row['id'],
'isAdmin' => 0,
"success" => $row,//记录的uid的信息,如果有其它信息,可以再添加数组的键值对
'username' => $row['gonghao'],
];
$tokens = base64_encode(json_encode($token_array));
$_SESSION[$tokens] = $row["id"];
$colum = "gonghao";
$md5 = md5($row["id"]."+10086");
$_SESSION[$md5] = $row[$colum];
$data = ['code' => 0, 'token' => $tokens];
exit(json_encode($data));
}
} else {
exit(json_encode(['code'=>500,'msg'=>"账号或密码错误"]));
}
}
/**
* 退出
* post
*/
public function logout(){
$token = $this->token();
unset($token);
exit(json_encode(['code'=>0,'msg'=>'退出成功']));
}
/**
* 注册
* post
*/
public function register(){
$tmpData = strval(file_get_contents("php://input"));
$postData = json_decode($tmpData,true);
$colum = "gonghao";
$trues = "select * from `yuangong` where `gonghao` = '".$postData[$colum]."'";
$result = table_sql($trues);
if($result->num_rows<1){
$keyArr = $valArr = array();
foreach ($postData as $key => $value){
if (in_array($key, $this->columData) && ($value===0 || $value!="")){
array_push($keyArr,"`".$key."`");
array_push($valArr,"'".$value."'");
}
}
$key = implode(',',$keyArr);
$v = implode(',',$valArr);
$sql = "INSERT INTO `yuangong` (`id`,".$key.") VALUES (".time().",".$v.")";
$result = table_sql($sql);
if (!$result) exit(json_encode(['code'=>500,'msg'=>'注册失败。']));
exit(json_encode(['code'=>0]));
}
exit(json_encode(['code'=>500,'msg'=>"用户名已存在。"]));
}
/**
* 获取session
*/
public function session(){
$token = $this->token();
$data = json_decode(base64_decode($token),true);
$dbname = $data['tablename'];
$uid = $data['id'];
$sql = "select * from ".$dbname." where id=".$uid;
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$arrayData = $row;
}
}
exit(json_encode(['code'=>0,'data'=>$arrayData]));
}
/**
* 找回密码 重置为123456
**/
public function resetPass(){
$username = $_REQUEST['username'];
$counts = "select * from `yuangong` where gonghao = '".$username."'";
$cotte = table_sql($counts);
if($cotte->num_rows<1){
exit(json_encode(['code'=>500,'msg'=>"用户名错误。"]));
}
$sql = "update yuangong set mima = '123456' where gonghao = '".$username."'";
$result = table_sql($sql);
exit(json_encode(['code'=>0,'msg'=>"密码已重置为:123456"]));
}
/**
* 分页,列表
* get
*/
public function page(){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>401,'msg'=>"你还没有登录。"]));
$userid = $tokens['id'];
$where = " where 1 ";//查询条件
$orwhere = '';
$page = isset($_REQUEST['page'])?$_REQUEST['page']:"1";
$limt = isset($_REQUEST['limit'])?$_REQUEST['limit']:"10";
$sort = isset($_REQUEST['sort'])?$_REQUEST['sort']:"id";
$order = isset($_REQUEST['order'])?$_REQUEST['order']:"asc";
foreach ($_REQUEST as $k => $val){
if(in_array($k, $this->columData)){
if ($val != ''){
$where.= " and ".$k." like '".$val."'";
}
}
}
$base = json_decode(base64_decode($token),true);
if ($base['isAdmin']!=1 || ($base['isAdmin']==1 && $base['tablename'] != "users")){
$md5 = md5($userid."+10086");
$colum = "gonghao";
$columData = $base['columData'];
if (isset($_SESSION[$md5]) && in_array($colum, $columData)){
if($base['tablename'] == '${column.authTable}'){
$orsign = false;
if(!$orsign) {
$where .= " and `gonghao` = '".$_SESSION[$md5]."'";
}
}
}
}
$sql = "select * from `yuangong` ".$where;
$count = table_sql($sql);
if ($count->num_rows < 1){
$numberCount = 0;
}else{
$numberCount = $count->num_rows;
}
$page_count = ceil($numberCount/$limt);//页数
$startCount = ($page-1)*$limt;
$where .= empty($orwhere) ? '' : "and (".$orwhere.")";
$lists = "select * from `yuangong` ".$where." order by ".$sort." ".$order." limit ".$startCount.",".$limt;
$result = table_sql($lists);
$arrayData = array();
if ($result->num_rows > 0) {
while ($datas = $result->fetch_assoc()){
array_push($arrayData,$datas);
}
}
exit(json_encode([
'code'=>0,
'data' => [
"total" => $numberCount,
"pageSize" => $limt,
"totalPage" => $page_count,
"currPage" => $page,
"list" => $arrayData
]
]));
}
/**
* 分页,列表list
* get
*/
public function lists(){
$sql = "select * from `yuangong`";
$result = table_sql($sql);
$arrayData = array();
if ($result->num_rows > 0) {
while ($datas = $result->fetch_assoc()){
array_push($arrayData,$datas);
}
}
exit(json_encode([
'code'=>0,
'data' =>$arrayData
]));
}
/**
* 分页,列表list
* get
*/
public function list(){
$page = isset($_REQUEST['page'])?$_REQUEST['page']:"1";
$limt = isset($_REQUEST['limit'])?$_REQUEST['limit']:"10";
$sort = isset($_REQUEST['sort'])?$_REQUEST['sort']:"id";
$order = isset($_REQUEST['order'])?$_REQUEST['order']:"asc";
$refid = isset($_REQUEST['refid']) ? $_REQUEST['refid'] : "0";
$where = " where 1 ";//查询条件
if(isset($_REQUEST['goodid'])) {
$where .= " and goodid = ".$_REQUEST['goodid']." ";
}
$sorts = explode(",", $sort);
$orders = explode(",", $order);
$sortorders = "";
foreach ($sorts as $index => $value) {
if($index == count($sorts)-1){
$sortorders =$sortorders.$value." ".$orders[$index];
}else{
$sortorders =$sortorders.$value." ".$orders[$index].",";
}
}
foreach ($_REQUEST as $k => $val){
if(in_array($k, $this->columData)){
$where.= " and ".$k." like '".$val."'";
}
}
$sql = "select * from `yuangong`".$where;
$count = table_sql($sql);
if ($count->num_rows < 1){
$numberCount = 0;
}else{
$numberCount = $count->num_rows;
}
$page_count = ceil($numberCount/$limt);//页数
$startCount = ($page-1)*$limt;
$lists = "select * from `yuangong` ".$where." order by ".$sortorders." limit ".$startCount.",".$limt;
$result = table_sql($lists);
$arrayData = array();
if ($result->num_rows > 0) {
while ($datas = $result->fetch_assoc()){
array_push($arrayData,$datas);
}
}
exit(json_encode([
'code'=>0,
'data' => [
"total" => $numberCount,
"pageSize" => $limt,
"totalPage" => $page_count,
"currPage" => $page,
"list" => $arrayData
]
]));
}
/**
* 新增数据接口
* post
*/
public function save(){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>401,'msg'=>"你还没有登录。"]));
$uid = $tokens['id'];
$keyArr = $valArr = array();
$tmpData = strval(file_get_contents("php://input"));//Content-Type: application/json 需要用到php://input 处理输入流
if (!empty($tmpData)&& isset($tmpData)){
$postData = json_decode($tmpData,true);
$gonghao = $postData['gonghao'];
$resultInfo = table_sql("select gonghao from `yuangong` where `gonghao` = '".$gonghao."'");
if ($resultInfo->num_rows > 0) {
exit(json_encode(['code'=>500,'msg'=>"工号已存在"]));
}
foreach ($postData as $key => $value){
if (in_array($key, $this->columData)){
if(!empty($value) || $value === 0) {
if ($key == 'id') {
continue;
}
array_push($keyArr,"`".$key."`");
if($key == 'clicktime') {
array_push($valArr,"'".date('Y-m-d h:i:s', time())."'");
} else {
array_push($valArr,"'".$value."'");
}
}
}
}
}
$k = implode(',',$keyArr);
$v = implode(',',$valArr);
$sql = "INSERT INTO `yuangong` (`id`,".$k.") VALUES (".time().",".$v.")";
$result = table_sql($sql);
exit(json_encode(['code'=>0]));
}
/**
* 新增数据接口 add
* post
*/
public function add(){
$keyArr = $valArr = array();
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>401,'msg'=>"你还没有登录。"]));
$uid = $tokens['id'];
$tmpData = strval(file_get_contents("php://input"));
if (!empty($tmpData)&& isset($tmpData)){
$postData = json_decode($tmpData,true);
$gonghao = $postData['gonghao'];
$resultInfo = table_sql("select gonghao from `yuangong` where `gonghao` = '".$gonghao."'");
if ($resultInfo->num_rows > 0) {
exit(json_encode(['code'=>500,'msg'=>"工号已存在"]));
}
foreach ($postData as $key => $value){
if (in_array($key, $this->columData)){
if(!empty($value) || $value === 0) {
if ($key == 'id') {
continue;
}
array_push($keyArr,"`".$key."`");
if($key == 'clicktime') {
array_push($valArr,"'".date('Y-m-d h:i:s', time())."'");
} else {
array_push($valArr,"'".$value."'");
}
}
}
}
}
$k = implode(',',$keyArr);
$v = implode(',',$valArr);
$sql = "INSERT INTO `yuangong` (".$k.") VALUES (".$v.")";
$result = table_sql($sql);
exit(json_encode(['code'=>0]));
}
/**
* 更新接口
* post
*/
public function update(){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>401,'msg'=>"你还没有登录。"]));
$uid = $tokens['id'];
$tmpData = strval(file_get_contents("php://input"));
$postData = json_decode($tmpData,true);
$gonghao = $postData['gonghao'];
$id = $postData['id'];
$resultInfo = table_sql("select gonghao from `yuangong` where id <> ".$id." and `gonghao` = '".$gonghao."'");
if ($resultInfo->num_rows > 0) {
exit(json_encode(['code'=>500,'msg'=>"工号已存在"]));
}
$v = array();
foreach ($postData as $key => $value){
if (in_array($key, $this->columData)){
if ($key == "id"){
$id = $value;
}
if(!empty($value) || $value === 0) {
array_push($v,$key." = '".$value."'");
}
}
}
$value = implode(',',$v);
$sql = "UPDATE yuangong SET ".$value." where id = ".$id;
$result = table_sql($sql);
exit(json_encode(['code'=>0]));
}
/**
* 删除
* post
*/
public function delete(){
$ids = strval(file_get_contents("php://input"));//发现接收的是字符串
preg_match_all('/\d+/',$ids,$arr);
$str = implode(',',$arr[0]);//拼接字符,
$sql = "delete from yuangong WHERE id in({$str})";
$result = table_sql($sql);
exit(json_encode(['code'=>0]));
}
// 查询单条记录(前端)
public function query(){
$where = "1";
foreach ($_REQUEST as $k => $val){
if(in_array($k, $this->columData) && !empty($val)){
$where.= " and ".$k." like '".$val."'";
}
}
$sql = "select * from `yuangong` where ".$where;
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$lists = $row;
}
}
exit(json_encode([
'code'=>0,
'data'=> $lists
]));
}
/**
* 查询一条数据
* get
*/
public function info($id=false){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
if (!isset($tokens['id']) || empty($tokens['id'])) exit(json_encode(['code'=>401,'msg'=>"你还没有登录。"]));
$userid = $tokens['id'];
$name = isset($_REQUEST['name'])? $_REQUEST['name']:"";
if (!empty($id)){
$where = "`id` = ".$id;
}else{
$where = "`name` = ".$name;
}
$sql = "select * from `yuangong` where ".$where;
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$lists = $row;
}
}
exit(json_encode([
'code'=>0,
'data'=> $lists
]));
}
/**
* 查询一条数据
* get
*/
public function detail($id=false){
$name = isset($_REQUEST['name'])? $_REQUEST['name']:"";
if ($id){
$where = "`id` = ".$id;
}else{
$where = "`name` = ".$name;
}
$sql = "select * from `yuangong` where ".$where;
$result = table_sql($sql);
if (!$result) exit(json_encode(['code'=>500,'msg'=>"查询数据发生错误。"]));
if ($result->num_rows > 0) {
// 输出数据
while($row = $result->fetch_assoc()) {
$lists = $row;
}
}
exit(json_encode([
'code'=>0,
'data'=> $lists
]));
}
/**
* 按值统计接口
**/
public function value(){
$url = explode('?',$_SERVER['REQUEST_URI']);
$request = explode('/',$url[0]);
$xColumnName = $request[4];
$yColumnName = $request[5];
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
$where = " where 1 ";
$sql = "SELECT ".$xColumnName.",sum(".$yColumnName.") total FROM yuangong ".$where." group by ".$xColumnName;
if(urldecode($request[6]) == '日') {
$sql = "SELECT DATE_FORMAT(".$xColumnName.", '%Y-%m-%d') ".$xColumnName.", sum(".$yColumnName.") total FROM yuangong ".$where." GROUP BY DATE_FORMAT(".$xColumnName.", '%Y-%m-%d')";
}
if(urldecode($request[6]) == '月') {
$sql = "SELECT DATE_FORMAT(".$xColumnName.", '%Y-%m') ".$xColumnName.", sum(".$yColumnName.") total FROM yuangong ".$where." GROUP BY DATE_FORMAT(".$xColumnName.", '%Y-%m')";
}
if(urldecode($request[6]) == '年') {
$sql = "SELECT DATE_FORMAT(".$xColumnName.", '%Y') ".$xColumnName.", sum(".$yColumnName.") total FROM yuangong ".$where." GROUP BY DATE_FORMAT(".$xColumnName.", '%Y')";
}
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
$total = array();
while($row = $result->fetch_assoc()) {
array_push($total,array('total' => intval($row['total']),$xColumnName => $row[$xColumnName]));
}
}
exit(json_encode(['code'=>0,'data'=>$total]));
}
/**
* (按值统计)时间统计类型(多)
**/
public function valueMul(){
$url = explode('?',$_SERVER['REQUEST_URI']);
$request = explode('/',$url[0]);
$xColumnName = $request[4];
$yColumnName = isset($_REQUEST['yColumnNameMul'])? $_REQUEST['yColumnNameMul']:"";
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
$where = " where 1 ";
$valueData = array();
foreach(explode(",", $yColumnName) as $item){
$sql = "SELECT ".$xColumnName.",sum(".$item.") total FROM yuangong ".$where." group by ".$xColumnName." LIMIT 10";
if(urldecode($request[6]) == '日') {
$sql = "SELECT DATE_FORMAT(".$xColumnName.", '%Y-%m-%d') ".$xColumnName.", sum(".$item.") total FROM yuangong ".$where." GROUP BY DATE_FORMAT(".$xColumnName.", '%Y-%m-%d') LIMIT 10";
}
if(urldecode($request[6]) == '月') {
$sql = "SELECT DATE_FORMAT(".$xColumnName.", '%Y-%m') ".$xColumnName.", sum(".$item.") total FROM yuangong ".$where." GROUP BY DATE_FORMAT(".$xColumnName.", '%Y-%m') LIMIT 10";
}
if(urldecode($request[6]) == '年') {
$sql = "SELECT DATE_FORMAT(".$xColumnName.", '%Y') ".$xColumnName.", sum(".$item.") total FROM yuangong ".$where." GROUP BY DATE_FORMAT(".$xColumnName.", '%Y') LIMIT 10";
}
$result = table_sql($sql);
if ($result->num_rows > 0) {// 输出数据
$total = array();
while($row = $result->fetch_assoc()) {
array_push($total,array('total' => intval($row['total']),$xColumnName => $row[$xColumnName]));
}
$valueData[] = $total;
}
}
exit(json_encode(['code'=>0,'data'=>$valueData]));
}
/**
* 获取需要提醒的记录数接口
* get
*/
public function remind($columnName,$type){
$remindStart = isset($_GET['remindstart'])?$_GET['remindstart']:"";
$remindEnd = isset($_GET['remindend'])?$_GET['remindend']:"";
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
$where = " where 1 ";//查询条件
if ($type == 1){//数字
if ($remindStart && $remindEnd){
$where .= " and ".$columnName."<='".$remindEnd."' and ".$columnName.">='".$remindStart."'";
}elseif($remindStart){
$where .= " and ".$columnName.">='".$remindStart."'";
}elseif($remindEnd){
$where .= " and ".$columnName."<='".$remindEnd."'";
}
}else{
if ($remindStart && $remindEnd){
$where .= " and ".$columnName."<='".date("Y-m-d",strtotime("+".$remindEnd." day"))."' and ".$columnName.">='".date("Y-m-d",strtotime("+".$remindStart." day"))."'";
}elseif($remindStart){
$where .= " and ".$columnName.">='".date("Y-m-d",strtotime("+".$remindStart." day"))."'";
}elseif($remindEnd){
$where .= " and ".$columnName."<='".date("Y-m-d",strtotime("+".$remindEnd." day"))."'";
}
}
$sql = "select * from `yuangong` ".$where;
$result = table_sql($sql);
exit(json_encode(['code'=> 0 ,'count' => $result->num_rows]));
}
public function group($columnName){
$token = $this->token();
$tokens = json_decode(base64_decode($token),true);
$where = " where 1 ";
$sql = "SELECT ".$columnName.",count(".$columnName.") as total FROM yuangong ".$where." GROUP BY ".$columnName." ORDER BY $columnName asc";
$result = table_sql($sql);
if ($result->num_rows > 0) {
// 输出数据
$total = array();
while($row = $result->fetch_assoc()) {
array_push($total,array('total' => $row['total'],$columnName => $row[$columnName]));
}
}
exit(json_encode(['code'=>0,'data'=>$total]));
}
}
开发的项目经验展示(项目案例):
为什么选择我:
我是程序员阿龙,专注于软件开发,拥有丰富的编程能力和实战经验。在过去的几年里,我辅导了上千名学生,帮助他们顺利完成毕业项目,同时我的技术分享也吸引了超过50W+的粉丝。我是CSDN特邀作者、博客专家、新星计划导师,并在Java领域内获得了多项荣誉,如博客之星。我的作品也被掘金、华为云、阿里云、InfoQ等多个平台推荐,成为各大平台的优质作者。
在Java技术领域和学生毕业项目实战中,我积累了深厚的知识与经验,并与高校老师、讲师及行业内的同行前辈保持着广泛的交流与合作。我的专业背景和丰富的实战经验使我能够为你提供高质量的辅导和技术支持,助你在编程学习和项目开发中取得更好的成果。选择我,你将获得的不仅是技术上的提升,更是对项目的全面理解与掌控。