123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package service
-
- import (
- "XT_New/models"
- "strconv"
- )
-
- func CreateVMOrgPatient(patients *models.VMOrgPatients) {
- writeDb.Model(&models.VMOrgPatients{}).Create(&patients)
-
- var lapseto models.PatientLapseto
- lapseto.PatientId = patients.ID
- lapseto.LapsetoType = patients.Lapseto
- lapseto.CreatedTime = patients.CreatedTime
- lapseto.UpdatedTime = patients.CreatedTime
- lapseto.Status = 1
- lapseto.LapsetoTime = patients.CreatedTime
- writeDb.Create(&lapseto)
-
- if len(patients.ContagionIds) > 0 {
- var diseases models.InfectiousDiseases
- diseases.PatientId = patients.ID
- diseases.Status = 1
- diseases.UpdatedTime = patients.UpdatedTime
- diseases.CreatedTime = patients.CreatedTime
- id, _ := strconv.ParseInt(patients.ContagionIds, 10, 64)
- diseases.DiseaseId = id
- writeDb.Create(&diseases)
- }
-
- }
-
- func CreateVMOrgNewPatient(patientsNew *models.XtPatientsNew) {
- writeDb.Model(&models.XtPatientsNew{}).Create(&patientsNew)
- }
-
- func CreateVMZone(zone *models.VMDeviceZone) {
- writeDb.Model(&models.VMDeviceZone{}).Create(&zone)
- }
-
- func CreateVMGroup(group *models.VMDeviceGroup) {
- writeDb.Model(&models.VMDeviceGroup{}).Create(&group)
- }
-
- func CreateVMDeviceNumber(number *models.VMDeviceNumber) {
- writeDb.Model(&models.VMDeviceNumber{}).Create(&number)
- }
-
- func CreateVMSch(sch *models.VMSchedule) {
- writeDb.Model(&models.VMSchedule{}).Create(&sch)
- }
-
- func CreateVMSchMode(schMode *models.VMPatientScheduleTemplateMode) {
- writeDb.Model(&models.VMPatientScheduleTemplateMode{}).Create(&schMode)
- }
-
- func CreateVMSchTemplateId(schTemplateId *models.VMPatientScheduleTemplateId) {
- writeDb.Model(&models.VMPatientScheduleTemplateId{}).Create(&schTemplateId)
- }
-
- func CreateVMSchTemplate(schTemplate *models.VMPatientScheduleTemplateItem) {
- writeDb.Model(&models.VMPatientScheduleTemplateItem{}).Create(&schTemplate)
- }
-
- func CreateVMPrescription(sys *models.SystemPrescription) {
- writeDb.Model(&models.SystemPrescription{}).Create(&sys)
- }
-
- func CreatedDeviceMode(mode *models.VMDeviceMode) {
-
- UserWriteDB().Model(&models.VMDeviceMode{}).Create(&mode)
- }
-
- func GetFirstDeviceMode(orgid int64) (models.VMDeviceMode, error) {
- mode := models.VMDeviceMode{}
- err = UserReadDB().Where("user_org_id = ? and status =1", orgid).First(&mode).Error
- return mode, err
- }
-
- func GetFirstBedNumber(orgid int64) (models.VMDeviceNumber, error) {
- number := models.VMDeviceNumber{}
- err := XTReadDB().Where("org_id = ? and status =1", orgid).First(&number).Error
- return number, err
- }
-
- func CreateDeviceAddMacher(addmacher *models.VmDeviceAddmacher) {
-
- UserWriteDB().Model(&models.VmDeviceAddmacher{}).Create(&addmacher)
- }
-
- func GetLastMacher(orgid int64) (models.VmDeviceAddmacher, error) {
- addmacher := models.VmDeviceAddmacher{}
- err := UserReadDB().Where("user_org_id = ? and status =1", orgid).First(&addmacher).Error
- return addmacher, err
- }
-
- func CreatedTreateMode(treatmentmode *models.VmDeviceTreatmentmode) {
- XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
-
- }
-
- func CreateVMPrintTemplate(template *models.VMGobalTemplate) (err error) {
- err = writeDb.Model(&models.VMGobalTemplate{}).Create(template).Error
- return
- }
|