【数据分析】基于大数据的广西医疗机构数据可视化分析系统 | 可视化大屏 毕设实战项目 大数据选题推荐 Hadoop SPark java Python

57 阅读6分钟

💖💖作者:计算机毕业设计杰瑞 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学校实战项目 计算机毕业设计选题推荐

基于大数据的广西医疗机构数据可视化分析系统介绍

基于大数据的广西医疗机构数据可视化分析系统是一个集数据采集、存储、分析和可视化展示于一体的综合性平台,采用Hadoop+Spark大数据框架作为核心技术架构,结合Python语言进行数据处理和Django框架构建后端服务,前端采用Vue+ElementUI+Echarts技术栈实现用户界面和图表展示。系统主要针对广西地区医疗机构的基础数据、地理分布、资源配置等信息进行深度挖掘和分析,通过HDFS分布式文件系统存储海量医疗机构数据,利用Spark SQL进行大数据查询和计算,结合Pandas、NumPy等数据科学库完成数据清洗和统计分析工作。平台提供医疗机构数据管理、医疗资源可达性分析、机构地理分布分析、医保服务覆盖率分析、机构规模结构分析等核心功能模块,帮助用户直观了解广西医疗资源的分布情况和服务能力,为医疗资源优化配置和政策制定提供数据支撑。

基于大数据的广西医疗机构数据可视化分析系统演示视频

演示视频

基于大数据的广西医疗机构数据可视化分析系统演示图片

在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述

基于大数据的广西医疗机构数据可视化分析系统代码展示

from pyspark.sql import SparkSession
from pyspark.sql.functions import col, count, avg, sum, when, desc
import pandas as pd
import numpy as np
from django.http import JsonResponse
import math

spark = SparkSession.builder.appName("GuangxiMedicalAnalysis").config("spark.sql.adaptive.enabled", "true").getOrCreate()

def medical_institution_data_management(request):
    institution_df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/medical_db").option("dbtable", "medical_institutions").option("user", "root").option("password", "123456").load()
    institution_df.createOrReplaceTempView("institutions")
    
    if request.method == 'POST':
        institution_data = request.POST
        new_institution = spark.sql(f"""
            SELECT '{institution_data.get('name')}' as name, 
                   '{institution_data.get('type')}' as institution_type,
                   '{institution_data.get('level')}' as level,
                   {institution_data.get('bed_count')} as bed_count,
                   {institution_data.get('doctor_count')} as doctor_count,
                   '{institution_data.get('address')}' as address,
                   {institution_data.get('longitude')} as longitude,
                   {institution_data.get('latitude')} as latitude
        """)
        new_institution.write.format("jdbc").option("url", "jdbc:mysql://localhost:3306/medical_db").option("dbtable", "medical_institutions").option("user", "root").option("password", "123456").mode("append").save()
        
    total_institutions = spark.sql("SELECT COUNT(*) as total FROM institutions").collect()[0]['total']
    institution_types = spark.sql("SELECT institution_type, COUNT(*) as count FROM institutions GROUP BY institution_type ORDER BY count DESC").toPandas()
    level_distribution = spark.sql("SELECT level, COUNT(*) as count FROM institutions GROUP BY level").toPandas()
    avg_bed_count = spark.sql("SELECT AVG(bed_count) as avg_beds FROM institutions").collect()[0]['avg_beds']
    recent_institutions = spark.sql("SELECT name, institution_type, level, address FROM institutions ORDER BY id DESC LIMIT 10").toPandas()
    
    city_stats = spark.sql("""
        SELECT SUBSTRING_INDEX(address, '市', 1) as city,
               COUNT(*) as institution_count,
               SUM(bed_count) as total_beds,
               SUM(doctor_count) as total_doctors
        FROM institutions 
        WHERE address LIKE '%市%'
        GROUP BY SUBSTRING_INDEX(address, '市', 1)
        ORDER BY institution_count DESC
    """).toPandas()
    
    return JsonResponse({
        'total_institutions': total_institutions,
        'institution_types': institution_types.to_dict('records'),
        'level_distribution': level_distribution.to_dict('records'),
        'avg_bed_count': round(avg_bed_count, 2),
        'recent_institutions': recent_institutions.to_dict('records'),
        'city_statistics': city_stats.to_dict('records')
    })

def medical_resource_accessibility_analysis(request):
    institutions_df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/medical_db").option("dbtable", "medical_institutions").option("user", "root").option("password", "123456").load()
    population_df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/medical_db").option("dbtable", "population_data").option("user", "root").option("password", "123456").load()
    
    institutions_df.createOrReplaceTempView("institutions")
    population_df.createOrReplaceTempView("population")
    
    accessibility_analysis = spark.sql("""
        SELECT p.district_name,
               p.population,
               COUNT(i.id) as institution_count,
               SUM(i.bed_count) as total_beds,
               SUM(i.doctor_count) as total_doctors,
               ROUND(p.population / COUNT(i.id), 2) as people_per_institution,
               ROUND(p.population / SUM(i.bed_count), 2) as people_per_bed,
               ROUND(p.population / SUM(i.doctor_count), 2) as people_per_doctor
        FROM population p
        LEFT JOIN institutions i ON SUBSTRING_INDEX(i.address, '市', 1) = p.district_name
        GROUP BY p.district_name, p.population
        ORDER BY people_per_institution DESC
    """)
    
    accessibility_df = accessibility_analysis.toPandas()
    
    distance_analysis = spark.sql("""
        SELECT i1.name as institution1,
               i2.name as institution2,
               i1.longitude as lon1, i1.latitude as lat1,
               i2.longitude as lon2, i2.latitude as lat2,
               ROUND(6371 * 2 * ASIN(SQRT(
                   POW(SIN((RADIANS(i2.latitude) - RADIANS(i1.latitude)) / 2), 2) +
                   COS(RADIANS(i1.latitude)) * COS(RADIANS(i2.latitude)) *
                   POW(SIN((RADIANS(i2.longitude) - RADIANS(i1.longitude)) / 2), 2)
               )), 2) as distance_km
        FROM institutions i1
        CROSS JOIN institutions i2
        WHERE i1.id < i2.id AND i1.institution_type = '三甲医院'
        ORDER BY distance_km
        LIMIT 50
    """).toPandas()
    
    coverage_analysis = spark.sql("""
        SELECT institution_type,
               COUNT(*) as count,
               AVG(bed_count) as avg_beds,
               SUM(bed_count) as total_beds,
               ROUND(AVG(doctor_count), 2) as avg_doctors
        FROM institutions
        GROUP BY institution_type
        ORDER BY total_beds DESC
    """).toPandas()
    
    return JsonResponse({
        'accessibility_data': accessibility_df.to_dict('records'),
        'distance_analysis': distance_analysis.to_dict('records'),
        'coverage_analysis': coverage_analysis.to_dict('records'),
        'summary': {
            'total_population': int(accessibility_df['population'].sum()),
            'avg_people_per_institution': round(accessibility_df['people_per_institution'].mean(), 2),
            'avg_people_per_bed': round(accessibility_df['people_per_bed'].mean(), 2)
        }
    })

def institution_geographic_distribution_analysis(request):
    institutions_df = spark.read.format("jdbc").option("url", "jdbc:mysql://localhost:3306/medical_db").option("dbtable", "medical_institutions").option("user", "root").option("password", "123456").load()
    institutions_df.createOrReplaceTempView("institutions")
    
    geographic_distribution = spark.sql("""
        SELECT longitude, latitude, name, institution_type, level, bed_count, doctor_count,
               CASE 
                   WHEN longitude BETWEEN 104.26 AND 106.8 AND latitude BETWEEN 20.9 AND 22.5 THEN '桂南地区'
                   WHEN longitude BETWEEN 107.0 AND 109.5 AND latitude BETWEEN 22.6 AND 24.5 THEN '桂东地区'
                   WHEN longitude BETWEEN 106.8 AND 108.5 AND latitude BETWEEN 24.5 AND 26.2 THEN '桂北地区'
                   ELSE '桂西地区'
               END as geographic_region
        FROM institutions
        WHERE longitude IS NOT NULL AND latitude IS NOT NULL
    """)
    
    region_stats = spark.sql("""
        SELECT geographic_region,
               COUNT(*) as institution_count,
               SUM(bed_count) as total_beds,
               SUM(doctor_count) as total_doctors,
               AVG(bed_count) as avg_beds_per_institution,
               COUNT(CASE WHEN institution_type = '三甲医院' THEN 1 END) as top_hospitals,
               COUNT(CASE WHEN institution_type = '社区卫生服务中心' THEN 1 END) as community_centers
        FROM (
            SELECT *, 
                   CASE 
                       WHEN longitude BETWEEN 104.26 AND 106.8 AND latitude BETWEEN 20.9 AND 22.5 THEN '桂南地区'
                       WHEN longitude BETWEEN 107.0 AND 109.5 AND latitude BETWEEN 22.6 AND 24.5 THEN '桂东地区'
                       WHEN longitude BETWEEN 106.8 AND 108.5 AND latitude BETWEEN 24.5 AND 26.2 THEN '桂北地区'
                       ELSE '桂西地区'
                   END as geographic_region
            FROM institutions
            WHERE longitude IS NOT NULL AND latitude IS NOT NULL
        ) t
        GROUP BY geographic_region
        ORDER BY institution_count DESC
    """).toPandas()
    
    density_analysis = spark.sql("""
        SELECT ROUND(longitude, 1) as lng_group,
               ROUND(latitude, 1) as lat_group,
               COUNT(*) as institution_density,
               SUM(bed_count) as bed_density,
               AVG(bed_count) as avg_beds
        FROM institutions
        WHERE longitude IS NOT NULL AND latitude IS NOT NULL
        GROUP BY ROUND(longitude, 1), ROUND(latitude, 1)
        HAVING COUNT(*) >= 2
        ORDER BY institution_density DESC
    """).toPandas()
    
    city_coordinates = spark.sql("""
        SELECT SUBSTRING_INDEX(address, '市', 1) as city_name,
               AVG(longitude) as avg_longitude,
               AVG(latitude) as avg_latitude,
               COUNT(*) as city_institution_count,
               SUM(bed_count) as city_total_beds
        FROM institutions
        WHERE address LIKE '%市%' AND longitude IS NOT NULL AND latitude IS NOT NULL
        GROUP BY SUBSTRING_INDEX(address, '市', 1)
        HAVING COUNT(*) >= 3
        ORDER BY city_institution_count DESC
    """).toPandas()
    
    return JsonResponse({
        'geographic_distribution': geographic_distribution.toPandas().to_dict('records'),
        'region_statistics': region_stats.to_dict('records'),
        'density_analysis': density_analysis.to_dict('records'),
        'city_coordinates': city_coordinates.to_dict('records'),
        'distribution_summary': {
            'total_regions': len(region_stats),
            'highest_density_region': region_stats.iloc[0]['geographic_region'] if len(region_stats) > 0 else 'N/A',
            'total_mapped_institutions': int(geographic_distribution.count())
        }
    })

基于大数据的广西医疗机构数据可视化分析系统文档展示

在这里插入图片描述

💖💖作者:计算机毕业设计杰瑞 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学校实战项目 计算机毕业设计选题推荐