Browse Source

历史排班

28169 1 year ago
parent
commit
e8e5832e0f

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

@@ -380,6 +380,7 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
380 380
 			newprescribe.TargetUltrafiltration = dewater_amount
381 381
 			newprescribe.PrescriptionWater = dewater_amount
382 382
 			newprescribe.Chaptalization = dialysisSolution.Chaptalization
383
+			newprescribe.PrescribingNumber = 1
383 384
 			newprescribe.Status = 1
384 385
 			if adminUserInfo.Org.Id != 10013 && adminUserInfo.Org.Id != 10014 {
385 386
 				newprescribe.Remark = dialysisSolution.Remark
@@ -397,6 +398,12 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
397 398
 				newprescribe.DisplaceLiquiValue = 32
398 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 408
 			err := service.AddSigleRecord(&newprescribe)
402 409
 			key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
@@ -467,9 +474,15 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
467 474
 				newprescribe.Status = 1
468 475
 				newprescribe.Remark = lastDialysisPrescribe.Remark
469 476
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
477
+				newprescribe.PrescribingNumber = 1
470 478
 				if adminUserInfo.Org.Id == 10340 {
471 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 486
 				err := service.AddSigleRecord(&newprescribe)
474 487
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
475 488
 				redis := service.RedisClient()
@@ -534,10 +547,16 @@ func (c *CheckWeightApiController) SavePatientInfoDialysis() {
534 547
 				newprescribe.TargetUltrafiltration = dewater_amount
535 548
 				newprescribe.Chaptalization = lastDialysisPrescribe.Chaptalization
536 549
 				newprescribe.Status = 1
550
+				newprescribe.PrescribingNumber = 1
537 551
 
538 552
 				if adminUserInfo.Org.Id == 10340 {
539 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 560
 				err := service.AddSigleRecord(&newprescribe)
542 561
 				key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(theAssessmentDateTime, 10) + ":" + strconv.FormatInt(mode_id, 10) + ":dialysis_prescribe"
543 562
 				redis := service.RedisClient()

+ 77 - 8
controllers/patient_api_controller.go View File

@@ -367,11 +367,32 @@ func (c *PatientApiController) CreatePatient() {
367 367
 		Doctor:                       patient.Doctor,
368 368
 		RecordNumber:                 patient.RecordNumber,
369 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 377
 	err = service.CreatePatientsNew(&patientsNew)
373 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 396
 	if len(record_date) > 0 {
376 397
 		var recordTime int64
377 398
 		timeLayout := "2006-01-02"
@@ -585,10 +606,31 @@ func (c *PatientApiController) EditPatient() {
585 606
 		TreatmentPlan:             patient.TreatmentPlan,
586 607
 		RecordNumber:              patient.RecordNumber,
587 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 615
 	//	//更新病人ID获取新表病人ID
590 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 634
 	nowTimeUinx := time.Now()
593 635
 	today := nowTimeUinx.Format("2006-01-02")
594 636
 
@@ -755,14 +797,14 @@ func (c *PatientApiController) EditLapseto() {
755 797
 
756 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 809
 	if err != nil {
768 810
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeEditLapsetoFail)
@@ -4931,7 +4973,34 @@ func patientFormData(patient *models.Patients, data []byte, method string) (cont
4931 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 5002
 	return
5003
+
4935 5004
 }
4936 5005
 
4937 5006
 func (c *PatientApiController) GetPatientsByKeyWord() {

+ 13 - 0
controllers/patient_dataconfig_api_controller.go View File

@@ -40,6 +40,8 @@ func PatientDataConfigAPIControllerRegistRouters() {
40 40
 
41 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 47
 type PatientDataConfigAPIController struct {
@@ -1141,3 +1143,14 @@ func (this *PatientDataConfigAPIController) GetContextScheduleList() {
1141 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 View File

@@ -3498,52 +3498,60 @@ func (this *SelfDrugApiController) GetDrugWarehouseInfoById() {
3498 3498
 func (this *SelfDrugApiController) GetSendGoodInformation() {
3499 3499
 
3500 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 3556
 	this.ServeSuccessJSON(map[string]interface{}{
3549 3557
 		"msg": "1",
@@ -3910,6 +3918,7 @@ func (this *SelfDrugApiController) GetPurchaseNewDrugQuery() {
3910 3918
 
3911 3919
 		//期中减少
3912 3920
 		outInfo, _ := service.FindeDrugWarehouseOutInfo(item.ID, item.OrgId, startTime, endTime)
3921
+		fmt.Println("putInfo2o2o2oo2o2", outInfo)
3913 3922
 		for _, it := range outInfo {
3914 3923
 			item.DrugWarehouseOutInfoStartEnd = append(item.DrugWarehouseOutInfoStartEnd, it)
3915 3924
 		}

+ 26 - 0
models/patient_models.go View File

@@ -225,6 +225,10 @@ type Patients struct {
225 225
 	RecordNumber             string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
226 226
 	PatientSource            int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
227 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 234
 func (Patients) TableName() string {
@@ -819,6 +823,10 @@ type XtPatientsNew struct {
819 823
 	RecordNumber                 string  `gorm:"column:record_number" json:"record_number" form:"record_number"`
820 824
 	PatientSource                int64   `gorm:"column:patient_source" json:"patient_source" form:"patient_source"`
821 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 832
 func (XtPatientsNew) TableName() string {
@@ -1978,3 +1986,21 @@ type ConScheduleList struct {
1978 1986
 func (ConScheduleList) TableName() string {
1979 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 View File

@@ -2506,7 +2506,7 @@ func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int6
2506 2506
 		db = db.Where("x.inspect_date <=?", endtime)
2507 2507
 	}
2508 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 2511
 	return inspection, total, err
2512 2512
 }
@@ -2547,7 +2547,7 @@ func GetLastPatientsControl(orgid int64, lapstor int64, startime int64, endtime
2547 2547
 
2548 2548
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2549 2549
 	table := readDb.Table("xt_patients as s")
2550
-	fmt.Println(table)
2550
+	//fmt.Println(table)
2551 2551
 	d := readDb.Table(" xt_inspection_reference as r")
2552 2552
 	fmt.Println(d)
2553 2553
 	d2 := readDb.Table("xt_quality_control_standard as d")
@@ -2571,7 +2571,7 @@ func GetLastPatientsControl(orgid int64, lapstor int64, startime int64, endtime
2571 2571
 	if endtime > 0 {
2572 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 2576
 	return inspection, err
2577 2577
 }

+ 15 - 0
service/new_stock_service.go View File

@@ -165,6 +165,21 @@ func UpdateActSumCount(user_org_id int64, storehouse_id int64, good_id int64, co
165 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 183
 func GetSendGoodInformation(org_id int64) (info []*models.WarehousingInfo, err error) {
169 184
 
170 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 View File

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

+ 15 - 1
service/patient_service.go View File

@@ -766,6 +766,13 @@ func CreatePatientsNew(patientsNew *models.XtPatientsNew) error {
766 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 776
 func EditPatientLapseto(patient *models.Patients, lapseto *models.PatientLapseto) (err error) {
770 777
 	utx := writeDb.Begin()
771 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,7 +887,7 @@ func UpdatePatientLapseto(patientid int64, lapseto models.PatientLapseto) error
880 887
 func UpdatepatientTwo(patientsNew *models.XtPatientsNew, id int64) error {
881 888
 
882 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 891
 	return err
885 892
 }
886 893
 
@@ -2944,3 +2951,10 @@ func GetContextScheduleListPatientId(startTime int64, endTime int64, org_id int6
2944 2951
 
2945 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
+}