Parcourir la source

Merge branch 'master' of http://git.shengws.com/csx/XT_New

csx il y a 5 ans
Parent
révision
74c2b13689

+ 98 - 4
controllers/new_mobile_api_controllers/mobile_regist_controller.go Voir le fichier

@@ -238,7 +238,7 @@ func (this *MobileRegistController) CreateOrg() {
238 238
 		//初始化角色和权限
239 239
 
240 240
 		//初始化设备管理
241
-
241
+		InitEquitMentInformation(org)
242 242
 		//初始化显示配置
243 243
 
244 244
 		//创建完机构后进行登录验证操作
@@ -515,17 +515,16 @@ func InitPatientAndSchedule(org *models.Org) {
515 515
 
516 516
 	//创建两个血透的虚拟病人到新表
517 517
 	fmt.Print("patients", patients)
518
-	for _, it := range patients {
518
+	for _, it := range ids {
519 519
 		patientsNew := models.XtPatientsNew{
520 520
 			UserOrgId:     org.Id,
521 521
 			CreatedTime:   time.Now().Unix(),
522 522
 			UpdatedTime:   time.Now().Unix(),
523 523
 			Status:        1,
524
-			BloodId:       it.ID,
524
+			BloodId:       it,
525 525
 			BloodPatients: 1,
526 526
 		}
527 527
 		service.CreateVMOrgNewPatient(&patientsNew)
528
-		ids = append(ids, it.ID)
529 528
 	}
530 529
 	//创建1个分组
531 530
 	vmGroup := &models.VMDeviceGroup{
@@ -964,3 +963,98 @@ func LoadConfig(dataFile string) *Config {
964 963
 	}
965 964
 	return &config
966 965
 }
966
+
967
+func InitEquitMentInformation(org *models.Org) {
968
+	//添加设备型号
969
+	mode := models.VMDeviceMode{
970
+		DeviceMode: "5008S",
971
+		Status:     1,
972
+		UserOrgId:  org.Id,
973
+		Ctime:      time.Now().Unix(),
974
+		Mtime:      time.Now().Unix(),
975
+	}
976
+	service.CreatedDeviceMode(&mode)
977
+
978
+	deviceMode := models.VMDeviceMode{
979
+		DeviceMode: "4008S",
980
+		Status:     1,
981
+		UserOrgId:  org.Id,
982
+		Ctime:      time.Now().Unix(),
983
+		Mtime:      time.Now().Unix(),
984
+	}
985
+	service.CreatedDeviceMode(&deviceMode)
986
+
987
+	firstDeviceMode, _ := service.GetFirstDeviceMode(org.Id)
988
+	//获取机构下对应的第一数据
989
+	number, _ := service.GetFirstBedNumber(org.Id)
990
+	//添加设备
991
+	deviceAddmacher := models.VmDeviceAddmacher{
992
+		SerialNumber:  "8VSAHE13",
993
+		DeviceType:    1,
994
+		BedId:         number.ID,
995
+		DeviceName:    "费森尤斯",
996
+		UnitType:      firstDeviceMode.ID,
997
+		MachineStatus: 1,
998
+		Status:        1,
999
+		UserOrgId:     org.Id,
1000
+		Ctime:         time.Now().Unix(),
1001
+	}
1002
+	service.CreateDeviceAddMacher(&deviceAddmacher)
1003
+	macher, _ := service.GetLastMacher(org.Id)
1004
+	fmt.Print(macher.ID)
1005
+	treatmentmode := models.VmDeviceTreatmentmode{
1006
+		MachineId:  macher.ID,
1007
+		Status:     1,
1008
+		Ctime:      time.Now().Unix(),
1009
+		Mtime:      time.Now().Unix(),
1010
+		UserOrgId:  org.Id,
1011
+		TreateMode: 1,
1012
+	}
1013
+	service.CreatedTreateMode(&treatmentmode)
1014
+	treatmentmodeone := models.VmDeviceTreatmentmode{
1015
+		MachineId:  macher.ID,
1016
+		Status:     1,
1017
+		Ctime:      time.Now().Unix(),
1018
+		Mtime:      time.Now().Unix(),
1019
+		UserOrgId:  org.Id,
1020
+		TreateMode: 2,
1021
+	}
1022
+	service.CreatedTreateMode(&treatmentmodeone)
1023
+	treatmentmodetwo := models.VmDeviceTreatmentmode{
1024
+		MachineId:  macher.ID,
1025
+		Status:     1,
1026
+		Ctime:      time.Now().Unix(),
1027
+		Mtime:      time.Now().Unix(),
1028
+		UserOrgId:  org.Id,
1029
+		TreateMode: 3,
1030
+	}
1031
+	service.CreatedTreateMode(&treatmentmodetwo)
1032
+
1033
+	treatmentmodethree := models.VmDeviceTreatmentmode{
1034
+		MachineId:  macher.ID,
1035
+		Status:     1,
1036
+		Ctime:      time.Now().Unix(),
1037
+		Mtime:      time.Now().Unix(),
1038
+		UserOrgId:  org.Id,
1039
+		TreateMode: 4,
1040
+	}
1041
+	service.CreatedTreateMode(&treatmentmodethree)
1042
+	treatmentmodefour := models.VmDeviceTreatmentmode{
1043
+		MachineId:  macher.ID,
1044
+		Status:     1,
1045
+		Ctime:      time.Now().Unix(),
1046
+		Mtime:      time.Now().Unix(),
1047
+		UserOrgId:  org.Id,
1048
+		TreateMode: 5,
1049
+	}
1050
+	service.CreatedTreateMode(&treatmentmodefour)
1051
+	treatmentmodefive := models.VmDeviceTreatmentmode{
1052
+		MachineId:  macher.ID,
1053
+		Status:     1,
1054
+		Ctime:      time.Now().Unix(),
1055
+		Mtime:      time.Now().Unix(),
1056
+		UserOrgId:  org.Id,
1057
+		TreateMode: 12,
1058
+	}
1059
+	service.CreatedTreateMode(&treatmentmodefive)
1060
+}

+ 74 - 2
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Voir le fichier

@@ -1113,14 +1113,14 @@ func (this *NewDialysisApiController) GetDoctorAdviceDetail() {
1113 1113
 	appid := adminUser.App.Id
1114 1114
 	id, _ := this.GetInt64("id")
1115 1115
 	doctorAdvicedetail, err := service.GetDoctorAdviceDetail(id, orgid)
1116
-	doctor, err := service.GetAllDoctorTwo(orgid, appid)
1116
+	doctorDetail, err := service.GetAllDoctorTwo(orgid, appid)
1117 1117
 	if err != nil {
1118 1118
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1119 1119
 		return
1120 1120
 	}
1121 1121
 	this.ServeSuccessJSON(map[string]interface{}{
1122 1122
 		"doctorAdvicedetail": doctorAdvicedetail,
1123
-		"doctor":             doctor,
1123
+		"doctorDetail":       doctorDetail,
1124 1124
 	})
1125 1125
 }
1126 1126
 
@@ -1396,3 +1396,75 @@ func (this *NewDialysisApiController) UpdatedPatient() {
1396 1396
 		})
1397 1397
 	}
1398 1398
 }
1399
+
1400
+func (this *NewDialysisApiController) GetAllDoctor() {
1401
+	orgid := this.GetMobileAdminUserInfo().Org.Id
1402
+	id := this.GetMobileAdminUserInfo().App.Id
1403
+	doctor, err := service.GetAllDoctorTwo(orgid, id)
1404
+	if err != nil {
1405
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1406
+		return
1407
+	}
1408
+	this.ServeSuccessJSON(map[string]interface{}{
1409
+		"doctor": doctor,
1410
+	})
1411
+}
1412
+
1413
+func (this *NewDialysisApiController) GetAllInspection() {
1414
+
1415
+	inspection, err := service.GetAllInspection(0)
1416
+	if err != nil {
1417
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1418
+		return
1419
+	}
1420
+	this.ServeSuccessJSON(map[string]interface{}{
1421
+		"inspection": inspection,
1422
+	})
1423
+}
1424
+
1425
+func (this *NewDialysisApiController) GetInspection() {
1426
+	timeLayout := "2006-01-02"
1427
+	loc, _ := time.LoadLocation("Local")
1428
+	id, _ := this.GetInt64("id")
1429
+	fmt.Print("id", id)
1430
+	patient, _ := service.GetPatientDetailTwo(id)
1431
+	start := this.GetString("startime")
1432
+	startTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", start+" 00:00:00", loc)
1433
+	startime := startTimes.Unix()
1434
+	fmt.Print("startime", startime)
1435
+	end := this.GetString("endtime")
1436
+	endTimes, _ := time.ParseInLocation(timeLayout+" 15:04:05", end+" 00:00:00", loc)
1437
+	endtime := endTimes.Unix()
1438
+	fmt.Print("endtime", endtime)
1439
+	limit, _ := this.GetInt64("limit")
1440
+	fmt.Print("limit", limit)
1441
+	page, _ := this.GetInt64("page")
1442
+	fmt.Print("page", page)
1443
+	adminInfo := this.GetMobileAdminUserInfo()
1444
+	orgid := adminInfo.Org.Id
1445
+	fmt.Print("patient", patient)
1446
+	fmt.Print("orgid", orgid)
1447
+	inspection, total, err := service.GetInspection(patient.BloodId, startime, endtime, limit, page, orgid)
1448
+	if err != nil {
1449
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1450
+		return
1451
+	}
1452
+	this.ServeSuccessJSON(map[string]interface{}{
1453
+		"inspection": inspection,
1454
+		"total":      total,
1455
+	})
1456
+}
1457
+
1458
+func (this *NewDialysisApiController) GetMyInformation() {
1459
+	adminUserInfo := this.GetMobileAdminUserInfo()
1460
+
1461
+	roleInfo := adminUserInfo.AppRole
1462
+
1463
+	es, _ := service.GetAdminUserElectronicSignature(adminUserInfo.Org.Id, adminUserInfo.App.Id, adminUserInfo.AdminUser.Id)
1464
+
1465
+	this.ServeSuccessJSON(map[string]interface{}{
1466
+		"electronic_signature": es,
1467
+		"roleInfo":             roleInfo,
1468
+	})
1469
+	return
1470
+}

+ 4 - 1
controllers/new_mobile_api_controllers/new_mobile_api_router_register.go Voir le fichier

@@ -87,5 +87,8 @@ func NewMobileAPIControllersRegisterRouters() {
87 87
 	beego.Router("/m/api/patient/getdoctoradvicedetail", &NewDialysisApiController{}, "Get:GetDoctorAdviceDetail")
88 88
 	beego.Router("/m/api/patient/deletemanagement", &NewDialysisApiController{}, "Delete:DeleteManagement")
89 89
 	beego.Router("/m/api/patient/updatedpatient", &NewDialysisApiController{}, "Post:UpdatedPatient")
90
-
90
+	beego.Router("/m/api/patient/getalldoctor", &NewDialysisApiController{}, "Get:GetAllDoctor")
91
+	beego.Router("/m/api/patient/getallinspection", &NewDialysisApiController{}, "Get:GetAllInspection")
92
+	beego.Router("/m/api/patient/getinspection", &NewDialysisApiController{}, "Get:GetInspection")
93
+	beego.Router("/m/api/patient/getmyinformation", &NewDialysisApiController{}, "Get:GetMyInformation")
91 94
 }

+ 20 - 0
models/dialysis.go Voir le fichier

@@ -800,3 +800,23 @@ type GobalTemplate struct {
800 800
 func (GobalTemplate) TableName() string {
801 801
 	return "xt_gobal_template"
802 802
 }
803
+
804
+type SgjUserAdminRole struct {
805
+	ID          int64  `gorm:"column:id" json:"id" form:"id"`
806
+	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
807
+	OrgId       int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
808
+	AppId       int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
809
+	RoleId      int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
810
+	UserName    string `gorm:"column:user_name" json:"user_name" form:"user_name"`
811
+	Avatar      string `gorm:"column:avatar" json:"avatar" form:"avatar"`
812
+	UserType    int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
813
+	UserTitle   int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
814
+	Intro       string `gorm:"column:intro" json:"intro" form:"intro"`
815
+	Status      int64  `gorm:"column:status" json:"status" form:"status"`
816
+	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
817
+	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
818
+}
819
+
820
+func (SgjUserAdminRole) TableName() string {
821
+	return "sgj_user_admin_role"
822
+}

+ 47 - 0
models/patient_models.go Voir le fichier

@@ -663,3 +663,50 @@ func (XtPatientsInfectiousDiseases) TableName() string {
663 663
 
664 664
 	return "xt_patients_infectious_diseases"
665 665
 }
666
+
667
+type XtInspectionReference struct {
668
+	ID               int64  `gorm:"column:id" json:"id" form:"id"`
669
+	OrgId            int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
670
+	ProjectName      string `gorm:"column:project_name" json:"project_name" form:"project_name"`
671
+	Project          string `gorm:"column:project" json:"project" form:"project"`
672
+	ProjectId        int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
673
+	ItemName         string `gorm:"column:item_name" json:"item_name" form:"item_name"`
674
+	ItemNameAddition string `gorm:"column:item_name_addition" json:"item_name_addition" form:"item_name_addition"`
675
+	ItemId           int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
676
+	Item             string `gorm:"column:item" json:"item" form:"item"`
677
+	RangeType        int64  `gorm:"column:range_type" json:"range_type" form:"range_type"`
678
+	RangeMin         string `gorm:"column:range_min" json:"range_min" form:"range_min"`
679
+	RangeMax         string `gorm:"column:range_max" json:"range_max" form:"range_max"`
680
+	RangeValue       string `gorm:"column:range_value" json:"range_value" form:"range_value"`
681
+	RangeOptions     string `gorm:"column:range_options" json:"range_options" form:"range_options"`
682
+	Unit             string `gorm:"column:unit" json:"unit" form:"unit"`
683
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
684
+	CreatedTime      int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
685
+	UpdatedTime      int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
686
+}
687
+
688
+func (XtInspectionReference) TableName() string {
689
+
690
+	return "xt_inspection_reference"
691
+}
692
+
693
+type XtInspection struct {
694
+	ID           int64  `gorm:"column:id" json:"id" form:"id"`
695
+	PatientId    int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
696
+	OrgId        int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
697
+	ProjectId    int64  `gorm:"column:project_id" json:"project_id" form:"project_id"`
698
+	ItemId       int64  `gorm:"column:item_id" json:"item_id" form:"item_id"`
699
+	ItemName     string `gorm:"column:item_name" json:"item_name" form:"item_name"`
700
+	ProjectName  string `gorm:"column:project_name" json:"project_name" form:"project_name"`
701
+	InspectType  int64  `gorm:"column:inspect_type" json:"inspect_type" form:"inspect_type"`
702
+	InspectValue string `gorm:"column:inspect_value" json:"inspect_value" form:"inspect_value"`
703
+	InspectDate  int64  `gorm:"column:inspect_date" json:"inspect_date" form:"inspect_date"`
704
+	Status       int64  `gorm:"column:status" json:"status" form:"status"`
705
+	CreatedTime  int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
706
+	UpdatedTime  int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
707
+}
708
+
709
+func (XtInspection) TableName() string {
710
+
711
+	return "xt_inspection"
712
+}

+ 65 - 0
models/vm_models.go Voir le fichier

@@ -231,3 +231,68 @@ type VMPatientScheduleTemplateMode struct {
231 231
 func (VMPatientScheduleTemplateMode) TableName() string {
232 232
 	return "xt_patient_schedule_template_mode"
233 233
 }
234
+
235
+type VMDeviceMode struct {
236
+	ID         int64  `gorm:"column:id" json:"id" form:"id"`
237
+	DeviceMode string `gorm:"column:device_mode" json:"device_mode" form:"device_mode"`
238
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
239
+	UserOrgId  int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
240
+	Ctime      int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
241
+	Mtime      int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
242
+}
243
+
244
+func (VMDeviceMode) TableName() string {
245
+	return "xt_device_mode"
246
+}
247
+
248
+type VmDeviceAddmacher struct {
249
+	ID                  int64  `gorm:"column:id" json:"id" form:"id"`
250
+	SerialNumber        string `gorm:"column:serial_number" json:"serial_number" form:"serial_number"`
251
+	DeviceType          int64  `gorm:"column:device_type" json:"device_type" form:"device_type"`
252
+	BedNumber           string `gorm:"column:bed_number" json:"bed_number" form:"bed_number"`
253
+	DeviceName          string `gorm:"column:device_name" json:"device_name" form:"device_name"`
254
+	ManufactureFactory  string `gorm:"column:manufacture_factory" json:"manufacture_factory" form:"manufacture_factory"`
255
+	ServiceManufacturer string `gorm:"column:service_manufacturer" json:"service_manufacturer" form:"service_manufacturer"`
256
+	UnitType            int64  `gorm:"column:unit_type" json:"unit_type" form:"unit_type"`
257
+	UseSection          string `gorm:"column:use_section" json:"use_section" form:"use_section"`
258
+	SectionNumber       string `gorm:"column:section_number" json:"section_number" form:"section_number"`
259
+	BuyDate             int64  `gorm:"column:buy_date" json:"buy_date" form:"buy_date"`
260
+	InstallDate         int64  `gorm:"column:install_date" json:"install_date" form:"install_date"`
261
+	StartDate           int64  `gorm:"column:start_date" json:"start_date" form:"start_date"`
262
+	MaintenaceEngineer  string `gorm:"column:maintenace_engineer" json:"maintenace_engineer" form:"maintenace_engineer"`
263
+	Telephone           string `gorm:"column:telephone" json:"telephone" form:"telephone"`
264
+	GuaranteeDate       string `gorm:"column:guarantee_date" json:"guarantee_date" form:"guarantee_date"`
265
+	MachineStatus       int64  `gorm:"column:machine_status" json:"machine_status" form:"machine_status"`
266
+	UserTotal           string `gorm:"column:user_total" json:"user_total" form:"user_total"`
267
+	DisinfectionMode    int64  `gorm:"column:disinfection_mode" json:"disinfection_mode" form:"disinfection_mode"`
268
+	Remarks             string `gorm:"column:remarks" json:"remarks" form:"remarks"`
269
+	RubbishDate         int64  `gorm:"column:rubbish_date" json:"rubbish_date" form:"rubbish_date"`
270
+	RubbishReason       int64  `gorm:"column:rubbish_reason" json:"rubbish_reason" form:"rubbish_reason"`
271
+	UserYear            string `gorm:"column:user_year" json:"user_year" form:"user_year"`
272
+	WorkTime            string `gorm:"column:work_time" json:"work_time" form:"work_time"`
273
+	ReversMode          int64  `gorm:"column:revers_mode" json:"revers_mode" form:"revers_mode"`
274
+	UserOrgId           int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
275
+	Status              int64  `gorm:"column:status" json:"status" form:"status"`
276
+	Ctime               int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
277
+	Mtime               int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
278
+	ZoneId              int64  `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
279
+	BedId               int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
280
+}
281
+
282
+func (VmDeviceAddmacher) TableName() string {
283
+	return "xt_device_addmacher"
284
+}
285
+
286
+type VmDeviceTreatmentmode struct {
287
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
288
+	MachineId  int64 `gorm:"column:machine_id" json:"machine_id" form:"machine_id"`
289
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
290
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
291
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
292
+	UserOrgId  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
293
+	TreateMode int64 `gorm:"column:treate_mode" json:"treate_mode" form:"treate_mode"`
294
+}
295
+
296
+func (VmDeviceTreatmentmode) TableName() string {
297
+	return "xt_device_treatmentmode"
298
+}

+ 28 - 2
service/patientmanage_service.go Voir le fichier

@@ -824,9 +824,9 @@ func GetDialysisrecord(patientID int64, start int64, end int64, limit int64, pag
824 824
 	return orders, total, err
825 825
 }
826 826
 
827
-func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.App_Role, err error) {
827
+func GetAllDoctorTwo(orgid int64, appid int64) (appRole []*models.SgjUserAdminRole, err error) {
828 828
 
829
-	err = UserReadDB().Where("org_id = ? AND app_id = ? AND status = ? ", orgid, appid, 1).Find(&appRole).Error
829
+	err = UserReadDB().Where("org_id = ? and app_id = ? and status = ? ", orgid, appid, 1).Find(&appRole).Error
830 830
 	return appRole, err
831 831
 }
832 832
 
@@ -875,3 +875,29 @@ func UpdatedCustomer(customer models.SgjUserCustomer, id int64) error {
875 875
 	err := UserWriteDB().Model(&customer).Where("id = ?", id).Update(map[string]interface{}{"name": customer.Name, "mobile": customer.Mobile, "gender": customer.Gender, "birthday": customer.Birthday, "ill_date": customer.IllDate, "avatar": customer.Avatar, "illness_id": customer.IllnessId, "treat_type": customer.TreatType}).Error
876 876
 	return err
877 877
 }
878
+
879
+func GetAllInspection(orgid int64) (inspection []*models.XtInspectionReference, err error) {
880
+
881
+	err = XTReadDB().Model(&inspection).Where("org_id = ? and status = 1", orgid).Group("project_name").Find(&inspection).Error
882
+	return inspection, err
883
+}
884
+
885
+func GetInspection(patientid int64, startime int64, endtime int64, limit int64, page int64, orgid int64) (inspection []*models.Inspection, total int64, err error) {
886
+	fmt.Print(limit, page)
887
+	db := XTReadDB().Table("xt_inspection as x").Where("x.status = 1")
888
+	if patientid > 0 {
889
+		db = db.Where("x.patient_id = ?", patientid)
890
+	}
891
+	if startime > 0 {
892
+		db = db.Where("x.inspect_date >= ?", startime)
893
+	}
894
+	if endtime > 0 {
895
+		db = db.Where("x.inspect_date<=?", endtime)
896
+	}
897
+	if orgid > 0 {
898
+		db = db.Where("x.org_id = ?", orgid)
899
+	}
900
+	err = db.Count(&total).Order("x.inspect_date").Group("x.id").
901
+		Select("x.id,x.patient_id,x.org_id,x.project_id,x.item_id,x.item_name,x.project_name,x.inspect_type,x.inspect_value,x.inspect_date,x.created_time").Find(&inspection).Error
902
+	return inspection, total, err
903
+}

+ 33 - 0
service/vm_service.go Voir le fichier

@@ -43,3 +43,36 @@ func CreateVMSchTemplate(schTemplate *models.VMPatientScheduleTemplateItem) {
43 43
 func CreateVMPrescription(sys *models.SystemPrescription) {
44 44
 	writeDb.Model(&models.SystemPrescription{}).Create(&sys)
45 45
 }
46
+
47
+func CreatedDeviceMode(mode *models.VMDeviceMode) {
48
+
49
+	UserWriteDB().Model(&models.VMDeviceMode{}).Create(&mode)
50
+}
51
+
52
+func GetFirstDeviceMode(orgid int64) (models.VMDeviceMode, error) {
53
+	mode := models.VMDeviceMode{}
54
+	err = UserReadDB().Where("user_org_id = ? and status =1", orgid).First(&mode).Error
55
+	return mode, err
56
+}
57
+
58
+func GetFirstBedNumber(orgid int64) (models.VMDeviceNumber, error) {
59
+	number := models.VMDeviceNumber{}
60
+	err := XTReadDB().Where("org_id = ? and status =1", orgid).First(&number).Error
61
+	return number, err
62
+}
63
+
64
+func CreateDeviceAddMacher(addmacher *models.VmDeviceAddmacher) {
65
+
66
+	UserWriteDB().Model(&models.VmDeviceAddmacher{}).Create(&addmacher)
67
+}
68
+
69
+func GetLastMacher(orgid int64) (models.VmDeviceAddmacher, error) {
70
+	addmacher := models.VmDeviceAddmacher{}
71
+	err := UserReadDB().Where("user_org_id = ? and status =1", orgid).First(&addmacher).Error
72
+	return addmacher, err
73
+}
74
+
75
+func CreatedTreateMode(treatmentmode *models.VmDeviceTreatmentmode) {
76
+	XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
77
+
78
+}