28169 1 anno fa
parent
commit
e8e5832e0f

+ 19 - 0
controllers/mobile_api_controllers/check_weight_api_controller.go Vedi File

380
 			newprescribe.TargetUltrafiltration = dewater_amount
380
 			newprescribe.TargetUltrafiltration = dewater_amount
381
 			newprescribe.PrescriptionWater = dewater_amount
381
 			newprescribe.PrescriptionWater = dewater_amount
382
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
382
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
383
+			newprescribe.PrescribingNumber = 1
383
 			newprescribe.Status = 1
384
 			newprescribe.Status = 1
384
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
385
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
385
 				newprescribe.Remark = dialysisSolution.Remark
386
 				newprescribe.Remark = dialysisSolution.Remark
397
 				newprescribe.DisplaceLiquiValue = 32
398
 				newprescribe.DisplaceLiquiValue = 32
398
 				newprescribe.DialysateFlow = 500
399
 				newprescribe.DialysateFlow = 500
399
 			}
400
 			}
401
+
402
+			if adminUserInfo.Org.Id == 10121 {
403
+				newprescribe.DialysisDurationHour = 4
404
+				newprescribe.DialysisDurationMinute = 0
405
+				newprescribe.BloodAccess = 0
406
+			}
400
 			//插入透析处方
407
 			//插入透析处方
401
 			err := service.AddSigleRecord(&newprescribe)
408
 			err := service.AddSigleRecord(&newprescribe)
402
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
409
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
467
 				newprescribe.Status = 1
474
 				newprescribe.Status = 1
468
 				newprescribe.Remark = lastDialysisPrescribe.Remark
475
 				newprescribe.Remark = lastDialysisPrescribe.Remark
469
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
476
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
477
+				newprescribe.PrescribingNumber = 1
470
 				if adminUserInfo.Org.Id == 10340 {
478
 				if adminUserInfo.Org.Id == 10340 {
471
 					newprescribe.TargetUltrafiltration = 0
479
 					newprescribe.TargetUltrafiltration = 0
472
 				}
480
 				}
481
+				if adminUserInfo.Org.Id == 10121 {
482
+					newprescribe.DialysisDurationHour = 4
483
+					newprescribe.DialysisDurationMinute = 0
484
+					newprescribe.BloodAccess = 0
485
+				}
473
 				err := service.AddSigleRecord(&newprescribe)
486
 				err := service.AddSigleRecord(&newprescribe)
474
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
487
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
475
 				redis := service.RedisClient()
488
 				redis := service.RedisClient()
534
 				newprescribe.TargetUltrafiltration = dewater_amount
547
 				newprescribe.TargetUltrafiltration = dewater_amount
535
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
548
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
536
 				newprescribe.Status = 1
549
 				newprescribe.Status = 1
550
+				newprescribe.PrescribingNumber = 1
537
 
551
 
538
 				if adminUserInfo.Org.Id == 10340 {
552
 				if adminUserInfo.Org.Id == 10340 {
539
 					newprescribe.TargetUltrafiltration = 0
553
 					newprescribe.TargetUltrafiltration = 0
540
 				}
554
 				}
555
+				if adminUserInfo.Org.Id == 10121 {
556
+					newprescribe.DialysisDurationHour = 4
557
+					newprescribe.DialysisDurationMinute = 0
558
+					newprescribe.BloodAccess = 0
559
+				}
541
 				err := service.AddSigleRecord(&newprescribe)
560
 				err := service.AddSigleRecord(&newprescribe)
542
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
561
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
543
 				redis := service.RedisClient()
562
 				redis := service.RedisClient()

+ 77 - 8
controllers/patient_api_controller.go Vedi File

367
 		Doctor:                       patient.Doctor,
367
 		Doctor:                       patient.Doctor,
368
 		RecordNumber:                 patient.RecordNumber,
368
 		RecordNumber:                 patient.RecordNumber,
369
 		PatientSource:                patient.PatientSource,
369
 		PatientSource:                patient.PatientSource,
370
+		PatientEndTime:               patient.PatientEndTime,
371
+		PatientStartTime:             patient.PatientStartTime,
372
+		InfectiousRemark:             patient.InfectiousRemark,
373
+		AllergicHistory:              patient.AllergicHistory,
374
+		PatientAddress:               patient.PatientAddress,
370
 	}
375
 	}
371
 
376
 
372
 	err = service.CreatePatientsNew(&patientsNew)
377
 	err = service.CreatePatientsNew(&patientsNew)
373
 	fmt.Print("创建失败", err)
378
 	fmt.Print("创建失败", err)
374
 
379
 
380
+	allergic := models.XtPatientAllergic{
381
+		UserOrgId:      adminUserInfo.CurrentOrgId,
382
+		PatientId:      patient.ID,
383
+		StartTime:      patient.PatientStartTime,
384
+		EndTime:        patient.PatientEndTime,
385
+		PatientSource:  patient.PatientSource,
386
+		PatientAddress: patient.PatientAddress,
387
+		Remake:         patient.Remark,
388
+		Status:         1,
389
+		Ctime:          time.Now().Unix(),
390
+	}
391
+
392
+	if len(patient.PatientAddress) > 0 {
393
+		service.CreateAllergic(allergic)
394
+	}
395
+
375
 	if len(record_date) > 0 {
396
 	if len(record_date) > 0 {
376
 		var recordTime int64
397
 		var recordTime int64
377
 		timeLayout := "2006-01-02"
398
 		timeLayout := "2006-01-02"
585
 		TreatmentPlan:             patient.TreatmentPlan,
606
 		TreatmentPlan:             patient.TreatmentPlan,
586
 		RecordNumber:              patient.RecordNumber,
607
 		RecordNumber:              patient.RecordNumber,
587
 		PatientSource:             patient.PatientSource,
608
 		PatientSource:             patient.PatientSource,
609
+		PatientStartTime:          patient.PatientStartTime,
610
+		PatientEndTime:            patient.PatientEndTime,
611
+		InfectiousRemark:          patient.InfectiousRemark,
612
+		AllergicHistory:           patient.AllergicHistory,
613
+		PatientAddress:            patient.PatientAddress,
588
 	}
614
 	}
589
 	//	//更新病人ID获取新表病人ID
615
 	//	//更新病人ID获取新表病人ID
590
 	err = service.UpdatepatientTwo(&patientsNew, id)
616
 	err = service.UpdatepatientTwo(&patientsNew, id)
591
 
617
 
618
+	allergic := models.XtPatientAllergic{
619
+		PatientId:      patient.ID,
620
+		UserOrgId:      adminUserInfo.CurrentOrgId,
621
+		StartTime:      patient.PatientStartTime,
622
+		EndTime:        patient.PatientEndTime,
623
+		PatientSource:  patient.PatientSource,
624
+		Status:         1,
625
+		Ctime:          time.Now().Unix(),
626
+		Mtime:          time.Now().Unix(),
627
+		Remake:         patient.Remark,
628
+		PatientAddress: patient.PatientAddress,
629
+	}
630
+	if len(patient.PatientAddress) > 0 {
631
+		service.CreateAllergic(allergic)
632
+	}
633
+
592
 	nowTimeUinx := time.Now()
634
 	nowTimeUinx := time.Now()
593
 	today := nowTimeUinx.Format("2006-01-02")
635
 	today := nowTimeUinx.Format("2006-01-02")
594
 
636
 
755
 
797
 
756
 	err = service.EditPatientLapseto(&patient, &lapseto)
798
 	err = service.EditPatientLapseto(&patient, &lapseto)
757
 
799
 
758
-	//if lapseto.LapsetoType == 3 || lapseto.LapsetoType == 2 {
759
-	//	timeStr := time.Now().Format("2006-01-02")
760
-	//	timeLayout := "2006-01-02 15:04:05"
761
-	//	timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
762
-	//	timenow := timeStringToTime.Unix()
763
-	//	service.UpdateScheduleByDeathTime(id, timenow)
764
-	//	service.UpdateScheduleItemByPatientId(id)
765
-	//}
800
+	if lapseto.LapsetoType == 3 || lapseto.LapsetoType == 2 {
801
+		timeStr := time.Now().Format("2006-01-02")
802
+		timeLayout := "2006-01-02 15:04:05"
803
+		timeStringToTime, _ := utils.ParseTimeStringToTime(timeLayout, timeStr+" 00:00:00")
804
+		timenow := timeStringToTime.Unix()
805
+		service.UpdateScheduleByDeathTime(id, timenow)
806
+		service.UpdateScheduleItemByPatientId(id)
807
+	}
766
 
808
 
767
 	if err != nil {
809
 	if err != nil {
768
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeEditLapsetoFail)
810
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeEditLapsetoFail)
4931
 		patient.PatientStartTime = startTime
4973
 		patient.PatientStartTime = startTime
4932
 	}
4974
 	}
4933
 
4975
 
4976
+	if patientBody["patient_end_time"] != nil && reflect.TypeOf(patientBody["patient_end_time"]).String() == "string" {
4977
+		patient_end_time := patientBody["patient_end_time"].(string)
4978
+		var endTime int64
4979
+		if len(patient_end_time) > 0 {
4980
+			theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", patient_end_time+" 00:00:00", loc)
4981
+
4982
+			endTime = theTime.Unix()
4983
+		}
4984
+		patient.PatientEndTime = endTime
4985
+	}
4986
+
4987
+	if patientBody["infectious_remark"] != nil && reflect.TypeOf(patientBody["infectious_remark"]).String() == "string" {
4988
+		record_number := patientBody["infectious_remark"].(string)
4989
+		patient.InfectiousRemark = record_number
4990
+	}
4991
+
4992
+	if patientBody["allergic_history"] != nil && reflect.TypeOf(patientBody["allergic_history"]).String() == "string" {
4993
+		allergic_history := patientBody["allergic_history"].(string)
4994
+		patient.AllergicHistory = allergic_history
4995
+	}
4996
+
4997
+	if patientBody["patient_address"] != nil && reflect.TypeOf(patientBody["patient_address"]).String() == "string" {
4998
+		patient_address := patientBody["patient_address"].(string)
4999
+		patient.PatientAddress = patient_address
5000
+	}
5001
+
4934
 	return
5002
 	return
5003
+
4935
 }
5004
 }
4936
 
5005
 
4937
 func (c *PatientApiController) GetPatientsByKeyWord() {
5006
 func (c *PatientApiController) GetPatientsByKeyWord() {

+ 13 - 0
controllers/patient_dataconfig_api_controller.go Vedi File

40
 
40
 
41
 	beego.Router("/api/patient/getcontextschedulelist", &PatientDataConfigAPIController{}, "Get:GetContextScheduleList")
41
 	beego.Router("/api/patient/getcontextschedulelist", &PatientDataConfigAPIController{}, "Get:GetContextScheduleList")
42
 
42
 
43
+	beego.Router("/api/patient/getpatientallagic", &PatientDataConfigAPIController{}, "Get:GetPatientAllagicList")
44
+
43
 }
45
 }
44
 
46
 
45
 type PatientDataConfigAPIController struct {
47
 type PatientDataConfigAPIController struct {
1141
 		"devicenumber": devicenumber,
1143
 		"devicenumber": devicenumber,
1142
 	})
1144
 	})
1143
 }
1145
 }
1146
+
1147
+func (this *PatientDataConfigAPIController) GetPatientAllagicList() {
1148
+
1149
+	id, _ := this.GetInt64("id")
1150
+	fmt.Println("id2ooooooooooooooooooo", id)
1151
+	orgId := this.GetAdminUserInfo().CurrentOrgId
1152
+	list, _ := service.GetPatientAllagicList(id, orgId)
1153
+	this.ServeSuccessJSON(map[string]interface{}{
1154
+		"list": list,
1155
+	})
1156
+}

+ 52 - 43
controllers/self_drug_api_congtroller.go Vedi File

3498
 func (this *SelfDrugApiController) GetSendGoodInformation() {
3498
 func (this *SelfDrugApiController) GetSendGoodInformation() {
3499
 
3499
 
3500
 	orgId := this.GetAdminUserInfo().CurrentOrgId
3500
 	orgId := this.GetAdminUserInfo().CurrentOrgId
3501
+	fmt.Println("orgid", orgId)
3501
 	//获取入库数据
3502
 	//获取入库数据
3502
-	list, _ := service.GetSendGoodInformation(orgId)
3503
-	for _, it := range list {
3504
-		//查询是否有数据
3505
-		_, errcode := service.GetStockFlush(it.StorehouseId, it.GoodId, it.OrgId)
3506
-		//获取总退库数量
3507
-		var cancel_count int64
3508
-		var out_count int64
3509
-		var act_count int64
3510
-		//退库总数量
3511
-		cancellist, _ := service.GetAllCancelCount(it.StorehouseId, it.GoodId, it.OrgId)
3512
-		for _, item := range cancellist {
3513
-			cancel_count += item.Count
3514
-		}
3515
-		//出库总数量
3516
-		outlist, _ := service.GetAllStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3517
-		for _, item := range outlist {
3518
-			out_count += item.Count
3519
-		}
3503
+	list, _ := service.GetSendGoodInformation(10265)
3520
 
3504
 
3521
-		//实际出库总数量
3522
-		actlist, _ := service.GetActStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3523
-		for _, item := range actlist {
3524
-			act_count += item.Count
3525
-		}
3505
+	//project, _ := service.GetHisPrescriptionList(10265)
3526
 
3506
 
3527
-		if errcode == gorm.ErrRecordNotFound {
3528
-			good := models.XtGoodStockCount{
3529
-				UserOrgId:        it.OrgId,
3530
-				GoodId:           it.GoodId,
3531
-				StorehouseId:     it.StorehouseId,
3532
-				Status:           1,
3533
-				Ctime:            time.Now().Unix(),
3534
-				Mtime:            0,
3535
-				StockInCount:     it.WarehousingCount,
3536
-				StockOutCount:    out_count - cancel_count,
3537
-				StockCancelCount: cancel_count,
3538
-				FlushCount:       it.StockCount,
3539
-				StockActOutCount: act_count,
3540
-			}
3541
-			service.CreateGoodCountSix(good)
3542
-		}
3543
-		if errcode == nil {
3544
-			service.UpdateGoodCount(it.WarehousingCount, it.StockCount, out_count, it.StorehouseId, it.GoodId, it.OrgId, cancel_count, act_count)
3545
-		}
3546
-	}
3507
+	for _, it := range list {
3508
+		service.UpdateGoodFlow(it.ID, it.PackingPrice)
3509
+	}
3510
+
3511
+	//for _, it := range list {
3512
+	//	//查询是否有数据
3513
+	//	_, errcode := service.GetStockFlush(it.StorehouseId, it.GoodId, it.OrgId)
3514
+	//	//获取总退库数量
3515
+	//	var cancel_count int64
3516
+	//	var out_count int64
3517
+	//	var act_count int64
3518
+	//	//退库总数量
3519
+	//	cancellist, _ := service.GetAllCancelCount(it.StorehouseId, it.GoodId, it.OrgId)
3520
+	//	for _, item := range cancellist {
3521
+	//		cancel_count += item.Count
3522
+	//	}
3523
+	//	//出库总数量
3524
+	//	outlist, _ := service.GetAllStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3525
+	//	for _, item := range outlist {
3526
+	//		out_count += item.Count
3527
+	//	}
3528
+	//
3529
+	//	//实际出库总数量
3530
+	//	actlist, _ := service.GetActStockOutCount(it.StorehouseId, it.GoodId, it.OrgId)
3531
+	//	for _, item := range actlist {
3532
+	//		act_count += item.Count
3533
+	//	}
3534
+	//
3535
+	//	if errcode == gorm.ErrRecordNotFound {
3536
+	//		good := models.XtGoodStockCount{
3537
+	//			UserOrgId:        it.OrgId,
3538
+	//			GoodId:           it.GoodId,
3539
+	//			StorehouseId:     it.StorehouseId,
3540
+	//			Status:           1,
3541
+	//			Ctime:            time.Now().Unix(),
3542
+	//			Mtime:            0,
3543
+	//			StockInCount:     it.WarehousingCount,
3544
+	//			StockOutCount:    out_count - cancel_count,
3545
+	//			StockCancelCount: cancel_count,
3546
+	//			FlushCount:       it.StockCount,
3547
+	//			StockActOutCount: act_count,
3548
+	//		}
3549
+	//		service.CreateGoodCountSix(good)
3550
+	//	}
3551
+	//	if errcode == nil {
3552
+	//		service.UpdateGoodCount(it.WarehousingCount, it.StockCount, out_count, it.StorehouseId, it.GoodId, it.OrgId, cancel_count, act_count)
3553
+	//	}
3554
+	//}
3547
 
3555
 
3548
 	this.ServeSuccessJSON(map[string]interface{}{
3556
 	this.ServeSuccessJSON(map[string]interface{}{
3549
 		"msg": "1",
3557
 		"msg": "1",
3910
 
3918
 
3911
 		//期中减少
3919
 		//期中减少
3912
 		outInfo, _ := service.FindeDrugWarehouseOutInfo(item.ID, item.OrgId, startTime, endTime)
3920
 		outInfo, _ := service.FindeDrugWarehouseOutInfo(item.ID, item.OrgId, startTime, endTime)
3921
+		fmt.Println("putInfo2o2o2oo2o2", outInfo)
3913
 		for _, it := range outInfo {
3922
 		for _, it := range outInfo {
3914
 			item.DrugWarehouseOutInfoStartEnd = append(item.DrugWarehouseOutInfoStartEnd, it)
3923
 			item.DrugWarehouseOutInfoStartEnd = append(item.DrugWarehouseOutInfoStartEnd, it)
3915
 		}
3924
 		}

+ 26 - 0
models/patient_models.go Vedi File

225
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
225
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
226
 	PatientSource            int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
226
 	PatientSource            int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
227
 	PatientStartTime         int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
227
 	PatientStartTime         int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
228
+	PatientEndTime           int64   `gorm:"column:patient_end_time" json:"patient_end_time" form:"patient_end_time"`
229
+	InfectiousRemark         string  `gorm:"column:infectious_remark" json:"infectious_remark" form:"infectious_remark"`
230
+	AllergicHistory          string  `gorm:"column:allergic_history" json:"allergic_history" form:"allergic_history"`
231
+	PatientAddress           string  `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
228
 }
232
 }
229
 
233
 
230
 func (Patients) TableName() string {
234
 func (Patients) TableName() string {
819
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
823
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
820
 	PatientSource                int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
824
 	PatientSource                int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
821
 	PatientStartTime             int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
825
 	PatientStartTime             int64   `gorm:"column:patient_start_time" json:"patient_start_time" form:"patient_start_time"`
826
+	PatientEndTime               int64   `gorm:"column:patient_end_time" json:"patient_end_time" form:"patient_end_time"`
827
+	InfectiousRemark             string  `gorm:"column:infectious_remark" json:"infectious_remark" form:"infectious_remark"`
828
+	AllergicHistory              string  `gorm:"column:allergic_history" json:"allergic_history" form:"allergic_history"`
829
+	PatientAddress               string  `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
822
 }
830
 }
823
 
831
 
824
 func (XtPatientsNew) TableName() string {
832
 func (XtPatientsNew) TableName() string {
1978
 func (ConScheduleList) TableName() string {
1986
 func (ConScheduleList) TableName() string {
1979
 	return "xt_schedule"
1987
 	return "xt_schedule"
1980
 }
1988
 }
1989
+
1990
+type XtPatientAllergic struct {
1991
+	ID             int64  `gorm:"column:id" json:"id" form:"id"`
1992
+	PatientId      int64  `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
1993
+	UserOrgId      int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1994
+	StartTime      int64  `gorm:"column:start_time" json:"start_time" form:"start_time"`
1995
+	EndTime        int64  `gorm:"column:end_time" json:"end_time" form:"end_time"`
1996
+	PatientSource  int64  `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
1997
+	Status         int64  `gorm:"column:status" json:"status" form:"status"`
1998
+	Ctime          int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1999
+	Mtime          int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
2000
+	Remake         string `gorm:"column:remake" json:"remake" form:"remake"`
2001
+	PatientAddress string `gorm:"column:patient_address" json:"patient_address" form:"patient_address"`
2002
+}
2003
+
2004
+func (XtPatientAllergic) TableName() string {
2005
+	return "xt_patient_allergic"
2006
+}

+ 3 - 3
service/common_service.go Vedi File

2506
 		db = db.Where("x.inspect_date <=?", endtime)
2506
 		db = db.Where("x.inspect_date <=?", endtime)
2507
 	}
2507
 	}
2508
 	offset := (page - 1) * limit
2508
 	offset := (page - 1) * limit
2509
-	err = db.Select("x.id,x.patient_id,s.name,s.dialysis_no,x.inspect_date").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_quality_control_standard as r on x.item_id = r.inspection_minor ").Where("r.user_org_id = ? and r.status = 1 and r.is_status = 1", orgid).Group("x.inspect_date").Count(&total).Offset(offset).Limit(limit).Scan(&inspection).Error
2509
+	err = db.Select("x.id,x.patient_id,s.name,s.dialysis_no,x.inspect_date").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_quality_control_standard as r on x.item_id = r.inspection_minor ").Where("r.user_org_id = ? and r.status = 1 and r.is_status = 1", orgid).Group("x.patient_id").Count(&total).Offset(offset).Limit(limit).Scan(&inspection).Error
2510
 
2510
 
2511
 	return inspection, total, err
2511
 	return inspection, total, err
2512
 }
2512
 }
2547
 
2547
 
2548
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2548
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2549
 	table := readDb.Table("xt_patients as s")
2549
 	table := readDb.Table("xt_patients as s")
2550
-	fmt.Println(table)
2550
+	//fmt.Println(table)
2551
 	d := readDb.Table(" xt_inspection_reference as r")
2551
 	d := readDb.Table(" xt_inspection_reference as r")
2552
 	fmt.Println(d)
2552
 	fmt.Println(d)
2553
 	d2 := readDb.Table("xt_quality_control_standard as d")
2553
 	d2 := readDb.Table("xt_quality_control_standard as d")
2571
 	if endtime > 0 {
2571
 	if endtime > 0 {
2572
 		db = db.Where("x.inspect_date <=?", endtime)
2572
 		db = db.Where("x.inspect_date <=?", endtime)
2573
 	}
2573
 	}
2574
-	err = db.Group("x.id").Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,s.dialysis_no,r.range_max,r.range_min,d.sort,d.min_range,d.large_range,d.range_value,d.range_type").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_inspection_reference as r on r.item_id = x.item_id AND r.org_id > 0 OR ( x.item_id = r.id AND r.org_id = 0)").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Where("d.min_range<>''and d.user_org_id = ? and d.is_status =1", orgid).Order("x.inspect_date desc").Scan(&inspection).Error
2574
+	err = db.Group("x.id").Select("x.id,x.patient_id,x.item_id,x.item_name,x.inspect_value,x.inspect_date,s.name,s.dialysis_no,r.range_max,r.range_min,d.sort,d.min_range,d.large_range,d.range_value,d.range_type").Joins("left join xt_patients as s on s.id = x.patient_id").Joins("left join xt_inspection_reference as r on r.item_id = x.item_id AND r.org_id > 0 OR ( x.item_id = r.id AND r.org_id = 0)").Joins("left join xt_quality_control_standard as d on d.inspection_minor = x.item_id").Where("d.min_range<>''and d.user_org_id = ? and d.is_status =1 and NOT EXISTS(SELECT 1 FROM xt_inspection AS x2 WHERE x2.patient_id = x.patient_id AND x2.org_id = ? AND x2.item_id = x.item_id AND x2.inspect_date > x.inspect_date)", orgid, orgid).Order("x.inspect_date desc").Scan(&inspection).Error
2575
 
2575
 
2576
 	return inspection, err
2576
 	return inspection, err
2577
 }
2577
 }

+ 15 - 0
service/new_stock_service.go Vedi File

165
 	return err
165
 	return err
166
 }
166
 }
167
 
167
 
168
+func GetHisPrescriptionList(orgid int64) (project []*models.HisPrescriptionProject, err error) {
169
+
170
+	err = XTReadDB().Where("user_org_id = ? and status= 1 and record_date =1690819200", orgid).Find(&project).Error
171
+	return project, err
172
+}
173
+
174
+func UpdateGoodFlow(project_id int64, price float64) error {
175
+	flow := models.VmStockFlow{}
176
+
177
+	err := XTWriteDB().Model(&flow).Where("warehousing_id = ? and user_org_id =10265", project_id).Updates(map[string]interface{}{"price": price}).Error
178
+
179
+	err = XTWriteDB().Model(models.WarehouseOutInfo{}).Where("warehouse_info_id = ? and org_id =10265", project_id).Updates(map[string]interface{}{"price": price}).Error
180
+	return err
181
+}
182
+
168
 func GetSendGoodInformation(org_id int64) (info []*models.WarehousingInfo, err error) {
183
 func GetSendGoodInformation(org_id int64) (info []*models.WarehousingInfo, err error) {
169
 
184
 
170
 	err = XTReadDB().Where("org_id = ? and is_check = 1 and status = 1", org_id).Find(&info).Error
185
 	err = XTReadDB().Where("org_id = ? and is_check = 1 and status = 1", org_id).Find(&info).Error

+ 27 - 24
service/new_warehouse_service.go Vedi File

87
 			IsCheck:                 1,
87
 			IsCheck:                 1,
88
 			OverCount:               sum_count,
88
 			OverCount:               sum_count,
89
 			RegisterNumber:          warehouse.RegisterNumber,
89
 			RegisterNumber:          warehouse.RegisterNumber,
90
+			BuyPrice:                warehouse.PackingPrice,
90
 		}
91
 		}
91
 		warehouseOutInfo.Count = count
92
 		warehouseOutInfo.Count = count
92
 		if orgID == 9671 || orgID == 10265 {
93
 		if orgID == 9671 || orgID == 10265 {
93
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
94
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
95
+
96
+			fmt.Println("加个我我我哦我我我", goodsInfo.PackingPrice)
94
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
97
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
95
 		}
98
 		}
96
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
99
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
156
 				RegisterNumber:          warehouse.RegisterNumber,
159
 				RegisterNumber:          warehouse.RegisterNumber,
157
 			}
160
 			}
158
 			if orgID == 9671 || orgID == 10265 {
161
 			if orgID == 9671 || orgID == 10265 {
159
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
162
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
160
 				flow.Price = goodsInfo.PackingPrice
163
 				flow.Price = goodsInfo.PackingPrice
161
 				flow.BuyPrice = goodsInfo.BuyPrice
164
 				flow.BuyPrice = goodsInfo.BuyPrice
162
 			}
165
 			}
227
 				IsCheck:         1,
230
 				IsCheck:         1,
228
 			}
231
 			}
229
 			if orgID == 9671 || orgID == 10265 {
232
 			if orgID == 9671 || orgID == 10265 {
230
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
233
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
231
 				cancelStockInfo.Price = goodsInfo.PackingPrice
234
 				cancelStockInfo.Price = goodsInfo.PackingPrice
232
 			}
235
 			}
233
 			CreateCancelStockInfoOne(&cancelStockInfo)
236
 			CreateCancelStockInfoOne(&cancelStockInfo)
271
 				RegisterNumber:          warehouse.RegisterNumber,
274
 				RegisterNumber:          warehouse.RegisterNumber,
272
 			}
275
 			}
273
 			if orgID == 9671 || orgID == 10265 {
276
 			if orgID == 9671 || orgID == 10265 {
274
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
277
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
275
 				flow.Price = goodsInfo.PackingPrice
278
 				flow.Price = goodsInfo.PackingPrice
276
 				flow.BuyPrice = goodsInfo.BuyPrice
279
 				flow.BuyPrice = goodsInfo.BuyPrice
277
 			}
280
 			}
351
 		}
354
 		}
352
 		warehouseOutInfo.Count = stock_number
355
 		warehouseOutInfo.Count = stock_number
353
 		if orgID == 9671 || orgID == 10265 {
356
 		if orgID == 9671 || orgID == 10265 {
354
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
357
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
355
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
358
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
356
 		}
359
 		}
357
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
360
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
416
 				RegisterNumber:          warehouse.RegisterNumber,
419
 				RegisterNumber:          warehouse.RegisterNumber,
417
 			}
420
 			}
418
 			if orgID == 9671 || orgID == 10265 {
421
 			if orgID == 9671 || orgID == 10265 {
419
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
422
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
420
 				flow.Price = goodsInfo.PackingPrice
423
 				flow.Price = goodsInfo.PackingPrice
421
 				flow.BuyPrice = goodsInfo.BuyPrice
424
 				flow.BuyPrice = goodsInfo.BuyPrice
422
 			}
425
 			}
483
 				IsCheck:         1,
486
 				IsCheck:         1,
484
 			}
487
 			}
485
 			if orgID == 9671 || orgID == 10265 {
488
 			if orgID == 9671 || orgID == 10265 {
486
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
489
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
487
 				cancelStockInfo.Price = goodsInfo.PackingPrice
490
 				cancelStockInfo.Price = goodsInfo.PackingPrice
488
 			}
491
 			}
489
 			CreateCancelStockInfoOne(&cancelStockInfo)
492
 			CreateCancelStockInfoOne(&cancelStockInfo)
527
 				RegisterNumber:          warehouse.RegisterNumber,
530
 				RegisterNumber:          warehouse.RegisterNumber,
528
 			}
531
 			}
529
 			if orgID == 9671 || orgID == 10265 {
532
 			if orgID == 9671 || orgID == 10265 {
530
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
533
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
531
 				flow.Price = goodsInfo.PackingPrice
534
 				flow.Price = goodsInfo.PackingPrice
532
 				flow.BuyPrice = goodsInfo.BuyPrice
535
 				flow.BuyPrice = goodsInfo.BuyPrice
533
 			}
536
 			}
3420
 		}
3423
 		}
3421
 		warehouseOutInfo.Count = count
3424
 		warehouseOutInfo.Count = count
3422
 		if orgID == 9671 || orgID == 10265 {
3425
 		if orgID == 9671 || orgID == 10265 {
3423
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3426
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3424
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3427
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3425
 		}
3428
 		}
3426
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3429
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3490
 				RegisterNumber:          warehouse.RegisterNumber,
3493
 				RegisterNumber:          warehouse.RegisterNumber,
3491
 			}
3494
 			}
3492
 			if orgID == 9671 || orgID == 10265 {
3495
 			if orgID == 9671 || orgID == 10265 {
3493
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3496
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3494
 				flow.Price = goodsInfo.PackingPrice
3497
 				flow.Price = goodsInfo.PackingPrice
3495
 				flow.BuyPrice = goodsInfo.BuyPrice
3498
 				flow.BuyPrice = goodsInfo.BuyPrice
3496
 			}
3499
 			}
3565
 				IsCheck:         1,
3568
 				IsCheck:         1,
3566
 			}
3569
 			}
3567
 			if orgID == 9671 || orgID == 10265 {
3570
 			if orgID == 9671 || orgID == 10265 {
3568
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3571
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3569
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3572
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3570
 			}
3573
 			}
3571
 
3574
 
3613
 				RegisterNumber:          warehouse.RegisterNumber,
3616
 				RegisterNumber:          warehouse.RegisterNumber,
3614
 			}
3617
 			}
3615
 			if orgID == 9671 || orgID == 10265 {
3618
 			if orgID == 9671 || orgID == 10265 {
3616
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3619
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3617
 				flow.Price = goodsInfo.PackingPrice
3620
 				flow.Price = goodsInfo.PackingPrice
3618
 				flow.BuyPrice = goodsInfo.BuyPrice
3621
 				flow.BuyPrice = goodsInfo.BuyPrice
3619
 			}
3622
 			}
3709
 		}
3712
 		}
3710
 		warehouseOutInfo.Count = stock_number
3713
 		warehouseOutInfo.Count = stock_number
3711
 		if orgID == 9671 || orgID == 10265 {
3714
 		if orgID == 9671 || orgID == 10265 {
3712
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3715
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3713
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3716
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
3714
 		}
3717
 		}
3715
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3718
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
3781
 				RegisterNumber:          warehouse.RegisterNumber,
3784
 				RegisterNumber:          warehouse.RegisterNumber,
3782
 			}
3785
 			}
3783
 			if orgID == 9671 || orgID == 10265 {
3786
 			if orgID == 9671 || orgID == 10265 {
3784
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3787
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3785
 				flow.Price = goodsInfo.PackingPrice
3788
 				flow.Price = goodsInfo.PackingPrice
3786
 				flow.BuyPrice = goodsInfo.BuyPrice
3789
 				flow.BuyPrice = goodsInfo.BuyPrice
3787
 			}
3790
 			}
3851
 				IsCheck:         1,
3854
 				IsCheck:         1,
3852
 			}
3855
 			}
3853
 			if orgID == 9671 || orgID == 10265 {
3856
 			if orgID == 9671 || orgID == 10265 {
3854
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3857
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3855
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3858
 				cancelStockInfo.Price = goodsInfo.PackingPrice
3856
 			}
3859
 			}
3857
 			err := tx.Create(&cancelStockInfo).Error
3860
 			err := tx.Create(&cancelStockInfo).Error
3898
 				RegisterNumber:          warehouse.RegisterNumber,
3901
 				RegisterNumber:          warehouse.RegisterNumber,
3899
 			}
3902
 			}
3900
 			if orgID == 9671 || orgID == 10265 {
3903
 			if orgID == 9671 || orgID == 10265 {
3901
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
3904
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
3902
 				flow.Price = goodsInfo.PackingPrice
3905
 				flow.Price = goodsInfo.PackingPrice
3903
 				flow.BuyPrice = goodsInfo.BuyPrice
3906
 				flow.BuyPrice = goodsInfo.BuyPrice
3904
 			}
3907
 			}
4003
 		}
4006
 		}
4004
 		warehouseOutInfo.Count = count
4007
 		warehouseOutInfo.Count = count
4005
 		if orgID == 9671 || orgID == 10265 {
4008
 		if orgID == 9671 || orgID == 10265 {
4006
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4009
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4007
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4010
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4008
 		}
4011
 		}
4009
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4012
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4074
 				RegisterNumber:          warehouse.RegisterNumber,
4077
 				RegisterNumber:          warehouse.RegisterNumber,
4075
 			}
4078
 			}
4076
 			if orgID == 9671 || orgID == 10265 {
4079
 			if orgID == 9671 || orgID == 10265 {
4077
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4080
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4078
 				flow.Price = goodsInfo.PackingPrice
4081
 				flow.Price = goodsInfo.PackingPrice
4079
 				flow.BuyPrice = goodsInfo.BuyPrice
4082
 				flow.BuyPrice = goodsInfo.BuyPrice
4080
 			}
4083
 			}
4150
 				IsCheck:         1,
4153
 				IsCheck:         1,
4151
 			}
4154
 			}
4152
 			if orgID == 9671 || orgID == 10265 {
4155
 			if orgID == 9671 || orgID == 10265 {
4153
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4156
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4154
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4157
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4155
 			}
4158
 			}
4156
 
4159
 
4198
 				RegisterNumber:          warehouse.RegisterNumber,
4201
 				RegisterNumber:          warehouse.RegisterNumber,
4199
 			}
4202
 			}
4200
 			if orgID == 9671 || orgID == 10265 {
4203
 			if orgID == 9671 || orgID == 10265 {
4201
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4204
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4202
 				flow.Price = goodsInfo.PackingPrice
4205
 				flow.Price = goodsInfo.PackingPrice
4203
 				flow.BuyPrice = goodsInfo.BuyPrice
4206
 				flow.BuyPrice = goodsInfo.BuyPrice
4204
 			}
4207
 			}
4294
 		}
4297
 		}
4295
 		warehouseOutInfo.Count = stock_number
4298
 		warehouseOutInfo.Count = stock_number
4296
 		if orgID == 9671 || orgID == 10265 {
4299
 		if orgID == 9671 || orgID == 10265 {
4297
-			goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4300
+			goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4298
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4301
 			warehouseOutInfo.Price = goodsInfo.PackingPrice
4299
 		}
4302
 		}
4300
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4303
 		_, errcodes := GetWarehouseOutInfoIsExistOne(goods.GoodId, patient_id, record_time, goods.ProjectId)
4365
 				RegisterNumber:          warehouse.RegisterNumber,
4368
 				RegisterNumber:          warehouse.RegisterNumber,
4366
 			}
4369
 			}
4367
 			if orgID == 9671 || orgID == 10265 {
4370
 			if orgID == 9671 || orgID == 10265 {
4368
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4371
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4369
 				flow.Price = goodsInfo.PackingPrice
4372
 				flow.Price = goodsInfo.PackingPrice
4370
 				flow.BuyPrice = goodsInfo.BuyPrice
4373
 				flow.BuyPrice = goodsInfo.BuyPrice
4371
 			}
4374
 			}
4437
 				IsCheck:         1,
4440
 				IsCheck:         1,
4438
 			}
4441
 			}
4439
 			if orgID == 9671 || orgID == 10265 {
4442
 			if orgID == 9671 || orgID == 10265 {
4440
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4443
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4441
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4444
 				cancelStockInfo.Price = goodsInfo.PackingPrice
4442
 			}
4445
 			}
4443
 
4446
 
4485
 				RegisterNumber:          warehouse.RegisterNumber,
4488
 				RegisterNumber:          warehouse.RegisterNumber,
4486
 			}
4489
 			}
4487
 			if orgID == 9671 || orgID == 10265 {
4490
 			if orgID == 9671 || orgID == 10265 {
4488
-				goodsInfo, _ := FindeGoodInfo(orgID, goods.ProjectId)
4491
+				goodsInfo, _ := FindeGoodInfo(orgID, goods.GoodId)
4489
 				flow.Price = goodsInfo.PackingPrice
4492
 				flow.Price = goodsInfo.PackingPrice
4490
 				flow.BuyPrice = goodsInfo.BuyPrice
4493
 				flow.BuyPrice = goodsInfo.BuyPrice
4491
 			}
4494
 			}

+ 15 - 1
service/patient_service.go Vedi File

766
 	return err
766
 	return err
767
 }
767
 }
768
 
768
 
769
+func CreateAllergic(allergic models.XtPatientAllergic) error {
770
+
771
+	err := XTWriteDB().Model(&allergic).Create(&allergic).Error
772
+
773
+	return err
774
+}
775
+
769
 func EditPatientLapseto(patient *models.Patients, lapseto *models.PatientLapseto) (err error) {
776
 func EditPatientLapseto(patient *models.Patients, lapseto *models.PatientLapseto) (err error) {
770
 	utx := writeDb.Begin()
777
 	utx := writeDb.Begin()
771
 	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto": patient.Lapseto, "out_reason": patient.OutReason, "death_time": patient.DeathTime}).Error
778
 	err = utx.Model(&models.Patients{}).Where("id=?", patient.ID).Update(map[string]interface{}{"lapseto": patient.Lapseto, "out_reason": patient.OutReason, "death_time": patient.DeathTime}).Error
880
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
887
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
881
 
888
 
882
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
889
 	err := XTWriteDB().Model(&patientsNew).Where("blood_id = ?", id).Update(map[string]interface{}{"user_org_id": patientsNew.UserOrgId, "user_id": patientsNew.UserId, "avatar": patientsNew.Avatar, "patient_type": patientsNew.Avatar, "dialysis_no": patientsNew.DialysisNo, "admission_number": patientsNew.AdmissionNumber, "source": patientsNew.Source, "lapseto": patientsNew.Lapseto, "partition_id": patientsNew.PartitionId, "bed_id": patientsNew.BedId, "name": patientsNew.Name, "alias": patientsNew.Alias, "gender": patientsNew.Gender, "marital_status": patientsNew.MaritalStatus, "id_card_no": patientsNew.IdCardNo, "birthday": patientsNew.Birthday, "reimbursement_way_id": patientsNew.ReimbursementWayId, "health_care_type": patientsNew.HealthCareType, "health_care_no": patientsNew.HealthCareType, "health_care_due_date": patientsNew.HealthCareType, "height": patientsNew.Height, "blood_type": patientsNew.BloodType, "rh": patientsNew.Rh, "health_care_due_alert_date": patientsNew.HealthCareDueAlertDate, "education_level": patientsNew.EducationLevel, "profession": patientsNew.Profession, "phone": patientsNew.Phone, "home_telephone": patientsNew.HomeTelephone, "relative_phone": patientsNew.RelativePhone, "relative_relations": patientsNew.RelativeRelations, "home_address": patientsNew.HomeAddress, "work_unit": patientsNew.WorkUnit, "unit_address": patientsNew.UnitAddress, "children": patientsNew.Children, "receiving_date": patientsNew.ReceivingDate, "is_hospital_first_dialysis": patientsNew.IsHospitalFirstDialysis, "first_dialysis_date": patientsNew.FirstDialysisDate, "first_dialysis_hospital": patientsNew.FirstDialysisHospital, "predialysis_condition": patientsNew.PredialysisCondition, "pre_hospital_dialysis_frequency": patientsNew.PreHospitalDialysisFrequency, "pre_hospital_dialysis_times": patientsNew.PreHospitalDialysisFrequency, "hospital_first_dialysis_date": patientsNew.HospitalFirstDialysisDate, "induction_period": patientsNew.InductionPeriod, "initial_dialysis": patientsNew.InitialDialysis, "total_dialysis": patientsNew.TotalDialysis, "attending_doctor_id": patientsNew.AttendingDoctorId, "head_nurse_id": patientsNew.HeadNurseId, "evaluate": patientsNew.Evaluate, "diagnose": patientsNew.Diagnose, "remark": patientsNew.Remark, "registrars_id": patientsNew.RegistrarsId, "registrars": patientsNew.Registrars, "qr_code": patientsNew.QrCode, "binding_state": patientsNew.BindingState, "patient_complains": patientsNew.PatientComplains, "present_history": patientsNew.PresentHistory, "past_history": patientsNew.PastHistory, "temperature": patientsNew.Temperature,
883
-		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber, "patient_start_time": patientsNew.PatientStartTime}).Error
890
+		"pulse": patientsNew.Pulse, "respiratory": patientsNew.Respiratory, "sbp": patientsNew.Sbp, "dbp": patientsNew.Dbp, "nation": patientsNew.Nation, "native_place": patientsNew.NativePlace, "age": patientsNew.Age, "infectious_next_record_time": patientsNew.InfectiousNextRecordTime, "is_infectious": patientsNew.IsInfectious, "remind_cycle": patientsNew.RemindCycle, "response_result": patientsNew.ResponseResult, "is_open_remind": patientsNew.IsOpenRemind, "first_treatment_date": patientsNew.FirstTreatmentDate, "dialysis_age": patientsNew.DialysisAge, "expense_kind": patientsNew.ExpenseKind, "tell_phone": patientsNew.ExpenseKind, "contact_name": patientsNew.ContactName, "blood_patients": patientsNew.BloodPatients, "slow_patients": patientsNew.SlowPatients, "member_patients": patientsNew.MemberPatients, "ecommer_patients": patientsNew.EcommerPatients, "troble_shoot": patientsNew.TrobleShoot, "sch_remark": patientsNew.SchRemark, "treatment_plan": patientsNew.TreatmentPlan, "record_number": patientsNew.RecordNumber, "patient_start_time": patientsNew.PatientStartTime, "patient_end_time": patientsNew.PatientEndTime, "infectious_remark": patientsNew.InfectiousRemark, "allergic_history": patientsNew.AllergicHistory, "patient_address": patientsNew.PatientAddress}).Error
884
 	return err
891
 	return err
885
 }
892
 }
886
 
893
 
2944
 
2951
 
2945
 	return schedule, total, err
2952
 	return schedule, total, err
2946
 }
2953
 }
2954
+
2955
+func GetPatientAllagicList(patient_id int64, user_org_id int64) (list []*models.XtPatientAllergic, err error) {
2956
+
2957
+	err = XTReadDB().Where("patient_id = ? and user_org_id =? and status= 1", patient_id, user_org_id).Find(&list).Error
2958
+
2959
+	return list, err
2960
+}