├── .idea ├── .name ├── .gitignore ├── modules.xml ├── encodings.xml ├── libraries │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__log4j_log4j_1_2_17.xml │ ├── Maven__org_ow2_asm_asm_5_0_4.xml │ ├── Maven__org_apache_poi_poi_3_15.xml │ ├── Maven__stax_stax_api_1_0_1.xml │ ├── Maven__org_hamcrest_hamcrest_2_1.xml │ ├── Maven__org_yaml_snakeyaml_1_25.xml │ ├── Maven__redis_clients_jedis_3_1_0.xml │ ├── Maven__com_auth0_java_jwt_3_4_0.xml │ ├── Maven__org_mybatis_mybatis_3_5_4.xml │ ├── Maven__com_zaxxer_HikariCP_3_4_2.xml │ ├── Maven__net_minidev_json_smart_2_3.xml │ ├── Maven__org_objenesis_objenesis_2_6.xml │ ├── Maven__com_google_guava_guava_16_0_1.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_30.xml │ ├── Maven__com_itextpdf_itextpdf_5_5_11.xml │ ├── Maven__com_fasterxml_classmate_1_5_1.xml │ ├── Maven__org_apache_poi_poi_ooxml_3_15.xml │ ├── Maven__cn_afterturn_easypoi_web_3_2_0.xml │ ├── Maven__com_itextpdf_itext_asian_5_2_0.xml │ ├── Maven__org_hamcrest_hamcrest_core_2_1.xml │ ├── Maven__net_bytebuddy_byte_buddy_1_10_6.xml │ ├── Maven__org_mockito_mockito_core_3_1_0.xml │ ├── Maven__org_opentest4j_opentest4j_1_2_0.xml │ ├── Maven__org_projectlombok_lombok_1_18_10.xml │ ├── Maven__org_xmlunit_xmlunit_core_2_6_3.xml │ ├── Maven__cn_afterturn_easypoi_base_3_2_0.xml │ ├── Maven__com_baomidou_mybatis_plus_3_1_1.xml │ ├── Maven__com_sun_mail_jakarta_mail_1_6_4.xml │ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml │ ├── Maven__org_slf4j_slf4j_log4j12_1_7_30.xml │ ├── Maven__com_github_virtuald_curvesapi_1_04.xml │ ├── Maven__commons_codec_commons_codec_1_13.xml │ ├── Maven__net_minidev_accessors_smart_1_2.xml │ ├── Maven__org_apache_xmlbeans_xmlbeans_2_6_0.xml │ ├── Maven__org_assertj_assertj_core_3_13_2.xml │ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml │ ├── Maven__org_mybatis_mybatis_spring_2_0_4.xml │ ├── Maven__com_github_jsqlparser_jsqlparser_1_2.xml │ ├── Maven__org_apache_commons_commons_lang3_3_9.xml │ ├── Maven__mysql_mysql_connector_java_8_0_19.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_5_5_2.xml │ ├── Maven__com_baomidou_mybatis_plus_core_3_1_1.xml │ ├── Maven__org_apache_commons_commons_pool2_2_7_0.xml │ ├── Maven__org_apache_poi_poi_ooxml_schemas_3_15.xml │ ├── Maven__org_apiguardian_apiguardian_api_1_1_0.xml │ ├── Maven__net_bytebuddy_byte_buddy_agent_1_10_6.xml │ ├── Maven__cn_afterturn_easypoi_annotation_3_2_0.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_api_5_5_2.xml │ ├── Maven__org_mockito_mockito_junit_jupiter_3_1_0.xml │ ├── Maven__org_springframework_spring_tx_5_2_3_RELEASE.xml │ ├── Maven__com_baomidou_mybatis_plus_extension_3_1_1.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_10_2.xml │ ├── Maven__com_sun_activation_jakarta_activation_1_2_1.xml │ ├── Maven__org_apache_commons_commons_collections4_4_1.xml │ ├── Maven__org_jboss_logging_jboss_logging_3_4_1_Final.xml │ ├── Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_2.xml │ ├── Maven__javax_validation_validation_api_2_0_1_Final.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_30.xml │ ├── Maven__org_springframework_spring_aop_5_2_3_RELEASE.xml │ ├── Maven__org_springframework_spring_jcl_5_2_3_RELEASE.xml │ ├── Maven__org_springframework_spring_oxm_5_2_3_RELEASE.xml │ ├── Maven__org_springframework_spring_web_5_2_3_RELEASE.xml │ ├── Maven__com_baomidou_mybatis_plus_annotation_3_1_1.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_engine_5_5_2.xml │ ├── Maven__org_junit_jupiter_junit_jupiter_params_5_5_2.xml │ ├── Maven__org_springframework_spring_core_5_2_3_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_5_2_3_RELEASE.xml │ ├── Maven__org_springframework_spring_test_5_2_3_RELEASE.xml │ ├── Maven__org_junit_platform_junit_platform_engine_1_5_2.xml │ ├── Maven__org_springframework_spring_beans_5_2_3_RELEASE.xml │ ├── Maven__com_baomidou_mybatis_plus_boot_starter_3_1_1.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_30.xml │ ├── Maven__org_springframework_spring_webmvc_5_2_3_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_10_2.xml │ ├── Maven__jakarta_activation_jakarta_activation_api_1_2_1.xml │ ├── Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml │ ├── Maven__jakarta_validation_jakarta_validation_api_2_0_2.xml │ ├── Maven__org_junit_platform_junit_platform_commons_1_5_2.xml │ ├── Maven__org_springframework_boot_spring_boot_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_spring_context_5_2_3_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_10_2.xml │ ├── Maven__org_springframework_spring_expression_5_2_3_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_30.xml │ ├── Maven__org_springframework_boot_spring_boot_test_2_2_4_RELEASE.xml │ ├── Maven__org_hibernate_validator_hibernate_validator_6_0_18_Final.xml │ ├── Maven__org_springframework_data_spring_data_redis_2_2_4_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_10_2.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_1_2.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_commons_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_spring_context_support_5_2_3_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_10_2.xml │ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml │ ├── Maven__org_springframework_data_spring_data_keyvalue_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_web_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_jdbc_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_json_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_mail_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_test_2_2_4_RELEASE.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_1_2.xml │ ├── Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_10_2.xml │ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_data_redis_2_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_validation_2_2_4_RELEASE.xml │ └── Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_2_4_RELEASE.xml ├── compiler.xml ├── $CACHE_FILE$ ├── misc.xml └── jarRepositories.xml ├── src ├── main │ ├── resources │ │ ├── static │ │ │ └── images │ │ │ │ └── dgut.jpeg │ │ ├── log4j.properties │ │ ├── redisConfig.properties │ │ ├── mybatis │ │ │ ├── BedMapper.xml │ │ │ ├── PatientMapper.xml │ │ │ ├── DoctorMapper.xml │ │ │ ├── ArrangeMapper.xml │ │ │ └── OrderMapper.xml │ │ └── application.yml │ └── java │ │ └── com │ │ └── dgut │ │ ├── mapper │ │ ├── DrugMapper.java │ │ ├── CheckMapper.java │ │ ├── AdminMapper.java │ │ ├── BedMapper.java │ │ ├── PatientMapper.java │ │ ├── ArrangeMapper.java │ │ ├── DoctorMapper.java │ │ └── OrderMapper.java │ │ ├── service │ │ ├── ArrangeService.java │ │ ├── AdminService.java │ │ ├── CheckService.java │ │ ├── DrugService.java │ │ ├── BedService.java │ │ ├── PatientService.java │ │ ├── serviceImpl │ │ │ ├── ArrangeServiceImpl.java │ │ │ ├── CheckServiceImpl.java │ │ │ ├── DrugServiceImpl.java │ │ │ ├── AdminServiceImpl.java │ │ │ ├── BedServiceImpl.java │ │ │ ├── PatientServiceImpl.java │ │ │ └── OrderServiceImpl.java │ │ ├── DoctorService.java │ │ └── OrderService.java │ │ ├── utils │ │ ├── Md5Util.java │ │ ├── RandomUtil.java │ │ ├── ResponseData.java │ │ ├── EmailUtil.java │ │ ├── JwtUtil.java │ │ ├── TodayUtil.java │ │ └── PdfUtil.java │ │ ├── Application.java │ │ ├── pojo │ │ ├── Checks.java │ │ ├── Arrange.java │ │ ├── Drug.java │ │ ├── Admin.java │ │ ├── Bed.java │ │ ├── Patient.java │ │ ├── Orders.java │ │ └── Doctor.java │ │ ├── MyBatisPlusConfig.java │ │ ├── config │ │ ├── InterceptorConfig.java │ │ └── JedisConfig.java │ │ ├── controller │ │ ├── ArrangeController.java │ │ ├── CheckController.java │ │ ├── DrugController.java │ │ ├── BedController.java │ │ ├── OrderController.java │ │ ├── DoctorController.java │ │ ├── PatientController.java │ │ └── AdminController.java │ │ └── interceptors │ │ └── JwtInterceptor.java └── test │ └── java │ └── com │ └── dgut │ └── TestArrange.java ├── README.md └── pom.xml /.idea/.name: -------------------------------------------------------------------------------- 1 | hospital -------------------------------------------------------------------------------- /src/main/resources/static/images/dgut.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/small-bears/hospital/HEAD/src/main/resources/static/images/dgut.jpeg -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/DrugMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Drug; 5 | 6 | public interface DrugMapper extends BaseMapper { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/CheckMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Checks; 5 | 6 | public interface CheckMapper extends BaseMapper { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=DEBUG,A1 2 | 3 | log4j.appender.A1=org.apache.log4j.ConsoleAppender 4 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.A1.layout.ConversionPattern=[%t] [%c]-[%p] %m%n -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/AdminMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Admin; 5 | 6 | 7 | public interface AdminMapper extends BaseMapper { 8 | } 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/BedMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Bed; 5 | 6 | public interface BedMapper extends BaseMapper { 7 | /** 8 | * 统计今天住院人数 9 | */ 10 | int bedPeople(String bStart); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/redisConfig.properties: -------------------------------------------------------------------------------- 1 | 2 | redis.host=127.0.0.1 3 | 4 | redis.port=6379 5 | 6 | #redis.password= 7 | 8 | redis.database=0 9 | 10 | redis.timeout=30000 11 | 12 | redis.maxTotal=60 13 | 14 | redis.maxIdle=10 15 | 16 | redis.minIdle=8 17 | 18 | redis.maxWaitMillis=1500 19 | 20 | redis.testOnBorrow=true 21 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/ArrangeService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Arrange; 4 | 5 | import java.util.List; 6 | 7 | public interface ArrangeService { 8 | /** 9 | * 根据日期查询排班信息 10 | */ 11 | List findByTime(String arTime, String dSection); 12 | /** 13 | * 增加排班信息 14 | */ 15 | Boolean addArrange(Arrange arrange); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/PatientMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Patient; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | public interface PatientMapper extends BaseMapper { 8 | /** 9 | * 统计患者男女人数 10 | */ 11 | Integer patientAge(@Param("startAge") int startAge, @Param("endAge") int endAge); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/BedMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/utils/Md5Util.java: -------------------------------------------------------------------------------- 1 | package com.dgut.utils; 2 | 3 | import org.springframework.util.DigestUtils; 4 | 5 | public class Md5Util { 6 | 7 | //盐,用于混交md5 8 | private static String salt = "asdwqAsd12_qS"; 9 | 10 | public static String getMD5(String str) { 11 | String base = str + "/" + salt; 12 | String md5 = DigestUtils.md5DigestAsHex(base.getBytes()); 13 | return md5; 14 | } 15 | 16 | 17 | } -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/AdminService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Admin; 4 | 5 | public interface AdminService { 6 | /** 7 | * 登录数据校验 8 | * */ 9 | Admin login(int aId, String aPassword); 10 | /** 11 | * 找回密码服务 12 | */ 13 | Boolean findPassword(String aEmail, String aPassword, String code); 14 | /** 15 | * 发送邮件 16 | */ 17 | Boolean sendEmail(String aEmail); 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/PatientMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/ArrangeMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Arrange; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface ArrangeMapper extends BaseMapper { 10 | 11 | /** 12 | * 根据日期查询排班信息 13 | */ 14 | List findByTime(@Param("ar_time") String arTime, @Param("d_section") String dSection); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/DoctorMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Doctor; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface DoctorMapper extends BaseMapper { 10 | 11 | List findDoctorBySection(String dSection); 12 | /** 13 | * 用户评价 14 | */ 15 | Boolean updateStar(@Param("dId")int dId, @Param("dStar")Double dStar); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/utils/RandomUtil.java: -------------------------------------------------------------------------------- 1 | package com.dgut.utils; 2 | 3 | import java.util.Random; 4 | 5 | public class RandomUtil { 6 | public static Integer randomOid(int oId){ 7 | int flag = new Random().nextInt(9999); 8 | if (flag < 1000) 9 | flag += 1000; 10 | return oId+flag; 11 | } 12 | public static Integer randomCode(){ 13 | int flag = new Random().nextInt(999999); 14 | if (flag < 100000) 15 | flag += 100000; 16 | return flag; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__log4j_log4j_1_2_17.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_3_15.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__stax_stax_api_1_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_yaml_snakeyaml_1_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__redis_clients_jedis_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_auth0_java_jwt_3_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_3_5_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_zaxxer_HikariCP_3_4_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_json_smart_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_objenesis_objenesis_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_guava_guava_16_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_itextpdf_itextpdf_5_5_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_classmate_1_5_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_ooxml_3_15.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__cn_afterturn_easypoi_web_3_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_itextpdf_itext_asian_5_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_core_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_10_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_core_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_projectlombok_lombok_1_18_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_6_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__cn_afterturn_easypoi_base_3_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_sun_mail_jakarta_mail_1_6_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_7_30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/CheckService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Checks; 4 | 5 | import java.util.HashMap; 6 | 7 | public interface CheckService { 8 | /** 9 | * 分页模糊查询所有检查信息 10 | */ 11 | HashMap findAllChecks(int pageNumber, int size, String query); 12 | /** 13 | * 根据id查找药物 14 | */ 15 | Checks findCheck(int chId); 16 | /** 17 | * 增加检查信息 18 | */ 19 | Boolean addCheck(Checks checks); 20 | /** 21 | * 删除检查信息 22 | */ 23 | Boolean deleteCheck(int chId); 24 | /** 25 | * 修改检查信息 26 | */ 27 | Boolean modifyCheck(Checks checks); 28 | } 29 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_virtuald_curvesapi_1_04.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_codec_commons_codec_1_13.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_xmlbeans_xmlbeans_2_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_assertj_assertj_core_3_13_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/Application.java: -------------------------------------------------------------------------------- 1 | package com.dgut; 2 | 3 | import com.dgut.mapper.ArrangeMapper; 4 | import com.dgut.pojo.Arrange; 5 | import org.junit.Test; 6 | import org.mybatis.spring.annotation.MapperScan; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | 11 | import java.util.List; 12 | 13 | @MapperScan("com.dgut.mapper") 14 | @SpringBootApplication 15 | public class Application { 16 | public static void main(String[] args) { 17 | SpringApplication.run(Application.class, args); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_spring_2_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_jsqlparser_jsqlparser_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Checks.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | @TableName(value = "checks") 14 | public class Checks { 15 | @TableId(value = "ch_id") 16 | @JsonProperty("chId") 17 | private int chId; 18 | @JsonProperty("chName") 19 | private String chName; 20 | @JsonProperty("chPrice") 21 | private Double chPrice; 22 | } 23 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__mysql_mysql_connector_java_8_0_19.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_core_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_pool2_2_7_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_poi_poi_ooxml_schemas_3_15.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_10_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__cn_afterturn_easypoi_annotation_3_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/DoctorMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 9 | 10 | update doctor set d_people = d_people+1,d_star = d_star+#{dStar},d_avg_star=d_star/d_people where d_id = #{dId} 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_api_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_junit_jupiter_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_extension_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_10_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_sun_activation_jakarta_activation_1_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_collections4_4_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_4_1_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_validation_validation_api_2_0_1_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jcl_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_oxm_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_web_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_annotation_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_engine_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_jupiter_junit_jupiter_params_5_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jdbc_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/DrugService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Drug; 4 | 5 | import java.util.HashMap; 6 | 7 | public interface DrugService { 8 | /** 9 | * 分页模糊查询所有药物信息 10 | */ 11 | HashMap findAllDrugs(int pageNumber, int size, String query); 12 | /** 13 | * 根据id查找药物 14 | */ 15 | Drug findDrug(int drId); 16 | /** 17 | * 根据id删除药物数量 18 | */ 19 | Boolean reduceDrugNumber(int drId,int usedNumber); 20 | /** 21 | * 增加药物信息 22 | */ 23 | Boolean addDrug(Drug drug); 24 | /** 25 | * 删除药物信息 26 | */ 27 | Boolean deleteDrug(int drId); 28 | /** 29 | * 修改药物信息 30 | */ 31 | Boolean modifyDrug(Drug drug); 32 | } 33 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_platform_junit_platform_engine_1_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_baomidou_mybatis_plus_boot_starter_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_webmvc_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_10_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_activation_jakarta_activation_api_1_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_validation_jakarta_validation_api_2_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_junit_platform_junit_platform_commons_1_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_10_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/MyBatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.dgut; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor; 4 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class MyBatisPlusConfig { 10 | /** 11 | * 配置分页插件 12 | */ 13 | @Bean 14 | public PaginationInterceptor paginationInterceptor(){ 15 | return new PaginationInterceptor(); 16 | } 17 | /** 18 | * 配置乐观锁插件 19 | */ 20 | @Bean 21 | public OptimisticLockerInterceptor optimisticLockerInterceptor(){ 22 | return new OptimisticLockerInterceptor(); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hibernate_validator_hibernate_validator_6_0_18_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_redis_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_10_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_2_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_support_5_2_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Arrange.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @TableName("arrange") 15 | public class Arrange { 16 | @TableId(value = "ar_id") 17 | @JsonProperty("arId") 18 | private String arId; 19 | @JsonProperty("arTime") 20 | private String arTime; 21 | @JsonProperty("dId") 22 | private int dId; 23 | /** 24 | * 多表查询用 25 | */ 26 | @TableField(exist = false) 27 | private Doctor doctor; 28 | } 29 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_10_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_keyvalue_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Drug.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | @TableName("drug") 14 | public class Drug { 15 | @TableId(value = "dr_id") 16 | @JsonProperty("drId") 17 | private int drId; 18 | @JsonProperty("drName") 19 | private String drName; 20 | @JsonProperty("drPrice") 21 | private double drPrice; 22 | @JsonProperty("drNumber") 23 | private int drNumber; 24 | @JsonProperty("drUnit") 25 | private String drUnit; 26 | @JsonProperty("drPublisher") 27 | private String drPublisher; 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8081 3 | 4 | 5 | spring: 6 | # 数据库驱动: 7 | datasource: 8 | driver-class-name: com.mysql.cj.jdbc.Driver 9 | # 数据库连接地址 10 | url: jdbc:mysql://localhost:3306/hospital?characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true 11 | # 数据库用户名&密码: 12 | username: root 13 | password: root 14 | #redis连接 15 | # redis: 16 | # host: 127.0.0.1 17 | # password: 090707 18 | # port: 6379 19 | 20 | 21 | 22 | 23 | #邮箱依赖 24 | mail: 25 | host: smtp.qq.com 26 | username: 1306931167@qq.com #自己的邮箱账号 27 | password: wnwlvjgwdbnrgbdj #这个不是登录密码而是163授权登录的密码 28 | default-encoding: UTF-8 29 | 30 | # mybatis扫描文件 31 | mybatis-plus: 32 | mapper-locations: classpath*:mybatis/*.xml 33 | configuration: 34 | map-underscore-to-camel-case: true 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_mail_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_2_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_10_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/config/InterceptorConfig.java: -------------------------------------------------------------------------------- 1 | package com.dgut.config; 2 | 3 | import com.dgut.interceptors.JwtInterceptor; 4 | import org.springframework.stereotype.Component; 5 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 6 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 7 | 8 | @Component 9 | public class InterceptorConfig implements WebMvcConfigurer { 10 | @Override 11 | public void addInterceptors(InterceptorRegistry registry) { 12 | registry.addInterceptor(new JwtInterceptor()) 13 | // .addPathPatterns("/admin/**") 14 | // .addPathPatterns("/patient/**") 15 | // .addPathPatterns("/doctor/**") 16 | .addPathPatterns("/666") 17 | .excludePathPatterns("/patient/pdf") 18 | .excludePathPatterns("/**/login"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_redis_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_validation_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Admin.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | @TableName("admini") 14 | public class Admin { 15 | @TableId(value = "a_id") 16 | @JsonProperty("aId") 17 | private int aId; 18 | @JsonProperty("aPassword") 19 | private String aPassword; 20 | @JsonProperty("aName") 21 | private String aName; 22 | @JsonProperty("aGender") 23 | private String aGender; 24 | @JsonProperty("aCard") 25 | private String aCard; 26 | @JsonProperty("aEmail") 27 | private String aEmail; 28 | @JsonProperty("aPhone") 29 | private String aPhone; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Bed.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.Version; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @TableName("bed") 15 | public class Bed { 16 | @TableId(value = "b_id") 17 | @JsonProperty("bId") 18 | private int bId; 19 | @JsonProperty("pId") 20 | private int pId; 21 | @JsonProperty("dId") 22 | private int dId; 23 | @JsonProperty("bState") 24 | private Integer bState; 25 | @JsonProperty("bStart") 26 | private String bStart; 27 | @JsonProperty("bReason") 28 | private String bReason; 29 | @Version 30 | private Integer version; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/utils/ResponseData.java: -------------------------------------------------------------------------------- 1 | package com.dgut.utils; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class ResponseData implements Serializable { 13 | /** 14 | * 表示当前相应的状态是成功或者失败 15 | */ 16 | private int status; 17 | /** 18 | * 表示当响应之后给前端的提示信息 19 | */ 20 | private String msg; 21 | /** 22 | * 表示当响应成功之后返回给前端的数据 23 | */ 24 | private Object data; 25 | 26 | 27 | public static ResponseData success(String msg, Object data) { 28 | return new ResponseData(200, msg, data); 29 | } 30 | 31 | public static ResponseData fail(String msg) { 32 | return new ResponseData(400, msg, null); 33 | } 34 | 35 | public static ResponseData success(String msg) { 36 | return new ResponseData(200, msg, null); 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/BedService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Bed; 4 | 5 | import java.util.HashMap; 6 | import java.util.List; 7 | 8 | public interface BedService { 9 | /** 10 | * 查找所有空床位 11 | */ 12 | List findNullBed(); 13 | /** 14 | * 更新床位信息 15 | */ 16 | Boolean updateBed(Bed bed); 17 | /** 18 | * 根据pId查询住院信息 19 | */ 20 | List findBedByPid(int pId); 21 | /** 22 | * 分页模糊查询所有床位信息 23 | */ 24 | HashMap findAllBeds(int pageNumber, int size, String query); 25 | /** 26 | * 根据id查找床位 27 | */ 28 | Bed findBed(int bId); 29 | /** 30 | * 增加床位信息 31 | */ 32 | Boolean addBed(Bed bed); 33 | /** 34 | * 删除床位信息 35 | */ 36 | Boolean deleteBed(int bId); 37 | /** 38 | * 清空床位信息 39 | */ 40 | Boolean emptyBed(int bId); 41 | /** 42 | * 统计今天住院人数 43 | */ 44 | int bedPeople(String bStart); 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/PatientService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Patient; 4 | 5 | import java.util.HashMap; 6 | import java.util.List; 7 | 8 | public interface PatientService { 9 | /** 10 | * 登录数据校验 11 | * */ 12 | Patient login(int pId, String pPassword); 13 | /** 14 | * 分页模糊查询所有患者信息 15 | */ 16 | HashMap findAllPatients(int pageNumber, int size, String query); 17 | /** 18 | * 删除患者信息 19 | */ 20 | Boolean deletePatient(int pId); 21 | /** 22 | * 根据患者id查询患者信息 23 | */ 24 | Patient findPatientById(int pId); 25 | /** 26 | * 找回密码服务 27 | */ 28 | Boolean findPassword(String pEmail, String pPassword, String code); 29 | /** 30 | * 发送邮件 31 | */ 32 | Boolean sendEmail(String pEmail); 33 | /** 34 | * 增加患者信息 35 | */ 36 | Boolean addPatient(Patient patient); 37 | /** 38 | * 统计患者男女人数 39 | */ 40 | List patientAge(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/utils/EmailUtil.java: -------------------------------------------------------------------------------- 1 | package com.dgut.utils; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.mail.SimpleMailMessage; 5 | import org.springframework.mail.javamail.JavaMailSender; 6 | 7 | public class EmailUtil { 8 | @Autowired 9 | private JavaMailSender javaMailSender;//邮箱 10 | 11 | public void sendMail(String to, Integer code) { 12 | SimpleMailMessage message = new SimpleMailMessage(); 13 | message.setFrom("1306931167@qq.com"); //发送者 14 | message.setTo(to); //接受者 15 | //message.setCc("hinschan1998@163.com"); //抄送,填发送者的邮箱即可 16 | message.setSubject("大朗医院找回密码服务"); //主题 17 | message.setText("尊敬的用户!你的验证码为 "+ code +" ,有效期为2分钟!"); //内容 18 | try { 19 | this.javaMailSender.send(message); 20 | System.out.println("简单邮件已经发送"); 21 | } catch (Exception e) { 22 | System.out.println("发送简单邮件时发生异常!" + e.toString()); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/com/dgut/TestArrange.java: -------------------------------------------------------------------------------- 1 | package com.dgut; 2 | 3 | import com.dgut.mapper.OrderMapper; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.test.context.SpringBootTest; 8 | import org.springframework.test.context.junit4.SpringRunner; 9 | 10 | @RunWith(SpringRunner.class) 11 | @SpringBootTest 12 | public class TestArrange { 13 | 14 | @Autowired 15 | private OrderMapper orderMapper; 16 | @Test 17 | public void contextLoads() { 18 | String date = "2021-04-01"; 19 | String substring = date.substring(0, 4); 20 | int i = Integer.parseInt(substring); 21 | System.out.println(i); 22 | } 23 | 24 | public synchronized void aaa() throws InterruptedException { 25 | System.out.println("资源正在被占用"); 26 | Thread.sleep(3000); 27 | } 28 | @Test 29 | public void testAAA() throws InterruptedException { 30 | for (int i = 0;i<10;i++){ 31 | aaa(); 32 | } 33 | } 34 | 35 | 36 | 37 | 38 | } -------------------------------------------------------------------------------- /.idea/$CACHE_FILE$: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Control flow issuesJava 10 | 11 | 12 | Java 13 | 14 | 15 | Kotlin 16 | 17 | 18 | Numeric issuesJava 19 | 20 | 21 | PerformanceJava 22 | 23 | 24 | Style issuesKotlin 25 | 26 | 27 | Threading issuesJava 28 | 29 | 30 | 31 | 32 | Android 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 17 | 19 | 20 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/utils/JwtUtil.java: -------------------------------------------------------------------------------- 1 | package com.dgut.utils; 2 | 3 | import com.auth0.jwt.JWT; 4 | import com.auth0.jwt.JWTCreator; 5 | import com.auth0.jwt.algorithms.Algorithm; 6 | import com.auth0.jwt.interfaces.DecodedJWT; 7 | 8 | import java.util.Calendar; 9 | import java.util.Map; 10 | 11 | public class JwtUtil { 12 | private static String SIGNAL = "1HU&**UUY**(GNH"; 13 | /** 14 | * 生成token 15 | */ 16 | public static String getToken(Map map){ 17 | Calendar instance = Calendar.getInstance(); 18 | instance.add(Calendar.DATE, 30); //设置过期时间为30天 19 | 20 | //创建jwt builder 21 | final JWTCreator.Builder builder = JWT.create(); 22 | //payload 23 | map.forEach((k,v)->{ 24 | builder.withClaim(k,v); 25 | }); 26 | String token = builder.withExpiresAt(instance.getTime())//指定令牌过期时间 27 | .sign(Algorithm.HMAC256(SIGNAL));//sign 28 | return token; 29 | } 30 | 31 | public static DecodedJWT verify(String token){ 32 | return JWT.require(Algorithm.HMAC256(SIGNAL)).build().verify(token); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Patient.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | @TableName("patient") 14 | public class Patient { 15 | @TableId(value = "p_id") 16 | @JsonProperty("pId") 17 | private int pId; 18 | @JsonProperty("pPassword") 19 | //@TableField(select = false) 20 | private String pPassword; 21 | @JsonProperty("pName") 22 | private String pName; 23 | @JsonProperty("pGender") 24 | private String pGender; 25 | @JsonProperty("pCard") 26 | private String pCard; 27 | @JsonProperty("pEmail") 28 | private String pEmail; 29 | @JsonProperty("pPhone") 30 | private String pPhone; 31 | @JsonProperty("pState") 32 | private Integer pState; 33 | @JsonProperty("pBirthday") 34 | private String pBirthday; 35 | @JsonProperty("pAge") 36 | private Integer pAge; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.dgut.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.dgut.pojo.Orders; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | public interface OrderMapper extends BaseMapper { 10 | /** 11 | * 统计今天挂号人数 12 | */ 13 | int orderPeople(String oStart); 14 | /** 15 | * 统计今天某个医生挂号人数 16 | */ 17 | int orderPeopleByDid(@Param("o_start") String oStart, @Param("d_id") int dId); 18 | /** 19 | * 统计挂号男女人数 20 | */ 21 | List orderGender(); 22 | /** 23 | * 根据挂号单号查询挂号 24 | */ 25 | Orders findOrderByOid(int oId); 26 | /** 27 | * 增加诊断及医生意见 28 | */ 29 | Integer updateOrderByAdd(Orders order); 30 | /** 31 | * 统计过去20天挂号科室人数 32 | */ 33 | List orderSection(@Param("startTime") String startTime, @Param("endTime") String endTime); 34 | /** 35 | * 查看当天挂号列表 36 | */ 37 | List findOrderByNull(@Param("dId") int dId, @Param("oStart") String oStart); 38 | /** 39 | * 根据pId查询挂号 40 | */ 41 | List findOrderByPid(int pId); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/ArrangeController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.pojo.Arrange; 4 | import com.dgut.service.ArrangeService; 5 | import com.dgut.utils.ResponseData; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RestController 12 | @RequestMapping("/arrange") 13 | public class ArrangeController { 14 | @Autowired 15 | private ArrangeService arrangeService; 16 | /** 17 | * 根据日期查询排班信息 18 | */ 19 | @RequestMapping("findByTime") 20 | public ResponseData findByTime(@RequestParam(value = "arTime") String arTime, @RequestParam(value = "dSection") String dSection) { 21 | return ResponseData.success("根据日期查询排班信息成功", this.arrangeService.findByTime(arTime, dSection)); 22 | } 23 | /** 24 | * 增加排班信息 25 | */ 26 | @RequestMapping("addArrange") 27 | public ResponseData addArrange(Arrange arrange){ 28 | if (this.arrangeService.addArrange(arrange)) 29 | return ResponseData.success("增加排班信息成功"); 30 | return ResponseData.fail("该医生该日已排班"); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/ArrangeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/serviceImpl/ArrangeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service.serviceImpl; 2 | 3 | import com.dgut.mapper.ArrangeMapper; 4 | import com.dgut.pojo.Arrange; 5 | import com.dgut.service.ArrangeService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | import redis.clients.jedis.Jedis; 9 | import redis.clients.jedis.JedisPool; 10 | 11 | import java.util.HashMap; 12 | import java.util.List; 13 | 14 | @Service("ArrangeService") 15 | public class ArrangeServiceImpl implements ArrangeService { 16 | @Autowired 17 | private ArrangeMapper arrangeMapper; 18 | @Autowired 19 | private JedisPool jedisPool;//redis连接池 20 | 21 | /** 22 | * 根据日期查询排班信息 23 | */ 24 | @Override 25 | public List findByTime(String arTime, String dSection) { 26 | return this.arrangeMapper.findByTime(arTime, dSection); 27 | } 28 | /** 29 | * 增加排班信息 30 | */ 31 | public Boolean addArrange(Arrange arrange){ 32 | Arrange arrange1 = this.arrangeMapper.selectById(arrange.getArId()); 33 | Jedis jedis = jedisPool.getResource(); 34 | HashMap map = new HashMap<>(); 35 | map.put("eTOn","40"); 36 | map.put("nTOt","40"); 37 | map.put("tTOe","40"); 38 | map.put("fTOf","40"); 39 | map.put("fTOs","40"); 40 | map.put("sTOs","40"); 41 | if (arrange1 == null) { 42 | //redis操作开始 43 | jedis.hset(arrange.getArId(), map); 44 | jedis.expire(arrange.getArId(), 604800); 45 | //redis操作结束 46 | this.arrangeMapper.insert(arrange); 47 | return true; 48 | } 49 | return false; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/interceptors/JwtInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.dgut.interceptors; 2 | 3 | import com.auth0.jwt.exceptions.AlgorithmMismatchException; 4 | import com.auth0.jwt.exceptions.SignatureVerificationException; 5 | import com.auth0.jwt.exceptions.TokenExpiredException; 6 | import com.dgut.utils.JwtUtil; 7 | import com.fasterxml.jackson.databind.ObjectMapper; 8 | import org.springframework.web.servlet.HandlerInterceptor; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.util.HashMap; 13 | import java.util.Map; 14 | 15 | public class JwtInterceptor implements HandlerInterceptor { 16 | @Override 17 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 18 | Map map = new HashMap<>(); 19 | //获取请求头中的令牌 20 | String token = request.getHeader("token"); 21 | try { 22 | JwtUtil.verify(token);//验证令牌 23 | return true; 24 | }catch (SignatureVerificationException e){ 25 | e.printStackTrace(); 26 | map.put("msg", "无效签名!"); 27 | }catch (TokenExpiredException e){ 28 | e.printStackTrace(); 29 | map.put("msg", "token过期!"); 30 | }catch (AlgorithmMismatchException e){ 31 | e.printStackTrace(); 32 | map.put("msg", "token算法不一致!"); 33 | }catch (Exception e){ 34 | e.printStackTrace(); 35 | map.put("msg", "token无效!"); 36 | } 37 | map.put("state", false); 38 | String json = new ObjectMapper().writeValueAsString(map); 39 | response.setContentType("application/json;charset=UTF-8"); 40 | response.getWriter().println(json); 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/utils/TodayUtil.java: -------------------------------------------------------------------------------- 1 | package com.dgut.utils; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Calendar; 5 | import java.util.Date; 6 | 7 | public class TodayUtil { 8 | 9 | public static String getToday(){ 10 | Calendar calendar = Calendar.getInstance(); 11 | String year = String.valueOf(calendar.get(Calendar.YEAR)); 12 | String month = String.valueOf(calendar.get(Calendar.MONTH)+1); 13 | String date = String.valueOf(calendar.get(Calendar.DATE)); 14 | String day = String.valueOf(calendar.get(Calendar.HOUR_OF_DAY)); 15 | String minute = String.valueOf(calendar.get(Calendar.MINUTE)); 16 | String second = String.valueOf(calendar.get(Calendar.SECOND)); 17 | if(calendar.get(Calendar.MONTH)+1 < 10) 18 | month = "0"+month; 19 | if(calendar.get(Calendar.DATE) < 10) 20 | date = "0"+date; 21 | return year+"-"+month+"-"+date+" "+day+":"+minute+":"+second; 22 | } 23 | public static String getTodayYmd(){ 24 | Calendar calendar = Calendar.getInstance(); 25 | Date today = calendar.getTime(); 26 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); 27 | String result = format.format(today); 28 | return result; 29 | } 30 | //获取过去的第past天 31 | public static String getPastDate(int past) { 32 | Calendar calendar = Calendar.getInstance(); 33 | //System.out.println(calendar.get(Calendar.DAY_OF_YEAR)); 34 | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - past); 35 | Date today = calendar.getTime(); 36 | //System.out.println(today); 37 | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); 38 | String result = format.format(today); 39 | return result; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/DoctorService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Doctor; 4 | import org.springframework.web.multipart.MultipartFile; 5 | 6 | import javax.servlet.http.HttpServletResponse; 7 | import java.io.IOException; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | 11 | public interface DoctorService { 12 | /** 13 | * 登录数据校验 14 | * */ 15 | Doctor login(int dId, String dPassword); 16 | /** 17 | * 分页模糊查询所有医生信息 18 | */ 19 | HashMap findAllDoctors(int pageNumber, int size, String query); 20 | /** 21 | * 根据id查找医生 22 | */ 23 | Doctor findDoctor(int dId); 24 | /** 25 | * 增加医生信息 26 | */ 27 | Boolean addDoctor(Doctor doctor); 28 | /** 29 | * 删除医生信息 30 | */ 31 | Boolean deleteDoctor(int dId); 32 | /** 33 | * 修改医生信息 34 | */ 35 | Boolean modifyDoctor(Doctor doctor); 36 | /** 37 | * 根据科室查询所有医生信息 38 | */ 39 | HashMap findDoctorBySection(String dSection); 40 | /** 41 | * 分页根据科室查询所有医生信息 42 | */ 43 | HashMap findDoctorBySectionPage(int pageNumber, int size, String query, String dSection); 44 | /** 45 | * 找回密码服务 46 | */ 47 | Boolean findPassword(String dEmail, String dPassword, String code); 48 | /** 49 | * 发送邮件 50 | */ 51 | Boolean sendEmail(String dEmail); 52 | /** 53 | * 用户评价 54 | */ 55 | Boolean updateStar(int dId, Double dStar); 56 | /** 57 | * 上传Excel导入数据 58 | */ 59 | Boolean uploadExcel(MultipartFile multipartFile) throws Exception; 60 | /** 61 | * Excel导出数据 62 | */ 63 | Boolean downloadExcel(HttpServletResponse response) throws IOException; 64 | /** 65 | * 查询所有医生不分页 66 | */ 67 | List findAll(); 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service; 2 | 3 | import com.dgut.pojo.Orders; 4 | 5 | import java.util.HashMap; 6 | import java.util.List; 7 | 8 | public interface OrderService { 9 | /** 10 | * 分页模糊查询所有挂号信息 11 | */ 12 | HashMap findAllOrders(int pageNumber, int size, String query); 13 | /** 14 | * 真正删除挂号信息 15 | */ 16 | Boolean deleteOrder(int oId); 17 | /** 18 | * 增加挂号信息 19 | */ 20 | Boolean addOrder(Orders order, String arId); 21 | /** 22 | * 根据pId查询挂号 23 | */ 24 | List findOrderByPid(int pId) ; 25 | /** 26 | * 查看当天挂号列表 27 | */ 28 | List findOrderByNull(int dId, String oStart) ; 29 | /** 30 | * 根据id更新挂号信息 31 | */ 32 | Boolean updateOrder(Orders orders); 33 | /** 34 | * 根据id设置缴费状态 35 | */ 36 | Boolean updatePrice(int oId); 37 | /** 38 | * 查找医生已完成的挂号单 39 | */ 40 | HashMap findOrderFinish(int pageNumber, int size, String query, int dId) ; 41 | /** 42 | * 根据dId查询挂号 43 | */ 44 | HashMap findOrderByDid(int pageNumber, int size, String query, int dId) ; 45 | /** 46 | * 统计今天挂号人数 47 | */ 48 | int orderPeople(String oStart); 49 | /** 50 | * 统计今天某个医生挂号人数 51 | */ 52 | int orderPeopleByDid(String oStart, int dId); 53 | /** 54 | * 统计挂号男女人数 55 | */ 56 | List orderGender(); 57 | /** 58 | * 增加诊断及医生意见 59 | */ 60 | Boolean updateOrderByAdd(Orders order); 61 | /** 62 | * 判断诊断之后再次购买药物是否已缴费 63 | */ 64 | Boolean findTotalPrice(int oId); 65 | /** 66 | * 请求挂号时间段 67 | */ 68 | HashMap findOrderTime(String arId); 69 | /** 70 | * 统计过去20天挂号科室人数 71 | */ 72 | List orderSection(); 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Orders.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | @Data 12 | @AllArgsConstructor 13 | @NoArgsConstructor 14 | @TableName("orders") 15 | public class Orders { 16 | @TableId(value = "o_id") 17 | @JsonProperty("oId") 18 | private int oId; 19 | @JsonProperty("pId") 20 | private int pId; 21 | @JsonProperty("dId") 22 | private int dId; 23 | @JsonProperty("oRecord") 24 | private String oRecord; 25 | @JsonProperty("oStart") 26 | private String oStart; 27 | @JsonProperty("oEnd") 28 | private String oEnd; 29 | @JsonProperty("oState") 30 | private Integer oState; 31 | @JsonProperty("oDrug") 32 | private String oDrug; 33 | @JsonProperty("oCheck") 34 | private String oCheck; 35 | @JsonProperty("oTotalPrice") 36 | private Double oTotalPrice; 37 | @JsonProperty("oPriceState") 38 | private Integer oPriceState; 39 | @JsonProperty("countGender") 40 | @TableField(exist = false) 41 | private Integer countGender; 42 | @JsonProperty("oAdvice") 43 | private String oAdvice; 44 | //多表查询用 45 | @TableField(exist = false)//声明不是数据库里面的字段 46 | private Doctor doctor; 47 | //多表查询用 48 | @TableField(exist = false)//声明不是数据库里面的字段 49 | private Patient patient; 50 | @TableField(exist = false) 51 | private Integer countSection; 52 | @JsonProperty("dName") 53 | @TableField(exist = false) 54 | private String dName; 55 | @JsonProperty("pName") 56 | @TableField(exist = false) 57 | private String pName; 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 联系方式(微信扫一扫): 2 | 2fc79856-4bde-42f0-a5ea-83281867fbbe 3 | 4 | ### 计算机毕设定制(直接点击链接):https://www.yuque.com/techninja/code/xrpvpxbu3y8fa3ey?singleDoc# 5 | 6 | ## 一、获取地址: 7 | 8 | #### 项目获取地址:https://www.666bear.com/1771.html 9 | #### 项目演示地址:https://www.bilibili.com/video/BV1uT411S78M/?spm_id_from=333.999.0.0 10 | **博主介绍:✌全网粉丝20W+,csdn特邀作者、Java领域优质创作者、csdn/掘金/哔哩哔哩/知乎/道客/小红书等平台优质作者,计算机毕设实战导师,目前专注于大学生项目实战开发,讲解,毕业答疑辅导✌工作室接计算机毕业设计程序开发、论文代写、代码讲解、出售成品源码等毕设服务,专业靠谱~** 11 | 12 | #### 作者QQ:3289948684 微信:bys7626 (支持修改、 部署调试、 代做接毕业设计和课程设计) 13 | 14 | #### 接网站建设、小程序、H5、APP、各种系统、样式修改等 15 | 16 | #### 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 都可以做 17 | 18 | #### 有需求尽管甩过来!一条龙帮你安心过! 19 | 20 | #### 所有项目以及源代码本人均调试运行无问题 可支持远程调试运行 21 | 22 | 23 | 24 | ## 一、 项目介绍 25 | (协同过滤推荐算法+AI智能助手)基于SpringBoot的医院管理系统分为前台患者及后台模块(管理员、医生),具体功能如下: 26 | 27 | (1) 前台患者:系统首页、科室信息、药品信息、医疗资讯、购物车、智能 AI 对话、个人中心(含修改密码、预约挂号、取消预约、就诊信息、病历信息、开具处方、费用信息、我的订单、我的地址、我的收藏) 28 | 29 | (2) 管理员(后台模块):系统首页、个人中心、患者管理、医生管理、科室类型管理、科室信息管理、预约挂号管理、取消预约管理、就诊信息管理、病历信息管理、开具处方管理、药品分类管理、药品信息管理、药品采购管理、排班信息管理、费用信息管理、充值记录管理、系统管理、订单管理 30 | 31 | (3) 医生(后台模块):个人中心、科室信息管理、预约挂号管理、取消预约管理、就诊信息管理、病历信息管理、开具处方管理、药品信息管理、排班信息管理 32 | ## 二、视频演示 33 | 34 | https://www.bilibili.com/video/BV1TpCeBmEEi/?spm_id_from=333.1387.upload.video_card.click&vd_source=e51e8ec2fb03314ad9fa517492a2ce94 35 | ## 三、项目技术 36 | 后端: SpringBoot+Mybaits 37 | 38 | 前端:Vue +ELementUI 39 | 40 | ## 四、 运行环境 41 | 开发语言:Java 42 | 43 | 开发工具:IDEA,Eclipse,Myeclipse都可以。推荐IDEA 44 | 45 | JDK版本:1.8 46 | 47 | 数据库: MySQL8.0版本以上 48 | 49 | Tomcat环境:Tomcat 7.x,8.x,9.x版本均可 50 | 51 | 项目管理:Maven 52 | 53 | Node版本:14 54 | 55 | 56 | ## 五、运行截图(点图片可放大) 57 | 58 | https://www.bilibili.com/video/BV1TpCeBmEEi/?spm_id_from=333.1387.upload.video_card.click&vd_source=e51e8ec2fb03314ad9fa517492a2ce94 59 | 60 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/CheckController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.pojo.Checks; 4 | import com.dgut.service.CheckService; 5 | import com.dgut.utils.ResponseData; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | @RestController 13 | @RequestMapping("check") 14 | public class CheckController { 15 | @Autowired 16 | private CheckService checkService; 17 | /** 18 | * 分页模糊查询所有检查信息 19 | */ 20 | @RequestMapping("findAllChecks") 21 | public ResponseData findAllChecks(int pageNumber, int size, String query){ 22 | return ResponseData.success("返回所有检查信息成功", this.checkService.findAllChecks(pageNumber, size, query)); 23 | } 24 | /** 25 | * 根据id查找检查 26 | */ 27 | @RequestMapping("findCheck") 28 | public ResponseData findCheck(int chId){ 29 | return ResponseData.success("根据id查找检查成功", this.checkService.findCheck(chId)); 30 | } 31 | /** 32 | * 增加检查信息 33 | */ 34 | @RequestMapping("addCheck") 35 | @ResponseBody 36 | public ResponseData addCheck(Checks checks) { 37 | Boolean bo = this.checkService.addCheck(checks); 38 | if (bo) { 39 | return ResponseData.success("增加检查信息成功"); 40 | } 41 | return ResponseData.fail("增加检查信息失败!账号或已被占用"); 42 | } 43 | /** 44 | * 删除药物信息 45 | */ 46 | @RequestMapping("deleteCheck") 47 | public ResponseData deleteCheck(@RequestParam(value = "chId") int chId) { 48 | Boolean bo = this.checkService.deleteCheck(chId); 49 | if (bo){ 50 | return ResponseData.success("删除检查信息成功"); 51 | } 52 | return ResponseData.fail("删除检查信息失败"); 53 | } 54 | /** 55 | * 修改检查信息 56 | */ 57 | @RequestMapping("modifyCheck") 58 | @ResponseBody 59 | public ResponseData modifyCheck(Checks checks) { 60 | this.checkService.modifyCheck(checks); 61 | return ResponseData.success("修改检查项目信息成功"); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/config/JedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.dgut.config; 2 | 3 | 4 | import org.springframework.beans.factory.annotation.Qualifier; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.PropertySource; 9 | import redis.clients.jedis.JedisPool; 10 | import redis.clients.jedis.JedisPoolConfig; 11 | 12 | 13 | @Configuration 14 | @PropertySource(value="classpath:redisConfig.properties") 15 | public class JedisConfig { 16 | @Value(value = "${redis.host}") 17 | private String host; 18 | @Value(value = "${redis.port}") 19 | private int port; 20 | // @Value(value = "${redis.password}") 21 | // private String password; 22 | @Value(value = "${redis.database}") 23 | private int database; 24 | @Value(value = "${redis.maxTotal}") 25 | private int maxTotal; 26 | @Value(value = "${redis.maxIdle}") 27 | private int maxIdle; 28 | @Value(value = "${redis.minIdle}") 29 | private int minIdle; 30 | @Value(value = "${redis.maxWaitMillis}") 31 | private int maxWaitMillis; 32 | @Value(value = "${redis.timeout}") 33 | private int timeout; 34 | @Value(value = "${redis.testOnBorrow}") 35 | private boolean testOnBorrow; 36 | 37 | /** 38 | * spring容器创建一个内存中实例,名字和name值相同 39 | * @return 40 | */ 41 | @Bean(name = "jedisPoolConfig") 42 | public JedisPoolConfig getJedisPoolConfig() { 43 | JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); 44 | jedisPoolConfig.setMaxTotal(maxTotal); 45 | jedisPoolConfig.setMaxIdle(maxIdle); 46 | jedisPoolConfig.setMinIdle(minIdle); 47 | jedisPoolConfig.setMaxWaitMillis(maxWaitMillis); 48 | jedisPoolConfig.setTestOnBorrow(testOnBorrow); 49 | return jedisPoolConfig; 50 | } 51 | 52 | /*** 53 | * 获得连接池对象,@Qualifier(value = "jedisPoolConfig")指定参数按名称严格匹配注入 54 | * @param jedisPoolConfig 55 | * @return 56 | */ 57 | @Bean(name = "jedisPool") 58 | public JedisPool getJedisPool(@Qualifier(value = "jedisPoolConfig") JedisPoolConfig jedisPoolConfig) { 59 | return new JedisPool(jedisPoolConfig, host, port, timeout, null, database); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/DrugController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.pojo.Drug; 4 | import com.dgut.service.DrugService; 5 | import com.dgut.utils.ResponseData; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestParam; 9 | import org.springframework.web.bind.annotation.ResponseBody; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | @RestController 13 | @RequestMapping("drug") 14 | public class DrugController { 15 | @Autowired 16 | private DrugService drugService; 17 | /** 18 | * 分页模糊查询所有药物信息 19 | */ 20 | @RequestMapping("findAllDrugs") 21 | public ResponseData findAllDrugs(int pageNumber, int size, String query){ 22 | return ResponseData.success("返回所有药物信息成功", this.drugService.findAllDrugs(pageNumber, size, query)); 23 | } 24 | /** 25 | * 根据id查找药物 26 | */ 27 | @RequestMapping("findDrug") 28 | public ResponseData findDrug(int drId){ 29 | return ResponseData.success("根据id查找药物成功", this.drugService.findDrug(drId)); 30 | } 31 | /** 32 | * 根据id删除药物数量 33 | */ 34 | @RequestMapping("reduceDrugNumber") 35 | public ResponseData reduceDrugNumber(int drId,int usedNumber){ 36 | if (this.drugService.reduceDrugNumber(drId, usedNumber)) 37 | return ResponseData.success("根据id删除药物数量成功"); 38 | return ResponseData.fail("根据id删除药物数量失败"); 39 | } 40 | /** 41 | * 增加药物信息 42 | */ 43 | @RequestMapping("addDrug") 44 | @ResponseBody 45 | public ResponseData addDrug(Drug drug) { 46 | Boolean bo = this.drugService.addDrug(drug); 47 | if (bo) { 48 | return ResponseData.success("增加药物信息成功"); 49 | } 50 | return ResponseData.fail("增加药物信息失败!账号或已被占用"); 51 | } 52 | /** 53 | * 删除药物信息 54 | */ 55 | @RequestMapping("deleteDrug") 56 | public ResponseData deleteDrug(@RequestParam(value = "drId") int drId) { 57 | Boolean bo = this.drugService.deleteDrug(drId); 58 | if (bo){ 59 | return ResponseData.success("删除药物信息成功"); 60 | } 61 | return ResponseData.fail("删除药物信息失败"); 62 | } 63 | /** 64 | * 修改药物信息 65 | */ 66 | @RequestMapping("modifyDrug") 67 | @ResponseBody 68 | public ResponseData modifyDrug(Drug drug) { 69 | this.drugService.modifyDrug(drug); 70 | return ResponseData.success("修改药物信息成功"); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/serviceImpl/CheckServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.dgut.mapper.CheckMapper; 7 | import com.dgut.pojo.Checks; 8 | import com.dgut.service.CheckService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | 15 | @Service("CheckService") 16 | public class CheckServiceImpl implements CheckService { 17 | 18 | @Autowired 19 | private CheckMapper checkMapper; 20 | /** 21 | * 分页模糊查询所有检查信息 22 | */ 23 | @Override 24 | public HashMap findAllChecks(int pageNumber, int size, String query) { 25 | Page page = new Page<>(pageNumber, size); 26 | QueryWrapper wrapper = new QueryWrapper<>(); 27 | wrapper.like("ch_name", query); 28 | IPage iPage = this.checkMapper.selectPage(page, wrapper); 29 | HashMap hashMap = new HashMap<>(); 30 | hashMap.put("total", iPage.getTotal()); //总条数 31 | hashMap.put("size", iPage.getPages()); //总页数 32 | hashMap.put("pageNumber", iPage.getCurrent());//当前页 33 | hashMap.put("checks", iPage.getRecords()); //查询到的记录 34 | return hashMap; 35 | } 36 | /** 37 | * 根据id查找检查 38 | */ 39 | @Override 40 | public Checks findCheck(int chId){ 41 | return this.checkMapper.selectById(chId); 42 | } 43 | /** 44 | * 增加检查信息 45 | */ 46 | @Override 47 | public Boolean addCheck(Checks checks){ 48 | //如果账号已存在则返回false 49 | List checks1 = this.checkMapper.selectList(null); 50 | for (Checks checks2 : checks1) { 51 | if (checks.getChId() == checks2.getChId()) { 52 | return false; 53 | } 54 | } 55 | this.checkMapper.insert(checks); 56 | return true; 57 | } 58 | /** 59 | * 删除检查信息 60 | */ 61 | @Override 62 | public Boolean deleteCheck(int chId) { 63 | this.checkMapper.deleteById(chId); 64 | return true; 65 | } 66 | /** 67 | * 修改检查信息 68 | */ 69 | @Override 70 | public Boolean modifyCheck(Checks checks) { 71 | int i = this.checkMapper.updateById(checks); 72 | System.out.println("影响行数:"+i); 73 | return true; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/serviceImpl/DrugServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.dgut.mapper.DrugMapper; 7 | import com.dgut.pojo.Drug; 8 | import com.dgut.service.DrugService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.HashMap; 13 | import java.util.List; 14 | 15 | @Service("DrugService") 16 | public class DrugServiceImpl implements DrugService { 17 | @Autowired 18 | private DrugMapper drugMapper; 19 | /** 20 | * 分页模糊查询所有药物信息 21 | */ 22 | @Override 23 | public HashMap findAllDrugs(int pageNumber, int size, String query){ 24 | Page page = new Page<>(pageNumber, size); 25 | QueryWrapper wrapper = new QueryWrapper<>(); 26 | wrapper.like("dr_name", query); 27 | IPage iPage = this.drugMapper.selectPage(page, wrapper); 28 | HashMap hashMap = new HashMap<>(); 29 | hashMap.put("total", iPage.getTotal()); //总条数 30 | hashMap.put("size", iPage.getPages()); //总页数 31 | hashMap.put("pageNumber", iPage.getCurrent());//当前页 32 | hashMap.put("drugs", iPage.getRecords()); //查询到的记录 33 | return hashMap; 34 | } 35 | 36 | /** 37 | * 根据id查找药物 38 | */ 39 | @Override 40 | public Drug findDrug(int drId){ 41 | return this.drugMapper.selectById(drId); 42 | } 43 | /** 44 | * 根据id删除药物数量 45 | */ 46 | @Override 47 | public Boolean reduceDrugNumber(int drId,int usedNumber){ 48 | Drug drug = this.drugMapper.selectById(drId); 49 | if(drug.getDrNumber() < usedNumber) 50 | return false; 51 | drug.setDrNumber(drug.getDrNumber()-usedNumber); 52 | this.drugMapper.updateById(drug); 53 | return true; 54 | } 55 | /** 56 | * 增加药物信息 57 | */ 58 | public Boolean addDrug(Drug drug){ 59 | //如果账号已存在则返回false 60 | List drugs = this.drugMapper.selectList(null); 61 | for (Drug drug1 : drugs) { 62 | if (drug.getDrId() == drug1.getDrId()) { 63 | return false; 64 | } 65 | } 66 | this.drugMapper.insert(drug); 67 | return true; 68 | } 69 | /** 70 | * 删除药物信息 71 | */ 72 | @Override 73 | public Boolean deleteDrug(int drId) { 74 | this.drugMapper.deleteById(drId); 75 | return true; 76 | } 77 | /** 78 | * 修改药物信息 79 | */ 80 | @Override 81 | public Boolean modifyDrug(Drug drug) { 82 | int i = this.drugMapper.updateById(drug); 83 | System.out.println("影响行数:"+i); 84 | return true; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/BedController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.pojo.Bed; 4 | import com.dgut.service.BedService; 5 | import com.dgut.utils.ResponseData; 6 | import com.dgut.utils.TodayUtil; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestParam; 10 | import org.springframework.web.bind.annotation.ResponseBody; 11 | import org.springframework.web.bind.annotation.RestController; 12 | 13 | @RestController 14 | @RequestMapping("bed") 15 | public class BedController { 16 | @Autowired 17 | private BedService bedService; 18 | 19 | /** 20 | * 查找所有空床位 21 | */ 22 | @RequestMapping("findNullBed") 23 | public ResponseData findNullBed(){ 24 | return ResponseData.success("查找所有空床位成功", this.bedService.findNullBed()); 25 | } 26 | 27 | /** 28 | * 增加床位信息 29 | */ 30 | @RequestMapping("updateBed") 31 | public ResponseData updateBed(Bed bed) { 32 | if (this.bedService.updateBed(bed)) 33 | return ResponseData.success("增加床位成功!"); 34 | return ResponseData.fail("增加床位失败!"); 35 | } 36 | /** 37 | * 根据pId查询住院 38 | */ 39 | @RequestMapping("findBedByPid") 40 | public ResponseData findBedByPid(@RequestParam(value = "pId") int pId){ 41 | return ResponseData.success("根据pId查询住院成功", this.bedService.findBedByPid(pId)) ; 42 | } 43 | /** 44 | * 分页模糊查询所有床位信息 45 | */ 46 | @RequestMapping("findAllBeds") 47 | public ResponseData findAllBeds(int pageNumber, int size, String query){ 48 | return ResponseData.success("返回所有床位信息成功", this.bedService.findAllBeds(pageNumber, size, query)); 49 | } 50 | /** 51 | * 根据id查找床位 52 | */ 53 | @RequestMapping("findBed") 54 | public ResponseData findBed(int bId){ 55 | return ResponseData.success("根据id查找床位成功", this.bedService.findBed(bId)); 56 | } 57 | /** 58 | * 增加床位信息 59 | */ 60 | @RequestMapping("addBed") 61 | @ResponseBody 62 | public ResponseData addBed(Bed bed) { 63 | Boolean bo = this.bedService.addBed(bed); 64 | if (bo) { 65 | return ResponseData.success("增加床位信息成功"); 66 | } 67 | return ResponseData.fail("增加床位信息失败!床号或已被占用"); 68 | } 69 | /** 70 | * 删除药物信息 71 | */ 72 | @RequestMapping("deleteBed") 73 | public ResponseData deleteBed(@RequestParam(value = "bId") int bId) { 74 | Boolean bo = this.bedService.deleteBed(bId); 75 | if (bo){ 76 | return ResponseData.success("删除床位信息成功"); 77 | } 78 | return ResponseData.fail("删除床位信息失败"); 79 | } 80 | /** 81 | * 清空床位信息 82 | */ 83 | @RequestMapping("emptyBed") 84 | public ResponseData emptyBed(int bId){ 85 | if(this.bedService.emptyBed(bId)) 86 | return ResponseData.success("清空床位信息成功"); 87 | return ResponseData.fail("清空床位信息失败"); 88 | } 89 | /** 90 | * 统计今天挂号人数 91 | */ 92 | @RequestMapping("bedPeople") 93 | public ResponseData bedPeople(){ 94 | String bStart = TodayUtil.getTodayYmd(); 95 | return ResponseData.success("统计今天住院人数成功", this.bedService.bedPeople(bStart)); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/serviceImpl/AdminServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 5 | import com.dgut.mapper.AdminMapper; 6 | import com.dgut.pojo.Admin; 7 | import com.dgut.service.AdminService; 8 | import com.dgut.utils.Md5Util; 9 | import com.dgut.utils.RandomUtil; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.mail.SimpleMailMessage; 12 | import org.springframework.mail.javamail.JavaMailSender; 13 | import org.springframework.stereotype.Service; 14 | import redis.clients.jedis.Jedis; 15 | import redis.clients.jedis.JedisPool; 16 | 17 | 18 | @Service("AdminService") 19 | public class AdminServiceImpl implements AdminService { 20 | 21 | @Autowired 22 | private AdminMapper adminMapper; 23 | @Autowired 24 | private JavaMailSender javaMailSender;//邮箱 25 | @Autowired 26 | private JedisPool jedisPool;//redis连接池 27 | /** 28 | * 登录数据校验 29 | * */ 30 | @Override 31 | public Admin login(int aId, String aPassword){ 32 | Admin admin = this.adminMapper.selectById(aId); 33 | if (admin == null) { 34 | return null; 35 | } else { 36 | if ((admin.getAPassword()).equals(aPassword)) { 37 | return admin; 38 | } 39 | } 40 | return null; 41 | } 42 | 43 | /** 44 | * 发送邮件 45 | */ 46 | @Override 47 | public Boolean sendEmail(String aEmail){ 48 | 49 | QueryWrapper wrapper = new QueryWrapper<>(); 50 | wrapper.eq("a_email", aEmail); 51 | Admin admin = this.adminMapper.selectOne(wrapper); 52 | if (admin == null){ 53 | return false; 54 | }else { 55 | Integer code = RandomUtil.randomCode(); 56 | SimpleMailMessage message = new SimpleMailMessage(); 57 | message.setFrom("1306931167@qq.com"); //发送者 58 | message.setTo(aEmail); //接受者 59 | //message.setCc("hinschan1998@163.com"); //抄送,填发送者的邮箱即可 60 | message.setSubject("大朗医院找回密码服务"); //主题 61 | message.setText("尊敬的管理员!您的账号为:" + admin.getAId() + " 验证码为 "+ code +" ,有效期为2分钟!"); //内容 62 | try { 63 | javaMailSender.send(message); 64 | Jedis jedis = jedisPool.getResource(); 65 | jedis.set(aEmail, String.valueOf(code)); 66 | jedis.expire(aEmail, 120); 67 | System.out.println("简单邮件已经发送"); 68 | } catch (Exception e) { 69 | System.out.println("发送简单邮件时发生异常!" + e.toString()); 70 | return false; 71 | } 72 | } 73 | return true; 74 | } 75 | /** 76 | * 找回密码服务 77 | */ 78 | @Override 79 | public Boolean findPassword(String aEmail, String aPassword, String code){ 80 | UpdateWrapper wrapper = new UpdateWrapper<>(); 81 | String password = Md5Util.getMD5(aPassword); 82 | Jedis jedis = jedisPool.getResource(); 83 | //System.out.println("============="+jedis.get(pEmail)); 84 | if (jedis.get(aEmail) == null) 85 | return false; 86 | if (jedis.get(aEmail).equals(code)){ 87 | wrapper.set("a_password", password).eq("a_email", aEmail); 88 | this.adminMapper.update(null, wrapper); 89 | return true; 90 | } 91 | return false; 92 | 93 | } 94 | 95 | 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/serviceImpl/BedServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.dgut.mapper.BedMapper; 8 | import com.dgut.pojo.Bed; 9 | import com.dgut.service.BedService; 10 | import com.dgut.utils.TodayUtil; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.HashMap; 15 | import java.util.List; 16 | 17 | @Service("BedService") 18 | public class BedServiceImpl implements BedService { 19 | 20 | @Autowired 21 | private BedMapper bedMapper; 22 | 23 | /** 24 | * 查找所有空床位 25 | */ 26 | @Override 27 | public List findNullBed(){ 28 | QueryWrapper wrapper = new QueryWrapper<>(); 29 | wrapper.select("b_id").eq("b_state", 0); 30 | return this.bedMapper.selectList(wrapper); 31 | } 32 | 33 | /** 34 | * 增加床位信息 35 | */ 36 | @Override 37 | /** 38 | * 更新床位信息 39 | */ 40 | public Boolean updateBed(Bed bed){ 41 | Bed bed1 = this.bedMapper.selectById(bed.getBId()); 42 | if (bed1.getBState() == 1) 43 | return false; 44 | bed.setBStart(TodayUtil.getTodayYmd()); 45 | bed.setBState(1); 46 | bed.setVersion(bed1.getVersion()); 47 | 48 | this.bedMapper.updateById(bed); 49 | return true; 50 | } 51 | /** 52 | * 根据pId查询挂号 53 | */ 54 | public List findBedByPid(int pId){ 55 | QueryWrapper wrapper = new QueryWrapper<>(); 56 | wrapper.eq("p_id", pId); 57 | return this.bedMapper.selectList(wrapper); 58 | } 59 | /** 60 | * 分页模糊查询所有检查信息 61 | */ 62 | @Override 63 | public HashMap findAllBeds(int pageNumber, int size, String query) { 64 | Page page = new Page<>(pageNumber, size); 65 | QueryWrapper wrapper = new QueryWrapper<>(); 66 | wrapper.like("p_id", query); 67 | IPage iPage = this.bedMapper.selectPage(page, wrapper); 68 | HashMap hashMap = new HashMap<>(); 69 | hashMap.put("total", iPage.getTotal()); //总条数 70 | hashMap.put("size", iPage.getPages()); //总页数 71 | hashMap.put("pageNumber", iPage.getCurrent());//当前页 72 | hashMap.put("beds", iPage.getRecords()); //查询到的记录 73 | return hashMap; 74 | } 75 | /** 76 | * 根据id查找检查 77 | */ 78 | @Override 79 | public Bed findBed(int bId){ 80 | return this.bedMapper.selectById(bId); 81 | } 82 | /** 83 | * 增加床位信息 84 | */ 85 | @Override 86 | public Boolean addBed(Bed bed){ 87 | //如果账号已存在则返回false 88 | List beds = this.bedMapper.selectList(null); 89 | for (Bed bed1 : beds) { 90 | if (bed1.getBId() == bed.getBId()) { 91 | return false; 92 | } 93 | } 94 | bed.setBState(0); 95 | this.bedMapper.insert(bed); 96 | return true; 97 | } 98 | /** 99 | * 删除床位信息 100 | */ 101 | @Override 102 | public Boolean deleteBed(int bId) { 103 | this.bedMapper.deleteById(bId); 104 | return true; 105 | } 106 | /** 107 | * 清空床位信息 108 | */ 109 | public Boolean emptyBed(int bId){ 110 | UpdateWrapper wrapper = new UpdateWrapper<>(); 111 | wrapper.set("p_id", -1).set("d_id", -1).set("b_reason", null).set("b_start", null).set("b_state", 0).eq("b_id", bId); 112 | this.bedMapper.update(null, wrapper); 113 | return true; 114 | 115 | } 116 | /** 117 | * 统计今天挂号人数 118 | */ 119 | @Override 120 | public int bedPeople(String bStart){ 121 | return this.bedMapper.bedPeople(bStart); 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.pojo.Orders; 4 | import com.dgut.service.OrderService; 5 | import com.dgut.utils.ResponseData; 6 | import com.dgut.utils.TodayUtil; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.*; 9 | 10 | import java.util.ArrayList; 11 | 12 | @RestController 13 | @RequestMapping("order") 14 | public class OrderController { 15 | @Autowired 16 | private OrderService orderService; 17 | /** 18 | * 根据id更新挂号信息 19 | */ 20 | @PostMapping("updateOrder") 21 | @ResponseBody 22 | public ResponseData updateOrder(@RequestBody Orders orders) { 23 | if (this.orderService.updateOrder(orders)) 24 | return ResponseData.success("更新挂号信息成功"); 25 | 26 | return ResponseData.fail("更新挂号信息失败!"); 27 | } 28 | /** 29 | * 根据id设置缴费状态 30 | */ 31 | @RequestMapping("updatePrice") 32 | public ResponseData updatePrice(int oId){ 33 | if (this.orderService.updatePrice(oId)) 34 | return ResponseData.success("根据id设置缴费状态成功"); 35 | return ResponseData.success("根据id设置缴费状态失败"); 36 | } 37 | /** 38 | * 查找医生已完成的挂号单 39 | */ 40 | @RequestMapping("findOrderFinish") 41 | public ResponseData findOrderFinish(int pageNumber, int size, String query, int dId){ 42 | return ResponseData.success("查找医生已完成的挂号单完成!", this.orderService.findOrderFinish(pageNumber, size, query, dId)); 43 | } 44 | /** 45 | * 根据dId查询挂号 46 | */ 47 | @RequestMapping("findOrderByDid") 48 | public ResponseData findOrderByDid(int pageNumber, int size, String query, int dId){ 49 | return ResponseData.success("返回挂号信息成功", this.orderService.findOrderByDid(pageNumber, size, query, dId)) ; 50 | } 51 | /** 52 | * 统计今天挂号人数 53 | */ 54 | @RequestMapping("orderPeople") 55 | public ResponseData oderPeople(){ 56 | String oStart = TodayUtil.getTodayYmd(); 57 | return ResponseData.success("统计今天挂号人数成功", this.orderService.orderPeople(oStart)); 58 | } 59 | /** 60 | * 统计今天某个医生挂号人数 61 | */ 62 | @RequestMapping("orderPeopleByDid") 63 | public ResponseData orderPeopleByDid(int dId){ 64 | String oStart = TodayUtil.getTodayYmd(); 65 | return ResponseData.success("统计今天挂号人数成功", this.orderService.orderPeopleByDid(oStart, dId)); 66 | } 67 | /** 68 | * 获取过去七天的挂号人数 69 | */ 70 | @RequestMapping("orderSeven") 71 | public ResponseData orderSeven(){ 72 | ArrayList list = new ArrayList<>(); 73 | String oStart = null; 74 | for(int i = 20; i > 0;i--){ 75 | oStart = TodayUtil.getPastDate(i); 76 | int people = this.orderService.orderPeople(oStart); 77 | list.add(people); 78 | } 79 | return ResponseData.success("获取过去20天的挂号人数成功", list); 80 | } 81 | /** 82 | * 统计挂号男女人数 83 | */ 84 | @RequestMapping("orderGender") 85 | public ResponseData orderGender(){ 86 | return ResponseData.success("统计挂号男女人数", this.orderService.orderGender()); 87 | } 88 | /** 89 | * 增加诊断及医生意见 90 | */ 91 | @PostMapping("updateOrderByAdd") 92 | @ResponseBody 93 | public ResponseData updateOrderByAdd(@RequestBody Orders order){ 94 | if (this.orderService.updateOrderByAdd(order)) 95 | return ResponseData.success("增加诊断及医生意见成功"); 96 | return ResponseData.fail("增加诊断及医生意见失败"); 97 | } 98 | /** 99 | * 判断诊断之后再次购买药物是否已缴费 100 | */ 101 | @RequestMapping("findTotalPrice") 102 | public ResponseData findTotalPrice(int oId){ 103 | if(this.orderService.findTotalPrice(oId)) 104 | return ResponseData.success("未缴费"); 105 | return ResponseData.fail("无需缴费"); 106 | } 107 | /** 108 | * 请求挂号时间段 109 | */ 110 | @RequestMapping("findOrderTime") 111 | public ResponseData findOrderTime(String arId){ 112 | return ResponseData.success("请求挂号时间段成功", this.orderService.findOrderTime(arId)); 113 | 114 | } 115 | /** 116 | * 统计过去20天挂号科室人数 117 | */ 118 | @RequestMapping("orderSection") 119 | public ResponseData orderSection(){ 120 | return ResponseData.success("统计过去20天挂号科室人数成功", this.orderService.orderSection()); 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/DoctorController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.pojo.Doctor; 4 | import com.dgut.service.DoctorService; 5 | import com.dgut.service.OrderService; 6 | import com.dgut.service.PatientService; 7 | import com.dgut.utils.JwtUtil; 8 | import com.dgut.utils.ResponseData; 9 | import org.apache.ibatis.annotations.Param; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | import org.springframework.web.multipart.MultipartFile; 13 | 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.io.IOException; 16 | import java.util.HashMap; 17 | import java.util.Map; 18 | 19 | @RestController 20 | @RequestMapping("doctor") 21 | public class DoctorController { 22 | @Autowired 23 | private DoctorService doctorService; 24 | @Autowired 25 | private OrderService orderService; 26 | @Autowired 27 | private PatientService patientService; 28 | /** 29 | * 登录数据验证 30 | */ 31 | @RequestMapping(value = "login", method = RequestMethod.POST) 32 | @ResponseBody 33 | public ResponseData login(@RequestParam(value = "dId") int dId, @RequestParam(value = "dPassword") String dPassword) { 34 | Doctor doctor = this.doctorService.login(dId, dPassword); 35 | if (doctor != null) { 36 | Map map = new HashMap<>(); 37 | map.put("dName", doctor.getdName()); 38 | map.put("dId", String.valueOf(doctor.getdId())); 39 | String token = JwtUtil.getToken(map); 40 | map.put("token", token); 41 | //response.setHeader("token", token); 42 | return ResponseData.success("登录成功", map); 43 | } else { 44 | return ResponseData.fail("登录失败,密码或账号错误"); 45 | } 46 | } 47 | /** 48 | * 查看当天挂号列表 49 | */ 50 | @RequestMapping("findOrderByNull") 51 | public ResponseData findOrderByNull(@Param(value = "dId") int dId, @RequestParam(value = "oStart") String oStart){ 52 | System.out.println("账号时间为"+dId+oStart); 53 | return ResponseData.success("返回当天挂号信息成功", this.orderService.findOrderByNull(dId,oStart)); 54 | 55 | } 56 | /** 57 | * 根据患者id查询患者信息 58 | */ 59 | @RequestMapping("findPatientById") 60 | public ResponseData findPatientById(int pId){ 61 | return ResponseData.success("返回患者信息成功!", this.patientService.findPatientById(pId)); 62 | } 63 | /** 64 | * 发送邮件 65 | */ 66 | @RequestMapping("sendEmail") 67 | public ResponseData sendEmail(String dEmail){ 68 | if (this.doctorService.sendEmail(dEmail)) 69 | return ResponseData.success("邮件发送成功!"); 70 | return ResponseData.fail("邮箱号未注册!"); 71 | } 72 | /** 73 | * 找回密码服务邮件和验证码校验 74 | */ 75 | @RequestMapping("findPassword") 76 | public ResponseData findPassword(String dEmail, String dPassword, String code){ 77 | if(this.doctorService.findPassword(dEmail, dPassword, code)) 78 | return ResponseData.success("密码修改成功"); 79 | return ResponseData.fail("密码修改失败!验证码不正确或者已过期"); 80 | } 81 | /** 82 | * 分页根据科室查询所有医生信息 83 | */ 84 | @RequestMapping("findDoctorBySectionPage") 85 | public ResponseData findDoctorBySectionPage(int pageNumber, int size, String query, String dSection){ 86 | return ResponseData.success("分页根据科室查询所有医生信息成功", this.doctorService.findDoctorBySectionPage(pageNumber, size, query, dSection)); 87 | } 88 | /** 89 | * 用户评价 90 | */ 91 | @RequestMapping("updateStar") 92 | public ResponseData updateStar(int dId, Double dStar){ 93 | if(this.doctorService.updateStar(dId, dStar)) 94 | return ResponseData.success("评价成功"); 95 | return ResponseData.fail("评价失败"); 96 | } 97 | /** 98 | * 上传Excel导入数据 99 | */ 100 | @RequestMapping(value = "uploadExcel", method = RequestMethod.POST) 101 | @ResponseBody 102 | public ResponseData uploadExcel(@RequestParam("file") MultipartFile multipartFile) throws Exception { 103 | if (this.doctorService.uploadExcel(multipartFile)) 104 | return ResponseData.success("上传Excel导入数据成功"); 105 | return ResponseData.fail("上传Excel导入数据失败"); 106 | 107 | } 108 | /** 109 | * Excel导出数据 110 | */ 111 | @RequestMapping("downloadExcel") 112 | public ResponseData downloadExcel(HttpServletResponse response) throws IOException { 113 | if (this.doctorService.downloadExcel(response)) 114 | return ResponseData.success("Excel导出数据成功"); 115 | return ResponseData.fail("Excel导出数据失败"); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/PatientController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.mapper.OrderMapper; 4 | import com.dgut.pojo.Orders; 5 | import com.dgut.pojo.Patient; 6 | import com.dgut.service.DoctorService; 7 | import com.dgut.service.OrderService; 8 | import com.dgut.service.PatientService; 9 | import com.dgut.utils.JwtUtil; 10 | import com.dgut.utils.PdfUtil; 11 | import com.dgut.utils.ResponseData; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.mail.javamail.JavaMailSender; 14 | import org.springframework.web.bind.annotation.*; 15 | import redis.clients.jedis.JedisPool; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | import javax.servlet.http.HttpServletResponse; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | @RestController 23 | @RequestMapping("patient") 24 | public class PatientController { 25 | 26 | @Autowired 27 | private DoctorService doctorService; 28 | @Autowired 29 | private PatientService patientService; 30 | @Autowired 31 | private OrderService orderService; 32 | @Autowired 33 | private JavaMailSender javaMailSender;//邮箱 34 | @Autowired 35 | private JedisPool jedisPool; 36 | @Autowired 37 | private OrderMapper orderMapper; 38 | 39 | /** 40 | * 登录数据验证 41 | */ 42 | @RequestMapping(value = "login", method = RequestMethod.POST) 43 | @ResponseBody 44 | public ResponseData login(@RequestParam(value = "pId") int pId, @RequestParam(value = "pPassword") String pPassword) { 45 | Patient patient = this.patientService.login(pId, pPassword); 46 | if (patient != null) { 47 | Map map = new HashMap<>(); 48 | map.put("pName", patient.getPName()); 49 | map.put("pId", String.valueOf(patient.getPId())); 50 | map.put("pCard", patient.getPCard()); 51 | String token = JwtUtil.getToken(map); 52 | map.put("token", token); 53 | //response.setHeader("token", token); 54 | return ResponseData.success("登录成功", map); 55 | } else { 56 | return ResponseData.fail("登录失败,密码或账号错误"); 57 | } 58 | } 59 | /** 60 | * 根据科室查询所有医生信息 61 | */ 62 | @RequestMapping("findDoctorBySection") 63 | public ResponseData findDoctorBySection(@RequestParam(value = "dSection") String dSection){ 64 | return ResponseData.success("根据科室查询所有医生信息成功", this.doctorService.findDoctorBySection(dSection)); 65 | } 66 | /** 67 | * 增加挂号信息 68 | */ 69 | @RequestMapping("addOrder") 70 | @ResponseBody 71 | public ResponseData addOrder(Orders order, String arId){ 72 | System.out.println(arId); 73 | if (this.orderService.addOrder(order, arId)) 74 | return ResponseData.success("插入挂号信息成功"); 75 | return ResponseData.fail("插入挂号信息失败"); 76 | } 77 | /** 78 | * 根据pId查询挂号 79 | */ 80 | @RequestMapping("findOrderByPid") 81 | public ResponseData findOrderByPid(@RequestParam(value = "pId") int pId){ 82 | return ResponseData.success("返回挂号信息成功", this.orderService.findOrderByPid(pId)) ; 83 | } 84 | 85 | /** 86 | * 发送邮件 87 | */ 88 | @RequestMapping("sendEmail") 89 | public ResponseData sendEmail(String pEmail){ 90 | if (this.patientService.sendEmail(pEmail)) 91 | return ResponseData.success("邮件发送成功!"); 92 | return ResponseData.fail("邮箱号未注册!"); 93 | } 94 | /** 95 | * 找回密码服务邮件和验证码校验 96 | */ 97 | @RequestMapping("findPassword") 98 | public ResponseData findPassword(String pEmail, String pPassword, String code){ 99 | if(this.patientService.findPassword(pEmail, pPassword, code)) 100 | return ResponseData.success("密码修改成功"); 101 | return ResponseData.fail("密码修改失败!验证码不正确或者已过期"); 102 | } 103 | /** 104 | * 增加患者信息 105 | */ 106 | @RequestMapping("addPatient") 107 | @ResponseBody 108 | public ResponseData addPatient(Patient patient) { 109 | Boolean bo = this.patientService.addPatient(patient); 110 | if (bo) { 111 | return ResponseData.success("注册成功"); 112 | } 113 | return ResponseData.fail("注册失败!账号或邮箱已被占用"); 114 | } 115 | @GetMapping("/pdf") 116 | public void downloadPDF(HttpServletRequest request, HttpServletResponse response, int oId) throws Exception { 117 | Orders order = this.orderMapper.findOrderByOid(oId); 118 | PdfUtil.ExportPdf(request, response, order); 119 | } 120 | /** 121 | * 统计患者男女人数 122 | */ 123 | @RequestMapping("patientAge") 124 | public ResponseData patientAge(){ 125 | return ResponseData.success("统计患者男女人数成功", this.patientService.patientAge()); 126 | 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/pojo/Doctor.java: -------------------------------------------------------------------------------- 1 | package com.dgut.pojo; 2 | 3 | import cn.afterturn.easypoi.excel.annotation.Excel; 4 | import cn.afterturn.easypoi.excel.annotation.ExcelTarget; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import com.fasterxml.jackson.annotation.JsonProperty; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | 12 | import java.io.Serializable; 13 | 14 | @Data 15 | @AllArgsConstructor 16 | @NoArgsConstructor 17 | @TableName("doctor") 18 | @ExcelTarget("doctor") 19 | public class Doctor implements Serializable { 20 | @JsonProperty("dId") 21 | @TableId(value = "d_id") 22 | @Excel(name = "账号") 23 | private Integer dId; 24 | @JsonProperty("dPassword") 25 | @Excel(name = "密码") 26 | private String dPassword; 27 | @JsonProperty("dName") 28 | @Excel(name = "姓名") 29 | private String dName; 30 | @JsonProperty("dGender") 31 | @Excel(name = "性别") 32 | private String dGender; 33 | @JsonProperty("dCard") 34 | @Excel(name = "身份证号码") 35 | private String dCard; 36 | @JsonProperty("dEmail") 37 | @Excel(name = "邮箱") 38 | private String dEmail; 39 | @JsonProperty("dPhone") 40 | @Excel(name = "手机号") 41 | private String dPhone; 42 | @JsonProperty("dPost") 43 | @Excel(name = "职位") 44 | private String dPost; 45 | @JsonProperty("dIntroduction") 46 | @Excel(name = "简介") 47 | private String dIntroduction; 48 | @JsonProperty("dSection") 49 | @Excel(name = "科室") 50 | private String dSection; 51 | @JsonProperty("dState") 52 | @Excel(name = "是否在职", replace = {"在职_1","离职_0"}) 53 | private Integer dState;//必须为integer类型,为int类型的话更新时会自动更新为0 54 | @JsonProperty("dPrice") 55 | @Excel(name = "挂号价格") 56 | private Double dPrice; 57 | @JsonProperty("dPeople") 58 | @Excel(name = "评价人数") 59 | private Integer dPeople;//必须为integer类型,为int类型的话更新时会自动更新为0 60 | @JsonProperty("dStar") 61 | @Excel(name = "总分") 62 | private Double dStar;//必须为integer类型,为int类型的话更新时会自动更新为0 63 | @JsonProperty("dAvgStar") 64 | @Excel(name = "平均分") 65 | private Double dAvgStar;//必须为integer类型,为int类型的话更新时会自动更新为0 66 | 67 | public Integer getdId() { 68 | return dId; 69 | } 70 | 71 | public void setdId(Integer dId) { 72 | this.dId = dId; 73 | } 74 | 75 | public String getdPassword() { 76 | return dPassword; 77 | } 78 | 79 | public void setdPassword(String dPassword) { 80 | this.dPassword = dPassword; 81 | } 82 | 83 | public String getdName() { 84 | return dName; 85 | } 86 | 87 | public void setdName(String dName) { 88 | this.dName = dName; 89 | } 90 | 91 | public String getdGender() { 92 | return dGender; 93 | } 94 | 95 | public void setdGender(String dGender) { 96 | this.dGender = dGender; 97 | } 98 | 99 | public String getdCard() { 100 | return dCard; 101 | } 102 | 103 | public void setdCard(String dCard) { 104 | this.dCard = dCard; 105 | } 106 | 107 | public String getdEmail() { 108 | return dEmail; 109 | } 110 | 111 | public void setdEmail(String dEmail) { 112 | this.dEmail = dEmail; 113 | } 114 | 115 | public String getdPhone() { 116 | return dPhone; 117 | } 118 | 119 | public void setdPhone(String dPhone) { 120 | this.dPhone = dPhone; 121 | } 122 | 123 | public String getdPost() { 124 | return dPost; 125 | } 126 | 127 | public void setdPost(String dPost) { 128 | this.dPost = dPost; 129 | } 130 | 131 | public String getdIntroduction() { 132 | return dIntroduction; 133 | } 134 | 135 | public void setdIntroduction(String dIntroduction) { 136 | this.dIntroduction = dIntroduction; 137 | } 138 | 139 | public String getdSection() { 140 | return dSection; 141 | } 142 | 143 | public void setdSection(String dSection) { 144 | this.dSection = dSection; 145 | } 146 | 147 | public Integer getdState() { 148 | return dState; 149 | } 150 | 151 | public void setdState(Integer dState) { 152 | this.dState = dState; 153 | } 154 | 155 | public Double getdPrice() { 156 | return dPrice; 157 | } 158 | 159 | public void setdPrice(Double dPrice) { 160 | this.dPrice = dPrice; 161 | } 162 | 163 | public Integer getdPeople() { 164 | return dPeople; 165 | } 166 | 167 | public void setdPeople(Integer dPeople) { 168 | this.dPeople = dPeople; 169 | } 170 | 171 | public Double getdStar() { 172 | return dStar; 173 | } 174 | 175 | public void setdStar(Double dStar) { 176 | this.dStar = dStar; 177 | } 178 | 179 | public Double getdAvgStar() { 180 | return dAvgStar; 181 | } 182 | 183 | public void setdAvgStar(Double dAvgStar) { 184 | this.dAvgStar = dAvgStar; 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/controller/AdminController.java: -------------------------------------------------------------------------------- 1 | package com.dgut.controller; 2 | 3 | import com.dgut.pojo.Admin; 4 | import com.dgut.pojo.Doctor; 5 | import com.dgut.service.AdminService; 6 | import com.dgut.service.DoctorService; 7 | import com.dgut.service.OrderService; 8 | import com.dgut.service.PatientService; 9 | import com.dgut.utils.JwtUtil; 10 | import com.dgut.utils.ResponseData; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | 18 | @RestController 19 | @RequestMapping("admin") 20 | public class AdminController { 21 | 22 | @Autowired 23 | private AdminService adminService; 24 | @Autowired 25 | private DoctorService doctorService; 26 | @Autowired 27 | private PatientService patientService; 28 | @Autowired 29 | private OrderService orderService; 30 | 31 | /** 32 | * 登录数据验证 33 | */ 34 | @PostMapping("/login") 35 | @ResponseBody 36 | public ResponseData login(@RequestParam("aId") int aId, @RequestParam("aPassword") String aPassword) { 37 | Admin admin = this.adminService.login(aId, aPassword); 38 | if (admin != null) { 39 | Map map = new HashMap<>(); 40 | map.put("aName", admin.getAName()); 41 | map.put("aId", String.valueOf(admin.getAId())); 42 | String token = JwtUtil.getToken(map); 43 | map.put("token", token); 44 | return ResponseData.success("登录成功", map); 45 | } else { 46 | return ResponseData.fail("登录失败,密码或账号错误"); 47 | } 48 | } 49 | 50 | /** 51 | * 分页模糊查询所有医护人员信息 52 | */ 53 | @RequestMapping("findAllDoctors") 54 | public ResponseData findAllDoctors(@RequestParam(value = "pageNumber") int pageNumber, @RequestParam(value = "size") int size, @RequestParam(value = "query") String query){ 55 | return ResponseData.success("返回医护人员信息成功", this.doctorService.findAllDoctors(pageNumber, size, query)); 56 | } 57 | /** 58 | * 根据id查找医生 59 | */ 60 | @RequestMapping("findDoctor") 61 | public ResponseData findDoctor(@RequestParam(value = "dId") int dId) { 62 | return ResponseData.success("查询医生成功", this.doctorService.findDoctor(dId)); 63 | } 64 | /** 65 | * 增加医生信息 66 | */ 67 | @RequestMapping("addDoctor") 68 | @ResponseBody 69 | public ResponseData addDoctor(Doctor doctor) { 70 | Boolean bo = this.doctorService.addDoctor(doctor); 71 | if (bo) { 72 | return ResponseData.success("增加医生信息成功"); 73 | } 74 | return ResponseData.fail("增加医生信息失败!账号或已被占用"); 75 | } 76 | /** 77 | * 删除医生信息 78 | */ 79 | @RequestMapping("deleteDoctor") 80 | public ResponseData deleteDoctor(@RequestParam(value = "dId") int dId) { 81 | Boolean bo = this.doctorService.deleteDoctor(dId); 82 | if (bo){ 83 | return ResponseData.success("删除医生信息成功"); 84 | } 85 | return ResponseData.fail("删除医生信息失败"); 86 | } 87 | /** 88 | * 修改医生信息 89 | * bug: dState会自动更新为0 90 | */ 91 | @RequestMapping("modifyDoctor") 92 | @ResponseBody 93 | public ResponseData modifyDoctor(Doctor doctor) { 94 | this.doctorService.modifyDoctor(doctor); 95 | return ResponseData.success("修改医生信息成功"); 96 | } 97 | /** 98 | * 分页模糊查询所有患者信息 99 | */ 100 | @RequestMapping("findAllPatients") 101 | public ResponseData findAllPatients(@RequestParam(value = "pageNumber") int pageNumber, @RequestParam(value = "size") int size, @RequestParam(value = "query") String query){ 102 | return ResponseData.success("返回患者信息成功", this.patientService.findAllPatients(pageNumber, size, query)); 103 | } 104 | /** 105 | * 删除患者信息 106 | */ 107 | @RequestMapping("deletePatient") 108 | public ResponseData deletePatient(@RequestParam(value = "pId") int pId) { 109 | Boolean bo = this.patientService.deletePatient(pId); 110 | if (bo){ 111 | return ResponseData.success("删除患者信息成功"); 112 | } 113 | return ResponseData.fail("删除患者信息失败"); 114 | } 115 | /** 116 | * 分页模糊查询所有挂号信息 117 | */ 118 | @RequestMapping("findAllOrders") 119 | public ResponseData findAllOrders(@RequestParam(value = "pageNumber") int pageNumber, @RequestParam(value = "size") int size, @RequestParam(value = "query") String query){ 120 | return ResponseData.success("返回挂号信息成功", this.orderService.findAllOrders(pageNumber, size, query)); 121 | } 122 | /** 123 | * 删除挂号信息 124 | */ 125 | @RequestMapping("deleteOrder") 126 | public ResponseData deleteOrder(@RequestParam(value = "oId") int oId) { 127 | Boolean bo = this.orderService.deleteOrder(oId); 128 | if (bo){ 129 | return ResponseData.success("删除挂号信息成功"); 130 | } 131 | return ResponseData.fail("删除挂号信息失败"); 132 | } 133 | /** 134 | * 发送邮件 135 | */ 136 | @RequestMapping("sendEmail") 137 | public ResponseData sendEmail(String aEmail){ 138 | if (this.adminService.sendEmail(aEmail)) 139 | return ResponseData.success("邮件发送成功!"); 140 | return ResponseData.fail("邮箱号未注册!"); 141 | } 142 | /** 143 | * 找回密码服务邮件和验证码校验 144 | */ 145 | @RequestMapping("findPassword") 146 | public ResponseData findPassword(String aEmail, String aPassword, String code){ 147 | if(this.adminService.findPassword(aEmail, aPassword, code)) 148 | return ResponseData.success("密码修改成功"); 149 | return ResponseData.fail("密码修改失败!验证码不正确或者已过期"); 150 | } 151 | 152 | 153 | } 154 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/utils/PdfUtil.java: -------------------------------------------------------------------------------- 1 | package com.dgut.utils; 2 | 3 | import com.dgut.pojo.Orders; 4 | import com.itextpdf.text.*; 5 | import com.itextpdf.text.pdf.*; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | public class PdfUtil { 11 | 12 | public static void ExportPdf(HttpServletRequest request, HttpServletResponse response, Orders order) throws Exception { 13 | //告诉浏览器用什么软件可以打开此文件 14 | response.setHeader("content-Type", "application/pdf"); 15 | //下载文件的默认名称 16 | // response.setHeader("Content-Disposition", "attachment;filename=XXX.pdf"); 17 | //设置中文 18 | BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); 19 | Font FontChinese = new Font(bfChinese, 12, Font.NORMAL); 20 | //创建一个文档 21 | Document document = new Document(PageSize.A4); 22 | //创建第一个段落 23 | Paragraph titleParagraph = new Paragraph(); 24 | //支持中文 25 | titleParagraph.setFont(new Font(bfChinese, 20, Font.NORMAL)); 26 | //设置居中显示 27 | titleParagraph.setAlignment(Element.ALIGN_CENTER); 28 | titleParagraph.add("医院病情报告单"); 29 | //创建第二个段落 30 | Paragraph tipsParagraph = new Paragraph(); 31 | tipsParagraph.setFont(new Font(bfChinese, 10, Font.NORMAL)); 32 | tipsParagraph.setAlignment(Element.ALIGN_CENTER); 33 | tipsParagraph.setLeading(tipsParagraph.getTotalLeading()+10); 34 | tipsParagraph.add("打印时间:" + TodayUtil.getTodayYmd()); 35 | 36 | PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream()); 37 | 38 | // 打开文档 39 | document.open(); 40 | //设置文档标题 41 | document.addTitle("医院"); 42 | //设置文档作者 43 | document.addAuthor("陈志朋"); 44 | document.addCreationDate(); 45 | //设置关键字 46 | document.addKeywords("iText"); 47 | document.addLanguage("中文"); 48 | //增加段落进入文档 49 | document.add(titleParagraph); 50 | document.add(tipsParagraph); 51 | //表格 52 | PdfPTable tableMessage = new PdfPTable(4); 53 | tableMessage.setSpacingBefore(8f); 54 | tableMessage.setSpacingAfter(8f); 55 | //设置表格无边框 56 | tableMessage.getDefaultCell().setBorder(0); 57 | //设置表格宽度 58 | tableMessage.setTotalWidth(new float[] { 30, 120, 30, 120 }); 59 | tableMessage.addCell(new Paragraph("姓名", FontChinese)); 60 | tableMessage.addCell(new Paragraph(order.getPatient().getPName(), FontChinese)); 61 | tableMessage.addCell(new Paragraph("性别", FontChinese)); 62 | tableMessage.addCell(new Paragraph(order.getPatient().getPGender(), FontChinese)); 63 | tableMessage.addCell(new Paragraph("年龄", FontChinese)); 64 | tableMessage.addCell(new Paragraph(order.getPatient().getPAge() +" 岁", FontChinese)); 65 | tableMessage.addCell(new Paragraph("单号", FontChinese)); 66 | tableMessage.addCell(String.valueOf(order.getOId())); 67 | tableMessage.addCell(new Paragraph("日期", FontChinese)); 68 | tableMessage.addCell(order.getOEnd()); 69 | tableMessage.addCell(new Paragraph("电话", FontChinese)); 70 | tableMessage.addCell(order.getPatient().getPPhone()); 71 | document.add(tableMessage); 72 | 73 | 74 | 75 | //病情表格 76 | PdfPTable tableOrder = new PdfPTable(1); 77 | //设置表格无边框 78 | tableOrder.getDefaultCell().setBorder(0); 79 | tableOrder.setSpacingBefore(30f); 80 | tableOrder.setSpacingAfter(10f); 81 | 82 | PdfPCell cell1 = new PdfPCell(new Paragraph("症状", new Font(bfChinese, 14, Font.NORMAL))); 83 | cell1.setFixedHeight(25); 84 | cell1.setBorder(0); 85 | PdfPCell cell2 = new PdfPCell(new Paragraph(order.getORecord(), new Font(bfChinese, 10, Font.NORMAL))); 86 | cell2.setFixedHeight(30); 87 | cell2.setBorder(0); 88 | cell2.setPaddingLeft(10); 89 | PdfPCell cell3 = new PdfPCell(new Paragraph("检查项目及价钱", new Font(bfChinese, 14, Font.NORMAL))); 90 | cell3.setFixedHeight(25); 91 | cell3.setBorder(0); 92 | PdfPCell cell4 = new PdfPCell(new Paragraph(order.getOCheck(), new Font(bfChinese, 10, Font.NORMAL))); 93 | cell4.setFixedHeight(30); 94 | cell4.setBorder(0); 95 | cell4.setPaddingLeft(10); 96 | PdfPCell cell5 = new PdfPCell(new Paragraph("药物及价钱", new Font(bfChinese, 14, Font.NORMAL))); 97 | cell5.setFixedHeight(25); 98 | cell5.setBorder(0); 99 | PdfPCell cell6 = new PdfPCell(new Paragraph(order.getODrug(), new Font(bfChinese, 10, Font.NORMAL))); 100 | cell6.setFixedHeight(30); 101 | cell6.setBorder(0); 102 | cell6.setPaddingLeft(10); 103 | PdfPCell cell7 = new PdfPCell(new Paragraph("诊断/医生意见", new Font(bfChinese, 14, Font.NORMAL))); 104 | cell7.setFixedHeight(25); 105 | cell7.setBorder(0); 106 | PdfPCell cell8 = new PdfPCell(new Paragraph(order.getOAdvice(), new Font(bfChinese, 10, Font.NORMAL))); 107 | cell8.setFixedHeight(100); 108 | cell8.setBorder(0); 109 | cell8.setPaddingLeft(10); 110 | 111 | tableOrder.addCell(cell1); 112 | tableOrder.addCell(cell2); 113 | tableOrder.addCell(cell3); 114 | tableOrder.addCell(cell4); 115 | tableOrder.addCell(cell5); 116 | tableOrder.addCell(cell6); 117 | tableOrder.addCell(cell7); 118 | tableOrder.addCell(cell8); 119 | document.add(tableOrder); 120 | 121 | //增加logo,绝对定位居于右上角 122 | // Image image = Image.getInstance("src/main/resources/static/images/dgut.jpeg"); 123 | // image.setAbsolutePosition(440,690); 124 | // document.add(image); 125 | 126 | //设置pdf底部版权说明 127 | PdfContentByte cb = writer.getDirectContent(); 128 | BaseFont bf= BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.EMBEDDED); 129 | cb.beginText(); 130 | cb.setFontAndSize(bf, 11); 131 | cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "该报告单仅供参考", 300, 40, 0); 132 | cb.setFontAndSize(bf,13); 133 | cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "版权医院所有", 300, 20, 0); 134 | cb.endText(); 135 | 136 | 137 | 138 | 139 | 140 | document.close(); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/main/resources/mybatis/OrderMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 64 | 65 | 66 | update orders set o_check = concat(o_check,#{oCheck}),o_drug = concat(o_drug,#{oDrug}),o_total_price = #{oTotalPrice},o_advice = #{oAdvice} where o_id=#{oId} 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 119 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/serviceImpl/PatientServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.dgut.mapper.PatientMapper; 8 | import com.dgut.pojo.Patient; 9 | import com.dgut.service.PatientService; 10 | import com.dgut.utils.Md5Util; 11 | import com.dgut.utils.RandomUtil; 12 | import com.dgut.utils.TodayUtil; 13 | import lombok.extern.slf4j.Slf4j; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.mail.SimpleMailMessage; 16 | import org.springframework.mail.javamail.JavaMailSender; 17 | import org.springframework.stereotype.Service; 18 | import redis.clients.jedis.Jedis; 19 | import redis.clients.jedis.JedisPool; 20 | 21 | import java.util.ArrayList; 22 | import java.util.HashMap; 23 | import java.util.List; 24 | 25 | @Service("PatientService") 26 | @Slf4j 27 | public class PatientServiceImpl implements PatientService { 28 | @Autowired 29 | private PatientMapper patientMapper; 30 | @Autowired 31 | private JavaMailSender javaMailSender;//邮箱 32 | @Autowired 33 | private JedisPool jedisPool;//redis连接池 34 | 35 | 36 | /** 37 | * 登录数据校验 38 | * */ 39 | @Override 40 | public Patient login(int pId, String pPassword){ 41 | Patient patient = this.patientMapper.selectById(pId); 42 | String password = Md5Util.getMD5(pPassword); 43 | if (patient == null) { 44 | return null; 45 | } else { 46 | if ((patient.getPPassword()).equals(password)) { 47 | return patient; 48 | } 49 | } 50 | return null; 51 | } 52 | /** 53 | * 分页模糊查询所有患者信息 54 | */ 55 | @Override 56 | public HashMap findAllPatients(int pageNumber, int size, String query) { 57 | Page page = new Page<>(pageNumber, size); 58 | QueryWrapper wrapper = new QueryWrapper<>(); 59 | wrapper.like("p_name", query).orderByDesc("p_state"); 60 | IPage iPage = this.patientMapper.selectPage(page, wrapper); 61 | HashMap hashMap = new HashMap<>(); 62 | hashMap.put("total", iPage.getTotal()); //总条数 63 | hashMap.put("pages", iPage.getPages()); //总页数 64 | hashMap.put("pageNumber", iPage.getCurrent());//当前页 65 | hashMap.put("patients", iPage.getRecords()); //查询到的记录 66 | return hashMap; 67 | } 68 | 69 | /** 70 | * 删除患者信息 71 | */ 72 | @Override 73 | public Boolean deletePatient(int pId) { 74 | Patient patient = new Patient(); 75 | patient.setPId(pId); 76 | patient.setPState(0); 77 | this.patientMapper.updateById(patient); 78 | return true; 79 | } 80 | /** 81 | * 根据患者id查询患者信息 82 | */ 83 | @Override 84 | public Patient findPatientById(int pId){ 85 | QueryWrapper wrapper = new QueryWrapper<>(); 86 | wrapper.eq("p_id", pId); 87 | return this.patientMapper.selectOne(wrapper); 88 | } 89 | 90 | /** 91 | * 发送邮件 92 | */ 93 | @Override 94 | public Boolean sendEmail(String pEmail){ 95 | 96 | QueryWrapper wrapper = new QueryWrapper<>(); 97 | wrapper.eq("p_email", pEmail); 98 | Patient patient = this.patientMapper.selectOne(wrapper); 99 | if (patient == null){ 100 | return false; 101 | }else { 102 | Integer code = RandomUtil.randomCode(); 103 | SimpleMailMessage message = new SimpleMailMessage(); 104 | message.setFrom("1306931167@qq.com"); //发送者 105 | message.setTo(pEmail); //接受者 106 | //message.setCc("hinschan1998@163.com"); //抄送,填发送者的邮箱即可 107 | message.setSubject("大朗医院找回密码服务"); //主题 108 | message.setText("尊敬的用户!您的账号为:" + patient.getPId() + " 验证码为 "+ code +" ,有效期为2分钟!"); //内容 109 | try { 110 | javaMailSender.send(message); 111 | Jedis jedis = jedisPool.getResource(); 112 | jedis.set(pEmail, String.valueOf(code)); 113 | jedis.expire(pEmail, 120); 114 | System.out.println("简单邮件已经发送"); 115 | } catch (Exception e) { 116 | System.out.println("发送简单邮件时发生异常!" + e.toString()); 117 | return false; 118 | } 119 | } 120 | return true; 121 | } 122 | /** 123 | * 找回密码服务 124 | */ 125 | @Override 126 | public Boolean findPassword(String pEmail, String pPassword, String code){ 127 | UpdateWrapper wrapper = new UpdateWrapper<>(); 128 | String password = Md5Util.getMD5(pPassword); 129 | Jedis jedis = jedisPool.getResource(); 130 | //System.out.println("============="+jedis.get(pEmail)); 131 | if (jedis.get(pEmail) == null) 132 | return false; 133 | if (jedis.get(pEmail).equals(code)){ 134 | wrapper.set("p_password", password).eq("p_email", pEmail); 135 | this.patientMapper.update(null, wrapper); 136 | return true; 137 | } 138 | return false; 139 | 140 | } 141 | /** 142 | * 增加患者信息 143 | */ 144 | @Override 145 | public Boolean addPatient(Patient patient) { 146 | //如果账号已存在则返回false 147 | List patients = this.patientMapper.selectList(null); 148 | for (Patient patient1 : patients) { 149 | if (patient.getPId() == patient1.getPId()) { 150 | return false; 151 | } 152 | if ((patient.getPEmail()).equals(patient1.getPEmail()) ){ 153 | return false; 154 | } 155 | } 156 | int yourYear = Integer.parseInt(patient.getPBirthday().substring(0, 4)); 157 | int todayYear = Integer.parseInt(TodayUtil.getTodayYmd().substring(0,4)); 158 | //密码md5加密 159 | String password = Md5Util.getMD5(patient.getPPassword()); 160 | patient.setPPassword(password); 161 | patient.setPAge(todayYear-yourYear); 162 | patient.setPState(1); 163 | this.patientMapper.insert(patient); 164 | return true; 165 | } 166 | /** 167 | * 统计患者男女人数 168 | */ 169 | public List patientAge(){ 170 | List ageList = new ArrayList<>(); 171 | Integer age1 = this.patientMapper.patientAge(0, 9); 172 | Integer age2 = this.patientMapper.patientAge(10, 19); 173 | Integer age3 = this.patientMapper.patientAge(20, 29); 174 | Integer age4 = this.patientMapper.patientAge(30, 39); 175 | Integer age5 = this.patientMapper.patientAge(40, 49); 176 | Integer age6 = this.patientMapper.patientAge(50, 59); 177 | Integer age7 = this.patientMapper.patientAge(60, 69); 178 | Integer age8 = this.patientMapper.patientAge(70, 79); 179 | Integer age9 = this.patientMapper.patientAge(80, 89); 180 | Integer age10 = this.patientMapper.patientAge(90, 99); 181 | ageList.add(age1); 182 | ageList.add(age2); 183 | ageList.add(age3); 184 | ageList.add(age4); 185 | ageList.add(age5); 186 | ageList.add(age6); 187 | ageList.add(age7); 188 | ageList.add(age8); 189 | ageList.add(age9); 190 | ageList.add(age10); 191 | return ageList; 192 | 193 | } 194 | 195 | 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 4.0.0 6 | 7 | com.dgut 8 | hospital 9 | 1.0-SNAPSHOT 10 | 11 | hospital 12 | 13 | http://www.example.com 14 | 15 | 16 | UTF-8 17 | 1.7 18 | 1.7 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-parent 25 | 2.2.4.RELEASE 26 | 27 | 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-starter 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-logging 37 | 38 | 39 | 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-web 44 | 45 | 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | 51 | 52 | 53 | mysql 54 | mysql-connector-java 55 | 56 | 57 | 58 | 59 | org.projectlombok 60 | lombok 61 | true 62 | 63 | 64 | 65 | 66 | org.mybatis.spring.boot 67 | mybatis-spring-boot-starter 68 | 2.1.2 69 | 70 | 71 | 72 | 73 | com.baomidou 74 | mybatis-plus-boot-starter 75 | 3.1.1 76 | 77 | 78 | 79 | com.auth0 80 | java-jwt 81 | 3.4.0 82 | 83 | 84 | 85 | 86 | org.slf4j 87 | slf4j-log4j12 88 | 89 | 90 | 91 | 92 | junit 93 | junit 94 | 4.11 95 | test 96 | 97 | 98 | junit 99 | junit 100 | 101 | 102 | org.springframework.boot 103 | spring-boot-starter-test 104 | test 105 | 106 | 107 | org.junit.vintage 108 | junit-vintage-engine 109 | 110 | 111 | 112 | 113 | org.springframework.boot 114 | spring-boot-test 115 | 116 | 117 | 118 | 119 | org.springframework.boot 120 | spring-boot-starter-mail 121 | 122 | 123 | 124 | org.springframework.boot 125 | spring-boot-starter-data-redis 126 | 127 | 128 | io.lettuce 129 | lettuce-core 130 | 131 | 132 | 133 | 134 | redis.clients 135 | jedis 136 | 137 | 138 | 139 | com.itextpdf 140 | itextpdf 141 | 5.5.11 142 | 143 | 144 | 145 | 146 | com.itextpdf 147 | itext-asian 148 | 5.2.0 149 | 150 | 151 | 152 | cn.afterturn 153 | easypoi-base 154 | 3.2.0 155 | 156 | 157 | cn.afterturn 158 | easypoi-web 159 | 3.2.0 160 | 161 | 162 | cn.afterturn 163 | easypoi-annotation 164 | 3.2.0 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | maven-clean-plugin 177 | 3.1.0 178 | 179 | 180 | 181 | maven-resources-plugin 182 | 3.0.2 183 | 184 | 185 | maven-compiler-plugin 186 | 3.8.0 187 | 188 | 189 | maven-surefire-plugin 190 | 2.22.1 191 | 192 | 193 | maven-jar-plugin 194 | 3.0.2 195 | 196 | 197 | maven-install-plugin 198 | 2.5.2 199 | 200 | 201 | maven-deploy-plugin 202 | 2.8.2 203 | 204 | 205 | 206 | maven-site-plugin 207 | 3.7.1 208 | 209 | 210 | maven-project-info-reports-plugin 211 | 3.0.0 212 | 213 | 214 | 215 | 216 | 217 | org.apache.maven.plugins 218 | maven-compiler-plugin 219 | 220 | 8 221 | 8 222 | 223 | 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /src/main/java/com/dgut/service/serviceImpl/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.dgut.service.serviceImpl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.dgut.mapper.OrderMapper; 8 | import com.dgut.pojo.Orders; 9 | import com.dgut.service.OrderService; 10 | import com.dgut.utils.RandomUtil; 11 | import com.dgut.utils.TodayUtil; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Service; 14 | import redis.clients.jedis.Jedis; 15 | import redis.clients.jedis.JedisPool; 16 | 17 | import java.util.HashMap; 18 | import java.util.List; 19 | 20 | @Service("OrderService") 21 | public class OrderServiceImpl implements OrderService { 22 | 23 | @Autowired 24 | private OrderMapper orderMapper; 25 | @Autowired 26 | private JedisPool jedisPool;//redis连接池 27 | /** 28 | * 分页模糊查询所有挂号信息 29 | */ 30 | @Override 31 | public HashMap findAllOrders(int pageNumber, int size, String query) { 32 | Page page = new Page<>(pageNumber, size); 33 | QueryWrapper wrapper = new QueryWrapper<>(); 34 | wrapper.like("p_id", query); 35 | IPage iPage = this.orderMapper.selectPage(page, wrapper); 36 | HashMap hashMap = new HashMap<>(); 37 | hashMap.put("total", iPage.getTotal()); //总条数 38 | hashMap.put("pages", iPage.getPages()); //总页数 39 | hashMap.put("pageNumber", iPage.getCurrent());//当前页 40 | hashMap.put("orders", iPage.getRecords()); //查询到的记录 41 | return hashMap; 42 | } 43 | 44 | /** 45 | * 删除挂号信息 46 | */ 47 | @Override 48 | public Boolean deleteOrder(int oId) { 49 | this.orderMapper.deleteById(oId); 50 | return true; 51 | } 52 | /** 53 | * 增加挂号信息 54 | */ 55 | @Override 56 | public Boolean addOrder(Orders order, String arId){ 57 | //redis开始 58 | Jedis jedis = jedisPool.getResource(); 59 | String time = order.getOStart().substring(11, 22); 60 | synchronized (this) { 61 | if (time.equals("08:30-09:30")) { 62 | if (jedis.hget(arId, "eTOn").equals("0")) 63 | return false; 64 | jedis.hincrBy(arId, "eTOn", -1); 65 | } 66 | 67 | if (time.equals("09:30-10:30")) { 68 | if (jedis.hget(arId, "nTOt").equals("0")) 69 | return false; 70 | jedis.hincrBy(arId, "nTOt", -1); 71 | } 72 | if (time.equals("10:30-11:30")) { 73 | if (jedis.hget(arId, "tTOe").equals("0")) 74 | return false; 75 | jedis.hincrBy(arId, "tTOe", -1); 76 | } 77 | if (time.equals("14:30-15:30")) { 78 | if (jedis.hget(arId, "fTOf").equals("0")) 79 | return false; 80 | jedis.hincrBy(arId, "fTOf", -1); 81 | } 82 | if (time.equals("15:30-16:30")) { 83 | if (jedis.hget(arId, "fTOs").equals("0")) 84 | return false; 85 | jedis.hincrBy(arId, "fTOs", -1); 86 | } 87 | if (time.equals("16:30-17:30")) { 88 | if (jedis.hget(arId, "sTOs").equals("0")) 89 | return false; 90 | jedis.hincrBy(arId, "sTOs", -1); 91 | } 92 | } 93 | jedis.close(); 94 | //redis结束 95 | order.setOId(RandomUtil.randomOid(order.getPId())); 96 | order.setOState(0); 97 | order.setOPriceState(0); 98 | order.setOStart(order.getOStart().substring(0,22)); 99 | this.orderMapper.insert(order); 100 | return true; 101 | } 102 | /** 103 | * 根据pId查询挂号 104 | */ 105 | public List findOrderByPid(int pId){ 106 | 107 | return this.orderMapper.findOrderByPid(pId); 108 | } 109 | /** 110 | * 查看当天挂号列表 111 | */ 112 | @Override 113 | public List findOrderByNull(int dId, String oStart){ 114 | return this.orderMapper.findOrderByNull(dId, oStart); 115 | } 116 | /** 117 | * 根据id更新挂号信息 118 | */ 119 | @Override 120 | public Boolean updateOrder(Orders orders) { 121 | orders.setOState(1); 122 | orders.setOEnd(TodayUtil.getToday()); 123 | QueryWrapper wrapper = new QueryWrapper<>(); 124 | wrapper.eq("o_id", orders.getOId()); 125 | this.orderMapper.update(orders, wrapper); 126 | return true; 127 | } 128 | /** 129 | * 根据id设置缴费状态 130 | */ 131 | @Override 132 | public Boolean updatePrice(int oId){ 133 | /** 134 | * 用QueryWrapper如果不把外键的值也传进来,会报错 135 | * 用UpdateWrapper就正常 136 | */ 137 | UpdateWrapper wrapper = new UpdateWrapper<>(); 138 | wrapper.eq("o_id", oId).set("o_price_state", 1).set("o_total_price", 0.00); 139 | int i = this.orderMapper.update(null, wrapper); 140 | System.out.println("影响行数"+i); 141 | return true; 142 | } 143 | /** 144 | * 查找医生已完成的挂号单 145 | */ 146 | @Override 147 | public HashMap findOrderFinish(int pageNumber, int size, String query, int dId){ 148 | Page page = new Page<>(pageNumber, size); 149 | QueryWrapper wrapper = new QueryWrapper<>(); 150 | wrapper.like("p_id", query).eq("d_id", dId).orderByDesc("o_start").eq("o_state", 1); 151 | IPage iPage = this.orderMapper.selectPage(page, wrapper); 152 | HashMap hashMap = new HashMap<>(); 153 | hashMap.put("total", iPage.getTotal()); //总条数 154 | hashMap.put("pages", iPage.getPages()); //总页数 155 | hashMap.put("pageNumber", iPage.getCurrent());//当前页 156 | hashMap.put("orders", iPage.getRecords()); //查询到的记录 157 | 158 | return hashMap; 159 | } 160 | /** 161 | * 根据dId查询挂号 162 | */ 163 | public HashMap findOrderByDid(int pageNumber, int size, String query, int dId){ 164 | Page page = new Page<>(pageNumber, size); 165 | QueryWrapper wrapper = new QueryWrapper<>(); 166 | wrapper.like("p_id", query).eq("d_id", dId).orderByDesc("o_start"); 167 | IPage iPage = this.orderMapper.selectPage(page, wrapper); 168 | HashMap hashMap = new HashMap<>(); 169 | hashMap.put("total", iPage.getTotal()); //总条数 170 | hashMap.put("pages", iPage.getPages()); //总页数 171 | hashMap.put("pageNumber", iPage.getCurrent());//当前页 172 | hashMap.put("orders", iPage.getRecords()); //查询到的记录 173 | return hashMap; 174 | } 175 | /** 176 | * 统计今天挂号人数 177 | */ 178 | @Override 179 | public int orderPeople(String oStart){ 180 | return this.orderMapper.orderPeople(oStart); 181 | } 182 | /** 183 | * 统计今天某个医生挂号人数 184 | */ 185 | @Override 186 | public int orderPeopleByDid(String oStart, int dId){ 187 | return this.orderMapper.orderPeopleByDid(oStart, dId); 188 | } 189 | /** 190 | * 统计挂号男女人数 191 | */ 192 | public List orderGender(){ 193 | return this.orderMapper.orderGender(); 194 | } 195 | /** 196 | * 增加诊断及医生意见 197 | */ 198 | public Boolean updateOrderByAdd(Orders order){ 199 | 200 | if (this.orderMapper.updateOrderByAdd(order) == 0){ 201 | return false; 202 | } 203 | 204 | return true; 205 | } 206 | /** 207 | * 判断诊断之后再次购买药物是否已缴费 208 | */ 209 | public Boolean findTotalPrice(int oId){ 210 | Orders order = this.orderMapper.selectById(oId); 211 | if (order.getOTotalPrice() != 0.00){ 212 | order.setOPriceState(0); 213 | this.orderMapper.updateById(order); 214 | return true; 215 | } 216 | return false; 217 | } 218 | /** 219 | * 请求挂号时间段 220 | */ 221 | @Override 222 | public HashMap findOrderTime(String arId){ 223 | Jedis jedis = jedisPool.getResource(); 224 | return (HashMap) jedis.hgetAll(arId); 225 | } 226 | /** 227 | * 统计过去20天挂号科室人数 228 | */ 229 | @Override 230 | public List orderSection(){ 231 | String startTime = TodayUtil.getPastDate(20); 232 | String endTime = TodayUtil.getTodayYmd(); 233 | return this.orderMapper.orderSection(startTime, endTime); 234 | } 235 | } 236 | --------------------------------------------------------------------------------