目标
- 需求分析
- 病历本相关的信息
- 初始加载项开发
- 级联项开发
需求分析
1、 发票号:手输(将来会入到发票表里invoice表 费用明细表)
(建表)2、病历号 姓名 性别 身份证号 家庭住址 ----存到病历信息表里(基本信息) 待建
年令 和岁别推算出来
病历号(触发查询病历本表medicalbook)
1、如果没有,证明在当前医院没有挂过号,姓名等基本信息需要录入
2、如果有,就把姓名,性别,身份证号等信息加载出来
2、结算类别 性别 来自于常数项(关联常数类别表和常数项表,有现成的接口) 可复用以前的
ok
3、看诊日期 选择的 -ok
4、午别 下拉选择的 -ok
noonTypeoptions: [{key:'1',value:'上午'},{key:'2',value:'下午'}],
5、挂号科室 下拉选择 (有现成的接口)
ok
***6、号别(需要根据3,4,5推算出来)
****7、看诊医生(需要根据3,4,5,6推算出来)
****8、初始号额(根据号别6能推算出来(专家号和普通号不同) 挂号级别表)
****9、已用号额(汇总挂号表里当前日期和医生的总条数 没退号)
隐式需求-需要判断已用号是否<初始号额 如果达到限 额需要给用户提示
10、选择此次是否需要病历本(勾选上结算时加5元)
11、应收金额(挂号级别表里的收费额度+病历本钱)
12、收费方式(关联常数类别表和常数项表,有现成的接口) 可复用以前的
ok
纯静态页开发
1、静态页开发(FY19-java24-姜楠作品)
<template>
<el-form :model="ruleForm" ref="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
<el-row>
<!--:span流式布局中占一行24份中的多少份-->
<el-col :span="20">
<el-form-item label="发票号" prop="invoiceNum" >
<el-input v-model="ruleForm.invoiceNum" style="width: 200px; float: left;"></el-input>
<el-button type="primary" @click="submitForm('ruleForm')" style="float: left; margin-left: 20px;">挂号</el-button>
<el-button type="primary" @click="restForm('ruleForm')" style="float: left; margin-left: 20px;">清空</el-button>
</el-form-item>
</el-col>
</el-row>
<p style="text-align: left; font-size: large;">挂号信息</p>
<hr />
<el-row>
<el-col :span="4">
<el-form-item label="病历号" prop="caseNumber">
<el-input v-model="ruleForm.caseNumber" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="姓名" prop="realName">
<el-input v-model="ruleForm.realName" ></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="性别" prop="gender">
<el-select v-model="ruleForm.gender" placeholder="请选择性别" >
<el-option v-for="item in genderoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3" >
<el-form-item label="年龄" prop="age">
<el-input v-model="ruleForm.age"></el-input>
</el-form-item>
</el-col>
<el-col :span="3" >
<el-form-item label="岁别" prop="ageType">
<el-select v-model="ruleForm.ageType">
<el-option v-for="item in ageTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="出生日期" prop="birthDate">
<el-date-picker
v-model="ruleForm.birthDate"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="身份证号" prop="idNumber">
<el-input v-model="ruleForm.idNumber" ></el-input>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="家庭住址" prop="homeAddress">
<el-input v-model="ruleForm.homeAddress" ></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="结算类型" prop="settleID">
<el-select v-model="ruleForm.settleID" placeholder="请选择结算类别" >
<el-option v-for="item in settleIDTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="看诊日期" prop="visitDate">
<el-date-picker
v-model="ruleForm.visitDate"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="午别" prop="noon">
<el-select v-model="ruleForm.noon" placeholder="请选择午别" >
<el-option v-for="item in noonTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="挂号科室" prop="deptID" style="float: right;">
<el-select v-model="ruleForm.deptID" placeholder="请选择科室" >
<el-option v-for="item in deptIDTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="好别" prop="registLeID">
<el-select v-model="ruleForm.registLeID" placeholder="请选择好别" >
<el-option v-for="item in registLeIDTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="看诊医生" prop="userId">
<el-select v-model="ruleForm.userId" placeholder="请选择医生" >
<el-option v-for="item in userIdTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="初始号额" prop="startRegistQuota">
<el-input v-model="ruleForm.startRegistQuota" placeholder="初始号额"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="已用号额" prop="usedRegistQuota" style="float: right;">
<el-input v-model="ruleForm.usedRegistQuota" placeholder="已用号额"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="病历本" prop="isBook" style="float: left;">
<el-radio v-model="ruleForm.isBook" label="1">是</el-radio>
<el-radio v-model="ruleForm.isBook" label="0">否</el-radio>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="应收金额">
<el-input v-model="ruleForm.fee" placeholder="应收金额"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="收费方式" prop="method">
<el-select v-model="ruleForm.method" placeholder="请选择收费方式" >
<el-option v-for="item in methodTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default{
data(){
return{
ruleForm:{
invoiceNum:'',
caseNumber:'',
realName:'',
age:'',
ageType:'',
birthDate:'',
idNumber:'',
homeAddress:'',
settleID:'',
visitDate:'',
noon:'',
deptID:'',
registLeID:'',
userId:'',
startRegistQuota:'',
usedRegistQuota:'',
isBook:'1',
fee:'',
method:'',
gender:''
},
rules:{
invoiceNum:[{required: true, message: '请输入发票号', trigger: 'blur'},
{min: 8, max: 64, message: '发票号在 8 到 64 之间', trigger: 'blur' }],
caseNumber:[{required: true, message: '请输入病历号', trigger: 'blur'},
{min: 8, max: 64, message: '病历号在 8 到 64 之间', trigger: 'blur'}],
realName:[{required: true, message: '请输入姓名', trigger: 'blur'},
{min: 2, max: 32, message: '姓名在 2 到 32 之间', trigger: 'blur'}],
idNumber:[{required: true, message: '请输入身份证号', trigger: 'blur'},
{min: 15, max: 18, message: '身份证号在 15 到 18 之间', trigger: 'blur'}]
},
genderoptions:[],
ageTypeoptions:[
{key:1,value:'岁'},
{key:2,value:'月'},
{key:3,value:'天'}
],
settleIDTypeoptions:[
{key:1,value:'自费'},
{key:2,value:'市医保'},
{key:3,value:'测试缴费'},
{key:4,value:'公费结算'}
],
noonTypeoptions:[],
deptIDTypeoptions:[],
registLeIDTypeoptions:[],
userIdTypeoptions:[],
methodTypeoptions:[
{key:1,value:'现金'},
{key:2,value:'支付宝'},
{key:3,value:'微信'},
{key:4,value:'银行卡'}
]
}
}
}
</script>
<style>
</style>
病历本相关的信息
建立病历本信息
package com.neuedu.his.pojo;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name = "medicalbook")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class MedicalBook {
@Id
@GeneratedValue(generator = "jpa-uuid")
@Column(name = "id", nullable = false, length = 32)
private String id;
@Column(name="caseNumber",nullable=false,length=64)
private String caseNumber;
@Column(name="realName",nullable=false,length=64)
private String realName;
@Column(name="sex",nullable=false,length=2)
private String sex;
@Column(name="idCard",nullable=false,length=18)
private String idCard;
@Column(name="address",nullable=false,length=200)
private String address;
private int delMark=1;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getDelMark() {
return delMark;
}
public void setDelMark(int delMark) {
this.delMark = delMark;
}
}
页面根据病历本号查询患者基本信息
<el-col :span="4">
<el-form-item label="病历号" prop="caseNumber">
<el-input v-model="ruleForm.caseNumber" @change="findBookByCaseNumber" ></el-input>
</el-form-item>
</el-col>
findBookByCaseNumber(){
//查询病历本表,
//如果有这个号码的,就加载数据库里caseNumber=?的这条
this.$axios.get("http://localhost:8080/book/findByCaseNumber?caseNumber="+this.ruleForm.caseNumber)
.then(response=>{
let book=response.data;
if(book!=null){
console.log("book:",book);
//查询到的话,就更新当前表单里的realName sex idCard address
//{"id":"","realName":"test","sex":"男","idCard":"12345","address":"沈阳市浑南新区","delMark":1}
this.ruleForm.realName=book.realName;
this.ruleForm.idNumber=book.idCard;
this.ruleForm.sex=book.sex;
this.ruleForm.homeAddress=book.address;
}
})
}
后台关键代码 :
@RestController
@RequestMapping("book")
public class MedicalBookController {
@Autowired
IMedicalBookService medicalBookService;
@RequestMapping("findByCaseNumber")
public MedicalBook findByCaseNumber(String caseNumber){
MedicalBook obj=medicalBookService.findByCaseNumber(caseNumber);
return obj;
}
}
public interface IMedicalBookRepository extends JpaRepository<MedicalBook, String> {
MedicalBook findByCaseNumberAndDelMark(String caseNumber, int i);
}
身份证号推算其他信息
页面完整代码
<template>
<el-form :model="ruleForm" ref="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
<el-row>
<!--:span流式布局中占一行24份中的多少份-->
<el-col :span="20">
<el-form-item label="发票号" prop="invoiceNum">
<el-input v-model="ruleForm.invoiceNum" style="width: 200px; float: left;"></el-input>
<el-button type="primary" @click="submitForm('ruleForm')" style="float: left; margin-left: 20px;">挂号</el-button>
<el-button type="primary" @click="restForm('ruleForm')" style="float: left; margin-left: 20px;">清空</el-button>
</el-form-item>
</el-col>
</el-row>
<p style="text-align: left; font-size: large;">挂号信息</p>
<hr />
<el-row>
<el-col :span="4">
<el-form-item label="病历号" prop="caseNumber">
<el-input v-model="ruleForm.caseNumber" @change="findBookByCaseNumber" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="姓名" prop="realName">
<el-input v-model="ruleForm.realName" size="mini" ></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="身份证号" prop="idNumber" >
<el-input v-model="ruleForm.idNumber" @change="getOther" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="出生日期" prop="birthDate" >
<el-date-picker v-model="ruleForm.birthDate" type="date" format="yyyy-MM-dd" :default-value="ruleForm.birthDate"
placeholder="选择日期" size="mini" >
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<el-form-item label="性别" prop="gender">
<el-select v-model="ruleForm.gender" placeholder="请选择性别" size="mini">
<el-option v-for="item in genderoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="年龄" prop="age">
<el-input v-model="ruleForm.age" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="岁别" prop="ageType">
<el-select v-model="ruleForm.ageType" size="mini">
<el-option v-for="item in ageTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="家庭住址" prop="homeAddress" >
<el-input v-model="ruleForm.homeAddress" size="mini"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="结算类型" prop="settleID">
<el-select v-model="ruleForm.settleID" placeholder="请选择结算类别" size="mini">
<el-option v-for="item in settleIDTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="看诊日期" prop="visitDate">
<el-date-picker v-model="ruleForm.visitDate" type="date" placeholder="选择日期" size="mini">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="午别" prop="noon">
<el-select v-model="ruleForm.noon" placeholder="请选择午别" size="mini">
<el-option v-for="item in noonTypeoptions" :key="item.key" :value="item.value" ></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="挂号科室" prop="deptID" style="float: right;">
<el-select v-model="ruleForm.deptID" placeholder="请选择科室" size="mini">
<el-option v-for="item in deptIDTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="好别" prop="registLeID">
<el-select v-model="ruleForm.registLeID" placeholder="请选择好别" size="mini">
<el-option v-for="item in registLeIDTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="看诊医生" prop="userId">
<el-select v-model="ruleForm.userId" placeholder="请选择医生" size="mini">
<el-option v-for="item in userIdTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="初始号额" prop="startRegistQuota">
<el-input v-model="ruleForm.startRegistQuota" placeholder="初始号额" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="已用号额" prop="usedRegistQuota" style="float: right;">
<el-input v-model="ruleForm.usedRegistQuota" placeholder="已用号额" size="mini"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4">
<el-form-item label="病历本" prop="isBook" style="float: left;">
<el-radio v-model="ruleForm.isBook" label="1">是</el-radio>
<el-radio v-model="ruleForm.isBook" label="0">否</el-radio>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="应收金额">
<el-input v-model="ruleForm.fee" placeholder="应收金额" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="收费方式" prop="method">
<el-select v-model="ruleForm.method" placeholder="请选择收费方式" size="mini">
<el-option v-for="item in methodTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
data() {
return {
ruleForm: {
invoiceNum: '',
caseNumber: '',
realName: '',
age: '',
ageType: '',
birthDate: '19790929',
idNumber: '',
homeAddress: '',
settleID: '',
visitDate: '',
noon: '',
deptID: '',
registLeID: '',
userId: '',
startRegistQuota: '',
usedRegistQuota: '',
isBook: '1',
fee: '',
method: '',
gender: ''
},
rules: {
invoiceNum: [{
required: true,
message: '请输入发票号',
trigger: 'blur'
},
{
min: 8,
max: 64,
message: '发票号在 8 到 64 之间',
trigger: 'blur'
}
],
caseNumber: [{
required: true,
message: '请输入病历号',
trigger: 'blur'
},
{
min: 8,
max: 64,
message: '病历号在 8 到 64 之间',
trigger: 'blur'
}
],
realName: [{
required: true,
message: '请输入姓名',
trigger: 'blur'
},
{
min: 2,
max: 32,
message: '姓名在 2 到 32 之间',
trigger: 'blur'
}
],
idNumber: [{
required: true,
message: '请输入身份证号',
trigger: 'blur'
},
{
min: 15,
max: 18,
message: '身份证号在 15 到 18 之间',
trigger: 'blur'
}
]
},
genderoptions: [],
ageTypeoptions: [{
key: 1,
value: '岁'
},
{
key: 2,
value: '月'
},
{
key: 3,
value: '天'
}
],
settleIDTypeoptions: [{
key: 1,
value: '自费'
},
{
key: 2,
value: '市医保'
},
{
key: 3,
value: '测试缴费'
},
{
key: 4,
value: '公费结算'
}
],
noonTypeoptions: [],
deptIDTypeoptions: [],
registLeIDTypeoptions: [],
userIdTypeoptions: [],
methodTypeoptions: [{
key: 1,
value: '现金'
},
{
key: 2,
value: '支付宝'
},
{
key: 3,
value: '微信'
},
{
key: 4,
value: '银行卡'
}
]
}
},
methods: {
findBookByCaseNumber() {
//查询病历本表,
//如果有这个号码的,就加载数据库里caseNumber=?的这条
this.$axios.get("http://localhost:8080/book/findByCaseNumber?caseNumber=" + this.ruleForm.caseNumber)
.then(response => {
let book = response.data;
if (book != null) {
console.log("book:", book);
//查询到的话,就更新当前表单里的realName sex idCard address
//{"id":"","realName":"test","sex":"男","idCard":"12345","address":"沈阳市浑南新区","delMark":1}
this.ruleForm.realName = book.realName;
this.ruleForm.idNumber = book.idCard;
this.ruleForm.gender = book.sex;
this.ruleForm.homeAddress = book.address;
//计算其他信息
this.getOther();
}
})
},
getOther() {
//根据身份证号的变化计算出生日期,年令,岁别
//alert("身份证号变化");
let idnumber = this.ruleForm.idNumber;
//把出生日期先截取成2020-05-13让他在日期框里显示 ,更新生日列
//把当前时间和出生时间都转换成yyyy-MM-dd格式
let birthday_str = idnumber.substring(6, 6 + 4)+"-"+idnumber.substring(10, 12)+"-"+idnumber.substring(12, 14);
this.ruleForm.birthDate = birthday_str;
let now=new Date();
let curdate = now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();
//计算两个日期相差的天数
let days=this.datedifference(curdate,birthday_str);
//alert("days:"+days);
//计算岁月年
let year=parseInt(days/365);
if(year>0){
//岁别=岁
this.ruleForm.ageType='岁';
//年令=year
this.ruleForm.age=year;
}else if(parseInt(days/30)>0){
//岁别=月
this.ruleForm.ageType='月';
//年令=year
this.ruleForm.age=parseInt(days/30);
}else{
this.ruleForm.age=days;
//岁别=日
this.ruleForm.ageType='日';
//年令=year
}
},
datedifference(sDate1, sDate2) { //sDate1和sDate2是2006-12-18格式
var dateSpan,
tempDate,
iDays;
sDate1 = Date.parse(sDate1);
sDate2 = Date.parse(sDate2);
dateSpan = sDate2 - sDate1;
dateSpan = Math.abs(dateSpan);
iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
return iDays
}
}
}
</script>
<style>
</style>
注意日期格式:yyyy-MM-dd
完整后的效果:
image.png页面初始化加载项开发
结算类别 收费方式 性别类型
前台
//这三个页面初始化时加载的,先清空,请求后台后进行更新
settleIDTypeoptions: [],
deptIDTypeoptions: [],
feeTypeoptions: [],
genderoptions: [],
mounted方法里调用后台获取数据
//如果页面初始化时就显示的信息,写在mounted created方法里
mounted() {
//加载结算类型数据
this.$axios.get("http://localhost:8080/constantItem/findAllByTypeName?typename=结算类别")
.then(response=>{
this.settleIDTypeoptions=response.data;
})
//页面初始化加载付费方式 feeTypeoptions
this.$axios.get("http://localhost:8080/constantItem/findAllByTypeName?typename=收费方式")
.then(response=>{
this.feeTypeoptions=response.data;
})
//性别类型也要加上。
this.$axios.get("http://localhost:8080/constantItem/findAllByTypeName?typename=性别类型")
.then(response=>{
this.genderoptions=response.data;
})
}
下拉列表的显示
<el-form-item label="结算类型" prop="settleID">
<!-- {"constantTypeID":"402880ed71edd0bf0171eddf3edf0004","id":"402880ed71edd0bf0171ede03a8a0005","contantCode":"jslb1","constantName":"自费","delMark":"1"}-->
<el-select v-model="ruleForm.settleID" placeholder="请选择结算类别" size="mini">
<el-option v-for="item in settleIDTypeoptions" :key="item.id" :value="item.id" :label="item.constantName"></el-option>
</el-select>
</el-form-item>
<el-form-item label="收费方式" prop="method">
<el-select v-model="ruleForm.method" placeholder="请选择收费方式" size="mini">
<el-option v-for="item in feeTypeoptions" :key="item.id" :value="item.id" :label="item.constantName"></el-option>
</el-select>
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="ruleForm.gender" placeholder="请选择性别" size="mini">
<el-option v-for="item in genderoptions" :key="item.id" :value="item.id" :label="item.constantName"></el-option>
</el-select>
</el-form-item>
</el-col>
午别
noonTypeoptions: [{key:'1',value:'上午'},{key:'2',value:'下午'}],
<el-form-item label="号别" prop="registLeID">
<el-select v-model="ruleForm.registLeID" placeholder="请选择好别" size="mini">
<el-option v-for="item in registLeIDTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
挂号科室复用以前的 略
级联项的开发(难)
1、号别(需要根据挂号日期,午别,科室推算出来)
<el-form-item label="挂号科室" prop="deptID" style="float: right;">
<!-- onchange事件触发本地方法进行级联查询
根据看诊日期 午别 科室 去查询号别-->
<el-select v-model="ruleForm.deptID" placeholder="请选择科室" size="mini" @change="getRegistLeID">
<el-option key="0" value="" label="请选择"></el-option>
<el-option v-for="item in deptIDTypeoptions" :key="item.id" :value="item.id" :label="item.deptName"></el-option>
</el-select>
</el-form-item>
getRegistLeID(){
alert(this.ruleForm.deptID);
//是想获取挂号时间,午别 ,科室,根据这三项查号别
//查询语句
/* SELECT distinct a.registName,a.id
FROM t_registlevel AS a,t_user AS b,t_department AS c,t_scheduling AS d
WHERE a.id=b.registLeId AND b.deptId=c.id AND b.id=d.userId
and d.schedDate='2020-05-13'
and d.noon="上午"
and d.deptID=1 */
this.$axios.get("http://localhost:8080/registLevel/findRegistLevelByParames?deptID="+this.ruleForm.deptID+"&visitDate="+this.ruleForm.visitDate+"&noon="+this.ruleForm.noon)
.then(response=>{
//如果响应回来,用这个数据更新页面上的号别部分
this.registLeIDTypeoptions=response.data;
})
}
<el-form-item label="号别" prop="registLeID">
<el-select v-model="ruleForm.registLeID" placeholder="请选择好别" size="mini">
<!-- [{"registName":"普通号","id":"402880ed71edd0bf0171edd2d3780000"}] -->
<el-option v-for="item in registLeIDTypeoptions" :key="item.id" :value="item.id" :label="item.registName"></el-option>
</el-select>
</el-form-item>
@RequestMapping("findRegistLevelByParames")
public List<Map<String,Object>> findRegistLevelByParames(String deptID,String visitDate,String noon){
List<Map<String,Object>> list=registlevelservice.findRegistLevelByParames(deptID,visitDate,noon);
return list;
}
public interface RegistLevelResponsitory extends JpaRepository<RegistLevel, String> {
@Query(value=" SELECT distinct a.registName,a.id "+
" FROM t_registlevel AS a,t_user AS b,t_department AS c,t_scheduling AS d "+
" WHERE a.id=b.registLeId AND b.deptId=c.id AND b.id=d.userId "+
" and d.schedDate=?2 "+
" and d.noon=?3 "+
" and d.deptID=?1",nativeQuery=true)
List<Map<String,Object>> findRegistLevelByParames(String deptID, String visitDate, String noon);
}
目前为上止前台的
<template>
<el-form :model="ruleForm" ref="ruleForm" :rules="rules" label-width="100px" class="demo-ruleForm">
<el-row>
<!--:span流式布局中占一行24份中的多少份-->
<el-col :span="20">
<el-form-item label="发票号" prop="invoiceNum">
<el-input v-model="ruleForm.invoiceNum" style="width: 200px; float: left;"></el-input>
<el-button type="primary" @click="submitForm('ruleForm')" style="float: left; margin-left: 20px;">挂号</el-button>
<el-button type="primary" @click="restForm('ruleForm')" style="float: left; margin-left: 20px;">清空</el-button>
</el-form-item>
</el-col>
</el-row>
<p style="text-align: left; font-size: large;">挂号信息</p>
<hr />
<el-row>
<el-col :span="6">
<el-form-item label="病历号" prop="caseNumber">
<el-input v-model="ruleForm.caseNumber" @change="findBookByCaseNumber" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="姓名" prop="realName">
<el-input v-model="ruleForm.realName" size="mini" ></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="身份证号" prop="idNumber" >
<el-input v-model="ruleForm.idNumber" @change="getOther" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="出生日期" prop="birthDate" >
<el-date-picker v-model="ruleForm.birthDate" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :default-value="ruleForm.birthDate"
placeholder="选择日期" size="mini" >
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="3">
<el-form-item label="性别" prop="gender">
<el-select v-model="ruleForm.gender" placeholder="请选择性别" size="mini">
<el-option v-for="item in genderoptions" :key="item.id" :value="item.id" :label="item.constantName"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="年龄" prop="age">
<el-input v-model="ruleForm.age" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<el-form-item label="岁别" prop="ageType">
<el-select v-model="ruleForm.ageType" size="mini">
<el-option v-for="item in ageTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="家庭住址" prop="homeAddress" >
<el-input v-model="ruleForm.homeAddress" size="mini"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="结算类型" prop="settleID">
<!-- {"constantTypeID":"402880ed71edd0bf0171eddf3edf0004","id":"402880ed71edd0bf0171ede03a8a0005","contantCode":"jslb1","constantName":"自费","delMark":"1"}-->
<el-select v-model="ruleForm.settleID" placeholder="请选择结算类别" size="mini">
<el-option v-for="item in settleIDTypeoptions" :key="item.id" :value="item.id" :label="item.constantName"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="看诊日期" prop="visitDate">
<el-date-picker v-model="ruleForm.visitDate" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" size="mini">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="午别" prop="noon">
<el-select v-model="ruleForm.noon" placeholder="请选择午别" size="mini">
<el-option v-for="item in noonTypeoptions" :key="item.key" :value="item.value" :label="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="挂号科室" prop="deptID" style="float: right;">
<!-- onchange事件触发本地方法进行级联查询
根据看诊日期 午别 科室 去查询号别-->
<el-select v-model="ruleForm.deptID" placeholder="请选择科室" size="mini" @change="getRegistLeID">
<el-option key="0" value="" label="请选择"></el-option>
<el-option v-for="item in deptIDTypeoptions" :key="item.id" :value="item.id" :label="item.deptName"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="号别" prop="registLeID">
<el-select v-model="ruleForm.registLeID" placeholder="请选择号别" size="mini">
<!-- [{"registName":"普通号","id":"402880ed71edd0bf0171edd2d3780000"}] -->
<el-option v-for="item in registLeIDTypeoptions" :key="item.id" :value="item.id" :label="item.registName"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="看诊医生" prop="userId">
<el-select v-model="ruleForm.userId" placeholder="请选择医生" size="mini">
<el-option v-for="item in userIdTypeoptions" :key="item.key" :value="item.value"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="初始号额" prop="startRegistQuota">
<el-input v-model="ruleForm.startRegistQuota" placeholder="初始号额" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="已用号额" prop="usedRegistQuota" style="float: right;">
<el-input v-model="ruleForm.usedRegistQuota" placeholder="已用号额" size="mini"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<el-form-item label="病历本" prop="isBook" style="float: left;">
<el-radio v-model="ruleForm.isBook" label="1">是</el-radio>
<el-radio v-model="ruleForm.isBook" label="0">否</el-radio>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="应收金额">
<el-input v-model="ruleForm.fee" placeholder="应收金额" size="mini"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="收费方式" prop="method">
<el-select v-model="ruleForm.method" placeholder="请选择收费方式" size="mini">
<el-option v-for="item in feeTypeoptions" :key="item.id" :value="item.id" :label="item.constantName"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
data() {
return {
ruleForm: {
invoiceNum: '',
caseNumber: '',
realName: '',
age: '',
ageType: '',
birthDate: '19790929',
idNumber: '',
homeAddress: '',
settleID: '',
visitDate: '',
noon: '',
deptID: '',
registLeID: '',
userId: '',
startRegistQuota: '',
usedRegistQuota: '',
isBook: '1',
fee: '',
method: '',
gender: ''
},
rules: {
invoiceNum: [{
required: true,
message: '请输入发票号',
trigger: 'blur'
},
{
min: 8,
max: 64,
message: '发票号在 8 到 64 之间',
trigger: 'blur'
}
],
caseNumber: [{
required: true,
message: '请输入病历号',
trigger: 'blur'
},
{
min: 8,
max: 64,
message: '病历号在 8 到 64 之间',
trigger: 'blur'
}
],
realName: [{
required: true,
message: '请输入姓名',
trigger: 'blur'
},
{
min: 2,
max: 32,
message: '姓名在 2 到 32 之间',
trigger: 'blur'
}
],
idNumber: [{
required: true,
message: '请输入身份证号',
trigger: 'blur'
},
{
min: 15,
max: 18,
message: '身份证号在 15 到 18 之间',
trigger: 'blur'
}
]
},
genderoptions: [],
ageTypeoptions: [{
key: 1,
value: '岁'
},
{
key: 2,
value: '月'
},
{
key: 3,
value: '天'
}
],
//这三个页面初始化时加载的,先清空,请求后台后进行更新
settleIDTypeoptions: [],
deptIDTypeoptions: [],
feeTypeoptions: [],
//
noonTypeoptions: [{key:'1',value:'上午'},{key:'2',value:'下午'}],
registLeIDTypeoptions: [],
userIdTypeoptions: []
}
},
methods: {
findBookByCaseNumber() {
//查询病历本表,
//如果有这个号码的,就加载数据库里caseNumber=?的这条
this.$axios.get("http://localhost:8080/book/findByCaseNumber?caseNumber=" + this.ruleForm.caseNumber)
.then(response => {
let book = response.data;
if (book != null) {
console.log("book:", book);
//查询到的话,就更新当前表单里的realName sex idCard address
//{"id":"","realName":"test","sex":"男","idCard":"12345","address":"沈阳市浑南新区","delMark":1}
this.ruleForm.realName = book.realName;
this.ruleForm.idNumber = book.idCard;
this.ruleForm.gender = book.sex;
this.ruleForm.homeAddress = book.address;
//计算其他信息
this.getOther();
}
})
},
getOther() {
//根据身份证号的变化计算出生日期,年令,岁别
//alert("身份证号变化");
let idnumber = this.ruleForm.idNumber;
//把出生日期先截取成2020-05-13让他在日期框里显示 ,更新生日列
let birthday_str = idnumber.substring(6, 6 + 4)+"-"+idnumber.substring(10, 12)+"-"+idnumber.substring(12, 14);
this.ruleForm.birthDate = birthday_str;
//把当前时间和出生时间都转换成yyyy-MM-dd格式
let now=new Date();
let curdate = now.getFullYear()+"-"+(now.getMonth()+1)+"-"+now.getDate();
//计算两个日期相差的天数
let days=this.datedifference(curdate,birthday_str);
//alert("days:"+days);
//计算岁月年
let year=parseInt(days/365);
if(year>0){
//岁别=岁
this.ruleForm.ageType='岁';
//年令=year
this.ruleForm.age=year;
}else if(parseInt(days/30)>0){
//岁别=月
this.ruleForm.ageType='月';
//年令=year
this.ruleForm.age=parseInt(days/30);
}else{
this.ruleForm.age=days;
//岁别=日
this.ruleForm.ageType='日';
//年令=year
}
},
datedifference(sDate1, sDate2) { //sDate1和sDate2是2006-12-18格式
var dateSpan,
tempDate,
iDays;
sDate1 = Date.parse(sDate1);
sDate2 = Date.parse(sDate2);
dateSpan = sDate2 - sDate1;
dateSpan = Math.abs(dateSpan);
iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
return iDays
},
getRegistLeID(){
alert(this.ruleForm.deptID);
//是想获取挂号时间,午别 ,科室,根据这三项查号别
//查询语句
/* SELECT distinct a.registName,a.id
FROM t_registlevel AS a,t_user AS b,t_department AS c,t_scheduling AS d
WHERE a.id=b.registLeId AND b.deptId=c.id AND b.id=d.userId
and d.schedDate='2020-05-13'
and d.noon="上午"
and d.deptID=1 */
this.$axios.get("http://localhost:8080/registLevel/findRegistLevelByParames?deptID="+this.ruleForm.deptID+"&visitDate="+this.ruleForm.visitDate+"&noon="+this.ruleForm.noon)
.then(response=>{
//如果响应回来,用这个数据更新页面上的号别部分
this.registLeIDTypeoptions=response.data;
})
}
},
//如果页面初始化时就显示的信息,写在mounted created方法里
mounted() {
//加载结算类型数据
this.$axios.get("http://localhost:8080/constantItem/findAllByTypeName?typename=结算类别")
.then(response=>{
this.settleIDTypeoptions=response.data;
})
//页面初始化加载付费方式 feeTypeoptions
this.$axios.get("http://localhost:8080/constantItem/findAllByTypeName?typename=收费方式")
.then(response=>{
this.feeTypeoptions=response.data;
})
//页面初始化加载科室 deptIDTypeoptions
//查询部门信息,下拉列表用
this.$axios.get("http://localhost:8080/department/findAll")
.then(response => {
this.deptIDTypeoptions = response.data;
})
//性别类型也要加上。
this.$axios.get("http://localhost:8080/constantItem/findAllByTypeName?typename=性别类型")
.then(response=>{
this.genderoptions=response.data;
})
}
}
</script>
<style>
</style>
看诊医生
-- 查询语句
select a.realName,a.id
FROM user as a,t_scheduling as b
WHERE a.id=b.userId
and b.schedDate='2020-05-18'
and b.noon='上午'
and a.deptID='4028818371ede80a0171ede91b4c0001'
and a.registLeID='4028818371edfbd70171ef6bf5f70006'
step 1:号别选择触发查询医生的事件
<el-select v-model="ruleForm.registLeID" placeholder="请选择号别" size="mini" @change="getDoc()">
<!-- [{"registName":"普通号","id":"402880ed71edd0bf0171edd2d3780000"}] -->
<el-option key="0" value="" label="请选择"></el-option>
<el-option v-for="item in registLeIDTypeoptions" :key="item.id" :value="item.id" :label="item.registName"></el-option>
</el-select>
step2:在事件处理函数里调用后台查询医生列表
step 3;查询回来后更新前台的userIdTypeoptions
getDoc(){
//根据日期 午别 科室 挂号级别 查医生 初始号额 挂号费
this.$axios.get("http://localhost:8080/user/findUserByParames?deptID="+this.ruleForm.deptID+"&visitDate="+this.ruleForm.visitDate+"&noon="+this.ruleForm.noon+"®istLeID="+this.ruleForm.registLeID)
.then(response=>{
//如果响应回来,用这个数据更新页面上的医生部分
//{id:,realName:}
if(response.data!=null){
this.userIdTypeoptions=response.data;
this.ruleForm.startRegistQuota=response.data[0].registQuota;
this.ruleForm.fee=response.data[0].registFee;
}
})
}
@RequestMapping("findUserByParames")
public List<Map<String,Object>> findUserByParames(String deptID,String visitDate,String noon,String registLeID) {
List<Map<String,Object>> userlist = userService.findUserByParames(deptID,visitDate,noon,registLeID);
return userlist;
}
@Query(value=" SELECT distinct a.*,c.registQuota,c.registFee "+
" from t_user a,t_scheduling b,t_registlevel c "+
" where a.id=b.userID "+
" and a.registLeID=c.id "+
" and b.schedDate=?2 "+
" and b.noon=?3 "+
" and b.deptID=?1 "+
" and a.registLeID=?4",nativeQuery=true)
List<Map<String, Object>> findUserByParames(String deptID, String visitDate, String noon, String registLeID);
step 4:前台医生列表的更新,初始号额和挂号费都可以更新
<el-form-item label="看诊医生" prop="userId">
<el-select v-model="ruleForm.userId" placeholder="请选择医生" size="mini">
<el-option key="0" value="" label="请选择"></el-option>
<el-option v-for="item in userIdTypeoptions" :key="item.id" :value="item.id" :label="item.realName"></el-option>
</el-select>
</el-form-item>
病历本:
<el-form-item label="病历本" prop="isBook" style="float: left;">
<el-radio-group v-model="ruleForm.isBook" @change="contentFee">
<el-radio label="1">需要</el-radio>
<el-radio label="0">不需要</el-radio>
</el-radio-group>
</el-form-item>
ruleForm:{isBook: '0',}
//算挂号费
contentFee(){
if(this.ruleForm.isBook==1){
this.ruleForm.fee=parseInt(this.ruleForm.fee)+5;
}else{
this.ruleForm.fee=parseInt(this.ruleForm.fee)-5;
}
}
已用号额(待查)
分析挂号入库
1、跟病历本相关的信息需要入到病历本表里medicalbook
2、其他挂号相关的信息入到挂号信息表里register
3、此次挂号与钱相关的需要向发票表里存储一条(关联挂号主键id) 1
4、此次发票相关的信息都存到费用明细表里(关键关联发票id) n
//存库
submitForm(formName){
console.log("ruleForm",this.ruleForm);
this.$axios.post('http://localhost:8080/register/addRegister',this.ruleForm,{headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
.then(response => {
if (response.data != null) {
this.$message("添加成功")
}
})
.catch(err => {
this.$message("添加失败")
console.log(error)
})
}
@RequestMapping("addRegister")
public String addRegoster(@RequestBody Register reg) {
System.out.println(reg);
try {
registService.save(reg);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return "挂号失败";
}
return "挂号成功";
}
service
@Autowired
IMedicalBookRepository medicalBookRepository;
@Autowired
IRegisterRepository registerRepository;
@Autowired
InvoiceRepository invoiceRepository;
@Autowired
PatientCostsRepository patientCostsRepository;
@Override
public void save(Register reg) throws Exception {
try {
//1、数据存到病历本库
MedicalBook mb=new MedicalBook();
mb.setCaseNumber(reg.getCaseNumber());
mb.setGender(reg.getGender());
mb.setHomeAddress(reg.getHomeAddress());
mb.setIdNumber(reg.getIdNumber());
mb.setRealName(reg.getRealName());
medicalBookRepository.save(mb);
//2、挂号数据
Register db_regist =registerRepository.save(reg);
//3、发票表数据
Invoice invoice=new Invoice();
invoice.setInvoiceNum(reg.getInvoiceNum());
invoice.setMoney(new BigDecimal(reg.getFee()));
invoice.setState(1);
invoice.setCreationTime(new Date());
//当前登录人员的id
//invoice.setUserId();
invoice.setRegistId(db_regist.getId());
invoice.setFeeType(reg.getFeeType());
invoiceRepository.save(invoice);
//4、消费明细表数据
Patientcost patientcost=new Patientcost();
patientcost.setRegistID(db_regist.getId());
patientcost.setInvoiceID(reg.getInvoiceNum());
patientcost.setItemType(2);
patientcost.setName("挂号");
patientcost.setPrice(new BigDecimal(reg.getFee()));
patientcost.setDeptID(reg.getDeptID());
//patientcost.setCreateOperID(createOperID);
patientcost.setFeeType(reg.getFeeType());
patientCostsRepository.save(patientcost);
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
网友评论