O’zbekiston respublikasi axborot texnologiyalari va kommunikasiyalarini rivojlantirish vazirligi
III. WEB TEXNOLOGIYAS ASOSIDA ISHLAYDIGAN SHIFOKOR-BEMOR MASOFAVIY TIZIMINI ISHLASH MEXANIZMI
shifokor
III.
|
WEB TEXNOLOGIYAS ASOSIDA ISHLAYDIGAN SHIFOKOR-BEMOR MASOFAVIY TIZIMINI ISHLASH MEXANIZMI |
3.1.Shifokor bemor ish jarayoni uchun masofaviy platformani bosqichma bisqich tasvirlash
Biz bu platformani qurish uchun uni ikki qismga bo’lib olamiz:
1.Frontend.
2.Backend.
Frontend qismi uchun React Js texnologiyasidan foydalanamiz. Ushbu texnologiyani qulayligi shundaki, uning o’zida Html,Css,Bootstrap texnologiyalarni qo’llay olamiz.
3.2. Web texnologiyalar asosida ishlaydigan shifokor-bemor ish jarayoni uchun masofaviy tizimini qanday ishlash jarayonidan lavhalar
Avvaliga bemor yoki mijoz tizimga kirish uchun ro’yxatdan o’tadi
Ro’yxatdan o’tgan vaqtda xavfsizlik ta’minlash maqsadida ro’yxatdan o’tgan telefon raqamiga kod yuboriladi. Buni qo’llash uchun google ning firebase saytidagi API sidan foydalanamiz.
Bu yerda o’zimning raqamimni registratsiya qildim.
Ro’yxatdan o’tgach shifokorga ariza beriladi. Unda hafta kuni, vaqti, va qaysi doctor kerak bo’lsa shuni tanlaydi.
Keyin biz ro’yxatdan o’tgan shifokorning login va paroli bilan tizimga kiramiz.
Shifokorning panelida barcha ariza bergan bemorlaring ro’yxati chiqadi.
Bemor doctorga ko’ringandan keyin doctor uni ro’yxatdan o’chiradi.
Ilovalar
package uz.pdp.doctorclient.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import uz.pdp.doctorclient.entity.Apply;
import uz.pdp.doctorclient.payload.ApiResponse;
import uz.pdp.doctorclient.payload.ReqApply;
import uz.pdp.doctorclient.repository.ApplyRepository;
import uz.pdp.doctorclient.repository.DiseaseRepository;
import uz.pdp.doctorclient.repository.WeekDaysRepository;
@Service
public class ApplyService {
@Autowired
ApplyRepository applyRepository;
@Autowired
WeekDaysRepository weekDaysRepository;
@Autowired
DiseaseRepository diseaseRepository;
public ApiResponse addApply(ReqApply reqApply) {
Apply apply = new Apply();
apply.setFirstName(reqApply.getFirstName());
apply.setLastName(reqApply.getLastName());
apply.setWeekDays(weekDaysRepository.getOne(reqApply.getWeekDaysId()));
apply.setTime(reqApply.getTime());
apply.setDisease(diseaseRepository.getOne(reqApply.getDiseaseId()));
applyRepository.save(apply);
return new ApiResponse("Ariza saqlandi",true);
}
public ApiResponse delete(Integer id){
applyRepository.deleteById(id);
return new ApiResponse("Uchirildi",true);
}
}
package uz.pdp.doctorclient.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import uz.pdp.doctorclient.payload.ApiResponse;
import uz.pdp.doctorclient.payload.JwtResponse;
import uz.pdp.doctorclient.payload.ReqLogin;
import uz.pdp.doctorclient.payload.ReqUser;
import uz.pdp.doctorclient.security.AuthService;
import uz.pdp.doctorclient.security.JwtTokenProvider;
@Controller
@RequestMapping("/api/auth")
public class AuthController {
@Autowired
AuthenticationManager authenticationManager;
@Autowired
JwtTokenProvider jwtTokenProvider;
@Autowired
AuthService authService;
@PostMapping("/login")
public HttpEntity> login(@RequestBody ReqLogin reqLogin) {
Authentication authentication = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(reqLogin.getPhoneNumber(), reqLogin.getPassword()));
SecurityContextHolder.getContext().setAuthentication(authentication);
String token = jwtTokenProvider.generateToken(authentication);
return ResponseEntity.ok(new JwtResponse(token));
}
@PostMapping("/register")
public HttpEntity> registerUser(@RequestBody ReqUser reqUser) {
ApiResponse response = authService.addUser(reqUser);
return ResponseEntity.status(response.isSuccess() ? HttpStatus.CREATED : HttpStatus.CONFLICT).body(response);
}
}
package uz.pdp.doctorclient.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
public class Apply {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String firstName;
private String lastName;
@OneToOne(fetch = FetchType.LAZY)
private WeekDays weekDays;
private String time;
@ManyToOne(fetch = FetchType.LAZY)
private Disease disease;
}
import React, {Component} from 'react';
import {Col, Container, Row} from "reactstrap";
import {AvField, AvForm} from "availity-reactstrap-validation";
import {connect} from "react-redux";
import router from "umi/router";
@connect(({apply, app}) => ({apply, app}))
class Cabinet extends Component {
componentDidMount() {
const {dispatch, app} = this.props;
dispatch({
type: 'apply/getWeekDays'
});
dispatch({
type: 'apply/getDisease'
})
}
render() {
const {dispatch, apply} = this.props;
const {weekDays, diseases} = apply;
const addApply = (e, v) => {
dispatch({
type: 'apply/addApply',
payload: {
...v
}
})
};
return (
{
weekDays.map(item =>
)
}
{
diseases.map(item =>
)
}
);
}
}
Cabinet.propTypes = {};
export default Cabinet;
import api from 'api'
import {router} from "umi";
const {getWeekDays, addApply, getDisease} = api;
export default ({
namespace: 'apply',
state: {
weekDays:[],
diseases:[]
},
subscriptions: {},
effects: {
* getWeekDays({payload}, {call, put, select}) {
const res = yield call(getWeekDays);
Do'stlaringiz bilan baham:
ma'muriyatiga murojaat qiling